symphony 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/ChangeLog +71 -2
- data/History.rdoc +9 -0
- data/Manifest.txt +0 -4
- data/Rakefile +7 -29
- data/TODO.md +0 -1
- data/lib/symphony/daemon.rb +1 -1
- data/lib/symphony/mixins.rb +0 -146
- data/lib/symphony/queue.rb +17 -4
- data/lib/symphony/task.rb +14 -0
- data/lib/symphony.rb +2 -2
- data/spec/symphony/mixins_spec.rb +0 -51
- data/spec/symphony/queue_spec.rb +10 -5
- data.tar.gz.sig +0 -0
- metadata +2 -35
- metadata.gz.sig +1 -1
- data/.gemtest +0 -0
- data/lib/symphony/intervalexpression.rb +0 -1216
- data/lib/symphony/tasks/ssh.rb +0 -126
- data/lib/symphony/tasks/sshscript.rb +0 -168
- data/spec/symphony/intervalexpression_spec.rb +0 -481
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edb7810dc562110768235353536ec4a000b02828
|
4
|
+
data.tar.gz: c0a047b0115a9a865ce90606478091e814ab23f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26eeea9cdd2546eeb51cf3f6f936e59a69886c0f83d431e8c770ce758564df01153cb710ff73abbb36fd9525f1234f3912f0fc74cb6bc0c01e14df1af437a854
|
7
|
+
data.tar.gz: ab8aa95349260ee6782133c5d151ad4e749cd77d906616c48c06cd7b7bdb84b4c94b89126c67032fe469e56ec342d5e0eecac82cf3b82da6330200d1f329d771
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/ChangeLog
CHANGED
@@ -1,3 +1,72 @@
|
|
1
|
+
2014-04-14 Mahlon E. Smith <mahlon@laika.com>
|
2
|
+
|
3
|
+
* Manifest.txt, Rakefile, lib/symphony/tasks/ssh.rb,
|
4
|
+
lib/symphony/tasks/sshscript.rb:
|
5
|
+
Branch merge from 221b25852ba6.
|
6
|
+
[3673b0e7202d] [tip]
|
7
|
+
|
8
|
+
* .hoerc, Manifest.txt, spec/symphony/mixins_spec.rb:
|
9
|
+
Complete the intervalexpression backout.
|
10
|
+
[ab1e59fc5ef8]
|
11
|
+
|
12
|
+
2014-04-14 Mahlon E. Smith <mahlon@martini.nu>
|
13
|
+
|
14
|
+
* .hgignore, Manifest.txt, Rakefile,
|
15
|
+
lib/symphony/intervalexpression.rl, lib/symphony/mixins.rb,
|
16
|
+
spec/symphony/intervalexpression_spec.rb,
|
17
|
+
spec/symphony/mixins_spec.rb:
|
18
|
+
After some further consideration, the intervalexpression pieces
|
19
|
+
aren't necessarily dependent upon symphony core -- breaking the
|
20
|
+
scheduling components out.
|
21
|
+
[9ec6a4b61674]
|
22
|
+
|
23
|
+
2014-04-14 Michael Granger <ged@FaerieMUD.org>
|
24
|
+
|
25
|
+
* Manifest.txt, lib/symphony/daemon.rb, lib/symphony/queue.rb,
|
26
|
+
lib/symphony/task.rb:
|
27
|
+
Allow a task to declare its queue as persistant.
|
28
|
+
[221b25852ba6]
|
29
|
+
|
30
|
+
* Rakefile:
|
31
|
+
Make the gemspec task a little smarter
|
32
|
+
[03efe7b2c206]
|
33
|
+
|
34
|
+
2014-04-11 Michael Granger <ged@FaerieMUD.org>
|
35
|
+
|
36
|
+
* lib/symphony/tasks/ssh.rb, lib/symphony/tasks/sshscript.rb:
|
37
|
+
Break out SSH tasks into their own gem
|
38
|
+
[a3c5dd11f642]
|
39
|
+
|
40
|
+
2014-04-08 Michael Granger <ged@FaerieMUD.org>
|
41
|
+
|
42
|
+
* .hgtags:
|
43
|
+
Added tag v0.5.0 for changeset f8e6883990fc
|
44
|
+
[41fc4926342b] [github/master]
|
45
|
+
|
46
|
+
* .hgsigs:
|
47
|
+
Added signature for changeset 369353a62297
|
48
|
+
[f8e6883990fc] [v0.5.0]
|
49
|
+
|
50
|
+
* History.rdoc, lib/symphony.rb:
|
51
|
+
Bump minor version, update history.
|
52
|
+
[369353a62297]
|
53
|
+
|
54
|
+
* lib/symphony/task.rb:
|
55
|
+
Don't set up default signal handlers for WINCH and CHLD for Tasks.
|
56
|
+
[d42c7aa57e0b]
|
57
|
+
|
58
|
+
2014-04-05 Michael Granger <ged@FaerieMUD.org>
|
59
|
+
|
60
|
+
* .hoerc, Manifest.txt, Rakefile, lib/symphony/intervalexpression.rl,
|
61
|
+
lib/symphony/mixins.rb, spec/symphony/intervalexpression_spec.rb,
|
62
|
+
spec/symphony/mixins_spec.rb:
|
63
|
+
Make time-math stuff in IntervalExpression a little safer.
|
64
|
+
|
65
|
+
- Use refinements to avoid polluting core modules
|
66
|
+
- Use an explicit function instead of #send for interval calulation.
|
67
|
+
- Fix manifest, add ragel files to the manifest-exclude pattern.
|
68
|
+
[466b8bd312b4]
|
69
|
+
|
1
70
|
2014-04-04 Mahlon E. Smith <mahlon@laika.com>
|
2
71
|
|
3
72
|
* .hgignore, Manifest.txt, Rakefile,
|
@@ -6,13 +75,13 @@
|
|
6
75
|
spec/symphony/mixins_spec.rb:
|
7
76
|
Add an interval expression parsing library in preparation for
|
8
77
|
Symphony scheduling.
|
9
|
-
[cddc160bc76f]
|
78
|
+
[cddc160bc76f]
|
10
79
|
|
11
80
|
2014-04-01 Michael Granger <ged@FaerieMUD.org>
|
12
81
|
|
13
82
|
* Rakefile:
|
14
83
|
Add direct dependency on loggability
|
15
|
-
[3afd6890a914]
|
84
|
+
[3afd6890a914]
|
16
85
|
|
17
86
|
* TODO.md:
|
18
87
|
Update TODO list
|
data/History.rdoc
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== v0.6.0 [2014-04-14] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
- Set cancel-on-failover flag in the queue consumer
|
4
|
+
- Allow a task to declare its queue as persistant.
|
5
|
+
- Break out SSH tasks into their own gem
|
6
|
+
- Remove the interval expression parser; scheduling will
|
7
|
+
be part of an separate library if we decide to release it.
|
8
|
+
|
9
|
+
|
1
10
|
== v0.5.0 [2014-04-08] Michael Granger <ged@FaerieMUD.org>
|
2
11
|
|
3
12
|
- Don't set up default signal handlers for WINCH and CHLD for Tasks.
|
data/Manifest.txt
CHANGED
@@ -11,7 +11,6 @@ bin/symphony-task
|
|
11
11
|
etc/config.yml.example
|
12
12
|
lib/symphony.rb
|
13
13
|
lib/symphony/daemon.rb
|
14
|
-
lib/symphony/intervalexpression.rb
|
15
14
|
lib/symphony/metrics.rb
|
16
15
|
lib/symphony/mixins.rb
|
17
16
|
lib/symphony/queue.rb
|
@@ -21,11 +20,8 @@ lib/symphony/task.rb
|
|
21
20
|
lib/symphony/tasks/auditor.rb
|
22
21
|
lib/symphony/tasks/failure_logger.rb
|
23
22
|
lib/symphony/tasks/simulator.rb
|
24
|
-
lib/symphony/tasks/ssh.rb
|
25
|
-
lib/symphony/tasks/sshscript.rb
|
26
23
|
spec/helpers.rb
|
27
24
|
spec/symphony/daemon_spec.rb
|
28
|
-
spec/symphony/intervalexpression_spec.rb
|
29
25
|
spec/symphony/mixins_spec.rb
|
30
26
|
spec/symphony/queue_spec.rb
|
31
27
|
spec/symphony/task_spec.rb
|
data/Rakefile
CHANGED
@@ -1,22 +1,12 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
|
3
|
-
require 'pathname'
|
4
|
-
|
5
3
|
begin
|
6
4
|
require 'hoe'
|
7
5
|
rescue LoadError
|
8
6
|
abort "This Rakefile requires hoe (gem install hoe)"
|
9
7
|
end
|
10
8
|
|
11
|
-
|
12
|
-
BASEDIR = Pathname( __FILE__ ).dirname.relative_path_from( Pathname.pwd )
|
13
|
-
|
14
|
-
LIBDIR = BASEDIR + 'lib'
|
15
|
-
SYMPHONY_LIBDIR = LIBDIR + 'symphony'
|
16
|
-
|
17
|
-
GEMSPEC = BASEDIR + 'symphony.gemspec'
|
18
|
-
EXPRESSION_RL = SYMPHONY_LIBDIR + 'intervalexpression.rl'
|
19
|
-
EXPRESSION_RB = SYMPHONY_LIBDIR + 'intervalexpression.rb'
|
9
|
+
GEMSPEC = 'symphony.gemspec'
|
20
10
|
|
21
11
|
|
22
12
|
Hoe.plugin :mercurial
|
@@ -47,29 +37,25 @@ hoespec = Hoe.spec 'symphony' do |spec|
|
|
47
37
|
spec.dependency 'rusage', '~> 0.2'
|
48
38
|
|
49
39
|
spec.dependency 'rspec', '~> 3.0', :developer
|
50
|
-
spec.dependency 'net-ssh', '~> 2.8', :developer
|
51
|
-
spec.dependency 'net-sftp', '~> 2.1', :developer
|
52
40
|
spec.dependency 'simplecov', '~> 0.8', :developer
|
53
41
|
|
54
42
|
spec.require_ruby_version( '>=2.0.0' )
|
55
43
|
spec.hg_sign_tags = true if spec.respond_to?( :hg_sign_tags= )
|
56
|
-
spec.quality_check_whitelist.include( EXPRESSION_RB.to_s ) if
|
57
|
-
spec.respond_to?( :quality_check_whitelist )
|
58
44
|
|
59
45
|
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
60
46
|
end
|
61
47
|
|
48
|
+
# Fix some Hoe retardedness
|
49
|
+
hoespec.spec.files.delete( '.gemtest' )
|
62
50
|
ENV['VERSION'] ||= hoespec.spec.version.to_s
|
63
51
|
|
64
52
|
# Run the tests before checking in
|
65
53
|
task 'hg:precheckin' => [ :check_history, :check_manifest, :spec ]
|
66
54
|
|
67
|
-
|
68
55
|
# Rebuild the ChangeLog immediately before release
|
69
56
|
task :prerelease => 'ChangeLog'
|
70
57
|
CLOBBER.include( 'ChangeLog' )
|
71
58
|
|
72
|
-
|
73
59
|
desc "Build a coverage report"
|
74
60
|
task :coverage do
|
75
61
|
ENV["COVERAGE"] = 'yes'
|
@@ -77,24 +63,16 @@ task :coverage do
|
|
77
63
|
end
|
78
64
|
|
79
65
|
|
80
|
-
# Generate the expression parser with Ragel
|
81
|
-
file EXPRESSION_RL
|
82
|
-
file EXPRESSION_RB
|
83
|
-
task EXPRESSION_RB => EXPRESSION_RL do |task|
|
84
|
-
sh 'ragel', '-R', '-T1', '-Ls', task.prerequisites.first
|
85
|
-
end
|
86
|
-
task :spec => EXPRESSION_RB
|
87
|
-
|
88
|
-
|
89
|
-
# Generate a .gemspec file for integration with systems that read it
|
90
66
|
task :gemspec => GEMSPEC
|
91
|
-
file GEMSPEC =>
|
67
|
+
file GEMSPEC => hoespec.spec.files do |task|
|
92
68
|
spec = $hoespec.spec
|
93
|
-
spec.files.delete( '.gemtest' )
|
94
69
|
spec.version = "#{spec.version}.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
|
95
70
|
File.open( task.name, 'w' ) do |fh|
|
96
71
|
fh.write( spec.to_ruby )
|
97
72
|
end
|
98
73
|
end
|
74
|
+
|
99
75
|
task :default => :gemspec
|
100
76
|
|
77
|
+
CLOBBER.include( GEMSPEC.to_s )
|
78
|
+
|
data/TODO.md
CHANGED
data/lib/symphony/daemon.rb
CHANGED
data/lib/symphony/mixins.rb
CHANGED
@@ -71,151 +71,5 @@ module Symphony
|
|
71
71
|
end # module MethodUtilities
|
72
72
|
|
73
73
|
|
74
|
-
# Functions for time calculations
|
75
|
-
module TimeFunctions
|
76
|
-
|
77
|
-
###############
|
78
|
-
module_function
|
79
|
-
###############
|
80
|
-
|
81
|
-
### Calculate the (approximate) number of seconds that are in +count+ of the
|
82
|
-
### given +unit+ of time.
|
83
|
-
def calculate_seconds( count, unit )
|
84
|
-
return case unit
|
85
|
-
when :seconds, :second
|
86
|
-
count
|
87
|
-
when :minutes, :minute
|
88
|
-
count * 60
|
89
|
-
when :hours, :hour
|
90
|
-
count * 3600
|
91
|
-
when :days, :day
|
92
|
-
count * 86400
|
93
|
-
when :weeks, :week
|
94
|
-
count * 604800
|
95
|
-
when :fortnights, :fortnight
|
96
|
-
count * 1209600
|
97
|
-
when :months, :month
|
98
|
-
count * 2592000
|
99
|
-
when :years, :year
|
100
|
-
count * 31557600
|
101
|
-
else
|
102
|
-
raise ArgumentError, "don't know how to calculate seconds in a %p" % [ unit ]
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
end # module TimeFunctions
|
107
|
-
|
108
|
-
|
109
|
-
# Refinements to Numeric to add time-related convenience methods
|
110
|
-
module TimeRefinements
|
111
|
-
refine Numeric do
|
112
|
-
|
113
|
-
### Number of seconds (returns receiver unmodified)
|
114
|
-
def seconds
|
115
|
-
return self
|
116
|
-
end
|
117
|
-
alias_method :second, :seconds
|
118
|
-
|
119
|
-
### Returns number of seconds in <receiver> minutes
|
120
|
-
def minutes
|
121
|
-
return TimeFunctions.calculate_seconds( self, :minutes )
|
122
|
-
end
|
123
|
-
alias_method :minute, :minutes
|
124
|
-
|
125
|
-
### Returns the number of seconds in <receiver> hours
|
126
|
-
def hours
|
127
|
-
return TimeFunctions.calculate_seconds( self, :hours )
|
128
|
-
end
|
129
|
-
alias_method :hour, :hours
|
130
|
-
|
131
|
-
### Returns the number of seconds in <receiver> days
|
132
|
-
def days
|
133
|
-
return TimeFunctions.calculate_seconds( self, :day )
|
134
|
-
end
|
135
|
-
alias_method :day, :days
|
136
|
-
|
137
|
-
### Return the number of seconds in <receiver> weeks
|
138
|
-
def weeks
|
139
|
-
return TimeFunctions.calculate_seconds( self, :weeks )
|
140
|
-
end
|
141
|
-
alias_method :week, :weeks
|
142
|
-
|
143
|
-
### Returns the number of seconds in <receiver> fortnights
|
144
|
-
def fortnights
|
145
|
-
return TimeFunctions.calculate_seconds( self, :fortnights )
|
146
|
-
end
|
147
|
-
alias_method :fortnight, :fortnights
|
148
|
-
|
149
|
-
### Returns the number of seconds in <receiver> months (approximate)
|
150
|
-
def months
|
151
|
-
return TimeFunctions.calculate_seconds( self, :months )
|
152
|
-
end
|
153
|
-
alias_method :month, :months
|
154
|
-
|
155
|
-
### Returns the number of seconds in <receiver> years (approximate)
|
156
|
-
def years
|
157
|
-
return TimeFunctions.calculate_seconds( self, :years )
|
158
|
-
end
|
159
|
-
alias_method :year, :years
|
160
|
-
|
161
|
-
|
162
|
-
### Returns the Time <receiver> number of seconds before the
|
163
|
-
### specified +time+. E.g., 2.hours.before( header.expiration )
|
164
|
-
def before( time )
|
165
|
-
return time - self
|
166
|
-
end
|
167
|
-
|
168
|
-
|
169
|
-
### Returns the Time <receiver> number of seconds ago. (e.g.,
|
170
|
-
### expiration > 2.hours.ago )
|
171
|
-
def ago
|
172
|
-
return self.before( ::Time.now )
|
173
|
-
end
|
174
|
-
|
175
|
-
|
176
|
-
### Returns the Time <receiver> number of seconds after the given +time+.
|
177
|
-
### E.g., 10.minutes.after( header.expiration )
|
178
|
-
def after( time )
|
179
|
-
return time + self
|
180
|
-
end
|
181
|
-
|
182
|
-
|
183
|
-
### Return a new Time <receiver> number of seconds from now.
|
184
|
-
def from_now
|
185
|
-
return self.after( ::Time.now )
|
186
|
-
end
|
187
|
-
|
188
|
-
|
189
|
-
### Return a string describing approximately the amount of time in
|
190
|
-
### <receiver> number of seconds.
|
191
|
-
def timeperiod
|
192
|
-
return case
|
193
|
-
when self < 1.minute
|
194
|
-
'less than a minute'
|
195
|
-
when self < 50.minutes
|
196
|
-
'%d minutes' % [ (self.to_f / 1.minute).ceil ]
|
197
|
-
when self < 90.minutes
|
198
|
-
'about an hour'
|
199
|
-
when self < 18.hours
|
200
|
-
"%d hours" % [ (self.to_f / 1.hour).ceil ]
|
201
|
-
when self < 30.hours
|
202
|
-
'about a day'
|
203
|
-
when self < 1.week
|
204
|
-
"%d days" % [ (self.to_f / 1.day).ceil ]
|
205
|
-
when self < 2.weeks
|
206
|
-
'about one week'
|
207
|
-
when self < 3.months
|
208
|
-
"%d weeks" % [ (self.to_f / 1.week).ceil ]
|
209
|
-
when self < 18.months
|
210
|
-
"%d months" % [ (self.to_f / 1.month).ceil ]
|
211
|
-
else
|
212
|
-
"%d years" % [ (self.to_f / 1.year).ceil ]
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
end # refine Numeric
|
217
|
-
end # module TimeRefinements
|
218
74
|
|
219
75
|
end # module Symphony
|
220
|
-
|
221
|
-
|
data/lib/symphony/queue.rb
CHANGED
@@ -22,6 +22,11 @@ class Symphony::Queue
|
|
22
22
|
heartbeat: 'server',
|
23
23
|
}
|
24
24
|
|
25
|
+
# Arguments to use when creating the consumer
|
26
|
+
CONSUMER_ARGS = {
|
27
|
+
'x-cancel-on-ha-failover' => true,
|
28
|
+
}
|
29
|
+
|
25
30
|
# The default number of messages to prefetch
|
26
31
|
DEFAULT_PREFETCH = 10
|
27
32
|
|
@@ -139,7 +144,8 @@ class Symphony::Queue
|
|
139
144
|
task_class.acknowledge,
|
140
145
|
task_class.consumer_tag,
|
141
146
|
task_class.routing_keys,
|
142
|
-
task_class.prefetch
|
147
|
+
task_class.prefetch,
|
148
|
+
task_class.persistent
|
143
149
|
]
|
144
150
|
return new( *args )
|
145
151
|
end
|
@@ -147,12 +153,13 @@ class Symphony::Queue
|
|
147
153
|
|
148
154
|
|
149
155
|
### Create a new Queue with the specified configuration.
|
150
|
-
def initialize( name, acknowledge, consumer_tag, routing_keys, prefetch )
|
156
|
+
def initialize( name, acknowledge, consumer_tag, routing_keys, prefetch, persistent )
|
151
157
|
@name = name
|
152
158
|
@acknowledge = acknowledge
|
153
159
|
@consumer_tag = consumer_tag
|
154
160
|
@routing_keys = routing_keys
|
155
161
|
@prefetch = prefetch
|
162
|
+
@persistent = persistent
|
156
163
|
|
157
164
|
@amqp_queue = nil
|
158
165
|
@shutting_down = false
|
@@ -178,6 +185,12 @@ class Symphony::Queue
|
|
178
185
|
# The maximum number of un-acked messages to prefetch
|
179
186
|
attr_reader :prefetch
|
180
187
|
|
188
|
+
# Whether or not to create a persistent queue
|
189
|
+
attr_reader :persistent
|
190
|
+
|
191
|
+
# The underlying Bunny::Queue this object manages
|
192
|
+
attr_reader :amqp_queue
|
193
|
+
|
181
194
|
# The Bunny::Consumer that is dispatching messages for the queue.
|
182
195
|
attr_accessor :consumer
|
183
196
|
|
@@ -211,7 +224,7 @@ class Symphony::Queue
|
|
211
224
|
# Last argument is *no_ack*, so need to invert the logic
|
212
225
|
self.log.debug "Creating consumer for the '%s' queue with tag: %s" %
|
213
226
|
[ amqp_queue.name, tag ]
|
214
|
-
cons = Bunny::Consumer.new( amqp_queue.channel, amqp_queue, tag, !ackmode )
|
227
|
+
cons = Bunny::Consumer.new( amqp_queue.channel, amqp_queue, tag, !ackmode, false, CONSUMER_ARGS )
|
215
228
|
|
216
229
|
cons.on_delivery do |delivery_info, properties, payload|
|
217
230
|
rval = self.handle_message( delivery_info, properties, payload, &work_callback )
|
@@ -244,7 +257,7 @@ class Symphony::Queue
|
|
244
257
|
channel = self.class.reset_amqp_channel
|
245
258
|
channel.prefetch( prefetch_count )
|
246
259
|
|
247
|
-
queue = channel.queue( self.name, auto_delete:
|
260
|
+
queue = channel.queue( self.name, auto_delete: !self.persistent )
|
248
261
|
self.routing_keys.each do |key|
|
249
262
|
self.log.info " binding queue %s to the %s exchange with topic key: %s" %
|
250
263
|
[ self.name, exchange.name, key ]
|
data/lib/symphony/task.rb
CHANGED
@@ -68,6 +68,7 @@ class Symphony::Task
|
|
68
68
|
subclass.instance_variable_set( :@work_model, :longlived )
|
69
69
|
subclass.instance_variable_set( :@prefetch, 10 )
|
70
70
|
subclass.instance_variable_set( :@timeout_action, :reject )
|
71
|
+
subclass.instance_variable_set( :@persistent, false )
|
71
72
|
end
|
72
73
|
|
73
74
|
|
@@ -188,6 +189,19 @@ class Symphony::Task
|
|
188
189
|
end
|
189
190
|
|
190
191
|
|
192
|
+
### Create the queue the task consumes from as a persistent queue, so it
|
193
|
+
### will continue to receive events even if the task is no longer consuming them.
|
194
|
+
### This only effects queues which are not already declared, so if the
|
195
|
+
### bindings for the queue change you'll need to delete the existing queue
|
196
|
+
### before starting up to have them take effect.
|
197
|
+
def self::persistent( new_setting=nil )
|
198
|
+
if new_setting
|
199
|
+
@persistent = new_setting
|
200
|
+
end
|
201
|
+
return @persistent
|
202
|
+
end
|
203
|
+
|
204
|
+
|
191
205
|
#
|
192
206
|
# Instance Methods
|
193
207
|
#
|
data/lib/symphony.rb
CHANGED
@@ -12,10 +12,10 @@ module Symphony
|
|
12
12
|
Configurability
|
13
13
|
|
14
14
|
# Library version constant
|
15
|
-
VERSION = '0.
|
15
|
+
VERSION = '0.6.0'
|
16
16
|
|
17
17
|
# Version-control revision constant
|
18
|
-
REVISION = %q$Revision:
|
18
|
+
REVISION = %q$Revision: fa6a367872f4 $
|
19
19
|
|
20
20
|
|
21
21
|
# The name of the environment variable to check for config file overrides
|
@@ -1,11 +1,9 @@
|
|
1
1
|
#!/usr/bin/env rspec -wfd
|
2
|
-
# vim: set nosta noet ts=4 sw=4:
|
3
2
|
|
4
3
|
require_relative '../helpers'
|
5
4
|
|
6
5
|
require 'symphony/mixins'
|
7
6
|
|
8
|
-
using Symphony::TimeRefinements
|
9
7
|
|
10
8
|
describe Symphony, 'mixins' do
|
11
9
|
|
@@ -77,53 +75,4 @@ describe Symphony, 'mixins' do
|
|
77
75
|
|
78
76
|
end
|
79
77
|
|
80
|
-
|
81
|
-
describe "numeric constant methods" do
|
82
|
-
|
83
|
-
SECONDS_IN_A_MINUTE = 60
|
84
|
-
SECONDS_IN_AN_HOUR = SECONDS_IN_A_MINUTE * 60
|
85
|
-
SECONDS_IN_A_DAY = SECONDS_IN_AN_HOUR * 24
|
86
|
-
SECONDS_IN_A_WEEK = SECONDS_IN_A_DAY * 7
|
87
|
-
SECONDS_IN_A_FORTNIGHT = SECONDS_IN_A_WEEK * 2
|
88
|
-
SECONDS_IN_A_MONTH = SECONDS_IN_A_DAY * 30
|
89
|
-
SECONDS_IN_A_YEAR = Integer( SECONDS_IN_A_DAY * 365.25 )
|
90
|
-
|
91
|
-
it "can calculate the number of seconds for various units of time" do
|
92
|
-
expect( 1.second ).to eq( 1 )
|
93
|
-
expect( 14.seconds ).to eq( 14 )
|
94
|
-
|
95
|
-
expect( 1.minute ).to eq( SECONDS_IN_A_MINUTE )
|
96
|
-
expect( 18.minutes ).to eq( SECONDS_IN_A_MINUTE * 18 )
|
97
|
-
|
98
|
-
expect( 1.hour ).to eq( SECONDS_IN_AN_HOUR )
|
99
|
-
expect( 723.hours ).to eq( SECONDS_IN_AN_HOUR * 723 )
|
100
|
-
|
101
|
-
expect( 1.day ).to eq( SECONDS_IN_A_DAY )
|
102
|
-
expect( 3.days ).to eq( SECONDS_IN_A_DAY * 3 )
|
103
|
-
|
104
|
-
expect( 1.week ).to eq( SECONDS_IN_A_WEEK )
|
105
|
-
expect( 28.weeks ).to eq( SECONDS_IN_A_WEEK * 28 )
|
106
|
-
|
107
|
-
expect( 1.fortnight ).to eq( SECONDS_IN_A_FORTNIGHT )
|
108
|
-
expect( 31.fortnights ).to eq( SECONDS_IN_A_FORTNIGHT * 31 )
|
109
|
-
|
110
|
-
expect( 1.month ).to eq( SECONDS_IN_A_MONTH )
|
111
|
-
expect( 67.months ).to eq( SECONDS_IN_A_MONTH * 67 )
|
112
|
-
|
113
|
-
expect( 1.year ).to eq( SECONDS_IN_A_YEAR )
|
114
|
-
expect( 13.years ).to eq( SECONDS_IN_A_YEAR * 13 )
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
|
-
it "can calculate various time offsets" do
|
119
|
-
starttime = Time.now
|
120
|
-
|
121
|
-
expect( 1.second.after( starttime ) ).to eq( starttime + 1 )
|
122
|
-
expect( 18.seconds.from_now ).to be_within( 10.seconds ).of( starttime + 18 )
|
123
|
-
|
124
|
-
expect( 1.second.before( starttime ) ).to eq( starttime - 1 )
|
125
|
-
expect( 3.hours.ago ).to be_within( 10.seconds ).of( starttime - 10800 )
|
126
|
-
end
|
127
|
-
end
|
128
78
|
end
|
129
|
-
|
data/spec/symphony/queue_spec.rb
CHANGED
@@ -160,7 +160,8 @@ describe Symphony::Queue do
|
|
160
160
|
with( Symphony::Queue::DEFAULT_PREFETCH )
|
161
161
|
|
162
162
|
expect( Bunny::Consumer ).to receive( :new ).
|
163
|
-
with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false
|
163
|
+
with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false, false,
|
164
|
+
Symphony::Queue::CONSUMER_ARGS ).
|
164
165
|
and_return( consumer )
|
165
166
|
|
166
167
|
# Set up an artificial method to call the delivery callback that we can later
|
@@ -211,7 +212,8 @@ describe Symphony::Queue do
|
|
211
212
|
expect( described_class.amqp_channel ).to receive( :prefetch ).with( 1 )
|
212
213
|
|
213
214
|
expect( Bunny::Consumer ).to receive( :new ).
|
214
|
-
with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false
|
215
|
+
with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false, false,
|
216
|
+
Symphony::Queue::CONSUMER_ARGS ).
|
215
217
|
and_return( consumer )
|
216
218
|
|
217
219
|
expect( consumer ).to receive( :on_delivery ) do |&block|
|
@@ -253,7 +255,8 @@ describe Symphony::Queue do
|
|
253
255
|
with( Symphony::Queue::DEFAULT_PREFETCH )
|
254
256
|
|
255
257
|
expect( Bunny::Consumer ).to receive( :new ).
|
256
|
-
with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false
|
258
|
+
with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false, false,
|
259
|
+
Symphony::Queue::CONSUMER_ARGS ).
|
257
260
|
and_return( consumer )
|
258
261
|
|
259
262
|
expect( consumer ).to receive( :on_delivery )
|
@@ -282,7 +285,8 @@ describe Symphony::Queue do
|
|
282
285
|
|
283
286
|
# Ackmode argument is actually 'no_ack'
|
284
287
|
expect( Bunny::Consumer ).to receive( :new ).
|
285
|
-
with( amqp_channel, amqp_queue, queue.consumer_tag, false
|
288
|
+
with( amqp_channel, amqp_queue, queue.consumer_tag, false, false,
|
289
|
+
Symphony::Queue::CONSUMER_ARGS ).
|
286
290
|
and_return( consumer )
|
287
291
|
expect( consumer ).to receive( :on_delivery )
|
288
292
|
expect( consumer ).to receive( :on_cancellation )
|
@@ -299,7 +303,8 @@ describe Symphony::Queue do
|
|
299
303
|
# Ackmode argument is actually 'no_ack'
|
300
304
|
queue.instance_variable_set( :@acknowledge, false )
|
301
305
|
expect( Bunny::Consumer ).to receive( :new ).
|
302
|
-
with( amqp_channel, amqp_queue, queue.consumer_tag, true
|
306
|
+
with( amqp_channel, amqp_queue, queue.consumer_tag, true, false,
|
307
|
+
Symphony::Queue::CONSUMER_ARGS ).
|
303
308
|
and_return( consumer )
|
304
309
|
expect( consumer ).to receive( :on_delivery )
|
305
310
|
expect( consumer ).to receive( :on_cancellation )
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symphony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
c7ZKPJcWBv0sm81+FCZXNACn2f9jfF8OQinxVs0O052KbGuEQaaiGIYeuuwQE2q6
|
32
32
|
ggcrPfcYeTwWlfZPu2LrBg==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-04-
|
34
|
+
date: 2014-04-14 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: loggability
|
@@ -215,34 +215,6 @@ dependencies:
|
|
215
215
|
- - ~>
|
216
216
|
- !ruby/object:Gem::Version
|
217
217
|
version: '3.0'
|
218
|
-
- !ruby/object:Gem::Dependency
|
219
|
-
name: net-ssh
|
220
|
-
requirement: !ruby/object:Gem::Requirement
|
221
|
-
requirements:
|
222
|
-
- - ~>
|
223
|
-
- !ruby/object:Gem::Version
|
224
|
-
version: '2.8'
|
225
|
-
type: :development
|
226
|
-
prerelease: false
|
227
|
-
version_requirements: !ruby/object:Gem::Requirement
|
228
|
-
requirements:
|
229
|
-
- - ~>
|
230
|
-
- !ruby/object:Gem::Version
|
231
|
-
version: '2.8'
|
232
|
-
- !ruby/object:Gem::Dependency
|
233
|
-
name: net-sftp
|
234
|
-
requirement: !ruby/object:Gem::Requirement
|
235
|
-
requirements:
|
236
|
-
- - ~>
|
237
|
-
- !ruby/object:Gem::Version
|
238
|
-
version: '2.1'
|
239
|
-
type: :development
|
240
|
-
prerelease: false
|
241
|
-
version_requirements: !ruby/object:Gem::Requirement
|
242
|
-
requirements:
|
243
|
-
- - ~>
|
244
|
-
- !ruby/object:Gem::Version
|
245
|
-
version: '2.1'
|
246
218
|
- !ruby/object:Gem::Dependency
|
247
219
|
name: simplecov
|
248
220
|
requirement: !ruby/object:Gem::Requirement
|
@@ -299,7 +271,6 @@ extra_rdoc_files:
|
|
299
271
|
- TODO.md
|
300
272
|
- USAGE.rdoc
|
301
273
|
files:
|
302
|
-
- .gemtest
|
303
274
|
- .simplecov
|
304
275
|
- ChangeLog
|
305
276
|
- History.rdoc
|
@@ -313,7 +284,6 @@ files:
|
|
313
284
|
- etc/config.yml.example
|
314
285
|
- lib/symphony.rb
|
315
286
|
- lib/symphony/daemon.rb
|
316
|
-
- lib/symphony/intervalexpression.rb
|
317
287
|
- lib/symphony/metrics.rb
|
318
288
|
- lib/symphony/mixins.rb
|
319
289
|
- lib/symphony/queue.rb
|
@@ -323,11 +293,8 @@ files:
|
|
323
293
|
- lib/symphony/tasks/auditor.rb
|
324
294
|
- lib/symphony/tasks/failure_logger.rb
|
325
295
|
- lib/symphony/tasks/simulator.rb
|
326
|
-
- lib/symphony/tasks/ssh.rb
|
327
|
-
- lib/symphony/tasks/sshscript.rb
|
328
296
|
- spec/helpers.rb
|
329
297
|
- spec/symphony/daemon_spec.rb
|
330
|
-
- spec/symphony/intervalexpression_spec.rb
|
331
298
|
- spec/symphony/mixins_spec.rb
|
332
299
|
- spec/symphony/queue_spec.rb
|
333
300
|
- spec/symphony/task_spec.rb
|