myrurema 0.0.0 → 0.0.1
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/VERSION +1 -1
- data/bin/rurema +24 -5
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/bin/rurema
CHANGED
@@ -6,10 +6,11 @@ class Pathname; alias / +; end
|
|
6
6
|
|
7
7
|
class Options
|
8
8
|
def initialize(argv)
|
9
|
+
@command = nil
|
10
|
+
@open_browser = false
|
9
11
|
@dry_run = false
|
10
12
|
@ruremadir = Pathname("~/.rurema").expand_path
|
11
13
|
@rubyver = RUBY_VERSION
|
12
|
-
@command = nil
|
13
14
|
@query = ""
|
14
15
|
|
15
16
|
@optionparser = OptionParser.new{|o|
|
@@ -21,7 +22,15 @@ class Options
|
|
21
22
|
"update documents and database"){
|
22
23
|
@command = :update
|
23
24
|
}
|
25
|
+
o.on("--server",
|
26
|
+
"start web server"){
|
27
|
+
@command = :server
|
28
|
+
}
|
24
29
|
|
30
|
+
o.on("--browser",
|
31
|
+
"open web browser (only meaningful with --server)"){
|
32
|
+
@open_browser = true
|
33
|
+
}
|
25
34
|
o.on("--dry-run",
|
26
35
|
"show commands only"){
|
27
36
|
@dry_run = true
|
@@ -42,7 +51,7 @@ class Options
|
|
42
51
|
}
|
43
52
|
@query = @optionparser.parse(argv).join(" ")
|
44
53
|
end
|
45
|
-
attr_reader :dry_run, :ruremadir, :rubyver
|
54
|
+
attr_reader :dry_run, :ruremadir, :rubyver, :open_browser
|
46
55
|
attr_reader :command, :query
|
47
56
|
|
48
57
|
def usage
|
@@ -90,11 +99,22 @@ class Rurema
|
|
90
99
|
end
|
91
100
|
|
92
101
|
sh "#{bitclust_path/'bin/refe.rb'}" +
|
93
|
-
|
102
|
+
" #{query} -d #{db_path(ver)}", :silent => true
|
94
103
|
end
|
95
104
|
|
96
105
|
def server
|
97
|
-
|
106
|
+
th = Thread.new{
|
107
|
+
sh "#{bitclust_path/'standalone.rb'}" +
|
108
|
+
" --baseurl=http://localhost:9292" +
|
109
|
+
" --port=9292" +
|
110
|
+
" --database=#{db_path(@opt.rubyver)}" +
|
111
|
+
" --debug"
|
112
|
+
}
|
113
|
+
if @opt.open_browser
|
114
|
+
cmd = (/mswin/ =~ RUBY_PLATFORM) ? "start" : "open"
|
115
|
+
sh "#{cmd} http://localhost:9292/view/"
|
116
|
+
end
|
117
|
+
th.join
|
98
118
|
end
|
99
119
|
|
100
120
|
private
|
@@ -127,7 +147,6 @@ class Rurema
|
|
127
147
|
end
|
128
148
|
|
129
149
|
def db_path(ver)
|
130
|
-
raise ArgumentError, "malformed ver: #{ver}" unless ver =~ /\A\d.\d.\d\z/
|
131
150
|
@opt.ruremadir / "db" / ver
|
132
151
|
end
|
133
152
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myrurema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Yutaka HARA
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-14 00:00:00 +09:00
|
19
19
|
default_executable: rurema
|
20
20
|
dependencies: []
|
21
21
|
|