simonmenke-shuttle 0.1.07 → 0.1.08

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
- require 'thor'
1
+ Shuttle.runtime_gem('thor', Shuttle::THOR_VERSION)
2
+
2
3
  require File.dirname(__FILE__)+'/extentions/thor_extentions'
3
4
 
4
5
  module Shuttle
@@ -1,4 +1,4 @@
1
- require 'thor'
1
+ Shuttle.runtime_gem('thor', Shuttle::THOR_VERSION)
2
2
 
3
3
  module Shuttle
4
4
  module Apps # :nodoc:
@@ -6,7 +6,8 @@ module Shuttle
6
6
  class Dev < Thor
7
7
  desc "create NAME", "create a new engine"
8
8
  def create(name)
9
- require 'rubigen'
9
+ Shuttle.runtime_gem('rubigen', Shuttle::RUBIGEN_VERSION)
10
+
10
11
  system("rails #{name}")
11
12
 
12
13
  FileUtils.rm_r("#{name}/doc", :verbose => true)
@@ -1,4 +1,4 @@
1
- require 'thor'
1
+ Shuttle.runtime_gem('thor', Shuttle::THOR_VERSION)
2
2
 
3
3
  module Shuttle
4
4
  module Apps # :nodoc:
@@ -1,4 +1,4 @@
1
- require 'thor'
1
+ Shuttle.runtime_gem('thor', Shuttle::THOR_VERSION)
2
2
 
3
3
  module Shuttle
4
4
  module Apps
@@ -1,4 +1,4 @@
1
- require 'thor'
1
+ Shuttle.runtime_gem('thor', Shuttle::THOR_VERSION)
2
2
 
3
3
  module Shuttle
4
4
  module Apps # :nodoc:
@@ -1,5 +1,4 @@
1
- require 'thor'
2
- require 'simple-daemon'
1
+ Shuttle.runtime_gem('thor', Shuttle::THOR_VERSION)
3
2
 
4
3
  module Shuttle
5
4
  module Apps
@@ -9,6 +8,7 @@ module Shuttle
9
8
  desc "start", 'start the server'
10
9
  method_options :foreground => :boolean, :config => :optional
11
10
  def start
11
+ Shuttle.runtime_gem('simple-daemon', Shuttle::SIMPLE_DEAMON_VERSION)
12
12
  Shuttle.server? true
13
13
  Shuttle::System.load!(options[:root_path])
14
14
 
@@ -1,4 +1,3 @@
1
- autoload :Logger, 'logger'
2
1
 
3
2
  module Shuttle
4
3
  module ExceptionHandler
@@ -50,4 +49,4 @@ end
50
49
 
51
50
  def FileUtils.fu_output_message(msg)
52
51
  Shuttle::ExceptionHandler.out.info(msg)
53
- end
52
+ end
@@ -1,4 +1,4 @@
1
- require 'thor'
1
+ Shuttle.runtime_gem('thor', Shuttle::THOR_VERSION)
2
2
 
3
3
  class Thor
4
4
  class << self
@@ -1,5 +1,4 @@
1
1
 
2
- autoload :TSort, 'tsort'
3
2
 
4
3
  module Shuttle
5
4
  class Satellite
@@ -76,4 +75,4 @@ module Shuttle
76
75
 
77
76
  end
78
77
  end
79
- end
78
+ end
@@ -45,10 +45,13 @@ module Shuttle
45
45
  case $?.exitstatus
46
46
  when Shuttle::STOP_STATUS
47
47
  stop_server = true
48
+ retries = 0
48
49
  when Shuttle::RESTART_STATUS
49
50
  wait_before_start = 2
51
+ retries = 0
50
52
  when Shuttle::RELOAD_STATUS
51
53
  stop_server = true
54
+ retries = 0
52
55
  Shuttle.system.run(%{sleep 2 ; #{Shuttle::BIN_PATH} #{ORIGINAL_ARGV.join(' ')}})
53
56
  else
54
57
  retries += 1
@@ -65,8 +68,9 @@ module Shuttle
65
68
  Dir.chdir(Shuttle.system.root)
66
69
 
67
70
  Shuttle.log "Server started"
68
- DRb.start_service "druby://localhost:5000", self.proxy, self.options_for_server
69
- Shuttle.log "listening at #{self.construct_uri("druby://#{`hostname`.strip}:5000")}"
71
+ uri = "druby://#{Shuttle.system.server_hostname}:#{Shuttle.system.server_port}"
72
+ DRb.start_service uri, self.proxy, self.options_for_server
73
+ Shuttle.log "listening at #{self.construct_uri(uri)}"
70
74
  make_client_cert_public!
71
75
 
72
76
  at_exit do
@@ -1,6 +1,4 @@
1
- require 'drb'
2
- require 'drb/ssl'
3
- require 'simple-daemon'
1
+ Shuttle.runtime_gem('simple-daemon', Shuttle::SIMPLE_DEAMON_VERSION)
4
2
 
5
3
  module Shuttle
6
4
 
@@ -31,6 +31,19 @@ module Shuttle
31
31
  option(:use_ssl, nil)
32
32
  end
33
33
 
34
+ def bind(hostname=nil, port=nil)
35
+ server_hostname { hostname }
36
+ server_port { port }
37
+ end
38
+
39
+ def server_hostname(&block)
40
+ option(:server_hostname, block) { |v| v or 'localhost' }
41
+ end
42
+
43
+ def server_port(&block)
44
+ option(:server_port, block) { |v| v or 5000 }
45
+ end
46
+
34
47
  end
35
48
  end
36
49
  end
@@ -1,6 +1,4 @@
1
1
 
2
- autoload :Etc, 'etc'
3
-
4
2
  module Shuttle
5
3
  class System
6
4
  module ProcessUser
data/lib/shuttle.rb CHANGED
@@ -1,9 +1,12 @@
1
1
  require 'rubygems'
2
2
 
3
- require File.dirname(__FILE__)+'/shuttle/extentions/rubygems_plugin'
4
-
3
+ autoload :Etc, 'etc'
4
+ autoload :DRb, 'drb'
5
+ autoload :TSort, 'tsort'
6
+ autoload :Logger, 'logger'
7
+ autoload :OpenSSL, 'drb/ssl'
8
+ autoload :FileUtils, 'fileutils'
5
9
  autoload :DRbUndumped, 'drb'
6
- autoload :FileUtils, 'fileutils'
7
10
 
8
11
  module Shuttle
9
12
  base = File.expand_path(File.dirname(__FILE__))
@@ -45,6 +48,10 @@ module Shuttle
45
48
  RELOAD_STATUS = 103
46
49
  QUICK_CERT = "http://segment7.net/projects/ruby/QuickCert/QuickCert-1.0.2.tar.gz"
47
50
 
51
+ THOR_VERSION = '>= 0.9.9'
52
+ RUBIGEN_VERSION = '>= 1.5.2'
53
+ SIMPLE_DEAMON_VERSION = '>= 0.1.2'
54
+
48
55
  Shuttle::ExceptionHandler.setup
49
56
  extend ExceptionHandler
50
57
 
@@ -79,4 +86,14 @@ module Shuttle
79
86
  @is_server
80
87
  end
81
88
 
89
+ def self.runtime_gem(gem, version='>= 0.0.0', lib=nil)
90
+ begin
91
+ gem(gem, version)
92
+ require(lib || gem)
93
+ rescue LoadError
94
+ puts "You must install #{gem} (#{version}) to use this.\nPlease run: [sudo] gem install #{gem}"
95
+ exit(1)
96
+ end
97
+ end
98
+
82
99
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simonmenke-shuttle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.07
4
+ version: 0.1.08
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Menke
@@ -9,39 +9,10 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-02 00:00:00 -07:00
12
+ date: 2009-06-03 00:00:00 -07:00
13
13
  default_executable: shuttle
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: thor
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 0.9.9
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: rubigen
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.5.2
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: simple-daemon
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 0.1.2
44
- version:
14
+ dependencies: []
15
+
45
16
  description: Manage satellites
46
17
  email: simon.menke@gmail.com
47
18
  executables:
@@ -90,8 +61,6 @@ files:
90
61
  - lib/shuttle/system/satellites.rb
91
62
  - lib/shuttle/system/shell.rb
92
63
  - lib/shuttle/system.rb
93
- - lib/shuttle/systems/centos_plesk_system.rb
94
- - lib/shuttle/systems/macports_system.rb
95
64
  - lib/shuttle.rb
96
65
  - app_generators/engine/engine_generator.rb
97
66
  - app_generators/engine/templates/config/routes.rb
@@ -1,28 +0,0 @@
1
- use :PassengerActor
2
- use :PleskActor
3
-
4
- apachectl_path { '/opt/local/apache2/bin/apachectl' }
5
- ruby_path { '/usr/bin/ruby' }
6
- gem_path { '/usr/bin/gem' }
7
- plesk_path { '/usr/bin/gem' }
8
-
9
- web_user { |s| s.domain.gsub(/[^a-zA-Z0-9]+/, '_') }
10
- web_group { 'psacln' }
11
-
12
- plesk_root { |s| "/var/www/vhost" }
13
-
14
- satellite_root do |s|
15
- if s.subdomain?
16
- "#{plesk_root}/#{s.basedomain}/subdomains/#{s.subdomain}/satellite"
17
- else
18
- "#{plesk_root}/#{s.domain}/satellite"
19
- end
20
- end
21
-
22
- shared_root do |s|
23
- if s.subdomain?
24
- "#{plesk_root}/#{s.basedomain}/subdomains/#{s.subdomain}/shared"
25
- else
26
- "#{plesk_root}/#{s.domain}/shared"
27
- end
28
- end
@@ -1,14 +0,0 @@
1
- use :PassengerActor
2
- use :ApacheActor
3
- use :MysqlActor
4
-
5
- apachectl_path { '/opt/local/apache2/bin/apachectl' }
6
- ruby_path { '/opt/local/bin/ruby' }
7
- gem_path { '/opt/local/bin/gem' }
8
-
9
-
10
- web_user { 'www' }
11
- web_group { 'www' }
12
-
13
- satellite_root { |s| "/opt/local/var/www/#{s.domain}/satellite" }
14
- shared_root { |s| "/opt/local/var/www/#{s.domain}/shared" }