rabbit 1.0.9 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. data/GPL +19 -20
  2. data/Rakefile +25 -10
  3. data/bin/rabbit +20 -844
  4. data/bin/rabbit-command +25 -36
  5. data/bin/rabbit-slide +22 -0
  6. data/bin/rabbit-theme +22 -0
  7. data/bin/rabbit-theme-manager +30 -30
  8. data/data/account.kou.gpg +0 -0
  9. data/data/locale/en/LC_MESSAGES/rabbit.mo +0 -0
  10. data/data/locale/fr/LC_MESSAGES/rabbit.mo +0 -0
  11. data/data/locale/ja/LC_MESSAGES/rabbit.mo +0 -0
  12. data/doc/_config.yml +8 -0
  13. data/doc/_includes/en.menu.html +8 -0
  14. data/doc/_includes/ja.menu.html +8 -0
  15. data/doc/_layouts/en.html +19 -16
  16. data/doc/_layouts/ja.html +19 -16
  17. data/doc/_plugins/converters/rd.rb +1 -1
  18. data/doc/_plugins/support_symlink.rb +11 -0
  19. data/doc/en/development.rd +2 -2
  20. data/doc/en/how-to-make/index.rd +5 -5
  21. data/doc/en/how-to-make/rd.rd +1 -1
  22. data/doc/en/index.rd +6 -12
  23. data/doc/en/sample/index.rd +3 -3
  24. data/doc/en/slides.rd +2 -0
  25. data/doc/en/usage.rd +14 -356
  26. data/doc/en/usage/rabbit.rd +360 -0
  27. data/doc/en/users.rd +3 -1
  28. data/doc/images/screenshots/en/blue-circle-raw.png +0 -0
  29. data/doc/images/screenshots/en/blue-circle.png +0 -0
  30. data/doc/images/screenshots/en/clear-blue-raw.png +0 -0
  31. data/doc/images/screenshots/en/clear-blue.png +0 -0
  32. data/doc/images/screenshots/en/cozmixng-raw.png +0 -0
  33. data/doc/images/screenshots/en/cozmixng.png +0 -0
  34. data/doc/images/screenshots/en/dark-gradation-raw.png +0 -0
  35. data/doc/images/screenshots/en/dark-gradation.png +0 -0
  36. data/doc/images/screenshots/en/day-white.png +0 -0
  37. data/doc/images/screenshots/en/debian-raw.png +0 -0
  38. data/doc/images/screenshots/en/debian.png +0 -0
  39. data/doc/images/screenshots/en/green-circle-raw.png +0 -0
  40. data/doc/images/screenshots/en/green-circle.png +0 -0
  41. data/doc/images/screenshots/en/night-black.png +0 -0
  42. data/doc/images/screenshots/en/rabbit-raw.png +0 -0
  43. data/doc/images/screenshots/en/rabbit.png +0 -0
  44. data/doc/images/screenshots/en/ranguba-raw.png +0 -0
  45. data/doc/images/screenshots/en/ranguba.png +0 -0
  46. data/doc/images/screenshots/en/red-frame-raw.png +0 -0
  47. data/doc/images/screenshots/en/red-frame.png +0 -0
  48. data/doc/images/screenshots/en/ruby-gnome2-raw.png +0 -0
  49. data/doc/images/screenshots/en/ruby-gnome2.png +0 -0
  50. data/doc/images/screenshots/en/rubykaigi2011-raw.png +0 -0
  51. data/doc/images/screenshots/en/rubykaigi2011.png +0 -0
  52. data/doc/images/screenshots/ja/blue-circle-raw.png +0 -0
  53. data/doc/images/screenshots/ja/blue-circle.png +0 -0
  54. data/doc/images/screenshots/ja/clear-blue-raw.png +0 -0
  55. data/doc/images/screenshots/ja/clear-blue.png +0 -0
  56. data/doc/images/screenshots/ja/cozmixng-raw.png +0 -0
  57. data/doc/images/screenshots/ja/cozmixng.png +0 -0
  58. data/doc/images/screenshots/ja/dark-gradation-raw.png +0 -0
  59. data/doc/images/screenshots/ja/dark-gradation.png +0 -0
  60. data/doc/images/screenshots/ja/day-white.png +0 -0
  61. data/doc/images/screenshots/ja/debian-raw.png +0 -0
  62. data/doc/images/screenshots/ja/debian.png +0 -0
  63. data/doc/images/screenshots/ja/green-circle-raw.png +0 -0
  64. data/doc/images/screenshots/ja/green-circle.png +0 -0
  65. data/doc/images/screenshots/ja/night-black.png +0 -0
  66. data/doc/images/screenshots/ja/rabbit-raw.png +0 -0
  67. data/doc/images/screenshots/ja/rabbit.png +0 -0
  68. data/doc/images/screenshots/ja/ranguba-raw.png +0 -0
  69. data/doc/images/screenshots/ja/ranguba.png +0 -0
  70. data/doc/images/screenshots/ja/red-frame-raw.png +0 -0
  71. data/doc/images/screenshots/ja/red-frame.png +0 -0
  72. data/doc/images/screenshots/ja/ruby-gnome2-raw.png +0 -0
  73. data/doc/images/screenshots/ja/ruby-gnome2.png +0 -0
  74. data/doc/images/screenshots/ja/rubykaigi2011-raw.png +0 -0
  75. data/doc/images/screenshots/ja/rubykaigi2011.png +0 -0
  76. data/doc/index.html.en +1 -1
  77. data/doc/index.html.ja +1 -1
  78. data/doc/ja/about.rd +3 -3
  79. data/doc/ja/development.rd +2 -2
  80. data/doc/ja/how-to-make/index.rd +5 -5
  81. data/doc/ja/index.rd +10 -16
  82. data/doc/ja/install/macports.rd +1 -1
  83. data/doc/ja/news.rd +4 -4
  84. data/doc/ja/sample/index.rd +3 -3
  85. data/doc/ja/usage.rd +13 -358
  86. data/doc/ja/usage/rabbit.rd +362 -0
  87. data/doc/ja/users.rd +1 -1
  88. data/lib/rabbit/action.rb +2 -2
  89. data/lib/rabbit/author-configuration.rb +73 -0
  90. data/lib/rabbit/canvas.rb +0 -14
  91. data/lib/rabbit/command/rabbit-slide.rb +571 -0
  92. data/lib/rabbit/command/rabbit-theme.rb +381 -0
  93. data/lib/rabbit/command/rabbit.rb +898 -0
  94. data/lib/rabbit/config.rb +40 -0
  95. data/lib/rabbit/console.rb +124 -55
  96. data/lib/rabbit/gem-finder.rb +61 -0
  97. data/lib/rabbit/gettext.rb +6 -79
  98. data/lib/rabbit/html/generator.rb +1 -0
  99. data/lib/rabbit/image.rb +1 -1
  100. data/lib/rabbit/logger.rb +12 -2
  101. data/lib/rabbit/logger/base.rb +33 -32
  102. data/lib/rabbit/logger/stderr.rb +1 -1
  103. data/lib/rabbit/menu.rb +1 -1
  104. data/lib/rabbit/parser.rb +2 -0
  105. data/lib/rabbit/parser/ext/image.rb +14 -20
  106. data/lib/rabbit/path-manipulatable.rb +40 -0
  107. data/lib/rabbit/rabbit.rb +18 -8
  108. data/lib/rabbit/renderer/base.rb +3 -4
  109. data/lib/rabbit/renderer/color.rb +0 -1
  110. data/lib/rabbit/slideshare.rb +116 -0
  111. data/lib/rabbit/source/base.rb +1 -1
  112. data/lib/rabbit/stock.rb +1 -1
  113. data/lib/rabbit/task.rb +18 -0
  114. data/lib/rabbit/task/slide.rb +162 -0
  115. data/lib/rabbit/task/theme.rb +122 -0
  116. data/lib/rabbit/theme-browser/tree.rb +1 -1
  117. data/lib/rabbit/theme/applier.rb +9 -0
  118. data/lib/rabbit/theme/background-image-toolkit/background-image-toolkit.rb +1 -2
  119. data/lib/rabbit/theme/blue-bar/blue-bar.rb +0 -11
  120. data/lib/rabbit/theme/clear-blue/clear-blue.rb +0 -11
  121. data/lib/rabbit/theme/cozmixng/cozmixng.rb +0 -11
  122. data/lib/rabbit/theme/day-white/day-white.rb +0 -6
  123. data/lib/rabbit/theme/default/default.rb +7 -1
  124. data/lib/rabbit/theme/enishi-green/property.rb +2 -2
  125. data/lib/rabbit/theme/entry.rb +85 -27
  126. data/lib/rabbit/theme/image-slide-number/image-slide-number.rb +4 -1
  127. data/lib/rabbit/theme/lightning-monochrome/lightning-monochrome.rb +0 -1
  128. data/lib/rabbit/theme/lightning-simple/lightning-simple.rb +0 -1
  129. data/lib/rabbit/theme/nari/nari.rb +6 -16
  130. data/lib/rabbit/theme/nari/property.rb +3 -0
  131. data/lib/rabbit/theme/night-black/night-black.rb +0 -6
  132. data/lib/rabbit/theme/pdf/pdf.rb +0 -4
  133. data/lib/rabbit/theme/rabbit/rabbit.rb +0 -6
  134. data/lib/rabbit/theme/ranguba/ranguba.rb +0 -12
  135. data/lib/rabbit/theme/ruby-gnome2/ruby-gnome2.rb +7 -4
  136. data/lib/rabbit/theme/rubykaigi2011/rubykaigi2011.rb +2 -9
  137. data/lib/rabbit/theme/searcher.rb +38 -16
  138. data/lib/rabbit/theme/syntax-highlighting/property.rb +2 -2
  139. data/lib/rabbit/version.rb +19 -0
  140. data/po/en/rabbit.po +1605 -1425
  141. data/po/fr/rabbit.po +1756 -1684
  142. data/po/ja/rabbit.po +2198 -2097
  143. data/po/rabbit.pot +1556 -1419
  144. metadata +34 -100
  145. data/bin/rabbirack +0 -99
  146. data/bin/rabbiter +0 -108
  147. data/bin/rabrick +0 -95
  148. data/bin/rabwii +0 -77
  149. data/lib/rabbit/default-config.rb +0 -24
  150. data/lib/rabbit/div/comment-i.erb +0 -7
  151. data/lib/rabbit/div/comment.erb +0 -45
  152. data/lib/rabbit/div/css.erb +0 -1
  153. data/lib/rabbit/div/js.erb +0 -1
  154. data/lib/rabbit/div/log.erb +0 -5
  155. data/lib/rabbit/div/main-i.erb +0 -24
  156. data/lib/rabbit/div/main.css +0 -40
  157. data/lib/rabbit/div/main.erb +0 -33
  158. data/lib/rabbit/div/navi-i.erb +0 -6
  159. data/lib/rabbit/div/navi.erb +0 -6
  160. data/lib/rabbit/div/prototype.js +0 -4320
  161. data/lib/rabbit/div/slide-i.erb +0 -2
  162. data/lib/rabbit/div/slide.erb +0 -5
  163. data/lib/rabbit/div/tofu.rb +0 -309
  164. data/lib/rabbit/middleware/config.ru +0 -42
  165. data/lib/rabbit/middleware/controller.rb +0 -63
  166. data/lib/rabbit/middleware/public/stylesheets/rabbirack.css +0 -12
  167. data/lib/rabbit/middleware/views/index.haml +0 -13
  168. data/lib/rabbit/middleware/views/layout.haml +0 -8
  169. data/lib/rabbit/post-setup.rb +0 -8
  170. data/lib/rabbit/pre-clean.rb +0 -2
  171. data/lib/rabbit/pre-distclean.rb +0 -2
  172. data/lib/rabbit/theme/twitter-comment/property.rb +0 -4
  173. data/lib/rabbit/theme/twitter-comment/twitter-comment.rb +0 -15
  174. data/lib/rabbit/twitter.rb +0 -239
  175. data/sample/theme-bench-en.hiki +0 -100
  176. data/sample/theme-bench-en.rab +0 -127
  177. data/sample/theme-bench.hiki +0 -101
  178. data/sample/theme-bench.rab +0 -128
  179. data/setup.rb +0 -1585
  180. data/update-mo.rb +0 -20
  181. data/update-po.rb +0 -57
data/GPL CHANGED
@@ -1,12 +1,12 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 2, June 1991
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
3
 
4
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
6
  Everyone is permitted to copy and distribute verbatim copies
7
7
  of this license document, but changing it is not allowed.
8
8
 
9
- Preamble
9
+ Preamble
10
10
 
11
11
  The licenses for most software are designed to take away your
12
12
  freedom to share and change it. By contrast, the GNU General Public
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
15
15
  General Public License applies to most of the Free Software
16
16
  Foundation's software and to any other program whose authors commit to
17
17
  using it. (Some other Free Software Foundation software is covered by
18
- the GNU Library General Public License instead.) You can apply it to
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
19
  your programs, too.
20
20
 
21
21
  When we speak of free software, we are referring to freedom, not
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
55
55
 
56
56
  The precise terms and conditions for copying, distribution and
57
57
  modification follow.
58
-
59
- GNU GENERAL PUBLIC LICENSE
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
60
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
61
 
62
62
  0. This License applies to any program or other work which contains
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
110
110
  License. (Exception: if the Program itself is interactive but
111
111
  does not normally print such an announcement, your work based on
112
112
  the Program is not required to print an announcement.)
113
-
113
+
114
114
  These requirements apply to the modified work as a whole. If
115
115
  identifiable sections of that work are not derived from the Program,
116
116
  and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
168
168
  access to copy the source code from the same place counts as
169
169
  distribution of the source code, even though third parties are not
170
170
  compelled to copy the source along with the object code.
171
-
171
+
172
172
  4. You may not copy, modify, sublicense, or distribute the Program
173
173
  except as expressly provided under this License. Any attempt
174
174
  otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
225
225
 
226
226
  This section is intended to make thoroughly clear what is believed to
227
227
  be a consequence of the rest of this License.
228
-
228
+
229
229
  8. If the distribution and/or use of the Program is restricted in
230
230
  certain countries either by patents or by copyrighted interfaces, the
231
231
  original copyright holder who places the Program under this License
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
255
255
  of preserving the free status of all derivatives of our free software and
256
256
  of promoting the sharing and reuse of software generally.
257
257
 
258
- NO WARRANTY
258
+ NO WARRANTY
259
259
 
260
260
  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
261
  FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
277
  PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
278
  POSSIBILITY OF SUCH DAMAGES.
279
279
 
280
- END OF TERMS AND CONDITIONS
281
-
282
- How to Apply These Terms to Your New Programs
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
283
 
284
284
  If you develop a new program, and you want it to be of the greatest
285
285
  possible use to the public, the best way to achieve this is to make it
@@ -303,10 +303,9 @@ the "copyright" line and a pointer to where the full notice is found.
303
303
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
304
  GNU General Public License for more details.
305
305
 
306
- You should have received a copy of the GNU General Public License
307
- along with this program; if not, write to the Free Software
308
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
309
-
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
310
309
 
311
310
  Also add information on how to contact you by electronic and paper mail.
312
311
 
@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
336
335
  This General Public License does not permit incorporating your program into
337
336
  proprietary programs. If your program is a subroutine library, you may
338
337
  consider it more useful to permit linking proprietary applications with the
339
- library. If this is what you want to do, use the GNU Library General
338
+ library. If this is what you want to do, use the GNU Lesser General
340
339
  Public License instead of this License.
data/Rakefile CHANGED
@@ -1,19 +1,36 @@
1
1
  # -*- ruby -*-
2
+ #
3
+ # Copyright (C) 2008-2012 Kouhei Sutou <kou@cozmixng.org>
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 along
16
+ # with this program; if not, write to the Free Software Foundation, Inc.,
17
+ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2
18
 
3
19
  require "find"
4
20
  require "rubygems"
5
21
  require "rubygems/package_task"
6
22
  require "bundler/gem_helper"
23
+ require "gettext/task"
7
24
 
8
25
  base_dir = File.expand_path(File.dirname(__FILE__))
9
26
  $LOAD_PATH.unshift(File.join(base_dir, 'lib'))
10
- require 'rabbit/rabbit'
11
27
 
12
28
  rsync_base_path = "rabbit@rabbit-shockers.org:public_html/"
13
29
 
14
30
  helper = Bundler::GemHelper.new(base_dir)
15
31
  helper.install
16
32
  spec = helper.gemspec
33
+ version = spec.version.to_s
17
34
 
18
35
  def force_array(enumerable)
19
36
  array = []
@@ -31,6 +48,11 @@ def spec.extra_rdoc_files
31
48
  @extra_rdoc_files = force_array(super)
32
49
  end
33
50
 
51
+ GetText::Task.new(spec) do |task|
52
+ task.files -= Dir.glob("sample/**/*.*")
53
+ task.mo_base_directory = "data"
54
+ end
55
+
34
56
  Gem::PackageTask.new(spec) do |package|
35
57
  package.need_tar_gz = true
36
58
  end
@@ -147,15 +169,8 @@ task :tag do
147
169
  sh("git tag -a #{version} -m 'release #{version}!!!'")
148
170
  end
149
171
 
150
- namespace :mo do
151
- desc "Update .mo."
152
- task :update do
153
- ruby("update-mo.rb")
154
- end
155
- end
156
-
157
- task :build => "mo:update"
158
- task :package => "mo:update"
172
+ task :build => "gettext"
173
+ task :package => "gettext"
159
174
 
160
175
  namespace :package do
161
176
  desc "Upload tar.gz."
data/bin/rabbit CHANGED
@@ -1,846 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- ruby -*-
3
-
4
- GC.disable
5
- require "rbconfig"
6
-
7
- require "rabbit/console"
8
- require "rabbit/source"
9
- require "rabbit/renderer"
10
- require "rabbit/front"
11
-
12
- def parse_args(args=ARGV, logger=nil)
13
- Rabbit::Console.parse!(args, logger) do |opts, options|
14
- options.theme = "default"
15
- options.theme_specified = false
16
- options.comment_theme = nil
17
- options.allotted_time = ENV["RABBIT_ALLOTTED_TIME"]
18
- options.base = nil
19
- options.source_type = :auto
20
- options.full_screen = false
21
- options.index_mode = false
22
- options.geometry = nil
23
- options.width = 800
24
- options.height = 600
25
- options.paper_width = nil
26
- options.paper_height = nil
27
- options.save_as_image = false
28
- options.saved_image_base_name = nil
29
- options.saved_image_type = "png"
30
- options.output_html = false
31
- options.output_index_html = false
32
- options.rss_base_uri = nil
33
- options.encoding = nil
34
- options.print = false
35
- options.print_out_filename = nil
36
- options.slides_per_page = 1
37
- options.draw_scaled_image = true
38
- options.margin_left = nil
39
- options.margin_right = nil
40
- options.margin_top = nil
41
- options.margin_bottom = nil
42
- options.page_margin_left = nil
43
- options.page_margin_right = nil
44
- options.page_margin_top = nil
45
- options.page_margin_bottom = nil
46
- options.use_druby = true
47
- options.druby_uri = "druby://127.0.0.1:10101"
48
- options.output_druby_uri = false
49
- options.use_soap = false
50
- options.soap_host = "0.0.0.0"
51
- options.soap_port = 10103
52
- options.use_xmlrpc = false
53
- options.xmlrpc_host = "0.0.0.0"
54
- options.xmlrpc_port = 10104
55
- options.server = false
56
- options.default_public_level = "all"
57
- options.public_level = nil
58
- options.migemo_dictionary_search_path = [
59
- File.join(RbConfig::CONFIG["prefix"], "share"),
60
- File.join("", "usr", "local", "share"),
61
- File.join("", "usr", "share"),
62
- ].uniq
63
- options.migemo_dictionary_name = "migemo-dict"
64
- options.use_gl = false
65
- options.show_native_window_id = false
66
- options.keep_above = false
67
- options.source_filename = nil
68
-
69
-
70
- opts.banner = "#{opts.banner} [SOURCE_INFOS]"
71
-
72
- opts.category _("Theme")
73
-
74
- opts.on("-I", "--include=PATH",
75
- _("Add [PATH] to load path.")) do |path|
76
- $LOAD_PATH.unshift(File.expand_path(path))
77
- end
78
-
79
- opts.on("-t", "--theme=THEME",
80
- _("Use [THEME] as theme."),
81
- "(#{options.theme})") do |theme|
82
- options.theme = theme
83
- options.theme_specified = true
84
- end
85
-
86
- opts.on("--comment-theme=THEME",
87
- _("Use [THEME] for comment."),
88
- "(#{options.comment_theme})") do |theme|
89
- options.comment_theme = theme
90
- end
91
-
92
- opts.on("--allotted-time=TIME",
93
- _("Use [TIME] as allotted time."),
94
- "(#{options.allotted_time})") do |time|
95
- options.allotted_time = time
96
- end
97
-
98
-
99
- opts.category _("Source")
100
-
101
- source_type_names = Rabbit::Source.types.collect do |x|
102
- Rabbit::Console.get_last_name(x).downcase
103
- end
104
- source_type_names.unshift("auto")
105
- source_type_descs = Rabbit::Source.types.collect do |x|
106
- message = _("When select %s\nspecify %s\nas [SOURCE_INFOS].")
107
- type = Rabbit::Console.get_last_name(x)
108
- message = message % [type, _(x.initial_args_description)]
109
- message.split(/\n/) + [" "]
110
- end.flatten
111
- opts.on("-T", "--type=TYPE",
112
- source_type_names,
113
- _("Specify source type as [TYPE]."),
114
- _("Select from [%s].") % source_type_names.join(', '),
115
- _("Note: case insensitive."),
116
- "(auto)",
117
- " ",
118
- *source_type_descs) do |source_type|
119
- if source_type == "auto"
120
- options.source_type = :auto
121
- else
122
- options.source_type = Rabbit::Source.types.find do |t|
123
- Rabbit::Console.get_last_name(t).downcase == source_type.downcase
124
- end
125
- end
126
- end
127
-
128
- opts.on("-e", "--encoding=ENCODING",
129
- _("Specify source encoding as [ENCODING]."),
130
- _("(auto)")) do |encoding|
131
- options.encoding = encoding
132
- end
133
-
134
- opts.on("-B", "--base=BASE",
135
- _("Specify base URI or path of source as [BASE]."),
136
- _("(auto)")) do |base|
137
- options.base = base
138
- end
139
-
140
-
141
- opts.category _("Initial state")
142
-
143
- opts.on("-f", "--[no-]full-screen",
144
- _("Toggle full screen mode."),
145
- "(#{options.full_screen ? 'on' : 'off'})") do |bool|
146
- options.full_screen = bool
147
- end
148
-
149
- opts.on("--[no-]index-mode",
150
- _("Toggle index mode."),
151
- "(#{options.index_mode ? 'on' : 'off'})") do |bool|
152
- options.index_mode = bool
153
- end
154
-
155
-
156
- opts.category _("Size")
157
-
158
- opts.on("-g", "--geometry=GEOMETRY",
159
- _("Set window geometry [GEOMETRY]."),
160
- _("Format: WIDTHxHEIGHT+X+Y"),
161
- "(#{options.geometry.inspect})") do |geometry|
162
- options.geometry = geometry
163
- end
164
-
165
- opts.on("-w", "--width=WIDTH",
166
- Integer,
167
- _("Set window width to [WIDTH]."),
168
- "(#{options.width})") do |width|
169
- options.width = width
170
- end
171
-
172
- opts.on("-h", "--height=HEIGHT",
173
- Integer,
174
- _("Set window height to [HEIGHT]."),
175
- "(#{options.height})") do |height|
176
- options.height = height
177
- end
178
-
179
- message = _("Set window width and height to\n" \
180
- "[WIDTH] and [HEIGHT].")
181
- message = message.split(/\n/) + ["(#{options.width},#{options.height})"]
182
- opts.on("-S", "--size=WIDTH,HEIGHT",
183
- Array,
184
- *message) do |size|
185
- width, height = size.collect{|x| Integer(x)}
186
- options.width = width
187
- options.height = height
188
- end
189
-
190
-
191
- opts.category _("Save")
192
-
193
- opts.on("-s", "--save-as-image",
194
- _("Save as image and exit.")) do
195
- options.save_as_image = true
196
- end
197
-
198
- opts.on("-i", "--saved-image-type=TYPE",
199
- _("Specify saved image type as [TYPE]."),
200
- "(#{options.saved_image_type})") do |t|
201
- options.saved_image_type = t
202
- end
203
-
204
- opts.on("-b", "--saved-image-base-name=BASE_NAME",
205
- "--saved-image-basename=BASE_NAME",
206
- _("Specify saved image base name as [BASE_NAME]."),
207
- "(" + _("Title of slide") + ")") do |b|
208
- options.saved_image_base_name = b
209
- end
210
-
211
- opts.on("--[no-]output-html",
212
- _("Output HTML for viewing saved images."),
213
- "(#{options.output_html})") do |bool|
214
- options.output_html = bool
215
- end
216
-
217
- opts.on("--[no-]output-index-html",
218
- _("Output index HTML for navigating slides."),
219
- "(#{options.output_index_html})") do |bool|
220
- options.output_index_html = bool
221
- end
222
-
223
- opts.on("--rss-base-uri=URI",
224
- _("Specify base URI of RSS as [URI]."),
225
- _("RSS is generated only when HTML is output."),
226
- "(#{options.rss_base_uri})") do |uri|
227
- options.rss_base_uri = uri
228
- end
229
-
230
- opts.on("--source-filename=FILENAME",
231
- _("Specify source filenam as [FILENAME]."),
232
- "(#{options.source_filename})") do |filename|
233
- options.source_filename = filename
234
- end
235
-
236
- opts.category _("Print")
237
-
238
- opts.on("-p", "--print",
239
- _("Print and exit.")) do
240
- options.print = true
241
- end
242
-
243
- opts.on("-o", "--output-filename=FILENAME",
244
- _("Specify printed out filename as [FILENAME]."),
245
- "(\#{%s}.pdf)" % _("Title of slide")) do |f|
246
- options.print_out_filename = f
247
- end
248
-
249
- opts.on("--slides-per-page=SLIDES",
250
- Integer,
251
- _("Set slides per page."),
252
- "(1)") do |slides|
253
- options.slides_per_page = slides
254
- end
255
-
256
- opts.on("--[no-]draw-scaled-image",
257
- _("Draw scaled image."),
258
- _("Better look for displaying but lesser look for printing."),
259
- "(#{options.draw_scaled_image})") do |boolean|
260
- options.draw_scaled_image = boolean
261
- end
262
-
263
- opts.category _("Paper")
264
-
265
- opts.on("--paper-width=WIDTH",
266
- Integer,
267
- _("Set paper width to [WIDTH] Pt."),
268
- _("(landscape A4 width)")) do |width|
269
- options.paper_width = width
270
- end
271
-
272
- opts.on("--paper-height=HEIGHT",
273
- Integer,
274
- _("Set paper height to [HEIGHT] Pt."),
275
- _("(landscape A4 height)")) do |height|
276
- options.paper_height = height
277
- end
278
-
279
- message = _("Set paper width and height to\n" \
280
- "[WIDTH] Pt and [HEIGHT] Pt.")
281
- message = message.split(/\n/) + [_("(landscape A4 size)")]
282
- opts.on("--paper-size=WIDTH,HEIGHT",
283
- Array,
284
- *message) do |size|
285
- width, height = size.collect{|x| Integer(x)}
286
- options.paper_width = width
287
- options.paper_height = height
288
- end
289
-
290
-
291
- opts.category _("Margin")
292
-
293
- opts.on("--margin-left=MARGIN",
294
- Integer,
295
- _("Set left margin for slides per page mode print."),
296
- _("(auto)")) do |margin|
297
- options.margin_left = margin
298
- end
299
-
300
- opts.on("--margin-right=MARGIN",
301
- Integer,
302
- _("Set right margin for slides per page mode print."),
303
- _("(auto)")) do |margin|
304
- options.margin_right = margin
305
- end
306
-
307
- opts.on("--margin-top=MARGIN",
308
- Integer,
309
- _("Set top margin for slides per page mode print."),
310
- _("(auto)")) do |margin|
311
- options.margin_top = margin
312
- end
313
-
314
- opts.on("--margin-bottom=MARGIN",
315
- Integer,
316
- _("Set bottom margin for slides per page mode print."),
317
- _("(auto)")) do |margin|
318
- options.margin_bottom = margin
319
- end
320
-
321
- margin1 = _("[ALL]")
322
- margin2 = _("[TOP_BOTTOM],[LEFT_RIGHT]")
323
- margin3 = _("[TOP],[LEFT_RIGHT],[BOTTOM]")
324
- margin4 = _("[TOP],[RIGHT],[BOTTOM],[LEFT]")
325
- opts.on("--margin={#{margin1}|#{margin2}|#{margin3}|#{margin4}}",
326
- Array,
327
- _("Set margin for slides per page mode print.")) do |margins|
328
- begin
329
- top, right, bottom, left = Rabbit::Utils.parse_four_way(margins)
330
- options.margin_top = top
331
- options.margin_right = right
332
- options.margin_bottom = bottom
333
- options.margin_left = left
334
- rescue ArgumentError
335
- raise OptionParser::InvalidArgument.new(margins)
336
- end
337
- end
338
-
339
- opts.on("--page-margin-left=MARGIN",
340
- Integer,
341
- _("Set left page margin."),
342
- _("(auto)")) do |margin|
343
- options.page_margin_left = margin
344
- end
345
-
346
- opts.on("--page-margin-right=MARGIN",
347
- Integer,
348
- _("Set right page margin."),
349
- _("(auto)")) do |margin|
350
- options.page_margin_right = margin
351
- end
352
-
353
- opts.on("--page-margin-top=MARGIN",
354
- Integer,
355
- _("Set top page margin."),
356
- _("(auto)")) do |margin|
357
- options.page_margin_top = margin
358
- end
359
-
360
- opts.on("--page-margin-bottom=MARGIN",
361
- Integer,
362
- _("Set bottom page margin."),
363
- _("(auto)")) do |margin|
364
- options.page_margin_bottom = margin
365
- end
366
-
367
- opts.on("--page-margin={#{margin1}|#{margin2}|#{margin3}|#{margin4}}",
368
- Array,
369
- _("Set page margin.")) do |margins|
370
- begin
371
- top, right, bottom, left = Utils.parse_four_dimensions(margins)
372
- options.page_margin_top = top
373
- options.page_margin_right = right
374
- options.page_margin_bottom = bottom
375
- options.page_margin_left = left
376
- rescue ArgumentError
377
- raise OptionParser::InvalidArgument.new(margins)
378
- end
379
- end
380
-
381
- opts.category _("dRuby")
382
-
383
- opts.on("--[no-]use-druby",
384
- _("Specify whether to use dRuby."),
385
- "(#{options.use_druby})") do |bool|
386
- options.use_druby = bool
387
- end
388
-
389
- opts.on("--druby-uri=URI",
390
- _("Specify dRuby URI."),
391
- "(#{options.druby_uri})") do |uri|
392
- options.druby_uri = uri if uri
393
- end
394
-
395
- opts.on("--[no-]output-druby-uri",
396
- _("Specify whether to output dRuby URI."),
397
- "(#{options.output_druby_uri})") do |bool|
398
- options.output_druby_uri = bool
399
- end
400
-
401
- opts.category _("SOAP")
402
-
403
- opts.on("--[no-]use-soap",
404
- _("Specify whether to use SOAP."),
405
- "(#{options.use_soap})") do |bool|
406
- options.use_soap = bool
407
- end
408
-
409
- opts.on("--soap-host=HOST",
410
- _("Specify SOAP host as [HOST]."),
411
- "(#{options.soap_host})") do |port|
412
- begin
413
- options.soap_host = host
414
- end
415
- end
416
-
417
- opts.on("--soap-port=PORT",
418
- _("Specify SOAP port as [PORT]."),
419
- "(#{options.soap_port})") do |port|
420
- begin
421
- options.soap_port = Integer(port) if port
422
- rescue ArgumentError
423
- raise OptionParser::InvalidArgument.new(port)
424
- end
425
- end
426
-
427
- opts.category _("XML-RPC")
428
-
429
- opts.on("--[no-]use-xmlrpc",
430
- _("Specify whether to use XML-RPC."),
431
- "(#{options.use_xmlrpc})") do |bool|
432
- options.use_xmlrpc = bool
433
- end
434
-
435
- opts.on("--xmlrpc-host=HOST",
436
- _("Specify XML-RPC host as [HOST]."),
437
- "(#{options.xmlrpc_host})") do |port|
438
- begin
439
- options.xmlrpc_host = host
440
- end
441
- end
442
-
443
- opts.on("--xmlrpc-port=PORT",
444
- _("Specify XML-RPC port as [PORT]."),
445
- "(#{options.xmlrpc_port})") do |port|
446
- begin
447
- options.xmlrpc_port = Integer(port) if port
448
- rescue ArgumentError
449
- raise OptionParser::InvalidArgument.new(port)
450
- end
451
- end
452
-
453
- opts.category _("Server")
454
-
455
- opts.on("--[no-]server",
456
- _("Specify whether to run as server."),
457
- "(#{options.server})") do |bool|
458
- options.server = bool
459
- end
460
-
461
- opts.category _("Public level")
462
-
463
- levels = Rabbit::Front::PublicLevel.constants.sort_by do |const|
464
- Rabbit::Front::PublicLevel.const_get(const)
465
- end.collect do |const|
466
- const.to_s.downcase.gsub(/_/, "-")
467
- end
468
- messages = [_("Specify public level.")]
469
- messages << _("Select from the following:")
470
- messages << "["
471
- messages << " "
472
- levels[0..-2].each do |level|
473
- messages.last << "#{level}, "
474
- messages << " " if messages.last.size > 30
475
- end
476
- messages.last << levels.last
477
- messages << "]"
478
- messages << _("(#{options.default_public_level})")
479
- opts.on("--public-level=LEVEL", levels, *messages) do |level|
480
- options.public_level = level
481
- end
482
-
483
- opts.category _("Comment")
484
-
485
- opts.on("--comment-source=FILE",
486
- _("Deprecated. Just ignored."),
487
- _("Specify initial comment source."),
488
- _("(default source)")) do |name|
489
- end
490
-
491
- opts.on("--comment-encoding=ENCODING",
492
- _("Deprecated. Just ignored."),
493
- _("Specify comment source encoding."),
494
- _("(auto)")) do |encoding|
495
- end
496
-
497
- opts.category _("Migemo")
498
-
499
- search_path = options.migemo_dictionary_search_path.join(', ')
500
- opts.on("--migemo-dictionary-search-path=PATH1,PATH2,...",
501
- Array,
502
- _("Specify search paths for Migemo static dictionary."),
503
- _("(#{search_path})")) do |path|
504
- options.migemo_dictionary_search_path = path
505
- end
506
-
507
- opts.on("--migemo-dictionary-name=NAME",
508
- Array,
509
- _("Specify static dictionary name for Migemo."),
510
- _("(#{options.migemo_dictionary_name})")) do |name|
511
- options.migemo_dictionary_name = name
512
- end
513
-
514
- opts.category _("3D")
515
-
516
- opts.on("--[no-]use-gl",
517
- _("Specify whether to use OpenGL if available."),
518
- "(#{options.use_gl})") do |bool|
519
- options.use_gl = bool
520
- end
521
-
522
- opts.category _("Display")
523
-
524
- opts.on("--[no-]keep-above",
525
- _("Specify whether to keep above window."),
526
- "(#{options.keep_above})") do |bool|
527
- options.keep_above = bool
528
- end
529
-
530
- opts.category _("Others")
531
-
532
- opts.on("--[no-]show-native-window-id",
533
- _("Show a native window ID of the Rabbit window if available."),
534
- _("e.g. The ID is the ID of X resource on X window system."),
535
- "(#{options.show_native_window_id})") do |bool|
536
- options.show_native_window_id = bool
537
- end
538
- end
539
- end
540
-
541
- def make_canvas(options, logger, renderer)
542
- canvas = Rabbit::Canvas.new(logger, renderer)
543
- canvas.comment_theme = options.comment_theme
544
- canvas.allotted_time = options.allotted_time
545
- canvas
546
- end
547
-
548
- def add_source_dialog_filter(dialog, name, pattern)
549
- filter = Gtk::FileFilter.new
550
- filter.name = "#{name} (#{pattern})"
551
- filter.add_pattern(pattern)
552
- dialog.add_filter(filter)
553
- end
554
-
555
- def choose_source_file_by_dialog(options)
556
- dialog = Gtk::FileChooserDialog.new(_("Choose a Rabbit source file"),
557
- nil,
558
- Gtk::FileChooser::ACTION_OPEN,
559
- nil,
560
- [Gtk::Stock::CANCEL,
561
- Gtk::Dialog::RESPONSE_CANCEL],
562
- [Gtk::Stock::OPEN,
563
- Gtk::Dialog::RESPONSE_ACCEPT])
564
- dialog.current_folder = options.base if options.base
565
- add_source_dialog_filter(dialog, "Rabbit files", "*.rab")
566
- add_source_dialog_filter(dialog, "RD files", "*.rd")
567
- add_source_dialog_filter(dialog, "Hiki files", "*.hiki")
568
- add_source_dialog_filter(dialog, "PDF files", "*.pdf")
569
- add_source_dialog_filter(dialog, "All files", "*")
570
- file_name = nil
571
- if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
572
- file_name = dialog.filename
573
- dialog.destroy
574
- end
575
- file_name
576
- end
577
-
578
- def make_source(options, argv, logger)
579
- if options.source_type == :auto
580
- if argv.empty?
581
- file_name = choose_source_file_by_dialog(options)
582
- exit if file_name.nil?
583
- argv = [file_name]
584
- options.source_type = Rabbit::Source::File
585
- elsif argv.size == 1 and /\Ahttps?:\/\// =~ argv[0]
586
- options.source_type = Rabbit::Source::URI
587
- else
588
- options.source_type = Rabbit::Source::File
589
- end
590
- end
591
- if options.source_type == Rabbit::Source::ARGF
592
- infos = [ARGF]
593
- else
594
- infos = argv
595
- end
596
- source = options.source_type.new(options.encoding, logger, *infos)
597
- source.base = options.base if options.base
598
- source
599
- end
600
-
601
- def make_front(canvas, options)
602
- level = options.public_level
603
- level ||= options.default_public_level
604
- level = level.gsub(/-/, "_").upcase
605
- canvas.front(Rabbit::Front::PublicLevel.const_get(level))
606
- end
607
-
608
- def apply_theme_if_need(target, options)
609
- target.apply_theme(options.theme) if options.theme_specified
610
- end
611
-
612
- def parse(target, source, background=false)
613
- if background
614
- callback = Rabbit::Utils.process_pending_events_proc
615
- else
616
- callback = nil
617
- end
618
- target.parse(source, callback)
619
- end
620
-
621
- def setup_image_info(target, options)
622
- target.saved_image_type = options.saved_image_type
623
- target.saved_image_base_name = options.saved_image_base_name
624
- target.output_html = options.output_html
625
- target.output_index_html = options.output_index_html
626
- target.rss_base_uri = options.rss_base_uri
627
- target.source_filename = options.source_filename
628
- end
629
-
630
- def setup_print_info(target, options)
631
- target.filename = options.print_out_filename
632
- target.slides_per_page = options.slides_per_page
633
- target.draw_scaled_image = options.draw_scaled_image
634
- end
635
-
636
- def setup_size(target, options)
637
- target.width = options.width
638
- target.height = options.height
639
- end
640
-
641
- def setup_paper_size(target, options)
642
- target.paper_width = options.paper_width
643
- target.paper_height = options.paper_height
644
- target.page_margin_left = options.page_margin_left
645
- target.page_margin_right = options.page_margin_right
646
- target.page_margin_top = options.page_margin_top
647
- target.page_margin_bottom = options.page_margin_bottom
648
- target.margin_left = options.margin_left
649
- target.margin_right = options.margin_right
650
- target.margin_top = options.margin_top
651
- target.margin_bottom = options.margin_bottom
652
- end
653
-
654
- def setup_migemo_info(target, options)
655
- target.migemo_dictionary_search_path = options.migemo_dictionary_search_path
656
- target.migemo_dictionary_name = options.migemo_dictionary_name
657
- end
658
-
659
- def setup_3d_info(target, options)
660
- target.use_gl = options.use_gl
661
- end
662
-
663
- def setup_druby(front, options, logger)
664
- require "drb/drb"
665
- begin
666
- DRb.start_service(options.druby_uri, front)
667
- logger.info(DRb.uri) if options.output_druby_uri
668
- rescue SocketError
669
- logger.error($!)
670
- rescue Errno::EADDRINUSE
671
- logger.error(_("dRuby URI <%s> is in use.") % options.druby_uri)
672
- end
673
- end
674
-
675
- def setup_soap(front, options, logger)
676
- require "rabbit/soap/server"
677
- thread = nil
678
-
679
- begin
680
- config = {
681
- :BindAddress => options.soap_host,
682
- :Port => options.soap_port,
683
- :AddressFamily => Socket::AF_INET,
684
- :Logger => logger,
685
- }
686
- server = Rabbit::SOAP::Server.new(front, config)
687
- prev = trap(:INT) {server.shutdown; trap(:INT, prev)}
688
- thread = Thread.new {server.start}
689
- rescue Errno::EADDRINUSE
690
- logger.error(_("port <%s> for SOAP is in use.") % options.soap_port)
691
- end
692
-
693
- thread
694
- end
695
-
696
- def setup_xmlrpc(front, options, logger)
697
- require "rabbit/xmlrpc/server"
698
- thread = nil
699
-
700
- begin
701
- config = {
702
- :BindAddress => options.xmlrpc_host,
703
- :Port => options.xmlrpc_port,
704
- :AddressFamily => Socket::AF_INET,
705
- :Logger => logger,
706
- }
707
- server = Rabbit::XMLRPC::Server.new(front, config)
708
- prev = trap(:INT) {server.shutdown; trap(:INT, prev)}
709
- thread = Thread.new {server.start}
710
- rescue Errno::EADDRINUSE
711
- logger.error(_("port <%s> for XML-RPC is in use.") % options.xmlrpc_port)
712
- end
713
-
714
- thread
715
- end
716
-
717
- def do_print(options, logger)
718
- source = make_source(options, ARGV, logger)
719
- renderer = Rabbit::Renderer.printable_renderer(options.slides_per_page)
720
- canvas = make_canvas(options, logger, renderer)
721
- setup_paper_size(canvas, options)
722
- setup_print_info(canvas, options)
723
- setup_3d_info(canvas, options)
724
- apply_theme_if_need(canvas, options)
725
- parse(canvas, source)
726
- canvas.print
727
- canvas.quit
728
- rescue Rabbit::NoPrintSupportError
729
- logger.error($!.message)
730
- end
731
-
732
- def do_save_as_image(options, logger)
733
- Rabbit::Renderer::Pixmap.init
734
- Rabbit.gui_init
735
-
736
- source = make_source(options, ARGV, logger)
737
- canvas = make_canvas(options, logger, Rabbit::Renderer::Pixmap)
738
- setup_size(canvas, options)
739
- setup_image_info(canvas, options)
740
- setup_print_info(canvas, options)
741
- setup_paper_size(canvas, options)
742
- setup_3d_info(canvas, options)
743
- apply_theme_if_need(canvas, options)
744
- parse(canvas, source)
745
- canvas.activate("ToggleIndexMode") if options.index_mode
746
- canvas.save_as_image
747
- canvas.quit
748
- end
749
-
750
- def do_display(options, logger)
751
- display_init_options = {}
752
- if options.use_gl
753
- display_init_options[:preferred_class_name] = "ClutterEmbed"
754
- end
755
- Rabbit::Renderer::Display.init(display_init_options)
756
- Rabbit.gui_init
757
-
758
- source = make_source(options, ARGV, logger)
759
- canvas = make_canvas(options, logger, Rabbit::Renderer::Display)
760
- frame = Rabbit::Frame.new(logger, canvas)
761
- frame.geometry = options.geometry
762
- frame.force_keep_above = options.keep_above
763
- setup_paper_size(canvas, options)
764
- setup_image_info(canvas, options)
765
- setup_print_info(canvas, options)
766
- setup_migemo_info(canvas, options)
767
- setup_3d_info(canvas, options)
768
- frame.init_gui(options.width, options.height, true)
769
- frame.fullscreen if options.full_screen
770
- native_window = frame.window.window
771
- if options.show_native_window_id and native_window.respond_to?(:xid)
772
- logger.info(_("Window ID: %d") % native_window.xid)
773
- end
774
- apply_theme_if_need(frame, options)
775
- parse(frame, source, !Rabbit::Utils.windows?)
776
- canvas.activate("ToggleIndexMode") if options.index_mode
777
-
778
- front = make_front(canvas, options)
779
- setup_druby(front, options, logger) if options.use_druby
780
- setup_soap(front, options, logger) if options.use_soap
781
- setup_xmlrpc(front, options, logger) if options.use_xmlrpc
782
-
783
- Gtk.main
784
- end
785
-
786
- def do_server(options, logger)
787
- Rabbit.gui_init
788
-
789
- # GLib::Log.cancel_handler
790
- # GLib::Log.set_handler(nil, GLib::Log::LEVEL_ERROR)
791
-
792
- source = make_source(options, ARGV, logger)
793
- canvas = make_canvas(options, logger, Rabbit::Renderer::Pixmap)
794
- setup_size(canvas, options)
795
- setup_paper_size(canvas, options)
796
- setup_image_info(canvas, options)
797
- setup_print_info(canvas, options)
798
- setup_3d_info(canvas, options)
799
- apply_theme_if_need(canvas, options)
800
- parse(canvas, source)
801
-
802
- soap_server_thread = nil
803
- xmlrpc_server_thread = nil
804
-
805
- front = make_front(canvas, options)
806
- setup_druby(front, options, logger) if options.use_druby
807
- if options.use_soap
808
- soap_server_thread = setup_soap(front, options, logger)
809
- end
810
- if options.use_xmlrpc
811
- xmlrpc_server_thread = setup_xmlrpc(front, options, logger)
812
- end
813
-
814
- soap_server_thread.join if soap_server_thread
815
- xmlrpc_server_thread.join if xmlrpc_server_thread
816
- if options.use_druby
817
- prev = trap(:INT) do
818
- logger.info(_("going to shutdown..."))
819
- DRb.thread.exit
820
- logger.info(_("DRb.thread done."))
821
- trap(:INT, prev)
822
- end
823
- DRb.thread.join
824
- end
825
- end
826
-
827
- def main
828
- options, logger = parse_args
829
-
830
- require "rabbit/canvas"
831
- GC.enable
832
-
833
- if options.save_as_image
834
- do_save_as_image(options, logger)
835
- elsif options.print
836
- do_print(options, logger)
837
- elsif options.server
838
- do_server(options, logger)
839
- else
840
- do_display(options, logger)
841
- end
842
-
843
- Rabbit.cleanup
844
- end
845
-
846
- main
3
+ #
4
+ # Copyright (C) 2004-2012 Kouhei Sutou <kou@cozmixng.org>
5
+ #
6
+ # This program is free software; you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation; either version 2 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License along
17
+ # with this program; if not, write to the Free Software Foundation, Inc.,
18
+ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
+
20
+ require "rabbit/command/rabbit"
21
+
22
+ Rabbit::Command::Rabbit.run(*ARGV)