• R/O
  • SSH
  • HTTPS

hiki: コミット


コミットメタ情報

リビジョン1097 (tree)
日時2009-12-02 22:14:43
作者okkez

ログメッセージ

fix RSSPage to use correct URI

変更サマリ

差分

--- hiki/branches/rack/hiki/farm/dispatcher.rb (revision 1096)
+++ hiki/branches/rack/hiki/farm/dispatcher.rb (revision 1097)
@@ -6,7 +6,7 @@
66 request = Hiki::Request.new(env)
77 conf = ::Hiki::Farm::Config.load(File.join(Hiki::PATH, 'hikifarm_conf.rb'))
88 case request.path_info
9- when '/'
9+ when '/', "/#{Hiki::Farm::RSSPage.page_name}"
1010 Hiki::Farm::App.new(conf).call(env)
1111 when %r!\A/(\w+)/!
1212 Hiki::App.new(File.join(conf.farm_root, $1, 'hikiconf.rb')).call(env)
--- hiki/branches/rack/hiki/farm/page.rb (revision 1096)
+++ hiki/branches/rack/hiki/farm/page.rb (revision 1097)
@@ -1,5 +1,6 @@
11 # -*- coding: utf-8 -*-
22 require 'erb'
3+require 'uri'
34 require 'hiki/util'
45
56 module Hiki
@@ -79,7 +80,7 @@
7980 end
8081
8182 def rss_href
82- "#{@hikifarm_uri}#{@manager.command_query(Hiki::Farm::RSSPage.command_name)}"
83+ URI.join(@hikifarm_uri, RSSPage.page_name)
8384 end
8485
8586 def template_name
@@ -105,7 +106,6 @@
105106 end
106107 end
107108
108- # TODO: refactor
109109 class RSSPage
110110 include ::Hiki::Util
111111
@@ -113,11 +113,16 @@
113113 def command_name
114114 'rss'
115115 end
116+
117+ def page_name
118+ 'hikifarm.rss'
119+ end
116120 end
117121
118- def initialize(conf, manager)
122+ def initialize(conf, manager, hikifarm_uri)
119123 @conf = conf
120124 @manager = manager
125+ @hikifarm_uri = hikifarm_uri
121126 end
122127
123128 def to_s
@@ -129,10 +134,10 @@
129134 def make_rss
130135 require 'rss'
131136 rss = RSS::Maker.make("1.0") do |maker|
132- maker.channel.about = "http://example.com/index.rdf"
137+ maker.channel.about = URI.join(@hikifarm_uri, self.class.page_name).to_s
133138 maker.channel.title = @conf.title
134139 maker.channel.description = @conf.hikifarm_description
135- maker.channel.link = "http://example.com/"
140+ maker.channel.link = @hikifarm_uri
136141
137142 maker.items.do_sort = true
138143 maker.items.max_size = 15
@@ -139,7 +144,7 @@
139144
140145 @manager.wikilist.each do |wiki|
141146 maker.items.new_item do |item|
142- item.link = "http://example.com/article.html"
147+ item.link = URI.join(@hikifarm_uri, wiki.name)
143148 item.title = wiki.title
144149 item.date = wiki.mtime
145150 item.description = wiki.description
--- hiki/branches/rack/hiki/farm.rb (revision 1096)
+++ hiki/branches/rack/hiki/farm.rb (revision 1097)
@@ -37,11 +37,11 @@
3737
3838 def run(manager, request)
3939 case
40- when request.get? && %r!\A/hikifarm.rss\z! =~ request.path_info
41- body = ::Hiki::Farm::RSSPage.new(@conf, manager).to_s
40+ when request.get? && %r!\A/#{::Hiki::Farm::RSSPage.page_name}\z! =~ request.path_info
41+ body = ::Hiki::Farm::RSSPage.new(@conf, manager, File.dirname(request.url)).to_s
4242 ::Hiki::Response.new(body, 200, { })
4343 when request.get? && 'rss' == request.params[manager.command_key]
44- body = ::Hiki::Farm::RSSPage.new(@conf, manager).to_s
44+ body = ::Hiki::Farm::RSSPage.new(@conf, manager, File.dirname(request.url)).to_s
4545 ::Hiki::Response.new(body, 200, { })
4646 when request.post? && request.params['wiki'] && !request.params['wiki'].empty?
4747 begin
旧リポジトリブラウザで表示