loop_dance 0.4.1 → 0.4.3
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.
- data/README.rdoc +1 -3
- data/VERSION +1 -1
- data/lib/loop_dance/commands.rb +7 -3
- data/lib/loop_dance/controller.rb +4 -1
- data/lib/loop_dance/dancer.rb +2 -3
- data/lib/loop_dance/railtie.rb +1 -1
- data/lib/loop_dance/task.rb +3 -1
- data/loop_dance.gemspec +2 -2
- data/spec/dancer_spec.rb +5 -6
- data/spec/task_spec.rb +4 -3
- data/tasks/loop_dance.rake +2 -2
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -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
|
-
|
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
|
+
0.4.3
|
data/lib/loop_dance/commands.rb
CHANGED
@@ -2,10 +2,14 @@ module LoopDance
|
|
2
2
|
|
3
3
|
module Commands
|
4
4
|
|
5
|
-
|
5
|
+
# internal vars
|
6
|
+
attr_accessor :tasks, :timeout, :maximal_timeout
|
6
7
|
|
7
|
-
|
8
|
-
|
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
|
data/lib/loop_dance/dancer.rb
CHANGED
data/lib/loop_dance/railtie.rb
CHANGED
data/lib/loop_dance/task.rb
CHANGED
data/loop_dance.gemspec
CHANGED
@@ -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.
|
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-
|
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 = [
|
data/spec/dancer_spec.rb
CHANGED
@@ -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
|
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
|
46
|
+
it { Dancer2.autostart.should be_false }
|
47
47
|
|
48
48
|
end
|
49
49
|
|
50
|
-
describe "muting log and
|
50
|
+
describe "muting log and enabling autostart" do
|
51
51
|
before(:all) do
|
52
52
|
class Dancer1 < LoopDance::Dancer
|
53
53
|
mute_log
|
54
|
-
|
54
|
+
enable_autostart
|
55
55
|
end
|
56
56
|
end
|
57
57
|
it { Dancer1.muted_log.should be_true }
|
58
|
-
it { Dancer1.autostart.should
|
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
|
data/spec/task_spec.rb
CHANGED
@@ -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
|
32
|
-
|
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.
|
36
|
+
t = Time.now()
|
37
|
+
Time.stub(:now).and_return(t + interval)
|
37
38
|
should be_time_to_run
|
38
39
|
end
|
39
40
|
|
data/tasks/loop_dance.rake
CHANGED
@@ -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:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
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-
|
18
|
+
date: 2011-01-25 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|