--- /dev/null
+=== 0.0.1 2010-07-04
+
+* 1 major enhancement:
+ * Initial release
--- /dev/null
+History.txt
+Manifest.txt
+PostInstall.txt
+README.rdoc
+Rakefile
+lib/shinagawaseaside.rb
+script/console
+script/destroy
+script/generate
+test/test_helper.rb
+test/test_shinagawaseaside.rb
--- /dev/null
+
+For more information on shinagawaseaside, see http://shinagawaseaside.rubyforge.org
+
+NOTE: Change this information in PostInstall.txt
+You can also delete it if you don't want it.
+
+
--- /dev/null
+= shinagawaseaside
+
+* http://github.com/#{github_username}/#{project_name}
+
+== DESCRIPTION:
+
+FIX (describe your package)
+
+== FEATURES/PROBLEMS:
+
+* FIX (list of features or problems)
+
+== SYNOPSIS:
+
+ FIX (code sample of usage)
+
+== REQUIREMENTS:
+
+* FIX (list of requirements)
+
+== INSTALL:
+
+* FIX (sudo gem install, anything else)
+
+== LICENSE:
+
+(The MIT License)
+
+Copyright (c) 2010 FIXME full name
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
--- /dev/null
+require 'rubygems'\r
+gem 'hoe', '>= 2.1.0'\r
+require 'hoe'\r
+require 'fileutils'\r
+require './lib/shinagawaseaside'\r
+\r
+Hoe.plugin :newgem\r
+# Hoe.plugin :website\r
+# Hoe.plugin :cucumberfeatures\r
+\r
+# Generate all the Rake tasks\r
+# Run 'rake -T' to see list of generated tasks (from gem root directory)\r
+$hoe = Hoe.spec 'shinagawaseaside' do\r
+ self.developer 'FIXME full name', 'FIXME email'\r
+ self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required\r
+ self.rubyforge_name = self.name # TODO this is default value\r
+ # self.extra_deps = [['activesupport','>= 2.0.2']]\r
+\r
+end\r
+\r
+require 'newgem/tasks'\r
+Dir['tasks/**/*.rake'].each { |t| load t }\r
+\r
+# TODO - want other tests/tasks run by default? Add them to the list\r
+# remove_task :default\r
+# task :default => [:spec, :features]\r
--- /dev/null
+$:.unshift(File.dirname(__FILE__)) unless
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
+
+module ShinagawaSeaside
+ VERSION = '0.0.1'
+
+ def ShinagawaSeaside::set(ttdb, opts)
+ p ttdb
+ p opts
+
+ ttdb = ttdb.map{|db|
+ name = db[:name]
+ port = db[:port].to_i
+ basedir = opts[:basedir]
+ {
+ :cmd => 'ttserver',
+ :basedir => basedir,
+ :name => name,
+ :port => port,
+ :pidfile => "#{basedir}/#{name}.pid",
+ :dbname => "#{basedir}/#{name}.tch#bnum=1000000"
+ }
+ }
+
+ desc 'start TokyoTyrant server'
+ task 'ttstart' do
+ puts 'starting TokyoTyrant servers..'
+ for tt in ttdb do
+ Dir.mkdir(tt[:basedir]) if !File.exists?(tt[:basedir])
+ puts ''
+ puts "name=>#{tt[:name]}, port=>#{tt[:port]}, pid=>#{tt[:pidfile]}"
+ if File.exists?(tt[:pidfile])
+ pid = open(tt[:pidfile]).read
+ puts "existing process - pid:#{pid}"
+ else
+ system("#{tt[:cmd]} -port #{tt[:port]} -dmn -pid #{tt[:pidfile]} #{tt[:dbname]}")
+ puts 'done'
+ end
+ end
+ end
+
+ desc 'stop TokyoTyrant server'
+ task 'ttstop' do
+ puts 'stopping TokyoTyrant servers..'
+ for tt in ttdb do
+ if File.exists?(tt[:pidfile])
+ pid = open(tt[:pidfile]).read
+ puts ''
+ puts "name=>#{tt[:name]}, port=>#{tt[:port]}, pid=>#{pid}"
+ system("kill -TERM #{pid}")
+ count = 0
+ loop do
+ sleep 0.1
+ if !File.exists?(tt[:pidfile])
+ puts 'done'
+ break
+ end
+ if (count+=1) > 100
+ puts "hanging process - pid:#{pid}"
+ break
+ end
+ end
+ else
+ puts 'no process found'
+ end
+ end
+ end
+
+ desc 'restart TokyoTyrant server'
+ task 'ttrestart' => ['ttstop', 'ttstart']
+
+ end
+
+end
--- /dev/null
+
+module ShinagawaSeaside::Task
+desc 'shinagawa'
+task 'shinagawa' do
+ puts 'start shinagawa'
+end
--- /dev/null
+
+puts 'load task'
+
--- /dev/null
+require 'rubygems'
+require '../lib/shinagawaseaside'
+
+ttdb = [ { :name => 'users', :port => 20010},
+ { :name => 'videos',:port => 20011},
+ { :name => 'comments', :port => 20012} ]
+
+ShinagawaSeaside::set(ttdb, :basedir => File.dirname(__FILE__)+'/ttdb')
--- /dev/null
+#!/usr/bin/env ruby
+# File: script/console
+irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
+
+libs = " -r irb/completion"
+# Perhaps use a console_lib to store any extra methods I may want available in the cosole
+# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
+libs << " -r #{File.dirname(__FILE__) + '/../lib/shinagawaseaside.rb'}"
+puts "Loading shinagawaseaside gem"
+exec "#{irb} #{libs} --simple-prompt"
\ No newline at end of file
--- /dev/null
+#!/usr/bin/env ruby
+APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+
+begin
+ require 'rubigen'
+rescue LoadError
+ require 'rubygems'
+ require 'rubigen'
+end
+require 'rubigen/scripts/destroy'
+
+ARGV.shift if ['--help', '-h'].include?(ARGV[0])
+RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
+RubiGen::Scripts::Destroy.new.run(ARGV)
--- /dev/null
+#!/usr/bin/env ruby
+APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+
+begin
+ require 'rubigen'
+rescue LoadError
+ require 'rubygems'
+ require 'rubigen'
+end
+require 'rubigen/scripts/generate'
+
+ARGV.shift if ['--help', '-h'].include?(ARGV[0])
+RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
+RubiGen::Scripts::Generate.new.run(ARGV)
--- /dev/null
+require 'stringio'
+require 'test/unit'
+require File.dirname(__FILE__) + '/../lib/shinagawaseaside'
--- /dev/null
+require File.dirname(__FILE__) + '/test_helper.rb'\r
+\r
+class TestShinagawaseaside < Test::Unit::TestCase\r
+\r
+ def setup\r
+ end\r
+ \r
+ def test_truth\r
+ assert true\r
+ end\r
+end\r