oliver 1.6.3 → 1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -3
- data/attempts/run.rb +24 -0
- data/attempts/test.yml +10 -0
- data/lib/oliver/argument_files/init.rb +2 -1
- data/lib/oliver/argument_files/install.rb +37 -40
- data/lib/oliver/argument_files/list.rb +2 -2
- data/lib/oliver/file_manager.rb +2 -2
- data/lib/oliver/version.rb +1 -1
- data/run.rb +23 -0
- data/test.yml +10 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46f04ee1c2e862d1138be0d1b068b53779c45dad
|
4
|
+
data.tar.gz: 3ad99a979b36bcc0faa4917a331100b1f76fb16a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9503166f657d4c93cc8b3eb961ffad04d1190dcc1d182ecade32e474b7dd95a4eeb7c24429e71006ec7cb5c5eb73f4c4a4cb98f42e096187917e5dd354e7fe7
|
7
|
+
data.tar.gz: 10e85d2abfc6a3acaade6e63f8237aeb23a8225628490f68dff2b44bd5b80ba59fe2efe45e81c64ffb1bcc7c893e32363df75ddc0e1c63ecbaac768024d7e070
|
data/README.md
CHANGED
@@ -116,11 +116,15 @@ $ olive init
|
|
116
116
|
```yaml
|
117
117
|
---
|
118
118
|
repos:
|
119
|
-
|
120
|
-
|
119
|
+
trommel:
|
120
|
+
- "oliver"
|
121
|
+
- "textymous"
|
122
|
+
istx25:
|
123
|
+
- "Fluorescent"
|
124
|
+
- "dotfiles"
|
121
125
|
---
|
122
126
|
|
123
|
-
# use 3 spaces for indentation, not tabs!
|
127
|
+
# use 3 spaces for indentation, not tabs! :P
|
124
128
|
# I spent, like, an hour trying to fix a non-existent bug because of this
|
125
129
|
# smh so hard
|
126
130
|
# by the way, this is YAML, for anyone interested
|
data/attempts/run.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Require libraries
|
2
|
+
require 'awesome_print'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
# Read and parse the YAML from the file
|
6
|
+
file = File.read('test.yml')
|
7
|
+
yaml = YAML.load(file)
|
8
|
+
|
9
|
+
# Map out the username and repos(array)
|
10
|
+
yaml['repos'].map do |username, repos|
|
11
|
+
# Assign individual repo from repos array
|
12
|
+
repos.each do |repo|
|
13
|
+
if !File.directory?(repo)
|
14
|
+
`git clone git://github.com/#{username}/#{repo} --quiet`
|
15
|
+
if File.directory?(repo)
|
16
|
+
puts "#{repo} was successfully cloned."
|
17
|
+
else
|
18
|
+
puts "An error occured while cloning #{repo}"
|
19
|
+
end
|
20
|
+
else
|
21
|
+
puts "#{repo} already exists."
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/attempts/test.yml
ADDED
@@ -15,7 +15,8 @@ def init
|
|
15
15
|
if !File.file?(Name::OLIVER)
|
16
16
|
File.open(Name::OLIVER, 'w') do |file|
|
17
17
|
file.write("---\nrepos:\n")
|
18
|
-
file.write(" - \"
|
18
|
+
file.write(" trommel:\n - \"oliver\"\n---\n")
|
19
|
+
dir_name = '.' if dir_name.nil?
|
19
20
|
puts "#{Rainbow(dir_name).green}/#{Rainbow(Name::OLIVER).green} has been created."
|
20
21
|
end
|
21
22
|
else
|
@@ -1,11 +1,11 @@
|
|
1
1
|
def install
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
success = "#{Rainbow('Success').underline.green}:"
|
4
|
+
warning = "#{Rainbow('Warning').underline.yellow}:"
|
5
|
+
error = "#{Rainbow('Error').underline.red}:"
|
6
6
|
|
7
7
|
# Fix this ASAP
|
8
|
-
if $
|
8
|
+
if $yaml['repos'].nil?
|
9
9
|
message = "This will normally return a bug, so I'm just not going to do it.
|
10
10
|
You have an empty repos list, though, and that's what's causing this bug.
|
11
11
|
Try adding something to the list for the time being."
|
@@ -14,45 +14,42 @@ Try adding something to the list for the time being."
|
|
14
14
|
end
|
15
15
|
|
16
16
|
listed_repos = []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
$final['repos'].each do |url|
|
22
|
-
|
23
|
-
# Split the url in half
|
24
|
-
splitted = url.split '/'
|
25
|
-
repo = splitted[1]
|
26
|
-
current_repos = Dir.entries '.'
|
27
|
-
['.', '..', '.backup', Name::OLIVER].each do |i|
|
28
|
-
current_repos.delete(i)
|
17
|
+
$yaml['repos'].map do |username, repos|
|
18
|
+
repos.each do |repo|
|
19
|
+
listed_repos.push(repo)
|
29
20
|
end
|
21
|
+
end
|
30
22
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
23
|
+
# Map out the username and repos(array)
|
24
|
+
$yaml['repos'].map do |username, repos|
|
25
|
+
# Assign individual repo from repos array
|
26
|
+
repos.each do |repo|
|
27
|
+
if !File.directory?(repo)
|
28
|
+
`git clone git://github.com/#{username}/#{repo} --quiet`
|
29
|
+
if File.directory?(repo)
|
30
|
+
puts "#{success} #{repo}/ has been cloned."
|
31
|
+
else
|
32
|
+
puts "#{error} Cloning #{repo}/ failed."
|
33
|
+
end
|
34
|
+
else
|
35
|
+
puts "#{warning} #{repo}/ already exists."
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
42
39
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
40
|
+
# If the directory doesn't exist
|
41
|
+
# in `Name::OLIVER`, delete it
|
42
|
+
# This is an extreme hack
|
43
|
+
current_repos = Dir.entries '.'
|
44
|
+
['.', '..', '.backup', Name::OLIVER].each do |i|
|
45
|
+
current_repos.delete(i)
|
46
|
+
end
|
47
|
+
current_repos.each do |directory|
|
48
|
+
unless listed_repos.to_s.include?(directory) &&
|
49
|
+
File.directory?(directory)
|
50
|
+
print "#{warning} Would you like to delete #{directory}/? (y/n) "
|
51
|
+
`yes | rm -r #{directory}` if STDIN.gets.chomp.downcase == 'y'
|
56
52
|
end
|
57
53
|
end
|
54
|
+
|
58
55
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# # todo: if user has multiple repos,
|
5
5
|
# # have one user key with an array of
|
6
6
|
# # the user's repos
|
7
|
-
# $
|
7
|
+
# $yaml['repos'].each do |thing|
|
8
8
|
# new_thing = thing.split('/')
|
9
9
|
# listed_repos.push(new_thing)
|
10
10
|
# end
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# Simple enough :P
|
15
15
|
def list
|
16
16
|
counter = 0
|
17
|
-
$
|
17
|
+
$yaml['repos'].each do |thing|
|
18
18
|
repo = thing.split('/')[1] # might as well discard the username
|
19
19
|
if File.directory?(repo)
|
20
20
|
print Rainbow(repo).green
|
data/lib/oliver/file_manager.rb
CHANGED
data/lib/oliver/version.rb
CHANGED
data/run.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
file = File.read('test.yml')
|
4
|
+
$yaml = YAML.load(file)
|
5
|
+
|
6
|
+
def clone
|
7
|
+
$yaml['repos'].map do |username, repos|
|
8
|
+
repos.each do |repo|
|
9
|
+
if !File.directory?(repo)
|
10
|
+
`git clone git://github.com/#{username}/#{repo} --quiet`
|
11
|
+
if File.directory? repo
|
12
|
+
puts "Successfully cloned #{username}/#{repo}."
|
13
|
+
else
|
14
|
+
puts "There was an error while cloning #{repo}."
|
15
|
+
end
|
16
|
+
else
|
17
|
+
puts "#{repo} already exists."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
clone
|
data/test.yml
ADDED
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.
|
4
|
+
version: '1.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh
|
@@ -68,6 +68,8 @@ files:
|
|
68
68
|
- LICENSE
|
69
69
|
- README.md
|
70
70
|
- Rakefile
|
71
|
+
- attempts/run.rb
|
72
|
+
- attempts/test.yml
|
71
73
|
- bin/olive
|
72
74
|
- bin/oliver
|
73
75
|
- lib/oliver.rb
|
@@ -83,7 +85,9 @@ files:
|
|
83
85
|
- lib/oliver/oliver_file_name.rb
|
84
86
|
- lib/oliver/version.rb
|
85
87
|
- oliver.gemspec
|
88
|
+
- run.rb
|
86
89
|
- spec/TESTING.md
|
90
|
+
- test.yml
|
87
91
|
homepage: https://github.com/trommel/oliver
|
88
92
|
licenses: []
|
89
93
|
metadata: {}
|