cron_wrapper 0.0.7 → 0.0.8

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/Manifest CHANGED
@@ -1,6 +1,8 @@
1
1
  Manifest
2
2
  Rakefile
3
3
  bin/cron_wrapper
4
+ cron_wrapper.gemspec
5
+ lib/cron/foo.rb
4
6
  lib/cron_wrapper.rb
5
7
  spec/cron_wrapper_spec.rb
6
8
  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.7') do |p|
5
+ Echoe.new('cron_wrapper', '0.0.8') 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.7"
5
+ s.version = "0.0.8"
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"]
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  s.description = %q{A gem that provides useful features for running ruby or Rails scripts with cron}
13
13
  s.email = %q{btaylor39 @nospam@ csc.com}
14
14
  s.executables = ["cron_wrapper"]
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"]
15
+ s.extra_rdoc_files = ["bin/cron_wrapper", "lib/cron/foo.rb", "lib/cron_wrapper.rb"]
16
+ s.files = ["Manifest", "Rakefile", "bin/cron_wrapper", "cron_wrapper.gemspec", "lib/cron/foo.rb", "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/foo.rb ADDED
@@ -0,0 +1 @@
1
+ puts "foo: #{ARGV}"
data/lib/cron_wrapper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'optparse'
2
2
  require 'logger'
3
3
  require 'fileutils'
4
-
4
+ require 'pp'
5
5
  class CronWrapper
6
6
 
7
7
  attr_reader :logger
@@ -9,13 +9,14 @@ class CronWrapper
9
9
 
10
10
  def initialize(*args)
11
11
  @options = {}
12
- @options[:skip_rails] = false
12
+ @options[:rails] = false
13
13
  @options[:root] = '.'
14
14
  @options[:lock_dir] = nil
15
15
  @options[:dry_run] = false
16
16
  @options[:silent] = false
17
17
  @options[:verbose] = false
18
18
  @options[:log] = nil
19
+ @options[:target] = nil
19
20
 
20
21
  @others = []
21
22
 
@@ -33,7 +34,7 @@ class CronWrapper
33
34
 
34
35
  opts.on("--wrap FILE", "file to run") { |o| @options[:target] = o }
35
36
  opts.on("--wrap-dry-run", "dry run (default: off)") { |o| @options[:dry_run] = o }
36
- opts.on("--wrap-skip-rails", "Do not try to load Rails (default: off)") { |o| @options[:skip_rails] = o }
37
+ opts.on("--wrap-rails", "Try to load Rails (default: off)") { |o| @options[:rails] = o }
37
38
  opts.on("--wrap-root DIR", "Root or working directory (default: .)") { |o| @options[:root] = o }
38
39
  opts.on("--wrap-lock_dir DIR", "Lock dir (default: <root>/tmp/locks)") { |o| @options[:lock_dir] = o }
39
40
  opts.on("--wrap-log FILE", "log file relative to root (default: STDOUT)") { |o| @options[:log] = o }
@@ -47,7 +48,7 @@ class CronWrapper
47
48
  end
48
49
 
49
50
  begin
50
- foo.parse!
51
+ foo.order!
51
52
  rescue OptionParser::InvalidOption => e
52
53
  @others << e.args
53
54
  end
@@ -60,7 +61,7 @@ class CronWrapper
60
61
 
61
62
 
62
63
  # Setup rails
63
- if !@options[:skip_rails]
64
+ if @options[:rails]
64
65
  libs = [ File.join(@options[:root],'config/environment.rb') ]
65
66
  libs.each do |lib|
66
67
  begin
@@ -127,6 +128,7 @@ class CronWrapper
127
128
 
128
129
  # Load target script
129
130
  begin
131
+ @others.flatten!
130
132
  @others.each_with_index do |arg, index|
131
133
  ARGV[index] = arg
132
134
  end
@@ -136,6 +138,7 @@ class CronWrapper
136
138
  logger.fatal "#{target} failed to load via cron_wrapper"
137
139
  logger.info e.message
138
140
  logger.debug e.backtrace
141
+ ensure
139
142
  FileUtils.rm_f lock_file
140
143
  end
141
144
 
data.tar.gz.sig CHANGED
Binary file
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: 17
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bryan Taylor
@@ -48,15 +48,17 @@ extensions: []
48
48
 
49
49
  extra_rdoc_files:
50
50
  - bin/cron_wrapper
51
+ - lib/cron/foo.rb
51
52
  - lib/cron_wrapper.rb
52
53
  files:
53
54
  - Manifest
54
55
  - Rakefile
55
56
  - bin/cron_wrapper
57
+ - cron_wrapper.gemspec
58
+ - lib/cron/foo.rb
56
59
  - lib/cron_wrapper.rb
57
60
  - spec/cron_wrapper_spec.rb
58
61
  - spec/spec_helper.rb
59
- - cron_wrapper.gemspec
60
62
  has_rdoc: true
61
63
  homepage: http://rubyisbeautiful.com
62
64
  licenses: []
metadata.gz.sig CHANGED
Binary file