golden_brindle 0.0.4 → 0.0.5

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.
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ begin
13
13
  gem.authors = ["Alexander Simonov"]
14
14
  gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
15
15
  gem.add_dependency "gem_plugin", ">= 0.2.3"
16
- gem.add_dependency "unicorn", ">= 0.99"
16
+ gem.add_dependency "unicorn", ">= 1.00"
17
17
  gem.version = GoldenBrindle::Const::VERSION
18
18
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
19
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{golden_brindle}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alexander Simonov"]
12
- s.date = %q{2010-06-06}
12
+ s.date = %q{2010-07-03}
13
13
  s.default_executable = %q{golden_brindle}
14
14
  s.description = %q{Unicorn HTTP server clustering tool like mongrel_cluster for Mongrel}
15
15
  s.email = %q{alex@simonov.me}
@@ -48,8 +48,8 @@ Gem::Specification.new do |s|
48
48
  s.rubygems_version = %q{1.3.7}
49
49
  s.summary = %q{Unicorn HTTP server clustering tool like mongrel_cluster for Mongrel}
50
50
  s.test_files = [
51
- "test/test_golden_brindle.rb",
52
- "test/helper.rb"
51
+ "test/helper.rb",
52
+ "test/test_golden_brindle.rb"
53
53
  ]
54
54
 
55
55
  if s.respond_to? :specification_version then
@@ -59,16 +59,16 @@ Gem::Specification.new do |s|
59
59
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
60
60
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
61
61
  s.add_runtime_dependency(%q<gem_plugin>, [">= 0.2.3"])
62
- s.add_runtime_dependency(%q<unicorn>, [">= 0.99"])
62
+ s.add_runtime_dependency(%q<unicorn>, [">= 1.00"])
63
63
  else
64
64
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
65
65
  s.add_dependency(%q<gem_plugin>, [">= 0.2.3"])
66
- s.add_dependency(%q<unicorn>, [">= 0.99"])
66
+ s.add_dependency(%q<unicorn>, [">= 1.00"])
67
67
  end
68
68
  else
69
69
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
70
70
  s.add_dependency(%q<gem_plugin>, [">= 0.2.3"])
71
- s.add_dependency(%q<unicorn>, [">= 0.99"])
71
+ s.add_dependency(%q<unicorn>, [">= 1.00"])
72
72
  end
73
73
  end
74
74
 
@@ -59,5 +59,4 @@ module Brindle
59
59
 
60
60
  end
61
61
 
62
- end
63
-
62
+ end
@@ -3,7 +3,7 @@ module GoldenBrindle
3
3
  module Const
4
4
 
5
5
  # current version
6
- VERSION="0.0.4".freeze
6
+ VERSION="0.0.5".freeze
7
7
  # main banner
8
8
  BANNER = "Usage: golden_brindle <command> [options]".freeze
9
9
 
@@ -27,12 +27,36 @@ module Brindle
27
27
  ]
28
28
  end
29
29
 
30
+
31
+ #
32
+ # Rails 3 dispatcher support
33
+ # Code from unicorn_rails script
34
+ #
35
+ def rails_dispatcher
36
+ if ::Rails::VERSION::MAJOR >= 3 && ::File.exist?('config/application.rb')
37
+ if ::File.read('config/application.rb') =~ /^module\s+([\w:]+)\s*$/
38
+ app_module = Object.const_get($1)
39
+ begin
40
+ result = app_module::Application
41
+ rescue NameError
42
+ end
43
+ end
44
+ end
45
+
46
+ if result.nil? && defined?(ActionController::Dispatcher)
47
+ result = ActionController::Dispatcher.new
48
+ end
49
+
50
+ result || abort("Unable to locate the application dispatcher class")
51
+ end
52
+
30
53
  def rails_builder(daemonize)
31
54
  # this lambda won't run until after forking if preload_app is false
32
55
  lambda do ||
33
56
  # Load Rails
34
57
  begin
35
- require 'config/boot'
58
+ require ::File.expand_path('config/boot')
59
+ require ::File.expand_path('config/environment')
36
60
  rescue LoadError => err
37
61
  abort "#$0 must be run inside RAILS_ROOT: #{err.inspect}"
38
62
  end
@@ -42,48 +66,43 @@ module Brindle
42
66
  defined?(::Rails::VERSION::STRING) or
43
67
  abort "Rails::VERSION::STRING not defined by config/{boot,environment}"
44
68
  # it seems Rails >=2.2 support Rack, but only >=2.3 requires it
45
- old_rails = case ::Rails::VERSION::MAJOR
46
- when 0, 1 then true
47
- when 2 then Rails::VERSION::MINOR < 3 ? true : false
48
- else
69
+ old_rails = if ::Rails::VERSION::MAJOR >= 3
49
70
  false
50
- end
51
-
52
- inner_app = if old_rails
53
- require 'unicorn/app/old_rails'
54
- Unicorn::App::OldRails.new
55
71
  else
56
- ActionController::Dispatcher.new
72
+ return false if ( ::Rails::VERSION::MAJOR == 2 && ::Rails::VERSION::MINOR >= 3 )
73
+ true
57
74
  end
58
75
 
59
76
  Rack::Builder.new do
60
77
  map_path = ENV['RAILS_RELATIVE_URL_ROOT'] || '/'
61
- if inner_app.class.to_s == "Unicorn::App::OldRails"
78
+ if old_rails
62
79
  if map_path != '/'
63
80
  # patches + tests welcome, but I really cbf to deal with this
64
81
  # since all apps I've ever dealt with just use "/" ...
65
- $stderr.puts "relative URL roots may not work for older Rails"
82
+ warn "relative URL roots may not work for older Rails"
66
83
  end
67
- $stderr.puts "LogTailer not available for Rails < 2.3" unless daemonize
68
- $stderr.puts "Debugger not available" if $DEBUG
84
+ warn "LogTailer not available for Rails < 2.3" unless daemonize
85
+ warn "Debugger not available" if $DEBUG
86
+ require 'unicorn/app/old_rails'
69
87
  map(map_path) do
70
88
  use Unicorn::App::OldRails::Static
71
- run inner_app
89
+ run Unicorn::App::OldRails.new
72
90
  end
73
91
  else
74
92
  use Rails::Rack::LogTailer unless daemonize
75
93
  use Rails::Rack::Debugger if $DEBUG
76
94
  map(map_path) do
77
- use Rails::Rack::Static
78
- run inner_app
95
+ unless defined?(ActionDispatch::Static)
96
+ use Rails::Rack::Static
97
+ end
98
+ run rails_dispatcher
79
99
  end
80
100
  end
81
101
  end.to_app
82
102
  end
83
103
  end
84
104
 
85
- def validate
86
-
105
+ def validate
87
106
  if @config_file
88
107
  valid_exists?(@config_file, "Config file not there: #@config_file")
89
108
  return false unless @valid
@@ -112,7 +131,7 @@ module Brindle
112
131
  options = { :listeners => []}
113
132
  options[:pid] = @pid_file
114
133
  options[:config_file] = @config_script
115
- options[:worker_processes] = @workers
134
+ options[:worker_processes] = @workers.to_i
116
135
  options[:working_directory] = @cwd
117
136
  options[:timeout] = @timeout
118
137
  # set user via Unicorn options. If we don't set group - then use only user
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: golden_brindle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alexander Simonov
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-06 00:00:00 +03:00
18
+ date: 2010-07-03 00:00:00 +03:00
19
19
  default_executable: golden_brindle
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -56,11 +56,11 @@ dependencies:
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- hash: 205
59
+ hash: 15
60
60
  segments:
61
+ - 1
61
62
  - 0
62
- - 99
63
- version: "0.99"
63
+ version: "1.00"
64
64
  type: :runtime
65
65
  version_requirements: *id003
66
66
  description: Unicorn HTTP server clustering tool like mongrel_cluster for Mongrel
@@ -130,5 +130,5 @@ signing_key:
130
130
  specification_version: 3
131
131
  summary: Unicorn HTTP server clustering tool like mongrel_cluster for Mongrel
132
132
  test_files:
133
- - test/test_golden_brindle.rb
134
133
  - test/helper.rb
134
+ - test/test_golden_brindle.rb