daemon-kit 0.3.0.rc1 → 0.3.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.travis.yml +2 -0
- data/README.md +2 -1
- data/Upgrading.md +11 -0
- data/daemon-kit.gemspec +1 -1
- data/features/app_generator.feature +5 -0
- data/features/step_definitions/daemon_steps.rb +17 -0
- data/features/support/env.rb +10 -0
- data/features/support/fixtures.rb +21 -0
- data/features/upgrades.feature +11 -0
- data/gemfiles/Gemfile.ci +8 -0
- data/lib/daemon_kit/abstract_logger.rb +0 -1
- data/lib/daemon_kit/initializer.rb +21 -11
- data/lib/daemon_kit/ruote_participants.rb +11 -1
- data/lib/daemon_kit/tasks/framework.rake +17 -98
- data/lib/daemon_kit/version.rb +3 -1
- data/lib/daemon_kit/xmpp.rb +14 -5
- data/lib/generators/daemon_kit/app/app_generator.rb +8 -2
- data/lib/generators/daemon_kit/app/templates/Gemfile.tt +25 -0
- data/lib/generators/daemon_kit/app/templates/README.tt +1 -1
- data/lib/generators/daemon_kit/app/templates/config/boot.rb +1 -15
- data/lib/generators/daemon_kit/capistrano/templates/config/deploy.rb.tt +0 -5
- data/lib/generators/daemon_kit/xmpp/templates/config/xmpp.yml +7 -3
- data/lib/generators/daemon_kit/xmpp/xmpp_generator.rb +1 -1
- data/{lib/generators/daemon_kit/app/templates → spec/fixtures/zero_two_three}/Gemfile +4 -0
- data/spec/fixtures/zero_two_three/README +65 -0
- data/spec/fixtures/zero_two_three/Rakefile +6 -0
- data/spec/fixtures/zero_two_three/bin/zero_two_three +8 -0
- data/spec/fixtures/zero_two_three/config/arguments.rb +12 -0
- data/spec/fixtures/zero_two_three/config/boot.rb +64 -0
- data/spec/fixtures/zero_two_three/config/environment.rb +22 -0
- data/spec/fixtures/zero_two_three/config/environments/development.rb +2 -0
- data/spec/fixtures/zero_two_three/config/post-daemonize/readme +5 -0
- data/spec/fixtures/zero_two_three/config/pre-daemonize/readme +12 -0
- data/spec/fixtures/zero_two_three/config/pre-daemonize/safely.rb +13 -0
- data/spec/fixtures/zero_two_three/lib/zero_two_three.rb +2 -0
- data/spec/fixtures/zero_two_three/libexec/zero_two_three-daemon.rb +18 -0
- data/spec/fixtures/zero_two_three/script/console +4 -0
- data/spec/fixtures/zero_two_three/script/destroy +4 -0
- data/spec/fixtures/zero_two_three/script/generate +4 -0
- data/spec/{spec.opts → fixtures/zero_two_three/spec/spec.opts} +0 -0
- data/spec/fixtures/zero_two_three/spec/spec_helper.rb +22 -0
- data/spec/fixtures/zero_two_three/spec/zero_two_three_spec.rb +11 -0
- data/spec/fixtures/zero_two_three/tasks/rspec.rake +13 -0
- data/spec/initializer_spec.rb +59 -7
- data/spec/spec_helper.rb +8 -0
- data/tasks/ci.rake +8 -0
- data/tasks/rspec.rake +1 -1
- metadata +62 -17
@@ -0,0 +1,13 @@
|
|
1
|
+
if ['test', 'development'].include?(DAEMON_ENV)
|
2
|
+
require 'rspec'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
desc "Run the specs under spec/"
|
6
|
+
RSpec::Core::RakeTask.new do |t|
|
7
|
+
t.rspec_opts = ['--options', "spec/spec.opts"]
|
8
|
+
end
|
9
|
+
|
10
|
+
# Want other tests/tasks run by default?
|
11
|
+
# Add them to the list
|
12
|
+
task :default => [:spec] #, :features]
|
13
|
+
end
|
data/spec/initializer_spec.rb
CHANGED
@@ -1,25 +1,77 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
require 'daemon_kit/initializer'
|
3
3
|
|
4
|
-
describe DaemonKit::
|
5
|
-
|
6
|
-
|
4
|
+
describe DaemonKit::Initializer do
|
5
|
+
|
6
|
+
let(:configuration) { DaemonKit::Configuration.new }
|
7
|
+
|
8
|
+
subject { DaemonKit::Initializer.new( configuration ) }
|
9
|
+
|
10
|
+
describe "#configure_exception_handling" do
|
11
|
+
|
12
|
+
it "should configure threads to abort on exceptions" do
|
13
|
+
subject.configure_exception_handling
|
14
|
+
|
15
|
+
expect( Thread.abort_on_exception ).to be_true
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should not configure safely if the gem isn't available" do
|
19
|
+
DaemonKit::Initializer.stub(:safely_available?).and_return( false )
|
20
|
+
subject.should_not_receive( :configure_safely )
|
21
|
+
|
22
|
+
subject.configure_exception_handling
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should configure safely if the gem is available" do
|
26
|
+
DaemonKit::Initializer.stub(:safely_available?).and_return( true )
|
27
|
+
subject.should_receive( :configure_safely )
|
28
|
+
|
29
|
+
subject.configure_exception_handling
|
30
|
+
end
|
31
|
+
|
7
32
|
end
|
8
33
|
|
34
|
+
describe "#configure_safely" do
|
35
|
+
let(:fake_class) { Class.new }
|
36
|
+
|
37
|
+
before(:each) do
|
38
|
+
@safely_log = stub_const('Safely::Strategy::Log', fake_class)
|
39
|
+
@safely_backtrace = stub_const('Safely::Backtrace', fake_class)
|
40
|
+
|
41
|
+
DaemonKit.logger = DaemonKit::AbstractLogger.new('/dev/null')
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should configure Safely" do
|
45
|
+
@safely_log.should_receive(:logger=)
|
46
|
+
|
47
|
+
@safely_backtrace.should_receive(:trace_directory=)
|
48
|
+
@safely_backtrace.should_receive(:enable!)
|
49
|
+
|
50
|
+
subject.configure_safely
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
describe DaemonKit::Configuration do
|
57
|
+
|
9
58
|
it "should know our environment" do
|
10
|
-
|
59
|
+
subject.environment.should_not be_nil
|
11
60
|
end
|
12
61
|
|
13
62
|
it "should have a default log path" do
|
14
|
-
|
63
|
+
subject.log_path.should_not be_nil
|
15
64
|
end
|
16
65
|
|
17
66
|
it "should have a default log level" do
|
18
|
-
|
67
|
+
subject.log_level.should_not be_nil
|
19
68
|
end
|
20
69
|
|
21
70
|
it "should have a default pid file" do
|
22
|
-
|
71
|
+
subject.stub(:default_log_path).and_return('/var/log/daemon.log')
|
72
|
+
subject.stub(:daemon_name).and_return('spec-daemon')
|
73
|
+
|
74
|
+
subject.pid_file.should == "/var/log/spec-daemon.1.pid"
|
23
75
|
end
|
24
76
|
|
25
77
|
it "should set a default umask" do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
begin
|
2
|
+
require 'coveralls'
|
3
|
+
Coveralls.wear_merged!
|
4
|
+
rescue LoadError
|
5
|
+
end
|
6
|
+
|
1
7
|
require 'fileutils'
|
2
8
|
require 'stringio'
|
3
9
|
|
@@ -13,6 +19,8 @@ require 'daemon_kit'
|
|
13
19
|
# in spec/support/ and its subdirectories.
|
14
20
|
Dir[ File.expand_path("../support/**/*.rb", __FILE__) ].each { |f| require f }
|
15
21
|
|
22
|
+
require 'rake/file_list'
|
23
|
+
|
16
24
|
RSpec.configure do |config|
|
17
25
|
# == Mock Framework
|
18
26
|
#
|
data/tasks/ci.rake
ADDED
data/tasks/rspec.rake
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daemon-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0.
|
4
|
+
version: 0.3.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenneth Kalmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,47 +109,47 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: safely
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
118
|
-
type: :
|
117
|
+
version: 0.3.2
|
118
|
+
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 0.3.2
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: thor
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0
|
131
|
+
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0
|
138
|
+
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: eventmachine
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - '>='
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
145
|
+
version: 0.12.10
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
152
|
+
version: 0.12.10
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: i18n
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,6 +182,7 @@ extra_rdoc_files:
|
|
182
182
|
- TODO.txt
|
183
183
|
files:
|
184
184
|
- .gitignore
|
185
|
+
- .rspec
|
185
186
|
- .travis.yml
|
186
187
|
- Configuration.txt
|
187
188
|
- Deployment.txt
|
@@ -205,7 +206,10 @@ files:
|
|
205
206
|
- features/sqs_generator.feature
|
206
207
|
- features/step_definitions/daemon_steps.rb
|
207
208
|
- features/support/env.rb
|
209
|
+
- features/support/fixtures.rb
|
208
210
|
- features/test_unit_generator.feature
|
211
|
+
- features/upgrades.feature
|
212
|
+
- gemfiles/Gemfile.ci
|
209
213
|
- lib/daemon_kit.rb
|
210
214
|
- lib/daemon_kit/abstract_logger.rb
|
211
215
|
- lib/daemon_kit/application.rb
|
@@ -248,7 +252,7 @@ files:
|
|
248
252
|
- lib/generators/daemon_kit/amqp/templates/libexec/%app_name%-daemon.rb
|
249
253
|
- lib/generators/daemon_kit/app/USAGE
|
250
254
|
- lib/generators/daemon_kit/app/app_generator.rb
|
251
|
-
- lib/generators/daemon_kit/app/templates/Gemfile
|
255
|
+
- lib/generators/daemon_kit/app/templates/Gemfile.tt
|
252
256
|
- lib/generators/daemon_kit/app/templates/README.tt
|
253
257
|
- lib/generators/daemon_kit/app/templates/Rakefile
|
254
258
|
- lib/generators/daemon_kit/app/templates/bin/daemon.tt
|
@@ -320,9 +324,29 @@ files:
|
|
320
324
|
- spec/daemon_kit_spec.rb
|
321
325
|
- spec/fixtures/env.yml
|
322
326
|
- spec/fixtures/noenv.yml
|
327
|
+
- spec/fixtures/zero_two_three/Gemfile
|
328
|
+
- spec/fixtures/zero_two_three/README
|
329
|
+
- spec/fixtures/zero_two_three/Rakefile
|
330
|
+
- spec/fixtures/zero_two_three/bin/zero_two_three
|
331
|
+
- spec/fixtures/zero_two_three/config/arguments.rb
|
332
|
+
- spec/fixtures/zero_two_three/config/boot.rb
|
333
|
+
- spec/fixtures/zero_two_three/config/environment.rb
|
334
|
+
- spec/fixtures/zero_two_three/config/environments/development.rb
|
335
|
+
- spec/fixtures/zero_two_three/config/post-daemonize/readme
|
336
|
+
- spec/fixtures/zero_two_three/config/pre-daemonize/readme
|
337
|
+
- spec/fixtures/zero_two_three/config/pre-daemonize/safely.rb
|
338
|
+
- spec/fixtures/zero_two_three/lib/zero_two_three.rb
|
339
|
+
- spec/fixtures/zero_two_three/libexec/zero_two_three-daemon.rb
|
340
|
+
- spec/fixtures/zero_two_three/script/console
|
341
|
+
- spec/fixtures/zero_two_three/script/destroy
|
342
|
+
- spec/fixtures/zero_two_three/script/generate
|
343
|
+
- spec/fixtures/zero_two_three/spec/spec.opts
|
344
|
+
- spec/fixtures/zero_two_three/spec/spec_helper.rb
|
345
|
+
- spec/fixtures/zero_two_three/spec/zero_two_three_spec.rb
|
346
|
+
- spec/fixtures/zero_two_three/tasks/rspec.rake
|
323
347
|
- spec/initializer_spec.rb
|
324
|
-
- spec/spec.opts
|
325
348
|
- spec/spec_helper.rb
|
349
|
+
- tasks/ci.rake
|
326
350
|
- tasks/cucumber.rake
|
327
351
|
- tasks/rspec.rake
|
328
352
|
- templates/god/god.erb
|
@@ -368,7 +392,9 @@ test_files:
|
|
368
392
|
- features/sqs_generator.feature
|
369
393
|
- features/step_definitions/daemon_steps.rb
|
370
394
|
- features/support/env.rb
|
395
|
+
- features/support/fixtures.rb
|
371
396
|
- features/test_unit_generator.feature
|
397
|
+
- features/upgrades.feature
|
372
398
|
- spec/abstract_logger_spec.rb
|
373
399
|
- spec/argument_spec.rb
|
374
400
|
- spec/config_spec.rb
|
@@ -376,6 +402,25 @@ test_files:
|
|
376
402
|
- spec/daemon_kit_spec.rb
|
377
403
|
- spec/fixtures/env.yml
|
378
404
|
- spec/fixtures/noenv.yml
|
405
|
+
- spec/fixtures/zero_two_three/Gemfile
|
406
|
+
- spec/fixtures/zero_two_three/README
|
407
|
+
- spec/fixtures/zero_two_three/Rakefile
|
408
|
+
- spec/fixtures/zero_two_three/bin/zero_two_three
|
409
|
+
- spec/fixtures/zero_two_three/config/arguments.rb
|
410
|
+
- spec/fixtures/zero_two_three/config/boot.rb
|
411
|
+
- spec/fixtures/zero_two_three/config/environment.rb
|
412
|
+
- spec/fixtures/zero_two_three/config/environments/development.rb
|
413
|
+
- spec/fixtures/zero_two_three/config/post-daemonize/readme
|
414
|
+
- spec/fixtures/zero_two_three/config/pre-daemonize/readme
|
415
|
+
- spec/fixtures/zero_two_three/config/pre-daemonize/safely.rb
|
416
|
+
- spec/fixtures/zero_two_three/lib/zero_two_three.rb
|
417
|
+
- spec/fixtures/zero_two_three/libexec/zero_two_three-daemon.rb
|
418
|
+
- spec/fixtures/zero_two_three/script/console
|
419
|
+
- spec/fixtures/zero_two_three/script/destroy
|
420
|
+
- spec/fixtures/zero_two_three/script/generate
|
421
|
+
- spec/fixtures/zero_two_three/spec/spec.opts
|
422
|
+
- spec/fixtures/zero_two_three/spec/spec_helper.rb
|
423
|
+
- spec/fixtures/zero_two_three/spec/zero_two_three_spec.rb
|
424
|
+
- spec/fixtures/zero_two_three/tasks/rspec.rake
|
379
425
|
- spec/initializer_spec.rb
|
380
|
-
- spec/spec.opts
|
381
426
|
- spec/spec_helper.rb
|