naf 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,7 +45,16 @@ module Process::Naf
45
45
  # Sort log files based on time
46
46
  files = files.sort { |x, y| Time.parse(y.scan(DATE_REGEX).first) <=> Time.parse(x.scan(DATE_REGEX).first) }
47
47
 
48
- return files
48
+ today = Time.zone.now.to_date
49
+ old_files = []
50
+ files.each_with_index do |file, index|
51
+ if (today - Time.parse(file.scan(DATE_REGEX).first).to_date).to_i > LOG_RETENTION
52
+ old_files = files[index..-1]
53
+ break
54
+ end
55
+ end
56
+
57
+ return old_files
49
58
  end
50
59
 
51
60
  def creation_time
@@ -56,10 +65,8 @@ module Process::Naf
56
65
  copy_files
57
66
  today = Time.zone.now.to_date
58
67
  files.each do |file|
59
- if (today - Time.parse(file.scan(DATE_REGEX).first).to_date).to_i > LOG_RETENTION
60
- logger.info "Archived file: #{file}"
61
- `rm #{file}`
62
- end
68
+ logger.info "Archived file: #{file}"
69
+ `rm #{file}`
63
70
  end
64
71
  end
65
72
 
data/lib/naf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Naf
2
- VERSION = "2.0.3"
2
+ VERSION = "2.0.4"
3
3
  end
data/naf.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.name = "naf"
9
9
  s.version = Naf::VERSION
10
10
  s.license = 'New BSD License'
11
- s.date = '2014-01-07'
11
+ s.date = '2014-01-10'
12
12
  s.summary = "Creates infrastructure for a customizable and robust Postgres-backed script scheduling/running"
13
13
  s.description = "A cloud based distributed cron, application framework and operations console. Naf works as a distributed script running " +
14
14
  "system that provides scheduling, logging, alarming, machine redundancy, and the ability to set constraint during script execution"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-01-07 00:00:00.000000000 Z
15
+ date: 2014-01-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails