gitkeep 0.2.0 → 0.2.1
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/lib/gitkeep.rb +24 -8
- metadata +2 -2
data/lib/gitkeep.rb
CHANGED
@@ -15,20 +15,23 @@ class Gitkeep
|
|
15
15
|
return false
|
16
16
|
end
|
17
17
|
|
18
|
-
puts "creating files..."
|
18
|
+
puts "gitkeep is creating files..."
|
19
19
|
|
20
20
|
ignores = ['.git']
|
21
21
|
|
22
22
|
Find.find(path) do |p|
|
23
23
|
name = File.basename(p)
|
24
24
|
if File.directory?(p)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
if File.readable?(p)
|
26
|
+
if ignores.include?(name)
|
27
|
+
Find.prune
|
28
|
+
else
|
29
|
+
if Dir.entries(p).size == 2
|
30
|
+
createFile(p)
|
31
|
+
end
|
31
32
|
end
|
33
|
+
else
|
34
|
+
puts red("[error] could not READ in #{p}/ -> check permissions")
|
32
35
|
end
|
33
36
|
end
|
34
37
|
end
|
@@ -40,6 +43,12 @@ class Gitkeep
|
|
40
43
|
|
41
44
|
def createFile(path)
|
42
45
|
gitkeep = "#{path}/.gitkeep"
|
46
|
+
|
47
|
+
unless File.writable?(path)
|
48
|
+
puts red("[error] could not WRITE in #{path}/ -> check permissions")
|
49
|
+
return false
|
50
|
+
end
|
51
|
+
|
43
52
|
unless File.exists?(gitkeep)
|
44
53
|
unless @dryrun
|
45
54
|
f = File.new(gitkeep, "w+")
|
@@ -48,7 +57,10 @@ class Gitkeep
|
|
48
57
|
else
|
49
58
|
puts blue("[dryrun] created #{gitkeep}")
|
50
59
|
end
|
51
|
-
end
|
60
|
+
end
|
61
|
+
|
62
|
+
@filecount += 1
|
63
|
+
|
52
64
|
end
|
53
65
|
|
54
66
|
private
|
@@ -61,6 +73,10 @@ class Gitkeep
|
|
61
73
|
colorize(text, 32)
|
62
74
|
end
|
63
75
|
|
76
|
+
def red(text)
|
77
|
+
colorize(text, 31)
|
78
|
+
end
|
79
|
+
|
64
80
|
def blue(text)
|
65
81
|
colorize(text, 36)
|
66
82
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitkeep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
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: 2012-08-
|
12
|
+
date: 2012-08-18 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: create .gitkeep files in all empty directories in your project
|
15
15
|
email: arthurz.mobile@gmail.com
|