iyyov 1.2.0-java → 1.3.0-java

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: 7692b765081a521e88f4b83ef83c6eb77f5d40b9
4
- data.tar.gz: 4bc956f7bb0ee66a43dcfdee726627fe8884a13f
3
+ metadata.gz: fb9a4d2984880e18916ce5a0e68cca50950a4932
4
+ data.tar.gz: 97b47e8ed075a1df2d439fa0579656fdbe3f55cd
5
5
  SHA512:
6
- metadata.gz: eee70d3b7aaad4509f4cffe854839652da43bc95c3d05c3fb5625cbe484718a4368f65ef115f5f6e42f898b41e1c1f7f2f898884fc85d43ddf9da86613626655
7
- data.tar.gz: 03ad99512a103d85de5e67eb6574b1f595da8142c28fb1863b1c5ae4e5046c6a5a59e249dc68f4fe3f7a50bedb8855eac2305b9c83cb367aab2b42441201e940
6
+ metadata.gz: 5a6cfbc1ce3601d6fa0a3e811e965802071e550772bf8bedcb2be6818a42da6ecd3dc3c442885d012d90ded4ea1082e677d451a2850d2dda59304cc0b3eba59e
7
+ data.tar.gz: e752e1fe1473db6330c188b37a259006f629b521ee91ac3cd848591f9c18a8fc25d7895398cbd5aac93e02f3e3ce9fe410b3aa6f724eb68200dec4f06a0e8664
data/History.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ === 1.3.0 (2014-2-24)
2
+ * Add Context.load_directory to load the contents of a jobs.d
3
+ directory. Each contained executable *.rb file is loaded. This
4
+ allows deploying a file for each independent job and
5
+ enabling/disabling jobs with chmod +x/-x. The directory itself and
6
+ all *.rb files are watched for mtime or ctime change.
7
+
1
8
  === 1.2.0 (2013-12-6)
2
9
  * Improve deamon log output
3
10
  * Add Travis CI test setup (build)
data/README.rdoc CHANGED
@@ -83,7 +83,7 @@ the above provided examples.
83
83
 
84
84
  == License
85
85
 
86
- Copyright (c) 2010-2013 David Kellum
86
+ Copyright (c) 2010-2014 David Kellum
87
87
 
88
88
  Licensed under the Apache License, Version 2.0 (the "License"); you
89
89
  may not use this file except in compliance with the License. You
data/bin/iyyov-fg CHANGED
@@ -4,7 +4,7 @@
4
4
  #. hashdot.vm.options += -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
5
5
 
6
6
  #--
7
- # Copyright (c) 2010-2013 David Kellum
7
+ # Copyright (c) 2010-2014 David Kellum
8
8
  #
9
9
  # Licensed under the Apache License, Version 2.0 (the "License"); you
10
10
  # may not use this file except in compliance with the License. You
data/config/init.d/iyyov CHANGED
@@ -14,7 +14,7 @@
14
14
  gem_home="/opt/jruby/gems"
15
15
 
16
16
  # (Exact) Gem version of iyyov to run
17
- version="1.2.0"
17
+ version="1.3.0"
18
18
 
19
19
  # User to run the daemon as (should own rundir)
20
20
  user="iyyov"
data/init/iyyov CHANGED
@@ -7,7 +7,7 @@
7
7
  #. hashdot.vm.options += -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
8
8
 
9
9
  #--
10
- # Copyright (c) 2010-2013 David Kellum
10
+ # Copyright (c) 2010-2014 David Kellum
11
11
  #
12
12
  # Licensed under the Apache License, Version 2.0 (the "License"); you
13
13
  # may not use this file except in compliance with the License. You
@@ -24,7 +24,7 @@
24
24
 
25
25
  require 'rubygems'
26
26
 
27
- gem( "iyyov", "= 1.2.0" )
27
+ gem( "iyyov", "= 1.3.0" )
28
28
 
29
29
  require 'rjack-logback'
30
30
  RJack::Logback.config_console( :full => true, :thread => true )
data/lib/iyyov.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2013 David Kellum
2
+ # Copyright (c) 2010-2014 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
data/lib/iyyov/base.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2013 David Kellum
2
+ # Copyright (c) 2010-2014 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
@@ -16,5 +16,5 @@
16
16
 
17
17
  module Iyyov
18
18
  # Iyyov version
19
- VERSION = '1.2.0'
19
+ VERSION = '1.3.0'
20
20
  end
data/lib/iyyov/context.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2013 David Kellum
2
+ # Copyright (c) 2010-2014 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
@@ -125,11 +125,32 @@ module Iyyov
125
125
  nil
126
126
  end
127
127
 
128
+ # Load all executable *.rb files in the specified
129
+ # directory. Non-executable *.rb files are assumed temporarily
130
+ # disabled and are still watched for a ctime change. The
131
+ # directory itself is also watched for an mtime change (as in
132
+ # adding a new file).
133
+ def load_directory( dir )
134
+ @files[ dir ] = [ File.stat( dir ).mtime, nil ]
135
+
136
+ Dir.glob( File.join( dir, '*.rb' ) ) do |file|
137
+ fstat = File.stat( file )
138
+ if fstat.executable?
139
+ load_file( file )
140
+ else
141
+ # Still watch ctime on this file, so if it changes to executable
142
+ # we reload.
143
+ @files[ file ] = [ nil, fstat.ctime ]
144
+ end
145
+ end
146
+ end
147
+
128
148
  def load_file( file, is_root = false )
129
149
  @log.info { "Loading #{file}" }
130
150
  begin
151
+ fstat = File.stat( file )
152
+ @files[ file ] = [ fstat.mtime, fstat.ctime ]
131
153
  load file
132
- @files[ file ] = File.stat( file ).mtime
133
154
  @root_files << file if is_root
134
155
  true
135
156
  rescue SetupError, ScriptError, StandardError => e
@@ -155,14 +176,19 @@ module Iyyov
155
176
  return unless @watch_files && ! @files.empty?
156
177
  t = Task.new( :name => "watch-files", :period => 11.0 ) do
157
178
  reload = false
158
- @files.each do |fname, last_time|
179
+ @files.each do |fname, (last_mtime, last_ctime)|
159
180
  begin
160
- new_time = File.stat( fname ).mtime
161
- if new_time != last_time
181
+ fstat = File.stat( fname )
182
+ if last_mtime && ( last_mtime != fstat.mtime )
162
183
  @log.info { "#{fname} has new modification time, reloading." }
163
184
  reload = true
164
185
  break
165
186
  end
187
+ if last_ctime && ( last_ctime != fstat.ctime )
188
+ @log.info { "#{fname} has new change time, reloading." }
189
+ reload = true
190
+ break
191
+ end
166
192
  rescue Errno::ENOENT, Errno::EACCES => e
167
193
  @log.error( e.to_s )
168
194
  end
data/lib/iyyov/daemon.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2013 David Kellum
2
+ # Copyright (c) 2010-2014 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
data/lib/iyyov/errors.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2013 David Kellum
2
+ # Copyright (c) 2010-2014 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2013 David Kellum
2
+ # Copyright (c) 2010-2014 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2013 David Kellum
2
+ # Copyright (c) 2010-2014 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2013 David Kellum
2
+ # Copyright (c) 2010-2014 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
data/lib/iyyov/task.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2013 David Kellum
2
+ # Copyright (c) 2010-2014 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
data/test/setup.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2013 David Kellum
2
+ # Copyright (c) 2010-2014 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
data/test/test_context.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env jruby
2
2
  #.hashdot.profile += jruby-shortlived
3
3
  #--
4
- # Copyright (c) 2010-2013 David Kellum
4
+ # Copyright (c) 2010-2014 David Kellum
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License"); you
7
7
  # may not use this file except in compliance with the License. You
data/test/test_daemon.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env jruby
2
2
  #.hashdot.profile += jruby-shortlived
3
3
  #--
4
- # Copyright (c) 2010-2013 David Kellum
4
+ # Copyright (c) 2010-2014 David Kellum
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License"); you
7
7
  # may not use this file except in compliance with the License. You
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env jruby
2
2
  #.hashdot.profile += jruby-shortlived
3
3
  #--
4
- # Copyright (c) 2010-2013 David Kellum
4
+ # Copyright (c) 2010-2014 David Kellum
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License"); you
7
7
  # may not use this file except in compliance with the License. You
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iyyov
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: java
6
6
  authors:
7
7
  - David Kellum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-06 00:00:00.000000000 Z
11
+ date: 2014-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rjack-slf4j