oliver 1.5.4 → 1.5.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/oliver/arguments.rb +39 -15
- data/lib/oliver/main.rb +22 -2
- data/lib/oliver/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 977b37fc167692f38e32c3cb816c68fef4f2b601
|
4
|
+
data.tar.gz: fd4ddc47bf557a2994dccb2b3830700ee9c43855
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b266c44410c9c618b1b1a62a495fec8155ea759ebfd27cb8426dd4266f9516c0cfd074b7e99c34f7a887e295e1f39e34c21ae4aef8c50ac90bad6ca55b2e6bc
|
7
|
+
data.tar.gz: dd32bac98eba1c2732a5519cca1a5f16a69841888dd4f224a93ac46ea4aa16657b29c62f9fd691ae98c4683d15b087b658f228a16af6be9e62f9e53a163d23c0
|
data/Gemfile.lock
CHANGED
data/lib/oliver/arguments.rb
CHANGED
@@ -1,3 +1,37 @@
|
|
1
|
+
def argument?(argument_number)
|
2
|
+
help if ARGV[argument_number].nil?
|
3
|
+
end
|
4
|
+
|
5
|
+
def init
|
6
|
+
if !File.file?(Name::OLIVER)
|
7
|
+
File.open(Name::OLIVER, 'w') do |file|
|
8
|
+
file.write("repos:\n")
|
9
|
+
file.write(" - \"trommel/oliver\"\n")
|
10
|
+
puts "#{Rainbow(Name::OLIVER).green} has been created."
|
11
|
+
end
|
12
|
+
else
|
13
|
+
puts "#{Rainbow(Name::OLIVER).red} already exists."
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def list
|
18
|
+
puts "list repos currently in the Olivefile"
|
19
|
+
end
|
20
|
+
|
21
|
+
def update
|
22
|
+
puts "pull updates from each tracked repo on the Olivefile"
|
23
|
+
end
|
24
|
+
|
25
|
+
def add
|
26
|
+
argument?(1)
|
27
|
+
puts "added #{Rainbow(ARGV[1]).green} to #{Rainbow('Olivefile').green}."
|
28
|
+
end
|
29
|
+
|
30
|
+
def remove
|
31
|
+
argument?(1)
|
32
|
+
puts "removed #{Rainbow(ARGV[1]).red} from #{Rainbow('Olivefile').green}."
|
33
|
+
end
|
34
|
+
|
1
35
|
# Different arguments
|
2
36
|
# (Make this into a case statement asap)
|
3
37
|
# (It'll be way easier and cleaner to work with later)
|
@@ -6,27 +40,17 @@ def different_arguments
|
|
6
40
|
when 'install'
|
7
41
|
run_main
|
8
42
|
when 'init'
|
9
|
-
|
10
|
-
File.open(Name::OLIVER, 'w') do |file|
|
11
|
-
file.write("repos:\n")
|
12
|
-
file.write(" - \"trommel/oliver\"\n")
|
13
|
-
puts "#{Rainbow(Name::OLIVER).green} has been created."
|
14
|
-
end
|
15
|
-
else
|
16
|
-
puts "#{Rainbow(Name::OLIVER).red} already exists."
|
17
|
-
end
|
18
|
-
exit
|
43
|
+
init
|
19
44
|
when 'list'
|
20
|
-
|
45
|
+
list
|
21
46
|
when 'update'
|
22
|
-
|
47
|
+
update
|
23
48
|
when 'add'
|
24
|
-
|
49
|
+
add
|
25
50
|
when 'remove'
|
26
|
-
|
51
|
+
remove
|
27
52
|
when '-v' || '--version'
|
28
53
|
puts "#{Rainbow('oliver').red} #{Rainbow("v#{Oliver::VERSION}").green}"
|
29
|
-
exit
|
30
54
|
when '-h' || '--help'
|
31
55
|
help
|
32
56
|
else
|
data/lib/oliver/main.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Main oliver file
|
2
2
|
def run_main
|
3
|
-
|
3
|
+
if !File.file? Name::OLIVER
|
4
|
+
puts "#{Rainbow('Olivefile').red} does not exist."
|
5
|
+
init
|
6
|
+
end
|
4
7
|
|
5
8
|
# Back up your files, man
|
6
9
|
if !File.directory?('.backup')
|
@@ -11,7 +14,18 @@ def run_main
|
|
11
14
|
# (that's probably totally untrue)
|
12
15
|
body = File.read(Name::OLIVER.chomp)
|
13
16
|
final = YAML.load("---\n#{body}\n---")
|
17
|
+
|
18
|
+
# Fix this ASAP
|
19
|
+
if final["repos"].nil?
|
20
|
+
message = "This will normally return a bug, so I'm just not going to do it.
|
21
|
+
You have an empty repos list, though, and that's what's causing this bug.
|
22
|
+
Try adding something to the list for the time being."
|
23
|
+
puts Rainbow(message).red
|
24
|
+
exit
|
25
|
+
end
|
26
|
+
|
14
27
|
listed_repos = []
|
28
|
+
|
15
29
|
final["repos"].each do |what|
|
16
30
|
listed_repos.push(what)
|
17
31
|
end
|
@@ -42,7 +56,13 @@ def run_main
|
|
42
56
|
# in `Name::OLIVER`, move it to .backup
|
43
57
|
current_repos.each do |directory_thing|
|
44
58
|
if !listed_repos.to_s.include? directory_thing
|
45
|
-
|
59
|
+
if !File.directory?(directory_thing)
|
60
|
+
%x(mv #{directory_thing} .backup)
|
61
|
+
else
|
62
|
+
backup_color = Rainbow('.backup/').red
|
63
|
+
repo_color = Rainbow(repo).red
|
64
|
+
puts "There was an error moving #{repo_color}/ to #{backup_color}"
|
65
|
+
end
|
46
66
|
end
|
47
67
|
end
|
48
68
|
|
data/lib/oliver/version.rb
CHANGED