zeus 0.10.0.pre → 0.10.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Binary file
Binary file
Binary file
@@ -4,6 +4,9 @@ require 'json'
4
4
  require 'zeus/load_tracking'
5
5
 
6
6
  module Zeus
7
+ class Plan
8
+ end
9
+
7
10
  class << self
8
11
 
9
12
  def add_extra_feature(path)
File without changes
@@ -5,137 +5,134 @@ APP_PATH = File.expand_path('config/application', ROOT_PATH)
5
5
 
6
6
  require 'zeus'
7
7
 
8
- module Zeus ; module Rails ; end ; end
9
- Zeus.plan ||= Zeus::Rails
10
-
11
8
  module Zeus
12
- module Rails
13
- class << self
14
-
15
- def after_fork
16
- reconnect_activerecord
17
- restart_girl_friday
18
- end
19
-
20
- def boot
21
- require BOOT_PATH
22
- require 'rails/all'
23
- end
9
+ class Rails < Plan
10
+ def after_fork
11
+ reconnect_activerecord
12
+ restart_girl_friday
13
+ end
24
14
 
25
- def default_bundle
26
- Bundler.require(:default)
27
- end
15
+ def boot
16
+ require BOOT_PATH
17
+ require 'rails/all'
18
+ end
28
19
 
29
- def development_environment
30
- Bundler.require(:development)
31
- ::Rails.env = ENV['RAILS_ENV'] = "development"
32
- require APP_PATH
33
- ::Rails.application.require_environment!
34
- end
20
+ def default_bundle
21
+ Bundler.require(:default)
22
+ end
35
23
 
36
- def prerake
37
- require 'rake'
38
- load 'Rakefile'
39
- end
24
+ def development_environment
25
+ Bundler.require(:development)
26
+ ::Rails.env = ENV['RAILS_ENV'] = "development"
27
+ require APP_PATH
28
+ ::Rails.application.require_environment!
29
+ end
40
30
 
41
- def rake
42
- Rake.application.run
43
- end
31
+ def prerake
32
+ require 'rake'
33
+ load 'Rakefile'
34
+ end
44
35
 
45
- def generate
46
- begin
47
- require 'rails/generators'
48
- ::Rails.application.load_generators
49
- rescue LoadError # Rails 3.0 doesn't require this block to be run, but 3.2+ does
50
- end
51
- require 'rails/commands/generate'
52
- end
36
+ def rake
37
+ Rake.application.run
38
+ end
53
39
 
54
- def runner
55
- require 'rails/commands/runner'
40
+ def generate
41
+ begin
42
+ require 'rails/generators'
43
+ ::Rails.application.load_generators
44
+ rescue LoadError # Rails 3.0 doesn't require this block to be run, but 3.2+ does
56
45
  end
46
+ require 'rails/commands/generate'
47
+ end
57
48
 
58
- def console
59
- require 'rails/commands/console'
60
- ::Rails::Console.start(::Rails.application)
61
- end
49
+ def runner
50
+ require 'rails/commands/runner'
51
+ end
62
52
 
63
- def server
64
- require 'rails/commands/server'
65
- server = ::Rails::Server.new
66
- Dir.chdir(::Rails.application.root)
67
- server.start
68
- end
53
+ def console
54
+ require 'rails/commands/console'
55
+ ::Rails::Console.start(::Rails.application)
56
+ end
69
57
 
70
- def test_environment
71
- Bundler.require(:test)
58
+ def server
59
+ require 'rails/commands/server'
60
+ server = ::Rails::Server.new
61
+ Dir.chdir(::Rails.application.root)
62
+ server.start
63
+ end
72
64
 
73
- ::Rails.env = ENV['RAILS_ENV'] = 'test'
74
- require APP_PATH
65
+ def test_environment
66
+ Bundler.require(:test)
75
67
 
76
- $rails_rake_task = 'yup' # lie to skip eager loading
77
- ::Rails.application.require_environment!
78
- $rails_rake_task = nil
79
- $LOAD_PATH.unshift(ROOT_PATH) unless $LOAD_PATH.include?(ROOT_PATH)
68
+ ::Rails.env = ENV['RAILS_ENV'] = 'test'
69
+ require APP_PATH
80
70
 
81
- if Dir.exist?(ROOT_PATH + "/test")
82
- test = File.join(ROOT_PATH, 'test')
83
- $LOAD_PATH.unshift(test) unless $LOAD_PATH.include?(test)
84
- end
71
+ $rails_rake_task = 'yup' # lie to skip eager loading
72
+ ::Rails.application.require_environment!
73
+ $rails_rake_task = nil
74
+ $LOAD_PATH.unshift(ROOT_PATH) unless $LOAD_PATH.include?(ROOT_PATH)
85
75
 
86
- if Dir.exist?(ROOT_PATH + "/spec")
87
- spec = File.join(ROOT_PATH, 'spec')
88
- $LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
89
- end
76
+ if Dir.exist?(ROOT_PATH + "/test")
77
+ test = File.join(ROOT_PATH, 'test')
78
+ $LOAD_PATH.unshift(test) unless $LOAD_PATH.include?(test)
90
79
  end
91
80
 
92
- def test_helper
93
- require 'test_helper'
81
+ if Dir.exist?(ROOT_PATH + "/spec")
82
+ spec = File.join(ROOT_PATH, 'spec')
83
+ $LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
94
84
  end
85
+ end
95
86
 
96
- def testrb
97
- argv = ARGV
98
-
99
- # try to find pattern by line using testrbl
100
- if defined?(Testrbl) && argv.size == 1 and argv.first =~ /^\S+:\d+$/
101
- file, line = argv.first.split(':')
102
- argv = [file, '-n', "/#{Testrbl.send(:pattern_from_file, File.readlines(file), line)}/"]
103
- puts "using -n '#{argv[2]}'" # let users copy/paste or adjust the pattern
104
- end
105
-
106
- runner = Test::Unit::AutoRunner.new(true)
107
- if runner.process_args(argv)
108
- exit runner.run
109
- else
110
- abort runner.options.banner + " tests..."
111
- end
112
- end
87
+ def test_helper
88
+ require 'test_helper'
89
+ end
113
90
 
114
- def spec_helper
115
- require 'spec_helper'
91
+ def testrb
92
+ argv = ARGV
93
+
94
+ # try to find pattern by line using testrbl
95
+ if defined?(Testrbl) && argv.size == 1 and argv.first =~ /^\S+:\d+$/
96
+ file, line = argv.first.split(':')
97
+ argv = [file, '-n', "/#{Testrbl.send(:pattern_from_file, File.readlines(file), line)}/"]
98
+ puts "using -n '#{argv[2]}'" # let users copy/paste or adjust the pattern
116
99
  end
117
100
 
118
- def rspec
119
- exit RSpec::Core::Runner.run(ARGV)
101
+ runner = Test::Unit::AutoRunner.new(true)
102
+ if runner.process_args(argv)
103
+ exit runner.run
104
+ else
105
+ abort runner.options.banner + " tests..."
120
106
  end
107
+ end
121
108
 
109
+ def spec_helper
110
+ require 'spec_helper'
111
+ end
112
+
113
+ def rspec
114
+ exit RSpec::Core::Runner.run(ARGV)
115
+ end
122
116
 
123
- private
124
117
 
125
- def restart_girl_friday
126
- return unless defined?(GirlFriday::WorkQueue)
127
- # The Actor is run in a thread, and threads don't persist post-fork.
128
- # We just need to restart each one in the newly-forked process.
129
- ObjectSpace.each_object(GirlFriday::WorkQueue) do |obj|
130
- obj.send(:start)
131
- end
132
- end
118
+ private
133
119
 
134
- def reconnect_activerecord
135
- ActiveRecord::Base.clear_all_connections! rescue nil
136
- ActiveRecord::Base.establish_connection rescue nil
120
+ def restart_girl_friday
121
+ return unless defined?(GirlFriday::WorkQueue)
122
+ # The Actor is run in a thread, and threads don't persist post-fork.
123
+ # We just need to restart each one in the newly-forked process.
124
+ ObjectSpace.each_object(GirlFriday::WorkQueue) do |obj|
125
+ obj.send(:start)
137
126
  end
127
+ end
138
128
 
129
+ def reconnect_activerecord
130
+ ActiveRecord::Base.clear_all_connections! rescue nil
131
+ ActiveRecord::Base.establish_connection rescue nil
139
132
  end
133
+
140
134
  end
141
135
  end
136
+
137
+ Zeus.plan ||= Zeus::Rails.new
138
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0.pre
4
+ version: 0.10.0.pre2
5
5
  prerelease: 7
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-06 00:00:00.000000000 Z
12
+ date: 2012-09-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Boot any rails app in under a second
15
15
  email:
@@ -31,6 +31,7 @@ files:
31
31
  - ext/inotify-wrapper/inotify-wrapper.cpp
32
32
  - Gemfile
33
33
  - lib/zeus/load_tracking.rb
34
+ - lib/zeus/plan.rb
34
35
  - lib/zeus/rails.rb
35
36
  - lib/zeus.rb
36
37
  - man/build/zeus