cleaner 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Cleaner
1
+ # Cleaner [![Build Status](https://secure.travis-ci.org/wijet/cleaner.png)](http://travis-ci.org/wijet/cleaner)
2
2
  ---
3
3
 
4
4
  Tool for automatic management of directories on your disk with simple DSL.
data/Rakefile CHANGED
@@ -1 +1,9 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ task :default => :spec
5
+
6
+ desc "Run specs"
7
+ RSpec::Core::RakeTask.new do |t|
8
+ t.rspec_opts = %w(-fs --color)
9
+ end
data/cleaner.gemspec CHANGED
@@ -26,6 +26,7 @@ desc
26
26
  s.add_dependency "thor"
27
27
  s.add_dependency "daemons"
28
28
  s.add_development_dependency "rspec"
29
+ s.add_development_dependency "rake"
29
30
  s.add_development_dependency "simplecov"
30
31
  s.add_development_dependency "timecop"
31
32
  if RUBY_PLATFORM =~ /darwin/
@@ -2,7 +2,7 @@ module Cleaner
2
2
  module Actions
3
3
  class Delete < Action
4
4
  def execute
5
- FileUtils.rm(files)
5
+ FileUtils.rm_rf(files)
6
6
  end
7
7
  end
8
8
  end
@@ -8,8 +8,11 @@ module Cleaner
8
8
  end
9
9
 
10
10
  def path_without_ext
11
- pathname = Pathname.new(path)
12
- pathname.sub_ext("").to_s
11
+ File.join(File.dirname(path), name_without_ext)
12
+ end
13
+
14
+ def name_without_ext
15
+ name.chomp(File.extname(name))
13
16
  end
14
17
  end
15
18
  end
@@ -1,3 +1,3 @@
1
1
  module Cleaner
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -18,6 +18,13 @@ describe Cleaner::Actions::Delete do
18
18
  File.exists?('bar').should be_false
19
19
  end
20
20
 
21
+ # FakeFS doesn't support proper behavior for FileUtils#rm_rf
22
+ # it's just an alias for FileUtils#rm
23
+ it "should use rm_rf for deleting" do
24
+ FileUtils.should_receive(:rm_rf)
25
+ delete.execute
26
+ end
27
+
21
28
  it "should leave other files" do
22
29
  delete.execute
23
30
  File.exists?('b.txt').should be_true
@@ -4,6 +4,7 @@ describe Cleaner::FileExtension do
4
4
  before do
5
5
  example_dir '/foo' do
6
6
  touch 'bar.txt'
7
+ touch 'bar.txt.zip'
7
8
  end
8
9
  end
9
10
 
@@ -20,4 +21,14 @@ describe Cleaner::FileExtension do
20
21
  file.path_without_ext.should == "/foo/bar"
21
22
  end
22
23
  end
24
+
25
+ describe "#name_without_ext" do
26
+ it "should return file name without last extension" do
27
+ file.name_without_ext.should == "bar"
28
+
29
+ file = File.new("/foo/bar.txt.zip")
30
+ file.extend(Cleaner::FileExtension)
31
+ file.name_without_ext.should == "bar.txt"
32
+ end
33
+ end
23
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70196097750240 !ruby/object:Gem::Requirement
16
+ requirement: &70311852171740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.3.14
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70196097750240
24
+ version_requirements: *70311852171740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: filelist
27
- requirement: &70196097749820 !ruby/object:Gem::Requirement
27
+ requirement: &70311852171320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70196097749820
35
+ version_requirements: *70311852171320
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: thor
38
- requirement: &70196097749360 !ruby/object:Gem::Requirement
38
+ requirement: &70311852187220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70196097749360
46
+ version_requirements: *70311852187220
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: daemons
49
- requirement: &70196097748940 !ruby/object:Gem::Requirement
49
+ requirement: &70311852186800 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70196097748940
57
+ version_requirements: *70311852186800
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &70196097748520 !ruby/object:Gem::Requirement
60
+ requirement: &70311852186380 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,21 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70196097748520
68
+ version_requirements: *70311852186380
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: &70311852185960 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70311852185960
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: simplecov
71
- requirement: &70196097748100 !ruby/object:Gem::Requirement
82
+ requirement: &70311852185540 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: '0'
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *70196097748100
90
+ version_requirements: *70311852185540
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: timecop
82
- requirement: &70196097747680 !ruby/object:Gem::Requirement
93
+ requirement: &70311852185120 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ! '>='
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: '0'
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *70196097747680
101
+ version_requirements: *70311852185120
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: rb-fsevent
93
- requirement: &70196097747220 !ruby/object:Gem::Requirement
104
+ requirement: &70311852184660 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ! '>='
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: '0'
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *70196097747220
112
+ version_requirements: *70311852184660
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: ruby_gntp
104
- requirement: &70196097746800 !ruby/object:Gem::Requirement
115
+ requirement: &70311852184240 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ! '>='
@@ -109,7 +120,7 @@ dependencies:
109
120
  version: '0'
110
121
  type: :development
111
122
  prerelease: false
112
- version_requirements: *70196097746800
123
+ version_requirements: *70311852184240
113
124
  description: ! " Cleaner is a small tool which helps you keep your directories clean.\n
114
125
  \ With simple DSL you define set of rules, which are then periodically executed
115
126
  against specified directory.\n"
@@ -122,6 +133,7 @@ extra_rdoc_files: []
122
133
  files:
123
134
  - .gitignore
124
135
  - .rspec
136
+ - .travis.yml
125
137
  - Gemfile
126
138
  - Guardfile
127
139
  - LICENSE