shinagawaseaside 0.0.2 → 0.0.3
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/History.txt +4 -0
- data/Manifest.txt +1 -1
- data/lib/shinagawaseaside.rb +13 -4
- data/samples/set_taskname/Rakefile +14 -0
- data/samples/simple/Rakefile +2 -2
- data/samples/with_yaml/Rakefile +1 -1
- metadata +4 -3
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/lib/shinagawaseaside.rb
CHANGED
@@ -2,9 +2,18 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
4
|
module ShinagawaSeaside
|
5
|
-
VERSION = '0.0.
|
5
|
+
VERSION = '0.0.3'
|
6
6
|
|
7
7
|
def ShinagawaSeaside::set_tasks(ttdb, opts)
|
8
|
+
tasks = {
|
9
|
+
:start => 'ttstart',
|
10
|
+
:stop => 'ttstop',
|
11
|
+
:restart => 'ttrestart'
|
12
|
+
}
|
13
|
+
tasks[:start] = opts[:start].to_s if opts[:start]
|
14
|
+
tasks[:stop] = opts[:stop].to_s if opts[:stop]
|
15
|
+
tasks[:restart] = opts[:restart].to_s if opts[:restart]
|
16
|
+
|
8
17
|
ttdb = ttdb.map{|db|
|
9
18
|
h = Hash.new
|
10
19
|
db.keys.each{|k|
|
@@ -26,7 +35,7 @@ module ShinagawaSeaside
|
|
26
35
|
}
|
27
36
|
|
28
37
|
desc 'start TokyoTyrant server'
|
29
|
-
task
|
38
|
+
task tasks[:start] do
|
30
39
|
puts 'starting TokyoTyrant servers..'
|
31
40
|
for tt in ttdb do
|
32
41
|
Dir.mkdir(tt[:basedir]) if !File.exists?(tt[:basedir])
|
@@ -43,7 +52,7 @@ module ShinagawaSeaside
|
|
43
52
|
end
|
44
53
|
|
45
54
|
desc 'stop TokyoTyrant server'
|
46
|
-
task
|
55
|
+
task tasks[:stop] do
|
47
56
|
puts 'stopping TokyoTyrant servers..'
|
48
57
|
for tt in ttdb do
|
49
58
|
if File.exists?(tt[:pidfile])
|
@@ -70,7 +79,7 @@ module ShinagawaSeaside
|
|
70
79
|
end
|
71
80
|
|
72
81
|
desc 'restart TokyoTyrant server'
|
73
|
-
task
|
82
|
+
task tasks[:restart] => [tasks[:stop], tasks[:start]]
|
74
83
|
|
75
84
|
end
|
76
85
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
#require 'shinagawaseaside'
|
3
|
+
require '../../lib/shinagawaseaside'
|
4
|
+
|
5
|
+
ttdb = [ { :name => 'users', :port => 20020},
|
6
|
+
{ :name => 'videos',:port => 20021},
|
7
|
+
{ :name => 'comments', :port => 20022} ]
|
8
|
+
|
9
|
+
ShinagawaSeaside::set_tasks(ttdb,
|
10
|
+
:basedir => File.dirname(__FILE__)+'/ttdb',
|
11
|
+
:start => 'start', # set task name
|
12
|
+
:stop => 'stop',
|
13
|
+
:restart => 'restart'
|
14
|
+
)
|
data/samples/simple/Rakefile
CHANGED
data/samples/with_yaml/Rakefile
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shinagawaseaside
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sho Hashimoto
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- samples/with_yaml/Rakefile
|
78
78
|
- samples/with_yaml/config.yaml
|
79
79
|
- samples/with_yaml/tokyotyrant-read-write.rb
|
80
|
+
- samples/set_taskname/Rakefile
|
80
81
|
has_rdoc: true
|
81
82
|
homepage: http://github.com/shokai/shinagawaseaside
|
82
83
|
licenses: []
|