gill 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -0
- data/gill.gemspec +2 -1
- data/lib/gill/remove.rb +26 -18
- data/lib/gill/version.rb +1 -1
- metadata +3 -2
data/.bundle/config
ADDED
data/gill.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gill}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dustin Willis Webber"]
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
"README.rdoc"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
|
+
".bundle/config",
|
22
23
|
".document",
|
23
24
|
".gitignore",
|
24
25
|
".specopts",
|
data/lib/gill/remove.rb
CHANGED
@@ -1,58 +1,66 @@
|
|
1
1
|
module Gill
|
2
2
|
|
3
3
|
class Remove
|
4
|
-
|
4
|
+
|
5
5
|
def initialize(type,folder)
|
6
|
-
|
6
|
+
|
7
7
|
@type = type
|
8
8
|
@folder = folder
|
9
9
|
@cache = GILL_CONFIG[:cache]
|
10
10
|
@source = GILL_CONFIG[:source]
|
11
|
-
|
11
|
+
|
12
12
|
end
|
13
13
|
|
14
14
|
def remove_cache
|
15
|
-
|
15
|
+
|
16
16
|
old_cache = YAML.load_file(@cache)
|
17
|
-
|
17
|
+
|
18
18
|
if old_cache[:"#{@type}"]
|
19
19
|
old_cache[:"#{@type}"].delete(:"#{@folder}")
|
20
|
-
|
20
|
+
|
21
21
|
if old_cache[:"#{@type}"].empty?
|
22
22
|
old_cache.delete(:"#{@type}")
|
23
23
|
Gill::Config.rebuild_cache(@cache, old_cache)
|
24
24
|
return true
|
25
|
-
|
25
|
+
|
26
26
|
else
|
27
|
-
|
27
|
+
|
28
28
|
Gill::Config.rebuild_cache(@cache, old_cache)
|
29
29
|
return false
|
30
|
-
|
30
|
+
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
def remove_repo
|
37
|
-
|
37
|
+
|
38
38
|
type_folder = "#{@source}/#{@type}"
|
39
39
|
folder = "#{@source}/#{@type}/#{@folder}"
|
40
|
-
|
40
|
+
|
41
41
|
if File.directory?(type_folder) && File.directory?(folder) && !YAML.load_file(@cache).empty?
|
42
|
-
|
42
|
+
|
43
43
|
if YAML.load_file(@cache)[:"#{@type}"][:"#{@folder}"]
|
44
44
|
STDERR.puts "Removing: #{@type} => " + "#{@folder}".foreground(:red)
|
45
45
|
FileUtils.rm_rf(folder)
|
46
|
+
if remove_cache
|
47
|
+
STDERR.puts "Reviewing folder #{@type}.".foreground(:green)
|
48
|
+
if Dir.enum_for(:foreach, type_folder).any? {|n| /\A\.\.?\z/ !~ n}
|
49
|
+
STDERR.puts "Skipping folder #{@type} - directory not empty.".foreground(:green)
|
50
|
+
else
|
51
|
+
STDERR.puts "Removing folder #{@type} - directory empty.".foreground(:green)
|
52
|
+
FileUtils.rm_rf(type_folder)
|
53
|
+
end
|
54
|
+
end
|
46
55
|
STDERR.puts "Repository Removed Successfully.".foreground(:green)
|
47
56
|
STDERR.puts "Updating Gill Cache...".foreground(:green)
|
48
|
-
FileUtils.rm_rf(type_folder) if remove_cache
|
49
57
|
end
|
50
|
-
|
58
|
+
|
51
59
|
else
|
52
|
-
|
60
|
+
|
53
61
|
STDERR.puts "The directory #{@source}/#{@type}/#{@folder} does not exist or was not cloned with gill."
|
54
|
-
|
55
|
-
end
|
62
|
+
|
63
|
+
end
|
56
64
|
end
|
57
65
|
|
58
66
|
end
|
data/lib/gill/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Dustin Willis Webber
|
@@ -82,6 +82,7 @@ extra_rdoc_files:
|
|
82
82
|
- LICENSE
|
83
83
|
- README.rdoc
|
84
84
|
files:
|
85
|
+
- .bundle/config
|
85
86
|
- .document
|
86
87
|
- .gitignore
|
87
88
|
- .specopts
|