shinagawaseaside 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,4 +1,7 @@
1
+ === 0.0.2 2010-07-04
2
+
3
+ * add samples
4
+
1
5
  === 0.0.1 2010-07-04
2
6
 
3
- * 1 major enhancement:
4
- * Initial release
7
+ * start/stop ttserver
data/Manifest.txt CHANGED
@@ -1,6 +1,5 @@
1
1
  History.txt
2
2
  Manifest.txt
3
- PostInstall.txt
4
3
  README.rdoc
5
4
  Rakefile
6
5
  lib/shinagawaseaside.rb
@@ -11,5 +10,9 @@ spec/shinagawaseaside_spec.rb
11
10
  spec/spec.opts
12
11
  spec/spec_helper.rb
13
12
  tasks/rspec.rake
14
- samples/Rakefile
13
+ samples/simple/Rakefile
14
+ samples/with_yaml/Rakefile
15
+ samples/with_yaml/config.yaml
16
+ samples/with_yaml/tokyotyrant-read-write.rb
17
+
15
18
 
data/README.rdoc CHANGED
@@ -8,6 +8,8 @@ add rake tasks they start/stop tokyo tyrant server
8
8
 
9
9
  == SYNOPSIS:
10
10
 
11
+ === Rakefile
12
+
11
13
  require 'rubygems'
12
14
  require 'shinagawaseaside'
13
15
 
@@ -18,13 +20,22 @@ add rake tasks they start/stop tokyo tyrant server
18
20
  ShinagawaSeaside::set_tasks(ttdb, :basedir => File.dirname(__FILE__)+'/ttdb')
19
21
 
20
22
 
23
+ === Start Server
24
+
25
+ rake ttstart
26
+
27
+ === Stop Server
28
+
29
+ rake ttstop
30
+
31
+
21
32
  == REQUIREMENTS:
22
33
 
23
34
  * TokyoTyrant
24
35
 
25
36
  == INSTALL:
26
37
 
27
- * sudo gem install ShinagawaSeaside
38
+ * sudo gem install shinagawaseaside
28
39
 
29
40
  == LICENSE:
30
41
 
@@ -2,10 +2,16 @@ $:.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.1'
5
+ VERSION = '0.0.2'
6
6
 
7
7
  def ShinagawaSeaside::set_tasks(ttdb, opts)
8
8
  ttdb = ttdb.map{|db|
9
+ h = Hash.new
10
+ db.keys.each{|k|
11
+ h[k.to_sym] = db[k]
12
+ }
13
+ h
14
+ }.map{|db|
9
15
  name = db[:name]
10
16
  port = db[:port].to_i
11
17
  basedir = opts[:basedir]
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'shinagawaseaside'
3
- #require '../lib/shinagawaseaside'
3
+ #require '../../lib/shinagawaseaside'
4
4
 
5
5
  ttdb = [ { :name => 'users', :port => 20010},
6
6
  { :name => 'videos',:port => 20011},
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'yaml'
3
+ #require 'shinagawaseaside'
4
+ require '../..//lib/shinagawaseaside'
5
+
6
+ begin
7
+ conf = YAML::load open(File.dirname(__FILE__)+'/config.yaml')
8
+ rescue
9
+ STDERR.puts 'config.yaml load error'
10
+ exit 1
11
+ end
12
+
13
+ ShinagawaSeaside::set_tasks(conf['ttdb'], :basedir => File.dirname(__FILE__)+'/ttdb')
@@ -0,0 +1,7 @@
1
+
2
+ ttdb :
3
+ - name : users
4
+ port : 23240
5
+ - name : videos
6
+ port : 23241
7
+
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/ruby
2
+ # -*- coding: utf-8 -*-
3
+ require 'rubygems'
4
+ require 'tokyotyrant'
5
+ include TokyoTyrant
6
+ require 'yaml'
7
+
8
+ begin
9
+ conf = YAML::load open(File.dirname(__FILE__)+'/config.yaml')
10
+ rescue
11
+ STDERR.puts 'config.yaml load error'
12
+ exit 1
13
+ end
14
+
15
+ dbs = Hash.new
16
+ conf['ttdb'].each{|db|
17
+ puts "open #{db['name']}"
18
+ rdb = RDB::new
19
+ if !rdb.open('127.0.0.1', db['port'].to_i)
20
+ STDERR.puts 'error - tokyotyrant : '+rdb.errmsg(rdb.ecode)
21
+ exit 1
22
+ else
23
+ dbs[db['name'].to_sym] = rdb
24
+ end
25
+ }
26
+
27
+ dbs[:users][1] = 'shokai'
28
+ dbs[:users][2] = 'hashimoto'
29
+
30
+ puts dbs[:users][1]
31
+
32
+ dbs[:users].keys.sort.each{|k|
33
+ puts "#{k} => #{dbs[:users][k]}"
34
+ }
35
+
36
+
37
+
38
+ for i in 0...10 do
39
+ dbs[:videos][i] = "#{rand(100)}.mov"
40
+ end
41
+
42
+ dbs[:videos].keys.sort.each{|k|
43
+ puts "#{k} => #{dbs[:videos][k]}"
44
+ }
45
+
46
+
47
+ dbs.each{|name,rdb|
48
+ puts "close #{name}"
49
+ if !rdb.close
50
+ STDERR.puts 'error - tokyotyrant : '+rdb.errmsg(rdb.ecode)
51
+ end
52
+ }
53
+
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: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sho Hashimoto
@@ -60,11 +60,9 @@ extensions: []
60
60
  extra_rdoc_files:
61
61
  - History.txt
62
62
  - Manifest.txt
63
- - PostInstall.txt
64
63
  files:
65
64
  - History.txt
66
65
  - Manifest.txt
67
- - PostInstall.txt
68
66
  - README.rdoc
69
67
  - Rakefile
70
68
  - lib/shinagawaseaside.rb
@@ -75,7 +73,10 @@ files:
75
73
  - spec/spec.opts
76
74
  - spec/spec_helper.rb
77
75
  - tasks/rspec.rake
78
- - samples/Rakefile
76
+ - samples/simple/Rakefile
77
+ - samples/with_yaml/Rakefile
78
+ - samples/with_yaml/config.yaml
79
+ - samples/with_yaml/tokyotyrant-read-write.rb
79
80
  has_rdoc: true
80
81
  homepage: http://github.com/shokai/shinagawaseaside
81
82
  licenses: []
data/PostInstall.txt DELETED
@@ -1,7 +0,0 @@
1
-
2
- For more information on shinagawaseaside, see http://shinagawaseaside.rubyforge.org
3
-
4
- NOTE: Change this information in PostInstall.txt
5
- You can also delete it if you don't want it.
6
-
7
-