loop_dance 0.4.1 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,8 +24,6 @@ Create file 'lib/loop_dance.rb':
24
24
 
25
25
  end
26
26
 
27
- LoopDance automatically starts at the rails 3 server startup.
28
-
29
27
  == Useful management
30
28
 
31
29
  From the rails application:
@@ -47,7 +45,7 @@ By the rake tasks (TODO):
47
45
 
48
46
  class Dancer1 < LoopDance::Dancer
49
47
  mute_log # mute redundant logging, just start, stop and errors
50
- disable_autostart # disable autostart at rails server startup
48
+ enable_autostart # enable autostart at rails server startup
51
49
 
52
50
 
53
51
  == Contributing to loop_dance
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.3
@@ -2,10 +2,14 @@ module LoopDance
2
2
 
3
3
  module Commands
4
4
 
5
- attr_accessor :tasks, :timeout, :maximal_timeout, :muted_log, :autostart
5
+ # internal vars
6
+ attr_accessor :tasks, :timeout, :maximal_timeout
6
7
 
7
- def disable_autostart
8
- @autostart = false
8
+ # options
9
+ attr_accessor :muted_log, :autostart, :start_timeout, :stop_timeout, :log_file_activity_timeout
10
+
11
+ def enable_autostart
12
+ @autostart = true
9
13
  end
10
14
 
11
15
  def mute_log
@@ -15,7 +15,10 @@ module LoopDance
15
15
  :start_command => start_command,
16
16
  :ping_command => lambda { true },
17
17
  :pid_file => dancer.pid_file,
18
- :log_file => log_file
18
+ :log_file => log_file,
19
+ :start_timeout => dancer.start_timeout,
20
+ :stop_timeout => dancer.stop_timeout,
21
+ :log_file_activity_timeout => dancer.log_file_activity_timeout
19
22
  }
20
23
  super h
21
24
  end
@@ -11,9 +11,8 @@ module LoopDance
11
11
 
12
12
  class << self
13
13
 
14
- def inherited(subclass)
15
- subclass.autostart = true
16
- end
14
+ # def inherited(subclass)
15
+ # end
17
16
 
18
17
  def controller
19
18
  @controller ||= LoopDance::Controller.new self
@@ -6,7 +6,7 @@ module LoopDance
6
6
  def self.load_dancers
7
7
  require 'dancers'
8
8
  rescue LoadError => err
9
- puts "LoopDance: file 'lib/dancers.rb' doesn't exist."
9
+ puts "LoopDance: can't load file 'lib/dancers.rb'."
10
10
  end
11
11
 
12
12
  initializer 'loop_dance.initialize' do
@@ -5,7 +5,9 @@ class LoopDance::Task
5
5
  run_count=0
6
6
  self.interval = interval
7
7
  self.block = block
8
- self.last_run_at = Time.now
8
+
9
+ # Run tasks when start dancer
10
+ # self.last_run_at = Time.now
9
11
  end
10
12
 
11
13
  def time_to_run?
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{loop_dance}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Danil Pismenny"]
12
- s.date = %q{2011-01-21}
12
+ s.date = %q{2011-01-25}
13
13
  s.description = %q{Really simple daemon builder and manager. Based on the looper and daemon_controller}
14
14
  s.email = %q{danil@orionet.ru}
15
15
  s.extra_rdoc_files = [
@@ -23,7 +23,7 @@ describe LoopDance do
23
23
  it { Dancer1.tasks.count.should == 4 }
24
24
  it { Dancer1.timeout.should == 2 }
25
25
  it { Dancer1.maximal_timeout.should == 10 }
26
- it { Dancer1.autostart.should be_true }
26
+ it { Dancer1.autostart.should be_false }
27
27
 
28
28
  it { LoopDance::Dancer.tasks.should be_blank }
29
29
 
@@ -43,20 +43,19 @@ describe LoopDance do
43
43
  it { Dancer2.timeout.should == 1 }
44
44
  it { Dancer2.maximal_timeout.should == 11 }
45
45
  it { Dancer2.muted_log.should be_nil }
46
- it { Dancer2.autostart.should be_true }
46
+ it { Dancer2.autostart.should be_false }
47
47
 
48
48
  end
49
49
 
50
- describe "muting log and disabling autostart" do
50
+ describe "muting log and enabling autostart" do
51
51
  before(:all) do
52
52
  class Dancer1 < LoopDance::Dancer
53
53
  mute_log
54
- disable_autostart
54
+ enable_autostart
55
55
  end
56
56
  end
57
57
  it { Dancer1.muted_log.should be_true }
58
- it { Dancer1.autostart.should be_false }
59
- it { Dancer1.autostart.should_not be_nil }
58
+ it { Dancer1.autostart.should be_true }
60
59
  end
61
60
 
62
61
  describe "find right minimal timeout" do
@@ -28,12 +28,13 @@ describe LoopDance::Task do
28
28
  subject.last_run_at.should < Time.now
29
29
  end
30
30
 
31
- it "should not run straight away" do
32
- should_not be_time_to_run
31
+ it "should run straight away" do
32
+ should be_time_to_run
33
33
  end
34
34
 
35
35
  it "should run if it's time" do
36
- Time.stub(:now).and_return(subject.last_run_at + interval)
36
+ t = Time.now()
37
+ Time.stub(:now).and_return(t + interval)
37
38
  should be_time_to_run
38
39
  end
39
40
 
@@ -36,12 +36,12 @@ namespace :loop_dance do
36
36
 
37
37
  desc "Start #{dancer}"
38
38
  task :start => :loop_dance do
39
- dancer.controller.safely_start
39
+ dancer.controller.safely_start( true )
40
40
  end
41
41
 
42
42
  desc "Restart #{dancer}"
43
43
  task :restart => :loop_dance do
44
- dancer.controller.safely_restart
44
+ dancer.controller.safely_restart( true )
45
45
  end
46
46
 
47
47
  desc "Stop #{dancer}"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loop_dance
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 3
10
+ version: 0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Danil Pismenny
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-21 00:00:00 +03:00
18
+ date: 2011-01-25 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency