myrurema 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -0
- data/Gemfile.lock +28 -0
- data/README.mkd +16 -5
- data/Rakefile +2 -34
- data/bin/rurema +2 -1
- data/lib/myrurema/options.rb +91 -0
- data/lib/myrurema/version.rb +4 -0
- data/{src → lib}/myrurema.rb +54 -110
- data/myrurema.gemspec +19 -0
- data/spec/commands.rb +26 -17
- metadata +42 -11
- data/VERSION +0 -1
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
myrurema (0.3.0)
|
5
|
+
launchy (~> 2.0.5)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.2.6)
|
11
|
+
diff-lcs (1.1.3)
|
12
|
+
launchy (2.0.5)
|
13
|
+
addressable (~> 2.2.6)
|
14
|
+
rspec (2.8.0)
|
15
|
+
rspec-core (~> 2.8.0)
|
16
|
+
rspec-expectations (~> 2.8.0)
|
17
|
+
rspec-mocks (~> 2.8.0)
|
18
|
+
rspec-core (2.8.0)
|
19
|
+
rspec-expectations (2.8.0)
|
20
|
+
diff-lcs (~> 1.1.2)
|
21
|
+
rspec-mocks (2.8.0)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
myrurema!
|
28
|
+
rspec (> 2.0)
|
data/README.mkd
CHANGED
@@ -34,7 +34,7 @@ RubyGemsでインストールします。
|
|
34
34
|
新しくデータベースを作成します。
|
35
35
|
(データベースの作成には数分かかります。)
|
36
36
|
|
37
|
-
別のディレクトリにインストールしたい場合はruremadirオプションを指定します。
|
37
|
+
(別のディレクトリにインストールしたい場合はruremadirオプションを指定します。)
|
38
38
|
|
39
39
|
$ rurema --init --ruremadir=/some/where
|
40
40
|
|
@@ -44,8 +44,8 @@ bitclustは、Rubyの各バージョンに合わせたデータベースを
|
|
44
44
|
作成するようになっています。デフォルトでは、お使いのRubyと
|
45
45
|
同じバージョンのデータベースを生成します。
|
46
46
|
|
47
|
-
別のRubyバージョン用のリファレンスデータベースを作成するには、
|
48
|
-
rubyverオプションを指定します。
|
47
|
+
(別のRubyバージョン用のリファレンスデータベースを作成するには、
|
48
|
+
rubyverオプションを指定します。)
|
49
49
|
|
50
50
|
$ rurema --init --rubyver=1.9.2
|
51
51
|
|
@@ -58,6 +58,17 @@ ruremaコマンドにメソッド名やクラス名を与えると、リファ
|
|
58
58
|
|
59
59
|
$ rurema Array#index
|
60
60
|
|
61
|
+
クラス名・メソッド名の一部だけでも検索できます。
|
62
|
+
|
63
|
+
$ rurema Ar ras
|
64
|
+
(Array#rassocのリファレンスが表示される)
|
65
|
+
|
66
|
+
あるクラスの全てのインスタンスメソッドを表示するには以下のようにします。
|
67
|
+
|
68
|
+
$ rurema Array#
|
69
|
+
|
70
|
+
(お使いのシェルによっては rurema Array\# とする必要があります)
|
71
|
+
|
61
72
|
引数によっては、複数の候補が表示されることもあります。
|
62
73
|
|
63
74
|
$ rurema each_w
|
@@ -78,8 +89,8 @@ ruremaコマンドにメソッド名やクラス名を与えると、リファ
|
|
78
89
|
|
79
90
|
$ rurema --server --browser
|
80
91
|
|
81
|
-
デフォルトではRubyのバージョンに合わせたポート番号(例:Ruby 1.8.7なら
|
82
|
-
ポート10187)を使います。ポート番号を変更するには--portオプションを指定します。
|
92
|
+
(デフォルトではRubyのバージョンに合わせたポート番号(例:Ruby 1.8.7なら
|
93
|
+
ポート10187)を使います。ポート番号を変更するには--portオプションを指定します。)
|
83
94
|
|
84
95
|
$ rurema --server --port=9999 --browser
|
85
96
|
|
data/Rakefile
CHANGED
@@ -1,34 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
# configurations:
|
5
|
-
PROJECT_NAME = File.basename(File.dirname(__FILE__))
|
6
|
-
|
7
|
-
begin
|
8
|
-
require 'jeweler'
|
9
|
-
rescue LoadError
|
10
|
-
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
11
|
-
end
|
12
|
-
|
13
|
-
Jeweler::Tasks.new do |gemspec|
|
14
|
-
gemspec.name = "#{PROJECT_NAME}"
|
15
|
-
gemspec.summary = "A tool for Rurema (the new Japanese Ruby reference manual)"
|
16
|
-
gemspec.email = "yutaka.hara/at/gmail.com"
|
17
|
-
gemspec.homepage = "http://github.com/yhara/#{PROJECT_NAME}"
|
18
|
-
gemspec.description = gemspec.summary
|
19
|
-
gemspec.authors = ["Yutaka HARA"]
|
20
|
-
gemspec.executables = ["rurema"]
|
21
|
-
end
|
22
|
-
|
23
|
-
desc "install current source as a gem"
|
24
|
-
task :dogfood => [:gemspec, :build] do
|
25
|
-
sh "gemi pkg/#{PROJECT_NAME}-#{File.read("VERSION").chomp}.gem"
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "uninstall the installed gem"
|
29
|
-
task :undogfood do
|
30
|
-
sh "gemi -u #{PROJECT_NAME}"
|
31
|
-
end
|
32
|
-
|
33
|
-
desc "uninstall, then install current source as gem"
|
34
|
-
task :redogfood => [:undogfood, :dogfood]
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require 'bundler/gem_tasks'
|
data/bin/rurema
CHANGED
@@ -0,0 +1,91 @@
|
|
1
|
+
class MyRurema
|
2
|
+
class Options
|
3
|
+
def initialize(argv)
|
4
|
+
@command = nil
|
5
|
+
@open_browser = false
|
6
|
+
@port = nil
|
7
|
+
@dry_run = false
|
8
|
+
@no_ask = false
|
9
|
+
@ruremadir = Pathname("~/.rurema").expand_path
|
10
|
+
@rubyver = RUBY_VERSION
|
11
|
+
|
12
|
+
@optionparser = OptionParser.new{|o|
|
13
|
+
o.banner = [
|
14
|
+
"Usage: rurema [options] <method name or class name>",
|
15
|
+
].join("\n")
|
16
|
+
|
17
|
+
o.on("--init",
|
18
|
+
"initialize rurema system"){
|
19
|
+
@command = :init
|
20
|
+
}
|
21
|
+
o.on("--update",
|
22
|
+
"update documents and database"){
|
23
|
+
@command = :update
|
24
|
+
}
|
25
|
+
o.on("--server",
|
26
|
+
"start web server"){
|
27
|
+
@command = :server
|
28
|
+
}
|
29
|
+
o.on("--preview",
|
30
|
+
"render a reference as HTML"){
|
31
|
+
@command = :preview
|
32
|
+
}
|
33
|
+
o.on("--list",
|
34
|
+
"list all classes"){
|
35
|
+
@command = :list
|
36
|
+
}
|
37
|
+
|
38
|
+
o.on("---- (OPTIONS)"){}
|
39
|
+
|
40
|
+
o.on("--port=N",
|
41
|
+
"port number of the web browser (only meaningful with --server)"){|n|
|
42
|
+
@port = n.to_i
|
43
|
+
}
|
44
|
+
o.on("--browser",
|
45
|
+
"open web browser (only meaningful with --server or --preview)"){
|
46
|
+
@open_browser = true
|
47
|
+
}
|
48
|
+
o.on("--dry-run",
|
49
|
+
"show commands only"){
|
50
|
+
@dry_run = true
|
51
|
+
}
|
52
|
+
o.on("--no-ask",
|
53
|
+
"do not ask keyboard input"){
|
54
|
+
@no_ask = true
|
55
|
+
}
|
56
|
+
o.on("--ruremadir=PATH",
|
57
|
+
"specify rurema directory (default: #{@ruremadir})"){|path|
|
58
|
+
@ruremadir = Pathname(path)
|
59
|
+
}
|
60
|
+
o.on("--rubyver=STR",
|
61
|
+
"specify Ruby version (default: #{@rubyver})"){|str|
|
62
|
+
@rubyver = str
|
63
|
+
}
|
64
|
+
|
65
|
+
o.on("----- (INFO)"){}
|
66
|
+
|
67
|
+
o.on("--version",
|
68
|
+
"show version of myrurema"){
|
69
|
+
puts "myrurema version #{MyRurema::VERSION}"
|
70
|
+
exit
|
71
|
+
}
|
72
|
+
o.on("--help",
|
73
|
+
"show this message"){
|
74
|
+
puts o
|
75
|
+
exit
|
76
|
+
}
|
77
|
+
}
|
78
|
+
@rest_args = @optionparser.parse(argv)
|
79
|
+
end
|
80
|
+
attr_accessor :dry_run, :no_ask, :ruremadir, :rubyver,
|
81
|
+
:open_browser, :command, :port, :rest_args
|
82
|
+
|
83
|
+
def ruremadir=(dir)
|
84
|
+
@ruremadir = Pathname(dir)
|
85
|
+
end
|
86
|
+
|
87
|
+
def usage
|
88
|
+
puts @optionparser
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
data/{src → lib}/myrurema.rb
RENAMED
@@ -3,100 +3,17 @@ require 'pathname'
|
|
3
3
|
require 'shellwords'
|
4
4
|
require 'tmpdir'
|
5
5
|
|
6
|
+
require 'launchy'
|
7
|
+
require 'myrurema/options'
|
8
|
+
require 'myrurema/version'
|
9
|
+
|
10
|
+
# Extend Pathname so that you can write
|
11
|
+
# foo / "bar" #=> Pathname("foo/bar")
|
12
|
+
# instead of
|
13
|
+
# foo + "bar"
|
6
14
|
class Pathname; alias / +; end
|
7
15
|
|
8
|
-
class Options
|
9
|
-
def initialize(argv)
|
10
|
-
@command = nil
|
11
|
-
@open_browser = false
|
12
|
-
@port = nil
|
13
|
-
@dry_run = false
|
14
|
-
@no_ask = false
|
15
|
-
@ruremadir = Pathname("~/.rurema").expand_path
|
16
|
-
@rubyver = RUBY_VERSION
|
17
|
-
|
18
|
-
@optionparser = OptionParser.new{|o|
|
19
|
-
o.banner = [
|
20
|
-
"Usage: rurema [options] <method name or class name>",
|
21
|
-
].join("\n")
|
22
|
-
|
23
|
-
o.on("--init",
|
24
|
-
"initialize rurema system"){
|
25
|
-
@command = :init
|
26
|
-
}
|
27
|
-
o.on("--update",
|
28
|
-
"update documents and database"){
|
29
|
-
@command = :update
|
30
|
-
}
|
31
|
-
o.on("--server",
|
32
|
-
"start web server"){
|
33
|
-
@command = :server
|
34
|
-
}
|
35
|
-
o.on("--preview",
|
36
|
-
"render a reference as HTML"){
|
37
|
-
@command = :preview
|
38
|
-
}
|
39
|
-
o.on("--list",
|
40
|
-
"list all classes"){
|
41
|
-
@command = :list
|
42
|
-
}
|
43
|
-
|
44
|
-
o.on("---- (OPTIONS)"){}
|
45
|
-
|
46
|
-
o.on("--port=N",
|
47
|
-
"port number of the web browser (only meaningful with --server)"){|n|
|
48
|
-
@port = n.to_i
|
49
|
-
}
|
50
|
-
o.on("--browser",
|
51
|
-
"open web browser (only meaningful with --server or --preview)"){
|
52
|
-
@open_browser = true
|
53
|
-
}
|
54
|
-
o.on("--dry-run",
|
55
|
-
"show commands only"){
|
56
|
-
@dry_run = true
|
57
|
-
}
|
58
|
-
o.on("--no-ask",
|
59
|
-
"do not ask keyboard input"){
|
60
|
-
@no_ask = true
|
61
|
-
}
|
62
|
-
o.on("--ruremadir=PATH",
|
63
|
-
"specify rurema directory (default: #{@ruremadir})"){|path|
|
64
|
-
@ruremadir = Pathname(path)
|
65
|
-
}
|
66
|
-
o.on("--rubyver=STR",
|
67
|
-
"specify Ruby version (default: #{@rubyver})"){|str|
|
68
|
-
@rubyver = str
|
69
|
-
}
|
70
|
-
|
71
|
-
o.on("----- (INFO)"){}
|
72
|
-
|
73
|
-
o.on("--version",
|
74
|
-
"show version of myrurema"){
|
75
|
-
puts MyRurema::VERSION
|
76
|
-
exit
|
77
|
-
}
|
78
|
-
o.on("--help",
|
79
|
-
"show this message"){
|
80
|
-
puts o
|
81
|
-
exit
|
82
|
-
}
|
83
|
-
}
|
84
|
-
@rest_args = @optionparser.parse(argv)
|
85
|
-
end
|
86
|
-
attr_accessor :dry_run, :no_ask, :ruremadir, :rubyver,
|
87
|
-
:open_browser, :command, :port, :rest_args
|
88
|
-
|
89
|
-
def ruremadir=(dir)
|
90
|
-
@ruremadir = Pathname(dir)
|
91
|
-
end
|
92
|
-
|
93
|
-
def usage
|
94
|
-
puts @optionparser
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
16
|
class MyRurema
|
99
|
-
VERSION = File.read((Pathname(__FILE__).dirname/"../VERSION").expand_path)
|
100
17
|
SVN_URL = "http://jp.rubyist.net/svn/rurema"
|
101
18
|
|
102
19
|
def initialize(opt=Options.new(ARGV))
|
@@ -107,14 +24,24 @@ class MyRurema
|
|
107
24
|
if @opt.command
|
108
25
|
send(@opt.command)
|
109
26
|
else
|
110
|
-
query
|
111
|
-
|
27
|
+
query = @opt.rest_args
|
28
|
+
num = if !query.empty? and query.last =~ /\A\d+\z/
|
29
|
+
query.pop.to_i
|
30
|
+
else
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
|
34
|
+
case
|
35
|
+
when query.empty?
|
36
|
+
if num
|
37
|
+
search(num, @opt.rubyver)
|
38
|
+
else
|
39
|
+
@opt.usage
|
40
|
+
end
|
112
41
|
when query && num
|
113
|
-
search_num(query, num
|
114
|
-
when query
|
115
|
-
search(query, @opt.rubyver)
|
42
|
+
search_num(query, num, @opt.rubyver)
|
116
43
|
else
|
117
|
-
@opt.
|
44
|
+
search(query, @opt.rubyver)
|
118
45
|
end
|
119
46
|
end
|
120
47
|
end
|
@@ -130,19 +57,24 @@ class MyRurema
|
|
130
57
|
refresh_db(@opt.rubyver)
|
131
58
|
end
|
132
59
|
|
60
|
+
# - query: Array or String
|
61
|
+
# - ver: String
|
133
62
|
def search(query, ver)
|
134
63
|
should_have_db(ver)
|
135
64
|
|
136
|
-
|
137
|
-
|
65
|
+
args = Array(query).map{|s| Shellwords.escape s}.join(" ")
|
66
|
+
cmd = "#{bitclust_path/'bin/refe'}" +
|
67
|
+
" #{args} -d #{db_path(ver)}"
|
138
68
|
sh cmd, :silent => true do |txt|
|
139
|
-
|
140
|
-
|
69
|
+
lines = txt.lines.to_a
|
70
|
+
if lines.count < 10 and
|
71
|
+
lines.first(2).join =~ /#{query}.*#{query}/m and
|
72
|
+
lines[1] !~ /^--- / and # ad hoc :-( see Issue #2
|
141
73
|
!@opt.no_ask
|
142
74
|
|
143
75
|
words = {}
|
144
76
|
k = 0
|
145
|
-
puts
|
77
|
+
puts lines.map{|line|
|
146
78
|
line.gsub(/(\S+)/){|str|
|
147
79
|
k+=1
|
148
80
|
words[k] = str
|
@@ -165,7 +97,7 @@ class MyRurema
|
|
165
97
|
def search_num(query, num, ver)
|
166
98
|
should_have_db(ver)
|
167
99
|
|
168
|
-
result = `#{bitclust_path/'bin/refe
|
100
|
+
result = `#{bitclust_path/'bin/refe'} #{query} -d #{db_path(ver)}`
|
169
101
|
word = result.split[num-1]
|
170
102
|
if word
|
171
103
|
word.gsub!(/\.#/, ".") # avoid multi-hit for a module function
|
@@ -179,7 +111,7 @@ class MyRurema
|
|
179
111
|
def list
|
180
112
|
should_have_db(@opt.rubyver)
|
181
113
|
|
182
|
-
sh "#{bitclust_path/'bin/refe
|
114
|
+
sh "#{bitclust_path/'bin/refe'}" +
|
183
115
|
" -l -d #{db_path(@opt.rubyver)}", :silent => true
|
184
116
|
end
|
185
117
|
|
@@ -187,16 +119,23 @@ class MyRurema
|
|
187
119
|
port = @opt.port || default_port(@opt.rubyver)
|
188
120
|
th = Thread.new{
|
189
121
|
sh "#{bitclust_path/'standalone.rb'}" +
|
122
|
+
" --srcdir=#{bitclust_path}" +
|
190
123
|
" --baseurl=http://localhost:#{port}" +
|
191
124
|
" --port=#{port}" +
|
192
125
|
" --database=#{db_path(@opt.rubyver)}" +
|
193
|
-
" --debug"
|
126
|
+
" --debug" # needed to avoid the server running as daemon :-(
|
194
127
|
}
|
128
|
+
|
129
|
+
url = "http://localhost:#{port}/view/"
|
130
|
+
puts "Starting BitClust server .."
|
131
|
+
puts "Open #{url} in your browser."
|
132
|
+
puts
|
133
|
+
|
195
134
|
if @opt.open_browser
|
196
135
|
sleep 1 # wait for the server to start
|
197
|
-
|
198
|
-
sh "#{cmd} http://localhost:#{port}/view/"
|
136
|
+
Launchy.open(url)
|
199
137
|
end
|
138
|
+
|
200
139
|
th.join
|
201
140
|
end
|
202
141
|
|
@@ -229,7 +168,7 @@ class MyRurema
|
|
229
168
|
end
|
230
169
|
|
231
170
|
def init_db(ver)
|
232
|
-
sh "#{bitclust_path/'bin/bitclust
|
171
|
+
sh "#{bitclust_path/'bin/bitclust'}" +
|
233
172
|
" -d #{db_path(ver)} init version=#{ver} encoding=euc-jp"
|
234
173
|
|
235
174
|
refresh_db(ver)
|
@@ -238,7 +177,7 @@ class MyRurema
|
|
238
177
|
def refresh_db(ver)
|
239
178
|
puts "Updating Rurema database:"
|
240
179
|
puts "This will take a few minutes. Please be patient."
|
241
|
-
sh "#{bitclust_path/'bin/bitclust
|
180
|
+
sh "#{bitclust_path/'bin/bitclust'}" +
|
242
181
|
" -d #{db_path(ver)}" +
|
243
182
|
" update --stdlibtree=#{doctree_path/'refm/api/src'}"
|
244
183
|
end
|
@@ -283,7 +222,12 @@ class MyRurema
|
|
283
222
|
end
|
284
223
|
|
285
224
|
def error(msg)
|
286
|
-
$stderr.puts msg
|
225
|
+
$stderr.puts msg unless $MYRUREMA_TEST
|
287
226
|
exit
|
288
227
|
end
|
228
|
+
|
229
|
+
def puts(str="")
|
230
|
+
Kernel.puts(str) unless $MYRUREMA_TEST
|
231
|
+
end
|
232
|
+
|
289
233
|
end
|
data/myrurema.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path('../lib/myrurema/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.authors = ["Yutaka HARA"]
|
5
|
+
gem.email = ["yutaka.hara.gmail.com"]
|
6
|
+
gem.description = %q{myrurema provides a command 'rurema', which helps searching/browsing/writing the Japanese Ruby documents (a.k.a Rurema http://bugs.ruby-lang.org/projects/rurema/wiki .)}
|
7
|
+
gem.summary = %q{A tool for Rurema (the new Japanese Ruby reference manual)}
|
8
|
+
gem.homepage = 'http://github.com/yhara/myrurema'
|
9
|
+
|
10
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
11
|
+
gem.files = `git ls-files`.split("\n")
|
12
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
13
|
+
gem.name = "myrurema"
|
14
|
+
gem.require_paths = ['lib']
|
15
|
+
gem.version = MyRurema::VERSION
|
16
|
+
|
17
|
+
gem.add_dependency("launchy", "~> 2.0.5")
|
18
|
+
gem.add_development_dependency("rspec", ">= 2.0")
|
19
|
+
end
|
data/spec/commands.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
require File.expand_path("../
|
1
|
+
require File.expand_path("../lib/myrurema", File.dirname(__FILE__))
|
2
2
|
|
3
|
+
$MYRUREMA_TEST = true
|
4
|
+
|
5
|
+
# Override methods for testing
|
3
6
|
class MyRurema
|
4
7
|
def sh(cmd, opt={})
|
5
8
|
@cmds ||= []
|
@@ -10,12 +13,14 @@ class MyRurema
|
|
10
13
|
def exit; end
|
11
14
|
end
|
12
15
|
|
16
|
+
module Launchy; def self.open(*args); end; end
|
17
|
+
|
13
18
|
CASES = {
|
14
19
|
"rurema --init" => [
|
15
|
-
%r{svn co .*
|
16
|
-
%r{svn co .*
|
17
|
-
%r{bitclust.*init},
|
18
|
-
%r{bitclust.*update},
|
20
|
+
%r{svn co -rHEAD .*/doctree/trunk .*},
|
21
|
+
%r{svn co -rHEAD .*/bitclust/trunk .*},
|
22
|
+
%r{.*/bin/bitclust -d .* init version=.* encoding=euc-jp},
|
23
|
+
%r{.*/bin/bitclust -d .* update --stdlibtree=.*/refm/api/src},
|
19
24
|
],
|
20
25
|
|
21
26
|
"rurema --init --rubyver=1.8.7" => [
|
@@ -32,20 +37,24 @@ CASES = {
|
|
32
37
|
],
|
33
38
|
|
34
39
|
"rurema Array" => [
|
35
|
-
%r{refe.*
|
40
|
+
%r{.*/refe Array -d .*}
|
41
|
+
],
|
42
|
+
|
43
|
+
"rurema Ar i" => [
|
44
|
+
%r{.*/refe Ar i -d .*},
|
36
45
|
],
|
37
46
|
|
38
47
|
"rurema --server" => [
|
39
|
-
%r{standalone}
|
48
|
+
%r{.*/standalone.rb --srcdir=.* --baseurl=http://localhost:.* --port=.* --database=.* --debug}
|
40
49
|
],
|
41
50
|
|
42
51
|
"rurema --server --port=9898" => [
|
43
|
-
%r{standalone
|
52
|
+
%r{.*/standalone.rb --srcdir=.* --baseurl=http://localhost:.* --port=9898 --database=.* --debug}
|
44
53
|
],
|
45
54
|
|
46
55
|
"rurema --server --browser" => [
|
47
|
-
%r{standalone}
|
48
|
-
|
56
|
+
%r{.*/standalone.rb --srcdir=.* --baseurl=http://localhost:.* --port=.* --database=.* --debug}
|
57
|
+
# Todo: Launchy.should_receive(:open)
|
49
58
|
],
|
50
59
|
|
51
60
|
"rurema --preview" => [
|
@@ -70,20 +79,20 @@ CASES = {
|
|
70
79
|
}
|
71
80
|
|
72
81
|
describe MyRurema do
|
73
|
-
|
74
|
-
|
75
|
-
opt = Options.new(command.split
|
82
|
+
CASES.each do |command, expects|
|
83
|
+
it "should respond to #{command}" do
|
84
|
+
opt = MyRurema::Options.new(command.split.drop(1))
|
76
85
|
my = MyRurema.new(opt)
|
77
86
|
my.run
|
78
87
|
|
79
88
|
cmds = my.cmds
|
80
89
|
i = 0
|
81
90
|
expects.each do |pattern|
|
82
|
-
|
83
|
-
|
84
|
-
not i.nil?
|
91
|
+
cmds[i..-1].should satisfy{|ary|
|
92
|
+
ary.any?{|s| pattern =~ s}
|
85
93
|
}
|
86
|
-
|
94
|
+
|
95
|
+
i = cmds[i..-1].index{|cmd| pattern =~ cmd} + 1
|
87
96
|
end
|
88
97
|
end
|
89
98
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myrurema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,25 +9,53 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
15
|
-
|
12
|
+
date: 2012-01-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: launchy
|
16
|
+
requirement: &2154448780 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.0.5
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2154448780
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &2154448100 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2154448100
|
36
|
+
description: myrurema provides a command 'rurema', which helps searching/browsing/writing
|
37
|
+
the Japanese Ruby documents (a.k.a Rurema http://bugs.ruby-lang.org/projects/rurema/wiki
|
38
|
+
.)
|
39
|
+
email:
|
40
|
+
- yutaka.hara.gmail.com
|
16
41
|
executables:
|
17
42
|
- rurema
|
18
43
|
extensions: []
|
19
|
-
extra_rdoc_files:
|
20
|
-
- README.mkd
|
44
|
+
extra_rdoc_files: []
|
21
45
|
files:
|
46
|
+
- Gemfile
|
47
|
+
- Gemfile.lock
|
22
48
|
- HISTORY
|
23
49
|
- README.mkd
|
24
50
|
- Rakefile
|
25
|
-
- VERSION
|
26
51
|
- bin/rurema
|
27
52
|
- features/basic_commands.feature
|
53
|
+
- lib/myrurema.rb
|
54
|
+
- lib/myrurema/options.rb
|
55
|
+
- lib/myrurema/version.rb
|
28
56
|
- main.rb
|
57
|
+
- myrurema.gemspec
|
29
58
|
- spec/commands.rb
|
30
|
-
- src/myrurema.rb
|
31
59
|
homepage: http://github.com/yhara/myrurema
|
32
60
|
licenses: []
|
33
61
|
post_install_message:
|
@@ -48,8 +76,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
76
|
version: '0'
|
49
77
|
requirements: []
|
50
78
|
rubyforge_project:
|
51
|
-
rubygems_version: 1.8.
|
79
|
+
rubygems_version: 1.8.10
|
52
80
|
signing_key:
|
53
81
|
specification_version: 3
|
54
82
|
summary: A tool for Rurema (the new Japanese Ruby reference manual)
|
55
|
-
test_files:
|
83
|
+
test_files:
|
84
|
+
- features/basic_commands.feature
|
85
|
+
- spec/commands.rb
|
86
|
+
has_rdoc:
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.2.0
|