shinagawaseaside 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ === 0.0.1 2010-07-04
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,15 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ lib/shinagawaseaside.rb
7
+ script/console
8
+ script/destroy
9
+ script/generate
10
+ spec/shinagawaseaside_spec.rb
11
+ spec/spec.opts
12
+ spec/spec_helper.rb
13
+ tasks/rspec.rake
14
+ samples/Rakefile
15
+
data/PostInstall.txt ADDED
@@ -0,0 +1,7 @@
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
+
data/README.rdoc ADDED
@@ -0,0 +1,52 @@
1
+ = shinagawaseaside
2
+
3
+ * http://github.com/shokai/shinagawaseaside
4
+
5
+ == DESCRIPTION:
6
+
7
+ add rake tasks they start/stop tokyo tyrant server
8
+
9
+ == SYNOPSIS:
10
+
11
+ require 'rubygems'
12
+ require 'shinagawaseaside'
13
+
14
+ ttdb = [ { :name => 'users', :port => 20010},
15
+ { :name => 'videos',:port => 20011},
16
+ { :name => 'comments', :port => 20012} ]
17
+
18
+ ShinagawaSeaside::set_tasks(ttdb, :basedir => File.dirname(__FILE__)+'/ttdb')
19
+
20
+
21
+ == REQUIREMENTS:
22
+
23
+ * TokyoTyrant
24
+
25
+ == INSTALL:
26
+
27
+ * sudo gem install ShinagawaSeaside
28
+
29
+ == LICENSE:
30
+
31
+ (The MIT License)
32
+
33
+ Copyright (c) 2010 Sho Hashimoto
34
+
35
+ Permission is hereby granted, free of charge, to any person obtaining
36
+ a copy of this software and associated documentation files (the
37
+ 'Software'), to deal in the Software without restriction, including
38
+ without limitation the rights to use, copy, modify, merge, publish,
39
+ distribute, sublicense, and/or sell copies of the Software, and to
40
+ permit persons to whom the Software is furnished to do so, subject to
41
+ the following conditions:
42
+
43
+ The above copyright notice and this permission notice shall be
44
+ included in all copies or substantial portions of the Software.
45
+
46
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
47
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
48
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
49
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
50
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
51
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
52
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/shinagawaseaside'
6
+
7
+ Hoe.plugin :newgem
8
+ # Hoe.plugin :website
9
+ # Hoe.plugin :cucumberfeatures
10
+
11
+ # Generate all the Rake tasks
12
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
+ $hoe = Hoe.spec 'shinagawaseaside' do
14
+ self.developer 'Sho Hashimoto', 'hashimoto@shokai.org'
15
+ # self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
16
+ self.rubyforge_name = self.name # TODO this is default value
17
+ # self.extra_deps = [['activesupport','>= 2.0.2']]
18
+
19
+ end
20
+
21
+ require 'newgem/tasks'
22
+ Dir['tasks/**/*.rake'].each { |t| load t }
23
+
24
+ # TODO - want other tests/tasks run by default? Add them to the list
25
+ # remove_task :default
26
+ # task :default => [:spec, :features]
@@ -0,0 +1,71 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module ShinagawaSeaside
5
+ VERSION = '0.0.1'
6
+
7
+ def ShinagawaSeaside::set_tasks(ttdb, opts)
8
+ ttdb = ttdb.map{|db|
9
+ name = db[:name]
10
+ port = db[:port].to_i
11
+ basedir = opts[:basedir]
12
+ {
13
+ :cmd => 'ttserver',
14
+ :basedir => basedir,
15
+ :name => name,
16
+ :port => port,
17
+ :pidfile => "#{basedir}/#{name}.pid",
18
+ :dbname => "#{basedir}/#{name}.tch#bnum=1000000"
19
+ }
20
+ }
21
+
22
+ desc 'start TokyoTyrant server'
23
+ task 'ttstart' do
24
+ puts 'starting TokyoTyrant servers..'
25
+ for tt in ttdb do
26
+ Dir.mkdir(tt[:basedir]) if !File.exists?(tt[:basedir])
27
+ puts ''
28
+ puts "name=>#{tt[:name]}, port=>#{tt[:port]}, pid=>#{tt[:pidfile]}"
29
+ if File.exists?(tt[:pidfile])
30
+ pid = open(tt[:pidfile]).read
31
+ puts "existing process - pid:#{pid}"
32
+ else
33
+ system("#{tt[:cmd]} -port #{tt[:port]} -dmn -pid #{tt[:pidfile]} #{tt[:dbname]}")
34
+ puts 'done'
35
+ end
36
+ end
37
+ end
38
+
39
+ desc 'stop TokyoTyrant server'
40
+ task 'ttstop' do
41
+ puts 'stopping TokyoTyrant servers..'
42
+ for tt in ttdb do
43
+ if File.exists?(tt[:pidfile])
44
+ pid = open(tt[:pidfile]).read
45
+ puts ''
46
+ puts "name=>#{tt[:name]}, port=>#{tt[:port]}, pid=>#{pid}"
47
+ system("kill -TERM #{pid}")
48
+ count = 0
49
+ loop do
50
+ sleep 0.1
51
+ if !File.exists?(tt[:pidfile])
52
+ puts 'done'
53
+ break
54
+ end
55
+ if (count+=1) > 100
56
+ puts "hanging process - pid:#{pid}"
57
+ break
58
+ end
59
+ end
60
+ else
61
+ puts 'no process found'
62
+ end
63
+ end
64
+ end
65
+
66
+ desc 'restart TokyoTyrant server'
67
+ task 'ttrestart' => ['ttstop', 'ttstart']
68
+
69
+ end
70
+
71
+ end
data/samples/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'shinagawaseaside'
3
+ #require '../lib/shinagawaseaside'
4
+
5
+ ttdb = [ { :name => 'users', :port => 20010},
6
+ { :name => 'videos',:port => 20011},
7
+ { :name => 'comments', :port => 20012} ]
8
+
9
+ ShinagawaSeaside::set_tasks(ttdb, :basedir => File.dirname(__FILE__)+'/ttdb')
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/shinagawaseaside.rb'}"
9
+ puts "Loading shinagawaseaside gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ # Time to add your specs!
4
+ # http://rspec.info/
5
+ describe "Place your specs here" do
6
+
7
+ it "find this spec in spec directory" do
8
+ # violated "Be sure to write your specs"
9
+ end
10
+
11
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'shinagawaseaside'
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shinagawaseaside
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Sho Hashimoto
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-07-04 00:00:00 +09:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rubyforge
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 2
32
+ - 0
33
+ - 4
34
+ version: 2.0.4
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: hoe
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 21
46
+ segments:
47
+ - 2
48
+ - 6
49
+ - 1
50
+ version: 2.6.1
51
+ type: :development
52
+ version_requirements: *id002
53
+ description: add rake tasks they start/stop tokyo tyrant server
54
+ email:
55
+ - hashimoto@shokai.org
56
+ executables: []
57
+
58
+ extensions: []
59
+
60
+ extra_rdoc_files:
61
+ - History.txt
62
+ - Manifest.txt
63
+ - PostInstall.txt
64
+ files:
65
+ - History.txt
66
+ - Manifest.txt
67
+ - PostInstall.txt
68
+ - README.rdoc
69
+ - Rakefile
70
+ - lib/shinagawaseaside.rb
71
+ - script/console
72
+ - script/destroy
73
+ - script/generate
74
+ - spec/shinagawaseaside_spec.rb
75
+ - spec/spec.opts
76
+ - spec/spec_helper.rb
77
+ - tasks/rspec.rake
78
+ - samples/Rakefile
79
+ has_rdoc: true
80
+ homepage: http://github.com/shokai/shinagawaseaside
81
+ licenses: []
82
+
83
+ post_install_message:
84
+ rdoc_options:
85
+ - --main
86
+ - README.rdoc
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ hash: 3
95
+ segments:
96
+ - 0
97
+ version: "0"
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ requirements: []
108
+
109
+ rubyforge_project: shinagawaseaside
110
+ rubygems_version: 1.3.7
111
+ signing_key:
112
+ specification_version: 3
113
+ summary: add rake tasks they start/stop tokyo tyrant server
114
+ test_files: []
115
+