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.
@@ -1,3 +1,7 @@
1
+ === 0.0.3 2010-07-04
2
+
3
+ * set names of rake tasks option
4
+
1
5
  === 0.0.2 2010-07-04
2
6
 
3
7
  * add samples
@@ -14,5 +14,5 @@ samples/simple/Rakefile
14
14
  samples/with_yaml/Rakefile
15
15
  samples/with_yaml/config.yaml
16
16
  samples/with_yaml/tokyotyrant-read-write.rb
17
-
17
+ samples/set_taskname/Rakefile
18
18
 
@@ -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.2'
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 'ttstart' do
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 'ttstop' do
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 'ttrestart' => ['ttstop', 'ttstart']
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
+ )
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
- require 'shinagawaseaside'
3
- #require '../../lib/shinagawaseaside'
2
+ #require 'shinagawaseaside'
3
+ require '../../lib/shinagawaseaside'
4
4
 
5
5
  ttdb = [ { :name => 'users', :port => 20010},
6
6
  { :name => 'videos',:port => 20011},
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'yaml'
3
3
  #require 'shinagawaseaside'
4
- require '../..//lib/shinagawaseaside'
4
+ require '../../lib/shinagawaseaside'
5
5
 
6
6
  begin
7
7
  conf = YAML::load open(File.dirname(__FILE__)+'/config.yaml')
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: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
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: []