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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da2ecaad510efd0abec8b967399cc325d08fab78
4
- data.tar.gz: 8fa51c10f1bb1e56ff2a46b90508686f1507ea16
3
+ metadata.gz: 977b37fc167692f38e32c3cb816c68fef4f2b601
4
+ data.tar.gz: fd4ddc47bf557a2994dccb2b3830700ee9c43855
5
5
  SHA512:
6
- metadata.gz: 570f3c5c3daee5435451f9925281fa13c83c73cede0b36d865e72623a9dcfbded4120145577353f96eeac9f9944252e000b71f3f02f1727d3a5fefca13e0aba7
7
- data.tar.gz: db67d9ff6e87210541f5edf4dadcac253f68fef756dfd2662025b11f20321cede08dc3c5e1e6559bc2c35e947265ec95fa679ce2d4ae5ad05b4da9a409ee07b1
6
+ metadata.gz: 7b266c44410c9c618b1b1a62a495fec8155ea759ebfd27cb8426dd4266f9516c0cfd074b7e99c34f7a887e295e1f39e34c21ae4aef8c50ac90bad6ca55b2e6bc
7
+ data.tar.gz: dd32bac98eba1c2732a5519cca1a5f16a69841888dd4f224a93ac46ea4aa16657b29c62f9fd691ae98c4683d15b087b658f228a16af6be9e62f9e53a163d23c0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oliver (1.5.3.7)
4
+ oliver (1.5.4.1)
5
5
  rainbow (>= 2.0.0)
6
6
 
7
7
  GEM
@@ -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
- if !File.file?(Name::OLIVER)
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
- puts "list repos currently in the Olivefile"
45
+ list
21
46
  when 'update'
22
- puts "pull updates from each tracked repo on the Olivefile"
47
+ update
23
48
  when 'add'
24
- puts "added #{ARGV[1]} to Olivefile"
49
+ add
25
50
  when 'remove'
26
- puts "removed #{ARGV[1]} from Olivefile"
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
- help if !File.file? Name::OLIVER
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
- %x(mv #{directory_thing} .backup)
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
 
@@ -1,3 +1,3 @@
1
1
  module Oliver
2
- VERSION = "1.5.4"
2
+ VERSION = "1.5.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oliver
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh