backup_cleaner 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,16 +1,14 @@
1
1
  = backup_cleaner
2
2
 
3
- Description goes here.
3
+ A simple command-line script to clean up old backups, leaving weekly and/or monthly backups for specified date ranges.
4
4
 
5
- == Note on Patches/Pull Requests
6
-
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
- * Send me a pull request. Bonus points for topic branches.
5
+ == Instructions
6
+
7
+ Install with:
8
+ gem install backup_cleaner
9
+
10
+ To view the help:
11
+ backup_cleaner --help
14
12
 
15
13
  == Copyright
16
14
 
data/Rakefile CHANGED
@@ -12,6 +12,7 @@ begin
12
12
  gem.authors = ["Brian Alexander"]
13
13
  gem.add_dependency "activesupport", ">= 3.0.0"
14
14
  gem.add_dependency "trollop", ">= 0"
15
+ gem.add_dependency "i18n", ">= 0"
15
16
  gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
16
17
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
18
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -1,63 +1,63 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{backup_cleaner}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Alexander"]
12
- s.date = %q{2010-10-09}
12
+ s.date = %q{2011-03-14}
13
13
  s.default_executable = %q{backup_cleaner}
14
14
  s.description = %q{A command-line script for cleaning up old backups}
15
15
  s.email = %q{balexand@gmail.com}
16
16
  s.executables = ["backup_cleaner"]
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE",
19
- "README.rdoc"
19
+ "README.rdoc"
20
20
  ]
21
21
  s.files = [
22
22
  ".document",
23
- ".gitignore",
24
- "LICENSE",
25
- "README.rdoc",
26
- "Rakefile",
27
- "VERSION",
28
- "backup_cleaner.gemspec",
29
- "bin/backup_cleaner",
30
- "lib/backup_cleaner.rb",
31
- "lib/backup_cleaner/cli.rb",
32
- "test/helper.rb",
33
- "test/test_backup_cleaner.rb"
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "backup_cleaner.gemspec",
28
+ "bin/backup_cleaner",
29
+ "lib/backup_cleaner.rb",
30
+ "lib/backup_cleaner/cli.rb",
31
+ "test/helper.rb",
32
+ "test/test_backup_cleaner.rb"
34
33
  ]
35
34
  s.homepage = %q{http://github.com/balexand/backup_cleaner}
36
- s.rdoc_options = ["--charset=UTF-8"]
37
35
  s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.3.7}
36
+ s.rubygems_version = %q{1.6.2}
39
37
  s.summary = %q{A command-line script for cleaning up old backups}
40
38
  s.test_files = [
41
39
  "test/helper.rb",
42
- "test/test_backup_cleaner.rb"
40
+ "test/test_backup_cleaner.rb"
43
41
  ]
44
42
 
45
43
  if s.respond_to? :specification_version then
46
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
44
  s.specification_version = 3
48
45
 
49
46
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
47
  s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
51
48
  s.add_runtime_dependency(%q<trollop>, [">= 0"])
49
+ s.add_runtime_dependency(%q<i18n>, [">= 0"])
52
50
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
53
51
  else
54
52
  s.add_dependency(%q<activesupport>, [">= 3.0.0"])
55
53
  s.add_dependency(%q<trollop>, [">= 0"])
54
+ s.add_dependency(%q<i18n>, [">= 0"])
56
55
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
57
56
  end
58
57
  else
59
58
  s.add_dependency(%q<activesupport>, [">= 3.0.0"])
60
59
  s.add_dependency(%q<trollop>, [">= 0"])
60
+ s.add_dependency(%q<i18n>, [">= 0"])
61
61
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
62
62
  end
63
63
  end
@@ -2,6 +2,7 @@ require 'active_support/time'
2
2
  require 'fileutils'
3
3
  require 'set'
4
4
 
5
+ # See backup_cleaner/cli for API documentation
5
6
  module BackupCleaner
6
7
  DATE_PATTERN = /^(.*)(\d{4}[-\.]\d{2}[-\.]\d{2})(.*)$/
7
8
 
@@ -55,6 +56,10 @@ module BackupCleaner
55
56
  end
56
57
  private_class_method :first_by_date_property
57
58
 
59
+ # Returns a unique number identifying the week that this date is a memeber of. If
60
+ # date d1 is in a later week than d2, then week_ordering_number(d1) > week_ordering_number(d2).
61
+ # If d1 is in the same week as d2, then week_ordering_number(d1) == week_ordering_number(d2).
62
+ # Week number for adjacent weeks are not guaranteed to be adjacent to one another.
58
63
  def self.week_ordering_number(date)
59
64
  # cweek considers weeks to start on Monday; adjust so week starts on Sunday
60
65
  date += 1.day if date.wday == 0
@@ -62,6 +67,7 @@ module BackupCleaner
62
67
  end
63
68
  private_class_method :week_ordering_number
64
69
 
70
+ # Like week_ordering_number except for month instead of week.
65
71
  def self.month_ordering_number(date)
66
72
  date.month + date.year * 100
67
73
  end
@@ -10,7 +10,7 @@ Cleans up backup files or folders within the specified folder. The names of thes
10
10
  in a format like: YYYY-MM-DD. Any files/folders with names not matching this pattern will be left untouched. Between \
11
11
  today and <days> days ago, all backups will be kept. Between today and <weeks> weeks ago, weekly backups will be kept. For \
12
12
  all time, monthly backups will be kept. For weekly/monthly backups, the earliest available backup from the week/month will \
13
- be kept. For example, if daily backups are present then weekly backups will be from Sunday and monthly backups will be from\
13
+ be kept. For example, if daily backups are present then weekly backups will be from Sunday and monthly backups will be from \
14
14
  the 1st of the month.
15
15
 
16
16
  This script can also handle backups from multiple projects in one directory as long as they are named differently. If files \
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup_cleaner
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- version: 1.0.0
4
+ prerelease:
5
+ version: 1.0.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - Brian Alexander
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-10-09 00:00:00 -07:00
13
+ date: 2011-03-14 00:00:00 +07:00
19
14
  default_executable: backup_cleaner
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,11 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 3
32
- - 0
33
- - 0
34
24
  version: 3.0.0
35
25
  type: :runtime
36
26
  version_requirements: *id001
@@ -42,26 +32,31 @@ dependencies:
42
32
  requirements:
43
33
  - - ">="
44
34
  - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
35
  version: "0"
49
36
  type: :runtime
50
37
  version_requirements: *id002
51
38
  - !ruby/object:Gem::Dependency
52
- name: thoughtbot-shoulda
39
+ name: i18n
53
40
  prerelease: false
54
41
  requirement: &id003 !ruby/object:Gem::Requirement
55
42
  none: false
56
43
  requirements:
57
44
  - - ">="
58
45
  - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
46
  version: "0"
63
- type: :development
47
+ type: :runtime
64
48
  version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: thoughtbot-shoulda
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ type: :development
59
+ version_requirements: *id004
65
60
  description: A command-line script for cleaning up old backups
66
61
  email: balexand@gmail.com
67
62
  executables:
@@ -73,7 +68,6 @@ extra_rdoc_files:
73
68
  - README.rdoc
74
69
  files:
75
70
  - .document
76
- - .gitignore
77
71
  - LICENSE
78
72
  - README.rdoc
79
73
  - Rakefile
@@ -89,8 +83,8 @@ homepage: http://github.com/balexand/backup_cleaner
89
83
  licenses: []
90
84
 
91
85
  post_install_message:
92
- rdoc_options:
93
- - --charset=UTF-8
86
+ rdoc_options: []
87
+
94
88
  require_paths:
95
89
  - lib
96
90
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -98,23 +92,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
92
  requirements:
99
93
  - - ">="
100
94
  - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
95
  version: "0"
105
96
  required_rubygems_version: !ruby/object:Gem::Requirement
106
97
  none: false
107
98
  requirements:
108
99
  - - ">="
109
100
  - !ruby/object:Gem::Version
110
- hash: 3
111
- segments:
112
- - 0
113
101
  version: "0"
114
102
  requirements: []
115
103
 
116
104
  rubyforge_project:
117
- rubygems_version: 1.3.7
105
+ rubygems_version: 1.6.2
118
106
  signing_key:
119
107
  specification_version: 3
120
108
  summary: A command-line script for cleaning up old backups
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC