bluepill 0.0.67 → 0.0.68

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de6a6e9c8ca09b86c05408c467802998559911d1
4
- data.tar.gz: 3a02ded7cad9e098e3add640a0da28310b794c0e
3
+ metadata.gz: 35f98731b6e37b345dc0abd6c97ef152004b7c1e
4
+ data.tar.gz: e2a074334d09655a98797944a70d582fd712b295
5
5
  SHA512:
6
- metadata.gz: 828074cd01dbab698e803f9f73fdedfca8b808183f7a40d563b34ecde7541e63b6ebbbe73eb26d7b91b4d2f65a3f62afb0398e688f2d92df9ccf2add3e136541
7
- data.tar.gz: 148bb1636929c5a7b4115c05a0c6296451e5d7db8a6a873fe3f602f9f761a0277942862d88f7dc0fcd849c06865f4d5b93f63fa6cf7996632a6b30e6452afbb2
6
+ metadata.gz: a6f3a92d2d04bb5ecc994882039cfdf56039315dbd0a869b7a2756a137367f7feaa62e7b396fcd03f5d1d5f78b3b033862da0338e60a33722287e0fa19296fc8
7
+ data.tar.gz: a9642dd51a9fa311b03e2b8b175e18e2a792c1d360886590330c6c36f8fa11b568e7662fe9929f429c1e7edc2602ab68ba0c418fde838f68a37529ccefda31c2
@@ -4,7 +4,7 @@ rvm:
4
4
  - 1.9.2
5
5
  - 1.9.3
6
6
  - 2.0.0
7
- - 2.1.0
7
+ - 2.1
8
8
  - jruby-18mode
9
9
  - jruby-19mode
10
10
  - jruby-head
data/Gemfile CHANGED
@@ -3,7 +3,12 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in bluepill.gemspec
4
4
  gemspec
5
5
 
6
- gem 'activesupport', '~> 3.0', :platforms => [:ruby_18, :jruby]
6
+ if RUBY_PLATFORM =~ /jruby|java/ || RUBY_VERSION =~ /1.8|1.9.2/
7
+ gem 'activesupport', '~> 3.0'
8
+ else
9
+ gem 'activesupport', '~> 4.1'
10
+ end
11
+
7
12
  gem 'rake'
8
13
 
9
14
  group :doc do
@@ -14,9 +19,9 @@ group :doc do
14
19
  end
15
20
 
16
21
  group :test do
22
+ gem 'coveralls', :require => false, :platforms => [:mri_19, :mri_20, :mri_21]
17
23
  gem 'faker', '>= 1.2'
18
- gem 'rspec', '>= 2.14'
24
+ gem 'rest-client', '~> 1.6.0', :platforms => [:jruby, :ruby_18]
25
+ gem 'rspec', '>= 3'
19
26
  gem 'simplecov', '>= 0.4', :platforms => :ruby_19
20
27
  end
21
-
22
- gem 'coveralls', :require => false, :platforms => [:mri_19, :mri_20], :group => :development
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.description = %q{Bluepill keeps your daemons up while taking up as little resources as possible. After all you probably want the resources of your server to be used by whatever daemons you are running rather than the thing that's supposed to make sure they are brought back up, should they die or misbehave.}
16
16
  s.license = 'MIT'
17
17
 
18
- s.add_dependency 'activesupport', ['>= 3', '< 4.1']
18
+ s.add_dependency 'activesupport', ['>= 3', '< 5']
19
19
  s.add_dependency 'blue-daemons', '~> 1.1.11'
20
20
  s.add_dependency 'i18n', '~> 0.5'
21
21
  s.add_dependency 'state_machine', '~> 1.1'
@@ -17,7 +17,7 @@ module Bluepill
17
17
  end
18
18
 
19
19
  def check(value)
20
- value.kilobytes < @below
20
+ value.kilobytes < @below rescue true
21
21
  end
22
22
 
23
23
  def format_value(value)
@@ -1,4 +1,4 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module Bluepill
3
- VERSION = "0.0.67"
3
+ VERSION = "0.0.68"
4
4
  end
@@ -2,29 +2,49 @@ describe Bluepill::Application do
2
2
  describe "#initialize" do
3
3
  let(:options){ {} }
4
4
  subject {described_class.new('test', options)}
5
- before(:each) {described_class.any_instance.should_receive(:setup_pids_dir)}
5
+ before(:each) {expect_any_instance_of(described_class).to receive(:setup_pids_dir)}
6
6
 
7
7
  context "when euid is not root" do
8
- before(:each) {::Process.stub(:euid).and_return(1)}
9
- its(:base_dir){ should eq(File.join(ENV['HOME'], '.bluepill')) }
8
+ before(:each) {allow(::Process).to receive(:euid).and_return(1)}
9
+
10
+ describe '#base_dir' do
11
+ subject { super().base_dir }
12
+ it{ should eq(File.join(ENV['HOME'], '.bluepill')) }
13
+ end
10
14
  end
11
15
  context "when euid is root" do
12
- before(:each) {::Process.stub(:euid).and_return(0)}
13
- its(:base_dir) { should eq('/var/run/bluepill') }
16
+ before(:each) {allow(::Process).to receive(:euid).and_return(0)}
17
+
18
+ describe '#base_dir' do
19
+ subject { super().base_dir }
20
+ it { should eq('/var/run/bluepill') }
21
+ end
14
22
  end
15
23
 
16
24
  context "when option base_dir is specified" do
17
25
  let(:options) { {:base_dir=>'/var/bluepill'} }
18
- its(:base_dir) { should eq(options[:base_dir]) }
26
+
27
+ describe '#base_dir' do
28
+ subject { super().base_dir }
29
+ it { should eq(options[:base_dir]) }
30
+ end
19
31
  end
20
32
 
21
33
  context "when environment BLUEPILL_BASE_DIR is specified" do
22
34
  before(:each) {ENV['BLUEPILL_BASE_DIR'] = '/bluepill'}
23
- its(:base_dir) { should eq(ENV['BLUEPILL_BASE_DIR']) }
35
+
36
+ describe '#base_dir' do
37
+ subject { super().base_dir }
38
+ it { should eq(ENV['BLUEPILL_BASE_DIR']) }
39
+ end
24
40
 
25
41
  context "and option base_dir is specified" do
26
42
  let(:options) { {:base_dir=>'/var/bluepill'} }
27
- its(:base_dir) { should eq(options[:base_dir]) }
43
+
44
+ describe '#base_dir' do
45
+ subject { super().base_dir }
46
+ it { should eq(options[:base_dir]) }
47
+ end
28
48
  end
29
49
  end
30
50
  end
@@ -15,35 +15,70 @@ describe Bluepill::Process do
15
15
  :daemonize, :pid_file, :working_dir, :uid, :gid, :child_process_factory,
16
16
  :pid_command, :auto_start, :supplementary_groups, :stop_signals
17
17
  ].each do |attr|
18
- its(attr) { should be_nil }
18
+ describe attr do
19
+ subject { super().send(attr) }
20
+ it { should be_nil }
21
+ end
22
+ end
23
+
24
+ describe '#monitor_children' do
25
+ subject { super().monitor_children }
26
+ it { should be false }
27
+ end
28
+
29
+ describe '#cache_actual_pid' do
30
+ subject { super().cache_actual_pid }
31
+ it { should be true }
32
+ end
33
+
34
+ describe '#start_grace_time' do
35
+ subject { super().start_grace_time }
36
+ it { should eq 3 }
37
+ end
38
+
39
+ describe '#stop_grace_time' do
40
+ subject { super().stop_grace_time }
41
+ it { should eq 3 }
42
+ end
43
+
44
+ describe '#restart_grace_time' do
45
+ subject { super().restart_grace_time }
46
+ it { should eq 3 }
47
+ end
48
+
49
+ describe '#on_start_timeout' do
50
+ subject { super().on_start_timeout }
51
+ it { should eq "start" }
52
+ end
53
+
54
+ describe '#environment' do
55
+ subject { super().environment }
56
+ it { should eq Hash[] }
19
57
  end
20
- its(:monitor_children) { should be_false }
21
- its(:cache_actual_pid) { should be_true }
22
- its(:start_grace_time) { should eq 3 }
23
- its(:stop_grace_time) { should eq 3 }
24
- its(:restart_grace_time) { should eq 3 }
25
- its(:on_start_timeout) { should eq "start" }
26
- its(:environment) { should eq Hash[] }
27
58
  end
28
59
 
29
60
  context "overrides" do
30
61
  subject { Bluepill::Process.new(:proc_name, [], :start_grace_time => 17) }
31
- its(:start_grace_time) { should eq 17 }
62
+
63
+ describe '#start_grace_time' do
64
+ subject { super().start_grace_time }
65
+ it { should eq 17 }
66
+ end
32
67
  end
33
68
  end
34
69
 
35
70
  describe "#start_process" do
36
71
  it "functions" do
37
- subject.stub(:start_command) { "/etc/init.d/script start" }
38
- subject.stub(:on_start_timeout) { "freakout" }
39
- subject.logger.stub(:warning)
40
- subject.stub(:daemonize?) { false }
72
+ allow(subject).to receive(:start_command) { "/etc/init.d/script start" }
73
+ allow(subject).to receive(:on_start_timeout) { "freakout" }
74
+ allow(subject.logger).to receive(:warning)
75
+ allow(subject).to receive(:daemonize?) { false }
41
76
 
42
- subject.should_receive(:with_timeout).
77
+ expect(subject).to receive(:with_timeout).
43
78
  with(3, "freakout").
44
79
  and_yield
45
80
 
46
- Bluepill::System.should_receive(:execute_blocking).
81
+ expect(Bluepill::System).to receive(:execute_blocking).
47
82
  with("/etc/init.d/script start", subject.system_command_options).
48
83
  and_return(:exit_code => 0)
49
84
 
@@ -52,13 +87,13 @@ describe Bluepill::Process do
52
87
 
53
88
  describe "#stop_process" do
54
89
  it "functions" do
55
- subject.stub(:stop_command) { "/etc/init.d/script stop" }
56
- subject.logger.stub(:warning)
57
- subject.should_receive(:with_timeout).
90
+ allow(subject).to receive(:stop_command) { "/etc/init.d/script stop" }
91
+ allow(subject.logger).to receive(:warning)
92
+ expect(subject).to receive(:with_timeout).
58
93
  with(3, "stop").
59
94
  and_yield
60
95
 
61
- Bluepill::System.should_receive(:execute_blocking).
96
+ expect(Bluepill::System).to receive(:execute_blocking).
62
97
  with("/etc/init.d/script stop", subject.system_command_options).
63
98
  and_return(:exit_code => 0)
64
99
 
@@ -68,13 +103,13 @@ describe Bluepill::Process do
68
103
 
69
104
  describe "#restart_process" do
70
105
  it "functions" do
71
- subject.stub(:restart_command) { "/etc/init.d/script restart" }
72
- subject.logger.stub(:warning)
73
- subject.should_receive(:with_timeout).
106
+ allow(subject).to receive(:restart_command) { "/etc/init.d/script restart" }
107
+ allow(subject.logger).to receive(:warning)
108
+ expect(subject).to receive(:with_timeout).
74
109
  with(3, "restart").
75
110
  and_yield
76
111
 
77
- Bluepill::System.should_receive(:execute_blocking).
112
+ expect(Bluepill::System).to receive(:execute_blocking).
78
113
  with("/etc/init.d/script restart", subject.system_command_options).
79
114
  and_return(:exit_code => 0)
80
115
 
@@ -87,12 +122,12 @@ describe Bluepill::Process do
87
122
  let(:block) { proc { nil } }
88
123
 
89
124
  before(:each) do
90
- subject.logger.stub(:err)
91
- Timeout.should_receive(:timeout).with(3.to_f, &block).and_raise(Timeout::Error)
125
+ allow(subject.logger).to receive(:err)
126
+ expect(Timeout).to receive(:timeout).with(3.to_f, &block).and_raise(Timeout::Error)
92
127
  end
93
128
 
94
129
  it "proceeds to next_state on timeout." do
95
- subject.should_receive(:dispatch!).with("state_override")
130
+ expect(subject).to receive(:dispatch!).with("state_override")
96
131
  subject.with_timeout(3, "state_override", &block)
97
132
  end
98
133
  end
@@ -6,19 +6,19 @@ describe Bluepill::ProcessStatistics do
6
6
  it "should record events" do
7
7
  @stats.record_event('some event', 'some reason')
8
8
  @stats.record_event('another event', 'another reason')
9
- @stats.events.should have(2).events
9
+ expect(@stats.events.size).to eq(2)
10
10
  end
11
11
 
12
12
  it "should record #EVENTS_TO_PERSIST events" do
13
13
  (2 * Bluepill::ProcessStatistics::EVENTS_TO_PERSIST).times do
14
14
  @stats.record_event('some event', 'some reason')
15
15
  end
16
- @stats.events.should have(Bluepill::ProcessStatistics::EVENTS_TO_PERSIST).events
16
+ expect(@stats.events.size).to eq(Bluepill::ProcessStatistics::EVENTS_TO_PERSIST)
17
17
  end
18
18
 
19
19
  it "should return event history" do
20
20
  @stats.record_event('some event', 'some reason')
21
- @stats.to_s.should match(/some reason/)
22
- @stats.to_s.should match(/event history/)
21
+ expect(@stats.to_s).to match(/some reason/)
22
+ expect(@stats.to_s).to match(/event history/)
23
23
  end
24
24
  end
@@ -1,28 +1,28 @@
1
1
  describe Bluepill::System do
2
2
  describe :pid_alive? do
3
3
  it "should be true if process responds to zero signal" do
4
- Process.should_receive(:kill).with(0, 555).and_return(0)
5
- Bluepill::System.should be_pid_alive(555)
4
+ expect(Process).to receive(:kill).with(0, 555).and_return(0)
5
+ expect(Bluepill::System).to be_pid_alive(555)
6
6
  end
7
7
 
8
8
  it "should be false if process throws exception on zero signal" do
9
- Process.should_receive(:kill).with(0, 555).and_raise(Errno::ESRCH)
10
- Bluepill::System.should_not be_pid_alive(555)
9
+ expect(Process).to receive(:kill).with(0, 555).and_raise(Errno::ESRCH)
10
+ expect(Bluepill::System).not_to be_pid_alive(555)
11
11
  end
12
12
  end
13
13
 
14
14
  describe :store do
15
15
  it "should be Hash" do
16
- Bluepill::System.store.should be_kind_of(Hash)
16
+ expect(Bluepill::System.store).to be_kind_of(Hash)
17
17
  end
18
18
 
19
19
  it "should return same Hash or every call" do
20
- Bluepill::System.store.should be_equal(Bluepill::System.store)
20
+ expect(Bluepill::System.store).to be_equal(Bluepill::System.store)
21
21
  end
22
22
 
23
23
  it "should store assigned pairs" do
24
24
  Bluepill::System.store[:somekey] = 10
25
- Bluepill::System.store[:somekey].should be_eql(10)
25
+ expect(Bluepill::System.store[:somekey]).to be_eql(10)
26
26
  end
27
27
  end
28
28
 
@@ -30,16 +30,16 @@ describe Bluepill::System do
30
30
  it 'should clear the #store' do
31
31
  Bluepill::System.store[:anotherkey] = Faker::Lorem.sentence
32
32
  Bluepill::System.reset_data
33
- Bluepill::System.store.should be_empty
33
+ expect(Bluepill::System.store).to be_empty
34
34
  end
35
35
  end
36
36
 
37
37
  describe :parse_etime do
38
38
  it "should parse etime format" do
39
- Bluepill::System.parse_elapsed_time("400-00:04:01").should be_equal(34560241)
40
- Bluepill::System.parse_elapsed_time("02:04:02").should be_equal(7442)
41
- Bluepill::System.parse_elapsed_time("20:03").should be_equal(1203)
42
- Bluepill::System.parse_elapsed_time("invalid").should be_equal(0)
39
+ expect(Bluepill::System.parse_elapsed_time("400-00:04:01")).to be_equal(34560241)
40
+ expect(Bluepill::System.parse_elapsed_time("02:04:02")).to be_equal(7442)
41
+ expect(Bluepill::System.parse_elapsed_time("20:03")).to be_equal(1203)
42
+ expect(Bluepill::System.parse_elapsed_time("invalid")).to be_equal(0)
43
43
  end
44
44
  end
45
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bluepill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.67
4
+ version: 0.0.68
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arya Asemanfar
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-05-01 00:00:00.000000000 Z
13
+ date: 2014-07-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '3'
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '4.1'
24
+ version: '5'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -31,7 +31,7 @@ dependencies:
31
31
  version: '3'
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '4.1'
34
+ version: '5'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: blue-daemons
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -188,3 +188,4 @@ test_files:
188
188
  - spec/lib/bluepill/process_statistics_spec.rb
189
189
  - spec/lib/bluepill/system_spec.rb
190
190
  - spec/spec_helper.rb
191
+ has_rdoc: