oliver 2.2.2 → 2.3.0

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: 18052b82cc0b4636492f1bfb5ddf680a0da6201a
4
- data.tar.gz: eea31f3199d680d26e765ae70bc46eeee6692bb0
3
+ metadata.gz: dab3aaf89df3b265a927670055cf2c94e97f07d5
4
+ data.tar.gz: 54a12a48d5046fa4b1639f143775879636f3da63
5
5
  SHA512:
6
- metadata.gz: 00054f43d22ea612502b65d9756649707c26157f6e8a8a00be5d586268cc34a382c1f27c7f98cbbe492abea0413b4f6c64b51251a6f794b8c036b8c95d1bd8a5
7
- data.tar.gz: 0918db974a47210ca7d213a4cb527cb44b9f0fb9142597774cb63937bb8e491a2de07d59cb386042d9268a3d9e1c6426a12b90a43ec80f2a4d29448ea283de1b
6
+ metadata.gz: c6d07f6a59895912ee9c053218ea9b15b9e953e1f2cd2d452b32b250cdf90d2ecd07b3cc283c6062701f628aeceb82bd5ae0170a449977eae3ca21cdb9730f26
7
+ data.tar.gz: c5c3e23ecee75830a3171db3a554a973ed2c83004dacbe9800e518a5b54956e42a8279518344e699f98b70405d3b1f154d029bae4de9e9cfb2055eae288596a5
data/README.md CHANGED
@@ -44,15 +44,10 @@ and then add whatever you'd like to the file (write in JSON)
44
44
  ],
45
45
  "Braeden-Mayer": [
46
46
  "Top-Hat"
47
- ],
48
- "misc": [
49
- "https://exampleserver.com/repo"
50
47
  ]
51
48
  }
52
49
  ```
53
50
 
54
- - Use `Misc` for URLs that aren't hosted on GitHub
55
-
56
51
  ### Initializing the root
57
52
 
58
53
  Creates the base `.oliver` file
@@ -8,10 +8,26 @@ require_relative 'file_manager'
8
8
  module Oliver
9
9
  module_function
10
10
 
11
+ def get_local_repos
12
+ temp = []
13
+ temp = Dir.entries('.').reject do |f|
14
+ f['.'] || f['..'] || f[Oliver::NAME]
15
+ end
16
+ return temp.sort
17
+ end
18
+
19
+ def get_tracked_repos
20
+ temp = []
21
+ FileManager::BODY.map do |user, repo|
22
+ temp << repo
23
+ end
24
+ return temp.first.sort
25
+ end
26
+
11
27
  def init
12
28
  unless File.exists?(Oliver::NAME)
13
29
  File.open(Oliver::NAME, 'w') do |file|
14
- tempHash = { trommel: ["oliver"] }
30
+ tempHash = { probablyjosh: ["oliver"] }
15
31
  file.write(JSON.pretty_generate(tempHash))
16
32
  puts "#{Oliver::NAME} created sucessfully" if @options[:verbose]
17
33
  end
@@ -54,23 +70,18 @@ module Oliver
54
70
  end
55
71
  end
56
72
 
57
- dirRepos = Dir.entries('.').reject do |f|
58
- f['.'] || f['..'] || f[Oliver::NAME]
59
- end
60
- dirRepos.sort!
61
-
62
- trackedRepos ||= []
63
- FileManager::BODY.each do |user|
64
- user[1].each { |repo| trackedRepos << repo }
65
- end
66
- trackedRepos.sort!
73
+ dirRepos = get_local_repos
74
+ trackedRepos = get_tracked_repos
67
75
 
68
76
  unless dirRepos == trackedRepos
69
77
  dirRepos ||= []
70
78
  trackedRepos ||= []
71
79
  dirRepos -= trackedRepos
72
80
  unless dirRepos.empty?
73
- dirRepos.each { |dirRepo| FileUtils.rm_rf(dirRepo) }
81
+ dirRepos.each do |dirRepo|
82
+ puts "Removing #{dirRepo}" if @options[:verbose]
83
+ FileUtils.rm_rf(dirRepo)
84
+ end
74
85
  end
75
86
  end
76
87
 
@@ -78,17 +89,25 @@ module Oliver
78
89
  end
79
90
 
80
91
  def list
81
- unless FileManager::BODY.nil?
82
- FileManager::BODY.map do |user, repos|
83
- repos ||= []
84
- # Add silent shit later when it's actually working
85
- unless repos.empty?
86
- repos.each do |repo|
87
- if File.directory?(repo) then print '# ' else print '+ ' end # bugs
88
- puts repo
89
- end
90
- end
91
- end
92
+ dirRepos = get_local_repos
93
+ trackedRepos = get_tracked_repos
94
+
95
+ # If repo exists in
96
+ # - .oliver and in directory, print "#" (neutral)
97
+ # - only .oliver, print "+" (clone)
98
+ # - only directory, print "-" (remove)
99
+
100
+ # If repos and directories are identical, just print # next to repo name
101
+ dirRepos.each {|repo| puts "# #{repo}" } if dirRepos == trackedRepos
102
+
103
+ # If repo only exists in .oliver, print '+'
104
+ dirRepos.each do |repo|
105
+ puts "+ #{repo}" unless trackedRepos.include? repo
106
+ end
107
+
108
+ # If repo only exists in directory, print '-'
109
+ trackedRepos.each do |repo|
110
+ puts "- #{repo}" unless dirRepos.include? repo
92
111
  end
93
112
  end
94
113
 
@@ -1,8 +1,8 @@
1
1
  module Oliver
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 2
5
- PATCH = 2
4
+ MINOR = 3
5
+ PATCH = 0
6
6
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  end
8
8
  end
data/lib/oliver.rb CHANGED
@@ -65,21 +65,17 @@ module Oliver
65
65
  advice.map { |key, value| puts "#{key} \t#{value}" }
66
66
  end
67
67
 
68
- advice # return advice
68
+ advice # Return advice
69
69
  end
70
70
 
71
71
  def build(commands)
72
72
  require_relative 'oliver/commands'
73
73
  @command = @command.split(' ')
74
74
  case @command.first
75
- when 'init'
76
- init
77
- when 'install'
78
- install
79
- when 'list'
80
- list
81
- when 'pull', 'update'
82
- pull
75
+ when 'init' then init
76
+ when 'install' then install
77
+ when 'list' then list
78
+ when 'pull', 'update' then pull
83
79
  else end
84
80
  end
85
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oliver
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Trommel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-14 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler