cumuli 0.3.0 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f273b5230330006e3325b4d0e314f98592cd613
4
- data.tar.gz: f5888db3dd0621ae18b35f846ff03b1c22274b52
3
+ metadata.gz: 01547cb2adf31baf7fd1328f3a7807bfd08aed43
4
+ data.tar.gz: ced1f7b479d52b9a86b9cdb25163ab3a146587ed
5
5
  SHA512:
6
- metadata.gz: 55dbad295e1f5613786f87ae39c454b7b1817ce7325440258c164438f03dd74a1d11aec2f2d7734052d681672b680d525f3b27fc14b92f796f8b0052a6f74306
7
- data.tar.gz: 6567664b296c3107bf61297e50d94c0cea1b6edeaf2a7fdcd19bdc000900bc2dc25173c8b85bcecea8d1a04cabf6825138658edf501297d7d8c3f718c6ddf2d2
6
+ metadata.gz: 31f12a1ccf7d92442cee54661035eb3e202bcabd8e85fdac9244268a2fb343ec17b7da5fc3f82f7ce4e2caa1f57f066580301246b622043d749b6b105b358dca
7
+ data.tar.gz: 0648447b4050095bcea6c3296b4c46974051e2f5d13b4eaac6e98a0493c3b6728d3ad48b9252768ecdad6047c1166490b1fb8b424a8842e688e10e0bdb0fe4ae
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
+ .idea
6
7
  Gemfile.lock
7
8
  InstalledFiles
8
9
  _yardoc
data/Rakefile CHANGED
@@ -1,2 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "#{File.dirname(__FILE__)}/lib/cumuli/tasks.rb"
3
+
4
+ require 'cucumber'
5
+ require 'cucumber/rake/task'
6
+ Cucumber::Rake::Task.new(:cucumber) do |t|
7
+ t.cucumber_opts = "features --format pretty"
8
+ end
data/cumuli.gemspec CHANGED
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
25
  spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "cucumber"
26
27
  end
File without changes
@@ -0,0 +1,14 @@
1
+ Feature: Cumuli exits the app gracefully
2
+ In order to use Cumuli to test in an integration way, a suite of apps and services
3
+ As a developer with a SOA stack
4
+ I want cucumber to exit with a good success code
5
+
6
+ Background:
7
+ Given the app suite is loaded
8
+
9
+ Scenario: App is stopped in a cucumber step
10
+ When I shutdown the app suite
11
+ Then the processes should not be running
12
+ And I should see that the rake was not aborted
13
+
14
+
@@ -0,0 +1,32 @@
1
+ Given(/^the app suite is loaded$/) do
2
+ @app = Cumuli::App.new({
3
+ env: 'test',
4
+ wait_time: 5,
5
+ log_dir: File.dirname(__FILE__) + "/../../spec/fixtures/log",
6
+ app_dir: File.dirname(__FILE__) + "/../../spec/fixtures/app_set"
7
+ })
8
+ @app.start
9
+ @pid = @app.pid
10
+ end
11
+
12
+ When(/^I shutdown the app suite$/) do
13
+ @trapped = false
14
+
15
+ trap('INT') do
16
+ @trapped = true
17
+ end
18
+
19
+ @app.stop
20
+ end
21
+
22
+ Then(/^I should see that the rake was not aborted$/) do
23
+ @trapped.should == false
24
+ end
25
+
26
+ Then(/^the processes should not be running$/) do
27
+ Cumuli::Waiter.new.wait_until(3) do
28
+ pses = Cumuli::PS.new.children(@pid)
29
+ pses.nil?
30
+ end
31
+ end
32
+
@@ -0,0 +1,13 @@
1
+ require 'cucumber'
2
+
3
+ require_relative "../../lib/cumuli"
4
+
5
+ Dir["#{File.dirname(__FILE__)}/*.rb"].each do |f|
6
+ require f
7
+ end
8
+
9
+
10
+ at_exit do
11
+ #@app.stop
12
+ end
13
+
@@ -0,0 +1,11 @@
1
+ def capturing(stream=:stdout)
2
+ stream = $stdout
3
+ old_stream = stream.dup
4
+ new_steam = StringIO.new
5
+ stream = new_steam
6
+ yield
7
+ new_steam
8
+ ensure
9
+ stream = old_stream
10
+ new_steam
11
+ end
@@ -45,10 +45,17 @@ module Cumuli
45
45
 
46
46
  def stop
47
47
  return if @killed_it
48
- Process.kill('INT', 0) # kills all processes in the group
48
+ kill_children
49
49
  @killed_it = true
50
50
  @pid = nil
51
51
  end
52
+
53
+ def kill_children
54
+ pids = PS.new.tree(pid)
55
+ pids.reverse.each do |p|
56
+ Process.kill("KILL", p)
57
+ end
58
+ end
52
59
  end
53
60
  end
54
61
  end
data/lib/cumuli/ps.rb CHANGED
@@ -45,9 +45,18 @@ module Cumuli
45
45
  end
46
46
 
47
47
  def tree(pid)
48
- child_pids = ppid_hash[pid]
49
- puts "#{pid} => #{child_pids}"
50
- child_pids.map{|cpid| tree(cpid) } if child_pids
48
+ collection = []
49
+ if kids = children(pid)
50
+ collection += kids
51
+ kids.each do |k|
52
+ collection += tree(k)
53
+ end
54
+ end
55
+ collection
56
+ end
57
+
58
+ def children(pid)
59
+ ppid_hash[pid]
51
60
  end
52
61
 
53
62
  def report(pid)
@@ -1,3 +1,3 @@
1
1
  module Cumuli
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -1,7 +1,3 @@
1
1
  def app_set_dir
2
2
  File.expand_path(File.dirname(__FILE__)) + "/../fixtures/app_set"
3
3
  end
4
-
5
- def fail_set_dir
6
- File.expand_path(File.dirname(__FILE__)) + "/../fixtures/fail_set"
7
- end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cumuli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SocialChorus
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-07-16 00:00:00.000000000 Z
15
+ date: 2013-07-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: foreman
@@ -70,6 +70,20 @@ dependencies:
70
70
  - - '>='
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
+ - !ruby/object:Gem::Dependency
74
+ name: cucumber
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ type: :development
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
73
87
  description: Cumuli runs several foreman processes in different directories
74
88
  email:
75
89
  - developers@socialchorus.com
@@ -87,6 +101,11 @@ files:
87
101
  - Rakefile
88
102
  - bin/cumuli
89
103
  - cumuli.gemspec
104
+ - features/fixtures/test.log
105
+ - features/graceful_exit.feature
106
+ - features/step_definitions/app_steps.rb
107
+ - features/support/env.rb
108
+ - features/support/io_capture.rb
90
109
  - lib/cumuli.rb
91
110
  - lib/cumuli/app.rb
92
111
  - lib/cumuli/app/app.rb
@@ -148,6 +167,11 @@ signing_key:
148
167
  specification_version: 4
149
168
  summary: Cumuli makes SOA on Heroku easier by delegating to Foreman in a Procfile
150
169
  test_files:
170
+ - features/fixtures/test.log
171
+ - features/graceful_exit.feature
172
+ - features/step_definitions/app_steps.rb
173
+ - features/support/env.rb
174
+ - features/support/io_capture.rb
151
175
  - spec/app/app_spec.rb
152
176
  - spec/app/procs_spec.rb
153
177
  - spec/cli/args_spec.rb