silver_spurs 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,8 +6,8 @@ module SilverSpurs
6
6
  include Singleton
7
7
  extend SingleForwardable
8
8
 
9
- attr_writer :base_path, :timeout
10
- def_delegators :instance, :has_lock?, :base_path, :base_path=, :timeout=, :timeout, :spawn_process, :has_lock?, :success?, :get_log, :reap_orphaned_lock, :reap_process, :reap_old_process, :exists?
9
+ attr_writer :base_path, :timeout, :logger
10
+ def_delegators :instance, :has_lock?, :base_path, :base_path=, :timeout=, :timeout, :spawn_process, :has_lock?, :success?, :get_log, :reap_orphaned_lock, :reap_process, :reap_old_process, :exists?, :logger=
11
11
 
12
12
  def timeout
13
13
  @timeout ||= 60 * 60
@@ -17,9 +17,18 @@ module SilverSpurs
17
17
  @base_path ||= './silver_spurs_async'
18
18
  end
19
19
 
20
+ def logger
21
+ unless @logger
22
+ @logger = Logger.new(STDERR)
23
+ @logger.level = Logger::DEBUG
24
+ end
25
+ @logger
26
+ end
27
+
20
28
  def spawn_process(process_name, command)
21
29
  create_directory_tree
22
- logged_command = "#{command} &> #{log_file_path process_name} && touch #{success_file_path process_name}"
30
+ logged_command = "#{command} 1> #{log_file_path process_name} 2>&1 && touch #{success_file_path process_name}"
31
+ logger.debug "Executing: #{logger_command}"
23
32
  pid = Process.spawn logged_command
24
33
  File.open(pid_file_path(process_name), 'wb') { |f| f.write pid }
25
34
  Process.detach pid
@@ -1,3 +1,3 @@
1
1
  module SilverSpurs
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: silver_spurs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-20 00:00:00.000000000 Z
12
+ date: 2013-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra