oliver 1.5.4.1 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -0
- data/README.md +14 -2
- data/lib/oliver/argument_files/add.rb +4 -0
- data/lib/oliver/argument_files/init.rb +27 -0
- data/lib/oliver/argument_files/install.rb +68 -0
- data/lib/oliver/argument_files/list.rb +3 -0
- data/lib/oliver/argument_files/remove.rb +4 -0
- data/lib/oliver/argument_files/update.rb +3 -0
- data/lib/oliver/arguments.rb +13 -32
- data/lib/oliver/main.rb +0 -67
- data/lib/oliver/version.rb +1 -1
- data/lib/oliver.rb +3 -6
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e49525dd2b30b24e54c153b948d8588bcead1b6d
|
4
|
+
data.tar.gz: 8eb689d49bc2bd9bf6979b7e6a8c71a94381e477
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b641ece129a7e9a78a3b631250849d3b3591edb6d1234d38753b1a5c7c86b345c2b19cf18be733011bcb0d1165b20c6b9777a02c8595db19ab983a5da961a2b4
|
7
|
+
data.tar.gz: d1b6ca1d806980ff236500d2bc359f86e623d9c8eef6d8f24e05eb3c126abe5717987b38cf7194fc8f60dde7746218e98a528ff8f332616fe9bdb1ed895da200
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -125,6 +125,15 @@ repos:
|
|
125
125
|
# then again, you could just look at the code and determine that yourself
|
126
126
|
```
|
127
127
|
|
128
|
+
you can also initialize the repo
|
129
|
+
with a folder, if you want to skip a couple
|
130
|
+
of steps (things surrounded by '[]' means
|
131
|
+
that they're optional)
|
132
|
+
|
133
|
+
```bash
|
134
|
+
$ olive init [--directory] [directory name (defaulted to 'olives')]
|
135
|
+
```
|
136
|
+
|
128
137
|
### install and/or remove listed repos
|
129
138
|
|
130
139
|
```bash
|
@@ -185,10 +194,12 @@ of the project, `olive` is the name of the CLI.
|
|
185
194
|
is defaulted), just use the full git URL instead of the simple
|
186
195
|
`username/repo-name`, for example `git://projects.josh.com/oliver.git`.
|
187
196
|
|
188
|
-
<!---
|
189
197
|
branches
|
190
198
|
========
|
191
199
|
|
200
|
+
(there may or may not be an unstable branch at the moment.
|
201
|
+
I'm constantly adding it and deleting it.)
|
202
|
+
|
192
203
|
I kept fixing bugs and then I would frantically
|
193
204
|
push the fixes because I was worried people, if anyone actually
|
194
205
|
uses oliver, would experience problems with it if I didn't push
|
@@ -201,7 +212,8 @@ anyways, there's an [unstable](https://github.com/trommel/oliver/tree/unstable)
|
|
201
212
|
branch, if you want to check it out.
|
202
213
|
the official gem that's hosted on rubygems, though, is
|
203
214
|
the gem of the master branch, and that's how it's going to stay.
|
204
|
-
|
215
|
+
|
216
|
+
also, the unstable branch probably won't work.
|
205
217
|
|
206
218
|
ideas
|
207
219
|
-----
|
@@ -0,0 +1,27 @@
|
|
1
|
+
def init
|
2
|
+
|
3
|
+
if !ARGV[1].nil?
|
4
|
+
if ARGV[2].nil?
|
5
|
+
dir_name = 'olives'
|
6
|
+
else
|
7
|
+
dir_name = ARGV[2]
|
8
|
+
end
|
9
|
+
if ARGV[1].downcase == '--directory'
|
10
|
+
Dir.mkdir dir_name
|
11
|
+
Dir.chdir(dir_name)
|
12
|
+
random_text = Rainbow("Changed directory").blue
|
13
|
+
puts "#{Rainbow(dir_name).green}/ has been created."
|
14
|
+
puts "#{random_text} into #{Rainbow(dir_name).green}/."
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
if !File.file?(Name::OLIVER)
|
19
|
+
File.open(Name::OLIVER, 'w') do |file|
|
20
|
+
file.write("repos:\n")
|
21
|
+
file.write(" - \"trommel/oliver\"\n")
|
22
|
+
puts "#{Rainbow(Name::OLIVER).green} has been created."
|
23
|
+
end
|
24
|
+
else
|
25
|
+
puts "#{Rainbow(Name::OLIVER).red} already exists."
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
def install
|
2
|
+
if !File.file? Name::OLIVER
|
3
|
+
puts "#{Rainbow('Olivefile').red} does not exist."
|
4
|
+
init
|
5
|
+
end
|
6
|
+
|
7
|
+
# Back up your files, man
|
8
|
+
if !File.directory?('.backup')
|
9
|
+
Dir.mkdir '.backup'
|
10
|
+
end
|
11
|
+
|
12
|
+
# The buggiest code in the world
|
13
|
+
# (that's probably totally untrue)
|
14
|
+
body = File.read(Name::OLIVER.chomp)
|
15
|
+
final = YAML.load("---\n#{body}\n---")
|
16
|
+
|
17
|
+
# Fix this ASAP
|
18
|
+
if final["repos"].nil?
|
19
|
+
message = "This will normally return a bug, so I'm just not going to do it.
|
20
|
+
You have an empty repos list, though, and that's what's causing this bug.
|
21
|
+
Try adding something to the list for the time being."
|
22
|
+
puts Rainbow(message).red
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
|
26
|
+
listed_repos = []
|
27
|
+
|
28
|
+
final["repos"].each do |what|
|
29
|
+
listed_repos.push(what)
|
30
|
+
end
|
31
|
+
final["repos"].each do |url|
|
32
|
+
|
33
|
+
# Split the url in half
|
34
|
+
splitted = url.split '/'
|
35
|
+
username = splitted[0]
|
36
|
+
repo = splitted[1]
|
37
|
+
current_repos = Dir.entries '.'
|
38
|
+
['.', '..', '.backup', Name::OLIVER].each do |i|
|
39
|
+
current_repos.delete(i)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Clone the repo if it doesn't already exist
|
43
|
+
if !File.directory?(repo)
|
44
|
+
%x(git clone git://github.com/#{url} --quiet)
|
45
|
+
if File.directory?(repo)
|
46
|
+
puts "#{Rainbow(repo).green}/ has been successfully cloned."
|
47
|
+
else
|
48
|
+
puts "There was an error cloning #{Rainbow(repo).red}/."
|
49
|
+
end
|
50
|
+
else
|
51
|
+
puts "#{Rainbow(repo).red}/ already exists."
|
52
|
+
end
|
53
|
+
|
54
|
+
# If the directory doesn't exist
|
55
|
+
# in `Name::OLIVER`, move it to .backup
|
56
|
+
current_repos.each do |directory_thing|
|
57
|
+
if !listed_repos.to_s.include? directory_thing
|
58
|
+
if !File.directory?(directory_thing)
|
59
|
+
%x(mv #{directory_thing} .backup)
|
60
|
+
else
|
61
|
+
backup_color = Rainbow('.backup/').red
|
62
|
+
repo_color = Rainbow(repo).red
|
63
|
+
puts "There was an error moving #{repo_color}/ to #{backup_color}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/oliver/arguments.rb
CHANGED
@@ -1,44 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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"
|
1
|
+
# Assign 'files' variable to all of the argument files
|
2
|
+
# (Make this automatic later on, but for some reason
|
3
|
+
# automatic isn't working right now, and I don't
|
4
|
+
# know why :P)
|
5
|
+
files = %w(add init install list remove update)
|
6
|
+
files.each do |file|
|
7
|
+
require_relative "argument_files/#{file}"
|
19
8
|
end
|
20
9
|
|
21
|
-
|
22
|
-
|
23
|
-
|
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}."
|
10
|
+
# `argument?` returns help if the
|
11
|
+
# specified argument is nonexistant
|
12
|
+
def argument?(argument_number)
|
13
|
+
help if ARGV[argument_number].nil?
|
33
14
|
end
|
34
15
|
|
35
16
|
# Different arguments
|
36
17
|
# (Make this into a case statement asap)
|
37
18
|
# (It'll be way easier and cleaner to work with later)
|
38
|
-
def
|
19
|
+
def arguments
|
39
20
|
case ARGV[0].downcase
|
40
21
|
when 'install'
|
41
|
-
|
22
|
+
install
|
42
23
|
when 'init'
|
43
24
|
init
|
44
25
|
when 'list'
|
data/lib/oliver/main.rb
CHANGED
@@ -1,70 +1,3 @@
|
|
1
1
|
# Main oliver file
|
2
2
|
def run_main
|
3
|
-
if !File.file? Name::OLIVER
|
4
|
-
puts "#{Rainbow('Olivefile').red} does not exist."
|
5
|
-
init
|
6
3
|
end
|
7
|
-
|
8
|
-
# Back up your files, man
|
9
|
-
if !File.directory?('.backup')
|
10
|
-
Dir.mkdir '.backup'
|
11
|
-
end
|
12
|
-
|
13
|
-
# The buggiest code in the world
|
14
|
-
# (that's probably totally untrue)
|
15
|
-
body = File.read(Name::OLIVER.chomp)
|
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
|
-
|
27
|
-
listed_repos = []
|
28
|
-
|
29
|
-
final["repos"].each do |what|
|
30
|
-
listed_repos.push(what)
|
31
|
-
end
|
32
|
-
final["repos"].each do |url|
|
33
|
-
|
34
|
-
# Split the url in half
|
35
|
-
splitted = url.split '/'
|
36
|
-
username = splitted[0]
|
37
|
-
repo = splitted[1]
|
38
|
-
current_repos = Dir.entries '.'
|
39
|
-
['.', '..', '.backup', Name::OLIVER].each do |i|
|
40
|
-
current_repos.delete(i)
|
41
|
-
end
|
42
|
-
|
43
|
-
# Clone the repo if it doesn't already exist
|
44
|
-
if !File.directory?(repo)
|
45
|
-
%x(git clone git://github.com/#{url} --quiet)
|
46
|
-
if File.directory?(repo)
|
47
|
-
puts "#{Rainbow(repo).green}/ has been successfully cloned."
|
48
|
-
else
|
49
|
-
puts "There was an error cloning #{Rainbow(repo).red}/."
|
50
|
-
end
|
51
|
-
else
|
52
|
-
puts "#{Rainbow(repo).red}/ already exists."
|
53
|
-
end
|
54
|
-
|
55
|
-
# If the directory doesn't exist
|
56
|
-
# in `Name::OLIVER`, move it to .backup
|
57
|
-
current_repos.each do |directory_thing|
|
58
|
-
if !listed_repos.to_s.include? directory_thing
|
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
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
data/lib/oliver/version.rb
CHANGED
data/lib/oliver.rb
CHANGED
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: 1.5.
|
4
|
+
version: 1.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -71,6 +71,12 @@ files:
|
|
71
71
|
- bin/olive
|
72
72
|
- bin/oliver
|
73
73
|
- lib/oliver.rb
|
74
|
+
- lib/oliver/argument_files/add.rb
|
75
|
+
- lib/oliver/argument_files/init.rb
|
76
|
+
- lib/oliver/argument_files/install.rb
|
77
|
+
- lib/oliver/argument_files/list.rb
|
78
|
+
- lib/oliver/argument_files/remove.rb
|
79
|
+
- lib/oliver/argument_files/update.rb
|
74
80
|
- lib/oliver/arguments.rb
|
75
81
|
- lib/oliver/help.rb
|
76
82
|
- lib/oliver/main.rb
|