yafr 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Mjc4MWYxNmYxZGU1YmZhNjE3NzhjMmQ4YzE5NmFkZjI3ZDU1MjRhYw==
4
+ MGY2NTFlMTcwMzU4MWVkNjQzNjJlYTM5Yjk3OTc4Y2Y2YTBjYjNiMg==
5
5
  data.tar.gz: !binary |-
6
- NTgyNWE2NzdmNjJiZjI4MWQ1YjY1NDdkNjg2MTM4Zjg3ZTMzMTc3MA==
6
+ ODAwNDE5Nzg2ZjExMTMyZWIxODhlNWQ3ODY2ZDE4MTE5ZWQ3Y2QwMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTVhNWE3ZWNiZjJjYzRhZWU2ZWEzZjlkYTlmZmIwMjE3ZmNmOTE3MTUzZmI0
10
- MTUyNmQ0NDkxZmQ1Y2RhZTg3NWYwMThiMTIwYzhlZTBlZGY4YjVhNzZhOTEx
11
- OWJlZDkzM2FhNjRmYzM1M2RmNDcwODJmZDJhN2RkOWE5YmZjNmU=
9
+ MTI0ZTI0Y2E1ODNhMzdlYmU5MDYzMDc5YjYyNTg1NDU0YThkNDNiNzliNTNk
10
+ ODQwN2RlYjNlNTQ5NDA0NTUwNWI0MzUwN2QzNzlkNDA3OTAxMmY3ZWZiYzgx
11
+ YzExMTNmNTUyYjBhZjdkMjAzNTUzMmExODRjNTQ4ZTc2MWI1YjY=
12
12
  data.tar.gz: !binary |-
13
- ZjE4OGVkZTI1MjI4ODBhOGI3NGQzODdhNDc0NTQwZjFmMjljZDIxYWZlY2Qz
14
- ZWEwMWM0OTViZTM0M2E2ZGQyMDQ3YzAxODYxOTI4ZDNhMmJiYzM0ZTI5YjFh
15
- OWI3YzNlMDgzZjIxNzY4NjM5NWVkZmU5YTIzYjFmN2IwZjUxOTc=
13
+ Yzc2MGRlZTY2OTJkZjZkYmYwNWQyNDA1MjY0ODc1YWJiNDNlMjg3YzFkMjM4
14
+ YjMxNTNhMmRjNTI0ZThhNmJkMGMxODE3YTExOTdiNmViZGFlZjczZTFlN2Ix
15
+ ODMyY2I1ZTljZGU0ZjBiZjM5YjVkNDY2ODU5MThhMjY2MWQ4Njk=
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # YAFR
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/yafr.png)](http://badge.fury.io/rb/yafr)
4
+
3
5
  Yet Another File Remover.
4
6
 
5
7
  YAFR (pronounce like wafer) is a command line tool for improve the file removing. It is in very alpha version, so I didn't really know what it will do someday (and when it does, be sure that will be here). Keep in track of the [issues list](https://github.com/kelvinst/yafr/issues) to keep up with the planned and the new features.
data/bin/yafr ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
4
+
5
+ require "yafr"
6
+ require "yafr/version"
7
+ require "mercenary"
8
+
9
+ Mercenary.program(:yafr) do |p|
10
+ p.version Yafr::VERSION
11
+ p.description 'yafr is a CLI for removing like a hacker'
12
+
13
+ p.command(:regex) do |c|
14
+ c.syntax "yafr regex REGEX"
15
+ c.description "Delete all files that the name match REGEX"
16
+
17
+ c.action do |args, options|
18
+ Yafr.by_regex(args[0])
19
+ end
20
+ end
21
+ end
data/lib/yafr.rb CHANGED
@@ -1,5 +1,8 @@
1
- require "yafr/version"
2
-
3
1
  module Yafr
4
- # Your code goes here...
2
+ def self.by_regex(regex)
3
+ directories, files = Dir["**/*"].select { |f| f.match regex }.partition { |f| File.directory? f }
4
+
5
+ File.delete(*files)
6
+ directories.reverse_each { |dir| Dir.rmdir(dir) }
7
+ end
5
8
  end
data/lib/yafr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yafr
2
- VERSION = "0.0.0"
2
+ VERSION = "0.0.1"
3
3
  end
data/yafr.gemspec CHANGED
@@ -14,10 +14,12 @@ Gem::Specification.new do |spec|
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.executables = ["yafr"]
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_runtime_dependency "mercenary", "~> 0.2"
22
+
21
23
  spec.add_development_dependency "bundler", "~> 1.3"
22
24
  spec.add_development_dependency "rake"
23
25
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yafr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelvin Raffael Stinghen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-30 00:00:00.000000000 Z
11
+ date: 2013-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mercenary
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.2'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -41,7 +55,8 @@ dependencies:
41
55
  description: Yet Another File Remover
42
56
  email:
43
57
  - kelvin.stinghen@gmail.com
44
- executables: []
58
+ executables:
59
+ - yafr
45
60
  extensions: []
46
61
  extra_rdoc_files: []
47
62
  files:
@@ -50,6 +65,7 @@ files:
50
65
  - LICENSE.txt
51
66
  - README.md
52
67
  - Rakefile
68
+ - bin/yafr
53
69
  - lib/yafr.rb
54
70
  - lib/yafr/version.rb
55
71
  - yafr.gemspec