dafuq 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +3 -1
- data/bin/dafuq +3 -0
- data/lib/dafuq.rb +4 -0
- data/lib/dafuq/filesystem.rb +25 -0
- data/lib/dafuq/version.rb +1 -1
- metadata +3 -2
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Dafuq
|
2
2
|
|
3
|
-
|
3
|
+
dafuq is here to handle dafuq tasks required now and then, sometimes and often
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -21,6 +21,8 @@ Or install it yourself as:
|
|
21
21
|
DaFuq
|
22
22
|
|
23
23
|
'-notail', '--no-whitespace' : Dafuq::Code.notail no_whitespace_path, recurse
|
24
|
+
'-noswap', '--no-temp-files' : Dafuq::FileSystem.noswap no_swap_path, recurse
|
25
|
+
|
24
26
|
'-no-r', '--no-recurse' : non-recursive action in directories
|
25
27
|
|
26
28
|
'-v', '--verbose' : verbose
|
data/bin/dafuq
CHANGED
@@ -7,8 +7,11 @@ require 'dafuq'
|
|
7
7
|
if Arg0::Console.switch?(['-h', '--help'])
|
8
8
|
puts <<-DATA
|
9
9
|
DaFuq
|
10
|
+
v0.0.2
|
10
11
|
|
11
12
|
'-notail', '--no-whitespace' : Dafuq::Code.notail no_whitespace_path, recurse
|
13
|
+
'-noswap', '--no-temp-files' : Dafuq::FileSystem.noswap no_swap_path, recurse
|
14
|
+
|
12
15
|
'-no-r', '--no-recurse' : non-recursive action in directories
|
13
16
|
|
14
17
|
'-v', '--verbose' : verbose
|
data/lib/dafuq.rb
CHANGED
@@ -22,5 +22,9 @@ module Dafuq
|
|
22
22
|
Arg0::Console.value_for(['-notail', '--no-whitespace']).each do |no_whitespace_path|
|
23
23
|
Dafuq::Code.notail no_whitespace_path, recurse
|
24
24
|
end
|
25
|
+
|
26
|
+
Arg0::Console.value_for(['-noswap', '--no-temp-files']).each do |no_temp_path|
|
27
|
+
Dafuq::FileSystem.noswap no_temp_path, recurse
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Dafuq
|
2
|
+
module FileSystem
|
3
|
+
|
4
|
+
# 'remove Vi/Vim Backup/Swap *swp/swo/~ files, leftovers temporary'
|
5
|
+
def self.noswap(clean_path, recursive = true)
|
6
|
+
Dir.glob(File.expand_path(File.join clean_path, '*')).each do |fyl|
|
7
|
+
Dafuq.log_me "Encountered: #{fyl}"
|
8
|
+
if File.symlink? fyl
|
9
|
+
next
|
10
|
+
elsif File.directory?(fyl) && recursive
|
11
|
+
Dafuq.log_me "Looking in: #{fyl}"
|
12
|
+
noswap(fyl)
|
13
|
+
elsif fyl.match(/(\.sw[po]|~)$/)
|
14
|
+
begin
|
15
|
+
File.delete fyl
|
16
|
+
Dafuq.log_me "Deleting: #{fyl}"
|
17
|
+
rescue
|
18
|
+
Dafuq.log_me "ERROR Deleting: #{fyl}"
|
19
|
+
raise
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/dafuq/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dafuq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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-02-
|
12
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: arg0
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- dafuq.gemspec
|
46
46
|
- lib/dafuq.rb
|
47
47
|
- lib/dafuq/code.rb
|
48
|
+
- lib/dafuq/filesystem.rb
|
48
49
|
- lib/dafuq/version.rb
|
49
50
|
homepage: https://github.com/abhishekkr/dafuq
|
50
51
|
licenses: []
|