zeus 0.12.0 → 0.13.0.preview1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/build/fsevents-wrapper +0 -0
- data/build/zeus-darwin-amd64 +0 -0
- data/build/zeus-linux-386 +0 -0
- data/build/zeus-linux-amd64 +0 -0
- data/examples/custom_plan/custom_plan.rb +11 -0
- data/examples/custom_plan/zeus.json +23 -0
- data/examples/zeus.json +1 -0
- data/ext/fsevents-wrapper/fsevents-wrapper +0 -0
- data/lib/zeus.rb +8 -6
- data/lib/zeus/load_tracking.rb +11 -0
- data/lib/zeus/m.rb +74 -28
- data/lib/zeus/m/test_collection.rb +8 -1
- data/lib/zeus/plan.rb +6 -0
- data/lib/zeus/rails.rb +41 -9
- data/lib/zeus/version.rb +3 -0
- data/man/build/zeus +3 -3
- data/man/build/zeus.txt +6 -6
- data/spec/fake_mini_test.rb +31 -0
- data/spec/m_spec.rb +83 -0
- data/spec/spec_helper.rb +38 -0
- data/zeus.gemspec +3 -1
- metadata +27 -5
data/Rakefile
CHANGED
data/build/fsevents-wrapper
CHANGED
Binary file
|
data/build/zeus-darwin-amd64
CHANGED
Binary file
|
data/build/zeus-linux-386
CHANGED
Binary file
|
data/build/zeus-linux-amd64
CHANGED
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"command": "ruby -rubygems -r./custom_plan -eZeus.go",
|
3
|
+
|
4
|
+
"plan": {
|
5
|
+
"boot": {
|
6
|
+
"default_bundle": {
|
7
|
+
"development_environment": {
|
8
|
+
"prerake": {"rake": []},
|
9
|
+
"runner": ["r"],
|
10
|
+
"console": ["c"],
|
11
|
+
"server": ["s"],
|
12
|
+
"generate": ["g"],
|
13
|
+
"destroy": ["d"],
|
14
|
+
"dbconsole": []
|
15
|
+
},
|
16
|
+
"test_environment": {
|
17
|
+
"cucumber_environment": {"cucumber": []},
|
18
|
+
"test_helper": {"test": ["rspec", "testrb"]}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
data/examples/zeus.json
CHANGED
Binary file
|
data/lib/zeus.rb
CHANGED
@@ -4,12 +4,10 @@ require 'json'
|
|
4
4
|
require 'pty'
|
5
5
|
|
6
6
|
require 'zeus/load_tracking'
|
7
|
+
require 'zeus/plan'
|
8
|
+
require 'zeus/version'
|
7
9
|
|
8
10
|
module Zeus
|
9
|
-
class Plan
|
10
|
-
def after_fork ; end
|
11
|
-
end
|
12
|
-
|
13
11
|
class << self
|
14
12
|
attr_accessor :plan, :dummy_tty, :master_socket
|
15
13
|
|
@@ -64,9 +62,9 @@ module Zeus
|
|
64
62
|
new_identifier =~ /^(.):(.*)/
|
65
63
|
code, ident = $1, $2
|
66
64
|
if code == "S"
|
67
|
-
fork {
|
65
|
+
fork { go(ident.to_sym) }
|
68
66
|
else
|
69
|
-
fork {
|
67
|
+
fork { command(ident.to_sym, local) }
|
70
68
|
end
|
71
69
|
end
|
72
70
|
end
|
@@ -92,6 +90,7 @@ module Zeus
|
|
92
90
|
|
93
91
|
pid = fork {
|
94
92
|
$0 = "zeus command: #{identifier}"
|
93
|
+
|
95
94
|
plan.after_fork
|
96
95
|
client_terminal = local.recv_io
|
97
96
|
local.write "P:#{Process.pid}:\0"
|
@@ -107,6 +106,8 @@ module Zeus
|
|
107
106
|
|
108
107
|
kill_command_if_client_quits!(pid, client_pid)
|
109
108
|
|
109
|
+
at_exit{ Process.kill(:TERM, client_pid) }
|
110
|
+
|
110
111
|
Process.wait(pid)
|
111
112
|
code = $?.exitstatus || 0
|
112
113
|
|
@@ -151,6 +152,7 @@ module Zeus
|
|
151
152
|
end
|
152
153
|
|
153
154
|
def run_action(socket, identifier)
|
155
|
+
plan.after_fork unless identifier == :boot
|
154
156
|
plan.send(identifier)
|
155
157
|
socket.write "R:OK\0"
|
156
158
|
rescue Exception => e
|
data/lib/zeus/load_tracking.rb
CHANGED
@@ -51,3 +51,14 @@ module Kernel
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
require 'yaml'
|
56
|
+
module YAML
|
57
|
+
class << self
|
58
|
+
alias_method :__load_file_without_zeus, :load_file
|
59
|
+
def load_file(file, *a)
|
60
|
+
Zeus::LoadTracking.add_feature(file)
|
61
|
+
__load_file_without_zeus(file, *a)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/zeus/m.rb
CHANGED
@@ -99,7 +99,7 @@ module Zeus
|
|
99
99
|
### M, your metal test runner
|
100
100
|
# Maybe this gem should have a longer name? Metal?
|
101
101
|
module M
|
102
|
-
VERSION = "1.2.1" unless defined?(VERSION)
|
102
|
+
M::VERSION = "1.2.1" unless defined?(M::VERSION)
|
103
103
|
|
104
104
|
# Accept arguments coming from bin/m and run tests.
|
105
105
|
def self.run(argv)
|
@@ -177,51 +177,90 @@ module Zeus
|
|
177
177
|
@line = line
|
178
178
|
end
|
179
179
|
|
180
|
+
opts.on '-n', '--name NAME', String, 'Name or pattern for test methods to run.' do |name|
|
181
|
+
if name[0] == "/" && name[-1] == "/"
|
182
|
+
@test_name = Regexp.new(name[1..-2])
|
183
|
+
else
|
184
|
+
@test_name = name
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
180
188
|
opts.parse! argv
|
181
189
|
end
|
182
190
|
end
|
183
191
|
|
184
192
|
def execute
|
185
|
-
|
186
|
-
all_tests = tests
|
187
|
-
if @line
|
188
|
-
tests_to_run = all_tests.within(@line)
|
189
|
-
end
|
193
|
+
generate_tests_to_run
|
190
194
|
|
191
|
-
|
192
|
-
if tests_to_run == []
|
193
|
-
# Otherwise we found no tests on this line, so you need to pick one.
|
194
|
-
message = "No tests found on line #{@line}. Valid tests to run:\n\n"
|
195
|
+
test_arguments = build_test_arguments
|
195
196
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
197
|
+
# directly run the tests from here and exit with the status of the tests passing or failing
|
198
|
+
case framework
|
199
|
+
when :minitest
|
200
|
+
nerf_test_unit_autorunner
|
201
|
+
exit_code = nil
|
202
|
+
at_exit { exit false if exit_code && exit_code != 0 }
|
203
|
+
exit_code = MiniTest::Unit.runner.run test_arguments
|
204
|
+
when :testunit1, :testunit2
|
205
|
+
exit Test::Unit::AutoRunner.run(false, nil, test_arguments)
|
206
|
+
else
|
207
|
+
not_supported
|
208
|
+
end
|
209
|
+
end
|
201
210
|
|
202
|
-
|
203
|
-
|
211
|
+
def generate_tests_to_run
|
212
|
+
# Locate tests to run that may be inside of this line. There could be more than one!
|
213
|
+
all_tests = tests
|
214
|
+
if @line
|
215
|
+
@tests_to_run = all_tests.within(@line)
|
204
216
|
end
|
217
|
+
end
|
205
218
|
|
219
|
+
def build_test_arguments
|
206
220
|
if @line
|
221
|
+
abort_with_no_test_found_by_line_number if @tests_to_run.empty?
|
222
|
+
|
207
223
|
# assemble the regexp to run these tests,
|
208
|
-
test_names = tests_to_run.map(&:name).join('|')
|
224
|
+
test_names = @tests_to_run.map(&:name).join('|')
|
209
225
|
|
210
226
|
# set up the args needed for the runner
|
211
|
-
|
227
|
+
["-n", "/(#{test_names})/"]
|
228
|
+
elsif user_specified_name?
|
229
|
+
abort_with_no_test_found_by_name unless tests.contains?(@test_name)
|
230
|
+
|
231
|
+
test_names = test_name_to_s
|
232
|
+
["-n", test_names]
|
212
233
|
else
|
213
|
-
|
234
|
+
[]
|
214
235
|
end
|
236
|
+
end
|
215
237
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
238
|
+
def abort_with_no_test_found_by_line_number
|
239
|
+
abort_with_valid_tests_msg "No tests found on line #{@line}. "
|
240
|
+
end
|
241
|
+
|
242
|
+
def abort_with_no_test_found_by_name
|
243
|
+
abort_with_valid_tests_msg "No test name matches '#{test_name_to_s}'. "
|
244
|
+
end
|
245
|
+
|
246
|
+
def abort_with_valid_tests_msg message=""
|
247
|
+
message << "Valid tests to run:\n\n"
|
248
|
+
# For every test ordered by line number,
|
249
|
+
# spit out the test name and line number where it starts,
|
250
|
+
tests.by_line_number do |test|
|
251
|
+
message << "#{sprintf("%0#{tests.column_size}s", test.name)}: zeus test #{@files[0]}:#{test.start_line}\n"
|
224
252
|
end
|
253
|
+
|
254
|
+
# fail like a good unix process should.
|
255
|
+
abort message
|
256
|
+
end
|
257
|
+
|
258
|
+
def test_name_to_s
|
259
|
+
@test_name.is_a?(Regexp)? "/#{@test_name.source}/" : @test_name
|
260
|
+
end
|
261
|
+
|
262
|
+
def user_specified_name?
|
263
|
+
!@test_name.nil?
|
225
264
|
end
|
226
265
|
|
227
266
|
def framework
|
@@ -301,6 +340,13 @@ module Zeus
|
|
301
340
|
end
|
302
341
|
end
|
303
342
|
|
343
|
+
def nerf_test_unit_autorunner
|
344
|
+
return unless defined?(Test::Unit::Runner)
|
345
|
+
if Test::Unit::Runner.class_variable_get("@@installed_at_exit")
|
346
|
+
Test::Unit::Runner.class_variable_set("@@stop_auto_run", true)
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
304
350
|
# Fail loudly if this isn't supported
|
305
351
|
def not_supported
|
306
352
|
abort "This test framework is not supported! Please open up an issue at https://github.com/qrush/m !"
|
@@ -10,7 +10,7 @@ module Zeus
|
|
10
10
|
extend Forwardable
|
11
11
|
# This should act like an array, so forward some common methods over to the
|
12
12
|
# internal collection
|
13
|
-
def_delegators :@collection, :size, :<<, :each
|
13
|
+
def_delegators :@collection, :size, :<<, :each, :empty?
|
14
14
|
|
15
15
|
def initialize(collection = nil)
|
16
16
|
@collection = collection || []
|
@@ -40,6 +40,13 @@ module Zeus
|
|
40
40
|
# the block into the sorted collection
|
41
41
|
sort_by(&:start_line).each(&block)
|
42
42
|
end
|
43
|
+
|
44
|
+
def contains? test_name
|
45
|
+
@collection.each do |test|
|
46
|
+
return true if test_name.match(test.name)
|
47
|
+
end
|
48
|
+
false
|
49
|
+
end
|
43
50
|
end
|
44
51
|
end
|
45
52
|
end
|
data/lib/zeus/plan.rb
CHANGED
data/lib/zeus/rails.rb
CHANGED
@@ -4,6 +4,16 @@ BOOT_PATH = File.expand_path('config/boot', ROOT_PATH)
|
|
4
4
|
APP_PATH = File.expand_path('config/application', ROOT_PATH)
|
5
5
|
|
6
6
|
require 'zeus'
|
7
|
+
|
8
|
+
def gem_is_bundled?(gem)
|
9
|
+
gemfile_lock_contents = File.read(ROOT_PATH + "/Gemfile.lock")
|
10
|
+
gemfile_lock_contents.scan(/\b#{gem} \(([^=~><]+?)\)/).flatten.first
|
11
|
+
end
|
12
|
+
|
13
|
+
if version = gem_is_bundled?('method_source')
|
14
|
+
gem 'method_source', version
|
15
|
+
end
|
16
|
+
|
7
17
|
require 'zeus/m'
|
8
18
|
|
9
19
|
module Zeus
|
@@ -36,9 +46,10 @@ module Zeus
|
|
36
46
|
ENV['RAILS_ENV'] = nil
|
37
47
|
ENV['RUBYOPT'] = nil # bundler sets this to require bundler :|
|
38
48
|
puts "zeus test #{file_list_string}"
|
39
|
-
system "zeus test #{file_list_string}"
|
49
|
+
ret = system "zeus test #{file_list_string}"
|
40
50
|
ENV['RAILS_ENV'] = rails_env
|
41
51
|
ENV['RUBYOPT'] = rubyopt
|
52
|
+
ret
|
42
53
|
end
|
43
54
|
self
|
44
55
|
end
|
@@ -100,21 +111,27 @@ module Zeus
|
|
100
111
|
end
|
101
112
|
|
102
113
|
def generate
|
103
|
-
|
104
|
-
require 'rails/generators'
|
105
|
-
::Rails.application.load_generators
|
106
|
-
rescue LoadError # Rails 3.0 doesn't require this block to be run, but 3.2+ does
|
107
|
-
end
|
114
|
+
load_rails_generators
|
108
115
|
require 'rails/commands/generate'
|
109
116
|
end
|
110
117
|
|
118
|
+
def destroy
|
119
|
+
load_rails_generators
|
120
|
+
require 'rails/commands/destroy'
|
121
|
+
end
|
122
|
+
|
111
123
|
def runner
|
112
124
|
require 'rails/commands/runner'
|
113
125
|
end
|
114
126
|
|
115
127
|
def console
|
116
|
-
|
117
|
-
|
128
|
+
if defined?(Pry) && IRB == Pry
|
129
|
+
require "pry"
|
130
|
+
Pry.start
|
131
|
+
else
|
132
|
+
require 'rails/commands/console'
|
133
|
+
::Rails::Console.start(::Rails.application)
|
134
|
+
end
|
118
135
|
end
|
119
136
|
|
120
137
|
def dbconsole
|
@@ -164,7 +181,7 @@ module Zeus
|
|
164
181
|
end
|
165
182
|
|
166
183
|
def test
|
167
|
-
if defined?(RSpec)
|
184
|
+
if spec_file?(ARGV) && defined?(RSpec)
|
168
185
|
exit RSpec::Core::Runner.run(ARGV)
|
169
186
|
else
|
170
187
|
Zeus::M.run(ARGV)
|
@@ -185,6 +202,15 @@ module Zeus
|
|
185
202
|
|
186
203
|
private
|
187
204
|
|
205
|
+
SPEC_FILE_REGEXP = /.+_spec\.rb$/
|
206
|
+
def spec_file? argv
|
207
|
+
SPEC_FILE_REGEXP.match(first_ruby_file argv) != nil
|
208
|
+
end
|
209
|
+
|
210
|
+
def first_ruby_file argv
|
211
|
+
argv.find { |e| /.+\.rb$/ =~ e }
|
212
|
+
end
|
213
|
+
|
188
214
|
def restart_girl_friday
|
189
215
|
return unless defined?(GirlFriday::WorkQueue)
|
190
216
|
# The Actor is run in a thread, and threads don't persist post-fork.
|
@@ -206,6 +232,12 @@ module Zeus
|
|
206
232
|
end
|
207
233
|
end
|
208
234
|
|
235
|
+
def load_rails_generators
|
236
|
+
require 'rails/generators'
|
237
|
+
::Rails.application.load_generators
|
238
|
+
rescue LoadError # Rails 3.0 doesn't require this block to be run, but 3.2+ does
|
239
|
+
end
|
240
|
+
|
209
241
|
end
|
210
242
|
end
|
211
243
|
|
data/lib/zeus/version.rb
ADDED
data/man/build/zeus
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "ZEUS" "1" "
|
4
|
+
.TH "ZEUS" "1" "December 2012" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBzeus\fR \- boot rails in under a second
|
@@ -13,10 +13,10 @@
|
|
13
13
|
Zeus makes working with large codebases much less painful\.
|
14
14
|
.
|
15
15
|
.P
|
16
|
-
To use Zeus with Ruby on Rails 3\.0+, Just run \fBzeus
|
16
|
+
To use Zeus with Ruby on Rails 3\.0+, Just run \fBzeus start\fR in your project directory\. It will output a list of available commands, including tasks to spawn consoles, servers, tests, and rake tasks\.
|
17
17
|
.
|
18
18
|
.P
|
19
|
-
See \fBhttps://github\.com/burke/zeus/blob/master/docs/ruby/modifying\.md\fR for information on modifying the boot process that Zeus uses by default\.
|
19
|
+
See \fBhttps://github\.com/burke/zeus/blob/master/docs/ruby/modifying\.md\fR for information on modifying the boot process that Zeus uses by default and adding custom tasks\.
|
20
20
|
.
|
21
21
|
.SH "SLIGHTLY MORE TECHNICAL DESCRIPTION"
|
22
22
|
Zeus is a language\-agnostic application checkpointer for non\-multithreaded applications\.
|
data/man/build/zeus.txt
CHANGED
@@ -11,13 +11,13 @@ SYNOPSIS
|
|
11
11
|
DESCRIPTION
|
12
12
|
Zeus makes working with large codebases much less painful.
|
13
13
|
|
14
|
-
To
|
15
|
-
directory
|
16
|
-
|
14
|
+
To use Zeus with Ruby on Rails 3.0+, Just run zeus start in your
|
15
|
+
project directory. It will output a list of available commands, includ-
|
16
|
+
ing tasks to spawn consoles, servers, tests, and rake tasks.
|
17
17
|
|
18
18
|
See https://github.com/burke/zeus/blob/master/docs/ruby/modifying.md
|
19
|
-
for information on
|
20
|
-
|
19
|
+
for information on modifying the boot process that Zeus uses by default
|
20
|
+
and adding custom tasks.
|
21
21
|
|
22
22
|
SLIGHTLY MORE TECHNICAL DESCRIPTION
|
23
23
|
Zeus is a language-agnostic application checkpointer for non-multi-
|
@@ -62,4 +62,4 @@ BUILTIN COMMANDS
|
|
62
62
|
|
63
63
|
|
64
64
|
|
65
|
-
|
65
|
+
December 2012 ZEUS(1)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module MiniTest
|
2
|
+
module Unit
|
3
|
+
class TestCase
|
4
|
+
end
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def stub_mini_test_methods
|
9
|
+
MiniTest::Unit::TestCase.stub!(:test_suites).and_return [fake_suite]
|
10
|
+
MiniTest::Unit.stub!(:runner).and_return fake_runner
|
11
|
+
end
|
12
|
+
|
13
|
+
def fake_runner
|
14
|
+
@runner ||= stub("Runner", :run => 0)
|
15
|
+
end
|
16
|
+
|
17
|
+
def fake_suite
|
18
|
+
@suite ||= stub("TestSuite",
|
19
|
+
:test_methods => [fake_test_method],
|
20
|
+
:instance_method => fake_instance_method)
|
21
|
+
end
|
22
|
+
|
23
|
+
def fake_test_method
|
24
|
+
"test_method"
|
25
|
+
end
|
26
|
+
|
27
|
+
def fake_instance_method
|
28
|
+
@instance_method ||= stub("InstanceMethod",
|
29
|
+
:source_location => ["path/to/file.rb", 2],
|
30
|
+
:source => "def #{fake_test_method} \n assert true \n end")
|
31
|
+
end
|
data/spec/m_spec.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'fake_mini_test'
|
3
|
+
|
4
|
+
describe Zeus::M::Runner do
|
5
|
+
Runner = Zeus::M::Runner
|
6
|
+
|
7
|
+
before do
|
8
|
+
stub_mini_test_methods
|
9
|
+
end
|
10
|
+
|
11
|
+
context "no option is given" do
|
12
|
+
it "runs the test without giving any option" do
|
13
|
+
argv = ["path/to/file.rb"]
|
14
|
+
|
15
|
+
fake_runner.should_receive(:run).with([])
|
16
|
+
|
17
|
+
lambda { Runner.new(argv).run }.should exit_with_code(0)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "given a line number" do
|
22
|
+
it "aborts if no test is found" do
|
23
|
+
argv = ["path/to/file.rb:100"]
|
24
|
+
|
25
|
+
STDERR.should_receive(:write).with(/No tests found on line 100/)
|
26
|
+
fake_runner.should_not_receive :run
|
27
|
+
|
28
|
+
lambda { Runner.new(argv).run }.should_not exit_with_code(0)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "runs the test if the correct line number is given" do
|
32
|
+
argv = ["path/to/file.rb:2"]
|
33
|
+
|
34
|
+
fake_runner.should_receive(:run).with(["-n", "/(#{fake_test_method})/"])
|
35
|
+
|
36
|
+
lambda { Runner.new(argv).run }.should exit_with_code(0)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "specifying test name" do
|
41
|
+
it "runs the specified tests when using a pattern in --name option" do
|
42
|
+
argv = ["path/to/file.rb", "--name", "/#{fake_test_method}/"]
|
43
|
+
|
44
|
+
fake_runner.should_receive(:run).with(["-n", "/#{fake_test_method}/"])
|
45
|
+
|
46
|
+
lambda { Runner.new(argv).run }.should exit_with_code(0)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "runs the specified tests when using a pattern in -n option" do
|
50
|
+
argv = ["path/to/file.rb", "-n", "/method/"]
|
51
|
+
|
52
|
+
fake_runner.should_receive(:run).with(["-n", "/method/"])
|
53
|
+
|
54
|
+
lambda { Runner.new(argv).run }.should exit_with_code(0)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "aborts if no test matches the given pattern" do
|
58
|
+
argv = ["path/to/file.rb", "-n", "/garbage/"]
|
59
|
+
|
60
|
+
STDERR.should_receive(:write).with(%r{No test name matches \'/garbage/\'})
|
61
|
+
fake_runner.should_not_receive :run
|
62
|
+
|
63
|
+
lambda { Runner.new(argv).run }.should_not exit_with_code(0)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "runs the specified tests when using a name (no pattern)" do
|
67
|
+
argv = ["path/to/file.rb", "-n", "#{fake_test_method}"]
|
68
|
+
|
69
|
+
fake_runner.should_receive(:run).with(["-n", fake_test_method])
|
70
|
+
|
71
|
+
lambda { Runner.new(argv).run }.should exit_with_code(0)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "aborts if no test matches the given test name" do
|
75
|
+
argv = ["path/to/file.rb", "-n", "method"]
|
76
|
+
|
77
|
+
STDERR.should_receive(:write).with(%r{No test name matches \'method\'})
|
78
|
+
fake_runner.should_not_receive :run
|
79
|
+
|
80
|
+
lambda { Runner.new(argv).run }.should_not exit_with_code(0)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'zeus/rails'
|
2
|
+
|
3
|
+
module Zeus::M
|
4
|
+
VERSION = "0.0.0.test"
|
5
|
+
end
|
6
|
+
|
7
|
+
RSpec::Matchers.define :exit_with_code do |exp_code|
|
8
|
+
actual = nil
|
9
|
+
match do |block|
|
10
|
+
begin
|
11
|
+
block.call
|
12
|
+
rescue SystemExit => e
|
13
|
+
actual = e.status
|
14
|
+
end
|
15
|
+
actual and actual == exp_code
|
16
|
+
end
|
17
|
+
failure_message_for_should do |block|
|
18
|
+
"expected block to call exit(#{exp_code}) but exit" +
|
19
|
+
(actual.nil? ? " not called" : "(#{actual}) was called")
|
20
|
+
end
|
21
|
+
failure_message_for_should_not do |block|
|
22
|
+
"expected block not to call exit(#{exp_code})"
|
23
|
+
end
|
24
|
+
description do
|
25
|
+
"expect block to call exit(#{exp_code})"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def stub_system_methods
|
30
|
+
Dir.stub!(:glob).and_return(["path/to/file.rb"])
|
31
|
+
Kernel.stub!(:load).and_return
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec.configure do |config|
|
35
|
+
config.before(:each) do
|
36
|
+
stub_system_methods
|
37
|
+
end
|
38
|
+
end
|
data/zeus.gemspec
CHANGED
metadata
CHANGED
@@ -1,16 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zeus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.13.0.preview1
|
5
|
+
prerelease: 7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Burke Libbey
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.12.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.12.0
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: method_source
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -41,6 +57,8 @@ files:
|
|
41
57
|
- build/zeus-darwin-amd64
|
42
58
|
- build/zeus-linux-386
|
43
59
|
- build/zeus-linux-amd64
|
60
|
+
- examples/custom_plan/custom_plan.rb
|
61
|
+
- examples/custom_plan/zeus.json
|
44
62
|
- examples/zeus.json
|
45
63
|
- ext/fsevents-wrapper/fsevents-wrapper
|
46
64
|
- ext/inotify-wrapper/extconf.rb
|
@@ -52,6 +70,7 @@ files:
|
|
52
70
|
- lib/zeus/m.rb
|
53
71
|
- lib/zeus/plan.rb
|
54
72
|
- lib/zeus/rails.rb
|
73
|
+
- lib/zeus/version.rb
|
55
74
|
- lib/zeus.rb
|
56
75
|
- man/build/zeus
|
57
76
|
- man/build/zeus-init
|
@@ -61,6 +80,9 @@ files:
|
|
61
80
|
- man/build/zeus.txt
|
62
81
|
- MIT-LICENSE
|
63
82
|
- Rakefile
|
83
|
+
- spec/fake_mini_test.rb
|
84
|
+
- spec/m_spec.rb
|
85
|
+
- spec/spec_helper.rb
|
64
86
|
- zeus.gemspec
|
65
87
|
homepage: http://zeus.is
|
66
88
|
licenses:
|
@@ -78,9 +100,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
101
|
none: false
|
80
102
|
requirements:
|
81
|
-
- - ! '
|
103
|
+
- - ! '>'
|
82
104
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
105
|
+
version: 1.3.1
|
84
106
|
requirements: []
|
85
107
|
rubyforge_project:
|
86
108
|
rubygems_version: 1.8.23
|