cron_wrapper 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -1,6 +1,7 @@
1
1
  Manifest
2
2
  Rakefile
3
3
  bin/cron_wrapper
4
+ cron_wrapper.gemspec
4
5
  lib/cron_wrapper.rb
5
6
  spec/cron_wrapper_spec.rb
6
7
  spec/spec_helper.rb
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('cron_wrapper', '0.0.5') do |p|
5
+ Echoe.new('cron_wrapper', '0.0.6') do |p|
6
6
  p.description = "A gem that provides useful features for running ruby or Rails scripts with cron"
7
7
  p.url = "http://rubyisbeautiful.com"
8
8
  p.author = "Bryan Taylor"
data/cron_wrapper.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{cron_wrapper}
5
- s.version = "0.0.5"
5
+ s.version = "0.0.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Bryan Taylor"]
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.email = %q{btaylor39 @nospam@ csc.com}
14
14
  s.executables = ["cron_wrapper"]
15
15
  s.extra_rdoc_files = ["bin/cron_wrapper", "lib/cron_wrapper.rb"]
16
- s.files = ["Manifest", "Rakefile", "bin/cron_wrapper", "lib/cron_wrapper.rb", "spec/cron_wrapper_spec.rb", "spec/spec_helper.rb", "cron_wrapper.gemspec"]
16
+ s.files = ["Manifest", "Rakefile", "bin/cron_wrapper", "cron_wrapper.gemspec", "lib/cron_wrapper.rb", "spec/cron_wrapper_spec.rb", "spec/spec_helper.rb"]
17
17
  s.homepage = %q{http://rubyisbeautiful.com}
18
18
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cron_wrapper"]
19
19
  s.require_paths = ["lib"]
data/lib/cron_wrapper.rb CHANGED
@@ -21,8 +21,8 @@ class CronWrapper
21
21
 
22
22
  # do options
23
23
  foo = OptionParser.new do |opts|
24
- opts.banner = "Usage: cron_wrapper [options] <script>\
25
- where script is the name (without file extension) of a file located in <root>/lib/cron
24
+ opts.banner = "Usage: cron_wrapper [options]
25
+ where script is the name (without file extension) of a file located by default in <root>/lib/cron
26
26
  Example:
27
27
  > pwd
28
28
  /home/projects/foo
@@ -31,6 +31,7 @@ class CronWrapper
31
31
  >cron_wrapper awesome_script
32
32
  "
33
33
 
34
+ opts.on("--wrap FILE", "file to run") { |o| @options[:target] = o }
34
35
  opts.on("--wrap-dry-run", "dry run (default: off)") { |o| @options[:dry_run] = o }
35
36
  opts.on("--wrap-skip-rails", "Do not try to load Rails (default: off)") { |o| @options[:skip_rails] = o }
36
37
  opts.on("--wrap-root DIR", "Root or working directory (default: .)") { |o| @options[:root] = o }
@@ -52,7 +53,7 @@ class CronWrapper
52
53
  end
53
54
 
54
55
  # if they did not enter a script name, then give them usage
55
- if ARGV[0].nil? or ARGV[0] == ''
56
+ if @options[:target].nil? or @options[:target] == ''
56
57
  puts foo.banner
57
58
  exit
58
59
  end
@@ -104,7 +105,7 @@ class CronWrapper
104
105
 
105
106
 
106
107
  def run
107
- base_name = ARGV[0]
108
+ base_name = @options[:target]
108
109
  target = File.join(@options[:root], "lib/cron/#{base_name}.rb")
109
110
  lock_file = File.join(@options[:lock_dir], "/#{base_name}.lock")
110
111
 
@@ -32,7 +32,7 @@ describe "cron_wrapper" do
32
32
 
33
33
 
34
34
  it "should create a lock file in lock_dir if no lock file exists" do
35
- t = Thread.new { `#{cmd} awesome_script --wrap-verbose --wrap-skip-rails --wrap-root #{root} --wrap-log log/awesome_script.log` }
35
+ t = Thread.new { `#{cmd} --wrap awesome_script --wrap-verbose --wrap-skip-rails --wrap-root #{root} --wrap-log log/awesome_script.log` }
36
36
  Timeout::timeout(2) do
37
37
  begin
38
38
  @pid = File.read "#{root}/tmp/locks/awesome_script.lock"
@@ -47,14 +47,14 @@ describe "cron_wrapper" do
47
47
 
48
48
 
49
49
  it "should remove the lock file in lock_dir after execution" do
50
- `#{cmd} awesome_script --wrap-skip-rails --wrap-root #{root} --wrap-log log/awesome_script.log`
50
+ `#{cmd} --wrap awesome_script --wrap-skip-rails --wrap-root #{root} --wrap-log log/awesome_script.log`
51
51
  File.exists?("tmp/locks/awesome_script.lock").should == false
52
52
  end
53
53
 
54
54
 
55
55
  it "should have the pid of the currently executing thread in the lock file" do
56
56
  read_pid = nil
57
- @pid = Process.fork { `#{cmd} awesome_script --wrap-verbose --wrap-skip-rails --wrap-root #{root} --wrap-log log/awesome_script.log` }
57
+ @pid = Process.fork { `#{cmd} --wrap awesome_script --wrap-verbose --wrap-skip-rails --wrap-root #{root} --wrap-log log/awesome_script.log` }
58
58
 
59
59
  begin
60
60
  read_pid = File.read "#{root}/tmp/locks/awesome_script.lock"
data.tar.gz.sig CHANGED
@@ -1 +1,4 @@
1
- bsz��cOlRc��'��N�O��TF��e��^ w��@�ECZ']����P�9����:�D���ab���yyՐ��-"��6���a��� zmpeB������W�Q/)�%��dƲzDX�4P����%�Q�vҢ�XIU�>�2����`tlf۝��S�����QWQS3?h) �P�~v�"9����G�@�HPx����#d���^sAK�Mi� J?Z��yt��{Brn�?T�k2B N�h6�P�
1
+ bO�*�x�gn�8��ΜA�Ѐ�͌�N>db�\pL7����Z6my���+�,�s�wL�XOh��� D^���&��c5�#��a
2
+ %8�9�40�Źy�
3
+ ;9�i5*l��!C���[/�5U/����yn��Y�[�,��V�i� ɐ�8�d��H\`S ۘ ]�"�����f*��
4
+ ������gH�܇�\��9� �h�@Q��o@����]I:�~��)d�lO�Ȃd��IJ�z��m;��Kg<. ���'�
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cron_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bryan Taylor
@@ -53,10 +53,10 @@ files:
53
53
  - Manifest
54
54
  - Rakefile
55
55
  - bin/cron_wrapper
56
+ - cron_wrapper.gemspec
56
57
  - lib/cron_wrapper.rb
57
58
  - spec/cron_wrapper_spec.rb
58
59
  - spec/spec_helper.rb
59
- - cron_wrapper.gemspec
60
60
  has_rdoc: true
61
61
  homepage: http://rubyisbeautiful.com
62
62
  licenses: []
metadata.gz.sig CHANGED
Binary file