rabbit 1.0.9 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GPL +19 -20
- data/Rakefile +25 -10
- data/bin/rabbit +20 -844
- data/bin/rabbit-command +25 -36
- data/bin/rabbit-slide +22 -0
- data/bin/rabbit-theme +22 -0
- data/bin/rabbit-theme-manager +30 -30
- data/data/account.kou.gpg +0 -0
- data/data/locale/en/LC_MESSAGES/rabbit.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rabbit.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rabbit.mo +0 -0
- data/doc/_config.yml +8 -0
- data/doc/_includes/en.menu.html +8 -0
- data/doc/_includes/ja.menu.html +8 -0
- data/doc/_layouts/en.html +19 -16
- data/doc/_layouts/ja.html +19 -16
- data/doc/_plugins/converters/rd.rb +1 -1
- data/doc/_plugins/support_symlink.rb +11 -0
- data/doc/en/development.rd +2 -2
- data/doc/en/how-to-make/index.rd +5 -5
- data/doc/en/how-to-make/rd.rd +1 -1
- data/doc/en/index.rd +6 -12
- data/doc/en/sample/index.rd +3 -3
- data/doc/en/slides.rd +2 -0
- data/doc/en/usage.rd +14 -356
- data/doc/en/usage/rabbit.rd +360 -0
- data/doc/en/users.rd +3 -1
- data/doc/images/screenshots/en/blue-circle-raw.png +0 -0
- data/doc/images/screenshots/en/blue-circle.png +0 -0
- data/doc/images/screenshots/en/clear-blue-raw.png +0 -0
- data/doc/images/screenshots/en/clear-blue.png +0 -0
- data/doc/images/screenshots/en/cozmixng-raw.png +0 -0
- data/doc/images/screenshots/en/cozmixng.png +0 -0
- data/doc/images/screenshots/en/dark-gradation-raw.png +0 -0
- data/doc/images/screenshots/en/dark-gradation.png +0 -0
- data/doc/images/screenshots/en/day-white.png +0 -0
- data/doc/images/screenshots/en/debian-raw.png +0 -0
- data/doc/images/screenshots/en/debian.png +0 -0
- data/doc/images/screenshots/en/green-circle-raw.png +0 -0
- data/doc/images/screenshots/en/green-circle.png +0 -0
- data/doc/images/screenshots/en/night-black.png +0 -0
- data/doc/images/screenshots/en/rabbit-raw.png +0 -0
- data/doc/images/screenshots/en/rabbit.png +0 -0
- data/doc/images/screenshots/en/ranguba-raw.png +0 -0
- data/doc/images/screenshots/en/ranguba.png +0 -0
- data/doc/images/screenshots/en/red-frame-raw.png +0 -0
- data/doc/images/screenshots/en/red-frame.png +0 -0
- data/doc/images/screenshots/en/ruby-gnome2-raw.png +0 -0
- data/doc/images/screenshots/en/ruby-gnome2.png +0 -0
- data/doc/images/screenshots/en/rubykaigi2011-raw.png +0 -0
- data/doc/images/screenshots/en/rubykaigi2011.png +0 -0
- data/doc/images/screenshots/ja/blue-circle-raw.png +0 -0
- data/doc/images/screenshots/ja/blue-circle.png +0 -0
- data/doc/images/screenshots/ja/clear-blue-raw.png +0 -0
- data/doc/images/screenshots/ja/clear-blue.png +0 -0
- data/doc/images/screenshots/ja/cozmixng-raw.png +0 -0
- data/doc/images/screenshots/ja/cozmixng.png +0 -0
- data/doc/images/screenshots/ja/dark-gradation-raw.png +0 -0
- data/doc/images/screenshots/ja/dark-gradation.png +0 -0
- data/doc/images/screenshots/ja/day-white.png +0 -0
- data/doc/images/screenshots/ja/debian-raw.png +0 -0
- data/doc/images/screenshots/ja/debian.png +0 -0
- data/doc/images/screenshots/ja/green-circle-raw.png +0 -0
- data/doc/images/screenshots/ja/green-circle.png +0 -0
- data/doc/images/screenshots/ja/night-black.png +0 -0
- data/doc/images/screenshots/ja/rabbit-raw.png +0 -0
- data/doc/images/screenshots/ja/rabbit.png +0 -0
- data/doc/images/screenshots/ja/ranguba-raw.png +0 -0
- data/doc/images/screenshots/ja/ranguba.png +0 -0
- data/doc/images/screenshots/ja/red-frame-raw.png +0 -0
- data/doc/images/screenshots/ja/red-frame.png +0 -0
- data/doc/images/screenshots/ja/ruby-gnome2-raw.png +0 -0
- data/doc/images/screenshots/ja/ruby-gnome2.png +0 -0
- data/doc/images/screenshots/ja/rubykaigi2011-raw.png +0 -0
- data/doc/images/screenshots/ja/rubykaigi2011.png +0 -0
- data/doc/index.html.en +1 -1
- data/doc/index.html.ja +1 -1
- data/doc/ja/about.rd +3 -3
- data/doc/ja/development.rd +2 -2
- data/doc/ja/how-to-make/index.rd +5 -5
- data/doc/ja/index.rd +10 -16
- data/doc/ja/install/macports.rd +1 -1
- data/doc/ja/news.rd +4 -4
- data/doc/ja/sample/index.rd +3 -3
- data/doc/ja/usage.rd +13 -358
- data/doc/ja/usage/rabbit.rd +362 -0
- data/doc/ja/users.rd +1 -1
- data/lib/rabbit/action.rb +2 -2
- data/lib/rabbit/author-configuration.rb +73 -0
- data/lib/rabbit/canvas.rb +0 -14
- data/lib/rabbit/command/rabbit-slide.rb +571 -0
- data/lib/rabbit/command/rabbit-theme.rb +381 -0
- data/lib/rabbit/command/rabbit.rb +898 -0
- data/lib/rabbit/config.rb +40 -0
- data/lib/rabbit/console.rb +124 -55
- data/lib/rabbit/gem-finder.rb +61 -0
- data/lib/rabbit/gettext.rb +6 -79
- data/lib/rabbit/html/generator.rb +1 -0
- data/lib/rabbit/image.rb +1 -1
- data/lib/rabbit/logger.rb +12 -2
- data/lib/rabbit/logger/base.rb +33 -32
- data/lib/rabbit/logger/stderr.rb +1 -1
- data/lib/rabbit/menu.rb +1 -1
- data/lib/rabbit/parser.rb +2 -0
- data/lib/rabbit/parser/ext/image.rb +14 -20
- data/lib/rabbit/path-manipulatable.rb +40 -0
- data/lib/rabbit/rabbit.rb +18 -8
- data/lib/rabbit/renderer/base.rb +3 -4
- data/lib/rabbit/renderer/color.rb +0 -1
- data/lib/rabbit/slideshare.rb +116 -0
- data/lib/rabbit/source/base.rb +1 -1
- data/lib/rabbit/stock.rb +1 -1
- data/lib/rabbit/task.rb +18 -0
- data/lib/rabbit/task/slide.rb +162 -0
- data/lib/rabbit/task/theme.rb +122 -0
- data/lib/rabbit/theme-browser/tree.rb +1 -1
- data/lib/rabbit/theme/applier.rb +9 -0
- data/lib/rabbit/theme/background-image-toolkit/background-image-toolkit.rb +1 -2
- data/lib/rabbit/theme/blue-bar/blue-bar.rb +0 -11
- data/lib/rabbit/theme/clear-blue/clear-blue.rb +0 -11
- data/lib/rabbit/theme/cozmixng/cozmixng.rb +0 -11
- data/lib/rabbit/theme/day-white/day-white.rb +0 -6
- data/lib/rabbit/theme/default/default.rb +7 -1
- data/lib/rabbit/theme/enishi-green/property.rb +2 -2
- data/lib/rabbit/theme/entry.rb +85 -27
- data/lib/rabbit/theme/image-slide-number/image-slide-number.rb +4 -1
- data/lib/rabbit/theme/lightning-monochrome/lightning-monochrome.rb +0 -1
- data/lib/rabbit/theme/lightning-simple/lightning-simple.rb +0 -1
- data/lib/rabbit/theme/nari/nari.rb +6 -16
- data/lib/rabbit/theme/nari/property.rb +3 -0
- data/lib/rabbit/theme/night-black/night-black.rb +0 -6
- data/lib/rabbit/theme/pdf/pdf.rb +0 -4
- data/lib/rabbit/theme/rabbit/rabbit.rb +0 -6
- data/lib/rabbit/theme/ranguba/ranguba.rb +0 -12
- data/lib/rabbit/theme/ruby-gnome2/ruby-gnome2.rb +7 -4
- data/lib/rabbit/theme/rubykaigi2011/rubykaigi2011.rb +2 -9
- data/lib/rabbit/theme/searcher.rb +38 -16
- data/lib/rabbit/theme/syntax-highlighting/property.rb +2 -2
- data/lib/rabbit/version.rb +19 -0
- data/po/en/rabbit.po +1605 -1425
- data/po/fr/rabbit.po +1756 -1684
- data/po/ja/rabbit.po +2198 -2097
- data/po/rabbit.pot +1556 -1419
- metadata +34 -100
- data/bin/rabbirack +0 -99
- data/bin/rabbiter +0 -108
- data/bin/rabrick +0 -95
- data/bin/rabwii +0 -77
- data/lib/rabbit/default-config.rb +0 -24
- data/lib/rabbit/div/comment-i.erb +0 -7
- data/lib/rabbit/div/comment.erb +0 -45
- data/lib/rabbit/div/css.erb +0 -1
- data/lib/rabbit/div/js.erb +0 -1
- data/lib/rabbit/div/log.erb +0 -5
- data/lib/rabbit/div/main-i.erb +0 -24
- data/lib/rabbit/div/main.css +0 -40
- data/lib/rabbit/div/main.erb +0 -33
- data/lib/rabbit/div/navi-i.erb +0 -6
- data/lib/rabbit/div/navi.erb +0 -6
- data/lib/rabbit/div/prototype.js +0 -4320
- data/lib/rabbit/div/slide-i.erb +0 -2
- data/lib/rabbit/div/slide.erb +0 -5
- data/lib/rabbit/div/tofu.rb +0 -309
- data/lib/rabbit/middleware/config.ru +0 -42
- data/lib/rabbit/middleware/controller.rb +0 -63
- data/lib/rabbit/middleware/public/stylesheets/rabbirack.css +0 -12
- data/lib/rabbit/middleware/views/index.haml +0 -13
- data/lib/rabbit/middleware/views/layout.haml +0 -8
- data/lib/rabbit/post-setup.rb +0 -8
- data/lib/rabbit/pre-clean.rb +0 -2
- data/lib/rabbit/pre-distclean.rb +0 -2
- data/lib/rabbit/theme/twitter-comment/property.rb +0 -4
- data/lib/rabbit/theme/twitter-comment/twitter-comment.rb +0 -15
- data/lib/rabbit/twitter.rb +0 -239
- data/sample/theme-bench-en.hiki +0 -100
- data/sample/theme-bench-en.rab +0 -127
- data/sample/theme-bench.hiki +0 -101
- data/sample/theme-bench.rab +0 -128
- data/setup.rb +0 -1585
- data/update-mo.rb +0 -20
- data/update-po.rb +0 -57
data/lib/rabbit/div/slide-i.erb
DELETED
data/lib/rabbit/div/slide.erb
DELETED
data/lib/rabbit/div/tofu.rb
DELETED
@@ -1,309 +0,0 @@
|
|
1
|
-
require "div/div"
|
2
|
-
require "div/tofusession"
|
3
|
-
|
4
|
-
require 'rabbit/utils'
|
5
|
-
|
6
|
-
module WEBrick
|
7
|
-
class Tofulet
|
8
|
-
def mobile?
|
9
|
-
%r[(DoCoMo|J-PHONE|Vodafone|MOT-|UP\.Browser|DDIPOCKET|ASTEL|PDXGW|Palmscape|Xiino|sharp pda browser|Windows CE|L-mode|WILLCOM)]i =~ @req["user-agent"]
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
module Rabbit
|
15
|
-
module Div
|
16
|
-
module RabbitDiv
|
17
|
-
def initialize(*args)
|
18
|
-
super
|
19
|
-
@cache = {}
|
20
|
-
end
|
21
|
-
|
22
|
-
def to_div_i(context)
|
23
|
-
to_html_i(context)
|
24
|
-
rescue
|
25
|
-
"<p>error! #{h($!)}</p>"
|
26
|
-
end
|
27
|
-
|
28
|
-
def to_html_i(context)
|
29
|
-
to_html(context)
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
def rabbit
|
34
|
-
@session.rabbit
|
35
|
-
end
|
36
|
-
|
37
|
-
def form2(attrs, method_name, context_or_param, context_or_empty=nil)
|
38
|
-
result = form(method_name, context_or_param, context_or_empty)
|
39
|
-
attrs = attrs.collect do |key, value|
|
40
|
-
"#{h(key)}=\"#{h(value)}\""
|
41
|
-
end.join(" ")
|
42
|
-
result.gsub!(/(<form )/, "\\1#{attrs}")
|
43
|
-
result
|
44
|
-
end
|
45
|
-
|
46
|
-
def param(method_name, add_param, separator=nil)
|
47
|
-
param = make_param(method_name, add_param)
|
48
|
-
ary = param.collect do |k, v|
|
49
|
-
"#{u(k)}=#{u(v)}"
|
50
|
-
end
|
51
|
-
ary.join(separator || h("&"))
|
52
|
-
end
|
53
|
-
|
54
|
-
def ajax_param(method_name, add_js_param=[])
|
55
|
-
result = ''
|
56
|
-
result << param(method_name, {"ajax" => "1"}, "&").dump
|
57
|
-
add_js_param.each do |k|
|
58
|
-
result << " + "
|
59
|
-
result << "&#{u(k)}=".dump
|
60
|
-
result << " + $F(#{u(k).dump})"
|
61
|
-
end
|
62
|
-
result
|
63
|
-
end
|
64
|
-
|
65
|
-
def ajax?(params)
|
66
|
-
params.has_key?("ajax")
|
67
|
-
end
|
68
|
-
|
69
|
-
def uri(method_name, add_param, context)
|
70
|
-
"#{action(context)}?#{param(method_name, add_param)}"
|
71
|
-
end
|
72
|
-
|
73
|
-
def cache_read_file(key, *name)
|
74
|
-
@cache[key] ||= read_file(*name)
|
75
|
-
end
|
76
|
-
|
77
|
-
def read_file(*name)
|
78
|
-
path = Utils.find_path_in_load_path(*name)
|
79
|
-
if path
|
80
|
-
File.read(path)
|
81
|
-
else
|
82
|
-
nil
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def to_sjis(str)
|
87
|
-
NKF.nkf("-sWdXm0", str.to_s)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
class MainDiv < ::Div::Div
|
92
|
-
include RabbitDiv
|
93
|
-
|
94
|
-
set_erb(File.join("rabbit", "div", "main.erb"))
|
95
|
-
add_erb("to_html_i(context)", File.join("rabbit", "div", "main-i.erb"))
|
96
|
-
reload_erb
|
97
|
-
|
98
|
-
attr_reader :navi
|
99
|
-
def initialize(session)
|
100
|
-
super
|
101
|
-
@slide = SlideDiv.new(session)
|
102
|
-
@navi = NaviDiv.new(session)
|
103
|
-
@comment = CommentDiv.new(session)
|
104
|
-
@js = JSDiv.new(session)
|
105
|
-
@css = CSSDiv.new(session)
|
106
|
-
end
|
107
|
-
|
108
|
-
def on_display(context)
|
109
|
-
if context.mobile?
|
110
|
-
context.res_header("Content-Type", "text/html; charset=Shift_JIS")
|
111
|
-
context.res_body(to_sjis(to_html_i(context)))
|
112
|
-
else
|
113
|
-
context.res_header("Content-Type", "text/html; charset=UTF-8")
|
114
|
-
context.res_body(to_html(context))
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
class NaviDiv < ::Div::Div
|
120
|
-
include RabbitDiv
|
121
|
-
|
122
|
-
set_erb(File.join("rabbit", "div", "navi.erb"))
|
123
|
-
add_erb("to_html_i(context)", File.join("rabbit", "div", "navi-i.erb"))
|
124
|
-
reload_erb
|
125
|
-
|
126
|
-
def do_first(context, params)
|
127
|
-
rabbit.move_to_first
|
128
|
-
end
|
129
|
-
|
130
|
-
def do_previous(context, params)
|
131
|
-
rabbit.move_to_previous_if_can
|
132
|
-
end
|
133
|
-
|
134
|
-
def do_next(context, params)
|
135
|
-
rabbit.move_to_next_if_can
|
136
|
-
end
|
137
|
-
|
138
|
-
def do_last(context, params)
|
139
|
-
rabbit.move_to_last
|
140
|
-
end
|
141
|
-
|
142
|
-
private
|
143
|
-
def a_link(context, key, label, label_only)
|
144
|
-
HTML.a_link("<a href=\"#{uri(key, {}, context)}\">", label, label_only)
|
145
|
-
end
|
146
|
-
|
147
|
-
def first_link(context)
|
148
|
-
a_link(context, "first", h("<<"), rabbit.first_slide?)
|
149
|
-
end
|
150
|
-
|
151
|
-
def previous_link(context)
|
152
|
-
a_link(context, "previous", h("<"), !rabbit.have_previous_slide?)
|
153
|
-
end
|
154
|
-
|
155
|
-
def next_link(context)
|
156
|
-
a_link(context, "next", h(">"), !rabbit.have_next_slide?)
|
157
|
-
end
|
158
|
-
|
159
|
-
def last_link(context)
|
160
|
-
a_link(context, "last", h(">>"), rabbit.last_slide?)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
class CommentDiv < ::Div::Div
|
165
|
-
include RabbitDiv
|
166
|
-
|
167
|
-
set_erb(File.join("rabbit", "div", "comment.erb"))
|
168
|
-
add_erb("to_html_i(context)", File.join("rabbit", "div", "comment-i.erb"))
|
169
|
-
add_erb("to_log_html(context=nil)", File.join("rabbit", "div", "log.erb"))
|
170
|
-
reload_erb
|
171
|
-
|
172
|
-
def initialize(session)
|
173
|
-
super
|
174
|
-
@error_message = nil
|
175
|
-
end
|
176
|
-
|
177
|
-
def do_comment(context, params)
|
178
|
-
comment, = params[comment_param_name]
|
179
|
-
rabbit.append_comment(comment.to_s) do |error|
|
180
|
-
@error_message = error.message
|
181
|
-
end
|
182
|
-
if ajax?(params)
|
183
|
-
context.res_header("Content-Type", "text/html; charset=UTF-8")
|
184
|
-
context.res_body(to_log_html(context))
|
185
|
-
throw(:tofu_done)
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
private
|
190
|
-
def comments
|
191
|
-
rabbit.comments
|
192
|
-
end
|
193
|
-
|
194
|
-
def comment_param_name
|
195
|
-
"comment"
|
196
|
-
end
|
197
|
-
|
198
|
-
def comment_form_name
|
199
|
-
"comment-form"
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
class SlideDiv < ::Div::Div
|
204
|
-
include RabbitDiv
|
205
|
-
|
206
|
-
set_erb(File.join("rabbit", "div", "slide.erb"))
|
207
|
-
add_erb("to_html_i(context)", File.join("rabbit", "div", "slide-i.erb"))
|
208
|
-
reload_erb
|
209
|
-
|
210
|
-
def do_current(context, params)
|
211
|
-
context.res_header("Content-Type", "image/#{rabbit.image_type}")
|
212
|
-
context.res_body(rabbit.current_slide_image)
|
213
|
-
throw(:tofu_done)
|
214
|
-
end
|
215
|
-
|
216
|
-
private
|
217
|
-
def image_title
|
218
|
-
title = h(rabbit.slide_title)
|
219
|
-
title << "(#{rabbit.current_slide_number}/"
|
220
|
-
title << "#{rabbit.total_slide_number - 1})"
|
221
|
-
title
|
222
|
-
end
|
223
|
-
|
224
|
-
def image_path(context, name="current", add_param={})
|
225
|
-
uri(name, add_param, context)
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
class JSDiv < ::Div::Div
|
230
|
-
include RabbitDiv
|
231
|
-
|
232
|
-
set_erb(File.join("rabbit", "div", "js.erb"))
|
233
|
-
|
234
|
-
def do_else(context, params)
|
235
|
-
cmd, = params['div_cmd']
|
236
|
-
content = cache_read_file(cmd, "rabbit", "div", "#{cmd}.js")
|
237
|
-
setup_js_response(context, content)
|
238
|
-
end
|
239
|
-
|
240
|
-
private
|
241
|
-
def setup_js_response(context, js)
|
242
|
-
context.res_header("Content-Type", "text/javascript; charset=UTF-8")
|
243
|
-
context.res_body(js.to_s)
|
244
|
-
throw(:tofu_done)
|
245
|
-
end
|
246
|
-
|
247
|
-
def js_path(context, name, add_param={})
|
248
|
-
uri(name, add_param, context)
|
249
|
-
end
|
250
|
-
|
251
|
-
def script(context, name)
|
252
|
-
src = js_path(context, name)
|
253
|
-
%Q!<script type="text/javascript" src="#{src}"></script>!
|
254
|
-
end
|
255
|
-
end
|
256
|
-
|
257
|
-
class CSSDiv < ::Div::Div
|
258
|
-
include RabbitDiv
|
259
|
-
|
260
|
-
set_erb(File.join("rabbit", "div", "css.erb"))
|
261
|
-
|
262
|
-
def do_else(context, params)
|
263
|
-
cmd, = params['div_cmd']
|
264
|
-
content = cache_read_file(cmd, "rabbit", "div", "#{cmd}.css")
|
265
|
-
setup_css_response(context, content)
|
266
|
-
end
|
267
|
-
|
268
|
-
private
|
269
|
-
def setup_css_response(context, css)
|
270
|
-
context.res_header("Content-Type", "text/css; charset=UTF-8")
|
271
|
-
context.res_body(css.to_s)
|
272
|
-
throw(:tofu_done)
|
273
|
-
end
|
274
|
-
|
275
|
-
def css_path(context, name, add_param={})
|
276
|
-
uri(name, add_param, context)
|
277
|
-
end
|
278
|
-
|
279
|
-
def css_link(context, name)
|
280
|
-
path = css_path(context, name)
|
281
|
-
%Q!<link rel="stylesheet" type="text/css" href="#{path}" />!
|
282
|
-
end
|
283
|
-
end
|
284
|
-
|
285
|
-
class TofuSession < ::Div::TofuSession
|
286
|
-
@@rabbit = nil
|
287
|
-
|
288
|
-
def self.rabbit=(rabbit)
|
289
|
-
@@rabbit = rabbit
|
290
|
-
end
|
291
|
-
|
292
|
-
attr_reader :rabbit
|
293
|
-
def initialize(bartender, hint=nil)
|
294
|
-
super
|
295
|
-
@main = MainDiv.new(self)
|
296
|
-
@rabbit = @@rabbit
|
297
|
-
end
|
298
|
-
|
299
|
-
def do_GET(context)
|
300
|
-
update_div(context)
|
301
|
-
@main.on_display(context)
|
302
|
-
end
|
303
|
-
|
304
|
-
def fetch(ref)
|
305
|
-
super || (@rabbit.accept_move? ? @main.navi : nil)
|
306
|
-
end
|
307
|
-
end
|
308
|
-
end
|
309
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# -*- mode: ruby; coding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
4
|
-
#
|
5
|
-
# This program is free software; you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU General Public License as published by
|
7
|
-
# the Free Software Foundation; either version 2 of the License, or
|
8
|
-
# (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU General Public License
|
16
|
-
# along with this program; if not, write to the Free Software
|
17
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18
|
-
|
19
|
-
require "drb/drb"
|
20
|
-
|
21
|
-
require "rabbit/middleware/controller"
|
22
|
-
|
23
|
-
environment = ENV["RACK_ENV"] || "development"
|
24
|
-
case environment
|
25
|
-
when "development"
|
26
|
-
use Rack::ShowExceptions
|
27
|
-
end
|
28
|
-
|
29
|
-
use Rack::Runtime
|
30
|
-
use Rack::ContentLength
|
31
|
-
|
32
|
-
use Rack::Deflater
|
33
|
-
use Rack::ConditionalGet
|
34
|
-
|
35
|
-
use Rack::Lint
|
36
|
-
use Rack::Head
|
37
|
-
|
38
|
-
rabbit = DRbObject.new_with_uri(ENV["RABBIT_URI"])
|
39
|
-
application = Rabbit::Middleware::Controller.new do |controller|
|
40
|
-
controller.rabbit = rabbit
|
41
|
-
end
|
42
|
-
run application
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# -*- mode: ruby; coding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
4
|
-
#
|
5
|
-
# This program is free software; you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU General Public License as published by
|
7
|
-
# the Free Software Foundation; either version 2 of the License, or
|
8
|
-
# (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU General Public License
|
16
|
-
# along with this program; if not, write to the Free Software
|
17
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18
|
-
|
19
|
-
require "sinatra/base"
|
20
|
-
require "haml"
|
21
|
-
|
22
|
-
module Rabbit
|
23
|
-
module Middleware
|
24
|
-
class Controller < Sinatra::Base
|
25
|
-
attr_accessor :rabbit
|
26
|
-
|
27
|
-
set :app_file, File.join(File.dirname(__FILE__), "config.ru")
|
28
|
-
|
29
|
-
layout
|
30
|
-
|
31
|
-
before do
|
32
|
-
content_type("text/html", "charset" => "UTF-8")
|
33
|
-
end
|
34
|
-
|
35
|
-
get "/" do
|
36
|
-
haml :index
|
37
|
-
end
|
38
|
-
|
39
|
-
get "/pages/next" do
|
40
|
-
@rabbit.move_to_next_if_can
|
41
|
-
haml :index
|
42
|
-
end
|
43
|
-
|
44
|
-
get "/pages/previous" do
|
45
|
-
@rabbit.move_to_previous_if_can
|
46
|
-
haml :index
|
47
|
-
end
|
48
|
-
|
49
|
-
get "/pages/:number" do |number|
|
50
|
-
@rabbit.move_to_if_can(number.to_i)
|
51
|
-
haml :index
|
52
|
-
end
|
53
|
-
|
54
|
-
def title
|
55
|
-
"Rabbit"
|
56
|
-
end
|
57
|
-
|
58
|
-
def slide_title
|
59
|
-
@rabbit.slide_title
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|