oliver 0.1.4 → 0.1.5

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: 49d205d7b4f8e0fadd2a83c969d9cb6977ad7a13
4
- data.tar.gz: 9233e6d96cc4d4725dd6ec13609be8cb54674f02
3
+ metadata.gz: d686a49cbf3764bb1776ff50533206c15a676ccd
4
+ data.tar.gz: 9a3c2bf11892142353fe89cf7a175af54cba0313
5
5
  SHA512:
6
- metadata.gz: 900364250c31094b4a4998dbdbdae7c4d6ed2799487f6527a7652e958abe93660dc4b0f5f78e4bea875c1d05f627a5d599193f415180e8eca5fcb3947651dab0
7
- data.tar.gz: def7143baef8edfcd4d64c4e2055b24945c9a7119ba3186c4d3507802afdf8b8e4ea35f52b173977befe1cf5974dfbf7dc140ba32a154dbb5d1dda6d7b891979
6
+ metadata.gz: fdacc5c3d3d93dcefd7157e6d8b2e18318c9c28fef2b312d36832f782331dca9b6c463ba3eb3a5980670db54e53a8db90ac879e3e913f52d57f287100d31c9d5
7
+ data.tar.gz: c2d1fda5a4844c6bfaa52e0bb8dba6a69d4250963bfaadf8fec4e8faea1334aa4318c93e0c49612ac8c66530df1984c882097008f585deabc823fbf4c76d1c82
data/README.md CHANGED
@@ -1,14 +1,19 @@
1
1
  oliver
2
2
  ======
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/oliver.svg)](http://badge.fury.io/rb/oliver)
5
+
4
6
  oliver manages your local GitHub
5
7
  repositories for you with a simple `Olivefile`.
6
8
 
9
+ > "like podfiles, but for git repositories"
10
+ -- [@istx25](https://github.com/istx25)
11
+
7
12
  installation
8
13
  ------------
9
14
 
10
15
  oliver is a CLI that you can install
11
- through [RubyGems](https://rubygems.org)
16
+ through [RubyGems](https://rubygems.org/gems/oliver)
12
17
 
13
18
  ```bash
14
19
  $ gem install oliver
@@ -105,6 +110,40 @@ the `olive` command will be what you use
105
110
  when working with oliver, similar to how
106
111
  bundler uses the `bundle` command.
107
112
 
113
+ before you do anything, you'll probably
114
+ want to initialize the entire directory
115
+ that you're keeping these git
116
+ repositories in (in the example
117
+ above, "main_directory/" would
118
+ be the directory)
119
+ do to this, you're going to want
120
+ to make a `OliveFile` and write a bit
121
+ in it
122
+
123
+ ```bash
124
+ $ cd main_directory/
125
+ $ touch Olivefile
126
+ $ vim Olivefile
127
+ ```
128
+
129
+ and in the `Olivefile`
130
+
131
+ ```vim
132
+ repos:
133
+ - "trommel/oliver"
134
+ - "istx25/dotfiles"
135
+
136
+ # use 3 spaces for indentation, not tabs!
137
+ # I spent, like, an hour trying to fix a nonexistant bug becuase of this
138
+ # smh so hard
139
+ ```
140
+
141
+ you can then run
142
+
143
+ ```bash
144
+ $ olive
145
+ ```
146
+
108
147
  ### start tracking a repo
109
148
 
110
149
  this will add it to the tracking list
@@ -149,6 +188,61 @@ append `colour=off` to any statement
149
188
 
150
189
  don't forget to spell *"colour"* **the proper way**.
151
190
 
191
+ branches
192
+ ========
193
+
194
+ I kept fixing bugs and then I would frantically
195
+ push the fixes because I was worried people, if anyone actually
196
+ uses oliver, would experience problems with it if I didn't push
197
+ the fix immediately. the problem, obviously, with this
198
+ is that I didn't catch other things I needed to fix, and now I have,
199
+ like, a billion commits, even though most of them are just me changing
200
+ the version variable.
201
+
202
+ anyways, there's an [unstable](https://github.com/trommel/oliver/tree/unstable)
203
+ branch, if you want to check it out.
204
+ the official gem that's hosted on rubygems, though, is
205
+ the gem of the master branch, and that's how it's going to stay.
206
+
207
+ things to implement
208
+ ===================
209
+
210
+ [Douglas](https://twitter.com/istx25) gave me this cool
211
+ idea that [CocoaPods](https://github.com/CocoaPods/CocoaPods) uses, where
212
+ when we run
213
+
214
+ ```bash
215
+ $ olive install
216
+ ```
217
+
218
+ it can not only install the repos on the list, but remove the repos
219
+ that have been installed locally but are no longer on the list.
220
+ this way, if you want to delete a bunch of repositories, you can simply
221
+ remove them from the list and run
222
+
223
+ ```bash
224
+ $ olive install
225
+ ```
226
+
227
+ I spent, like, 50 minutes on this and I can't figure out a good way
228
+ to do it, though, so.. yeah
229
+
230
+ I'll add it as soon as I can figure it out.
231
+
232
+ versions
233
+ ========
234
+
235
+ for some reason, I was using things like "1.5" as oliver's
236
+ version for a bit, even though oliver isn't even finished (to
237
+ even the help menu), so if you check the previous gem versions,
238
+ the newest gem version is probably (maybe) smaller / below
239
+ previous gem versions. this was me being silly and not thinking.
240
+
241
+ as of right now (July 18, 2014, 6:19 PM), oliver's version
242
+ is 0.1.5, and it will continue to build off from there.
243
+
244
+ sorry about doing that silly thing.
245
+
152
246
  testing
153
247
  =======
154
248
 
@@ -0,0 +1,21 @@
1
+ # Different arguments
2
+ # (Make this into a case statement asap)
3
+ # (It'll be way easier and cleaner to work with later)
4
+ def different_arguments
5
+ if !ARGV[0].nil?
6
+ if ARGV[0].downcase == 'init'
7
+
8
+ if !File.file?(Name::OLIVER)
9
+ File.open(Name::OLIVER, 'w') do |file|
10
+ file.write("repos:\n")
11
+ file.write(" - \"trommel/oliver\"\n")
12
+ puts "#{Rainbow(Name::OLIVER.red)} has been created."
13
+ end
14
+ else
15
+ puts "#{Rainbow(Name::OLIVER).red} already exists."
16
+ end
17
+
18
+ Jib.exit
19
+ end
20
+ end
21
+ end
data/lib/oliver/main.rb CHANGED
@@ -1,5 +1,41 @@
1
+ require 'awesome_print'
1
2
  # Main oliver file
2
3
  def run_main
3
- contents = File.read(Name::OLIVER).chomp
4
- puts contents
4
+
5
+ # Back up your files, man
6
+ if !File.directory?('.backup')
7
+ Dir.mkdir '.backup'
8
+ end
9
+
10
+ # The buggiest code in the world (that's probably totally untrue)
11
+ body = File.read(Name::OLIVER.chomp)
12
+ final = YAML.load("---\n#{body}\n---")
13
+ final["repos"].each do |url|
14
+
15
+ # Split the url in half
16
+ splitted = url.split '/'
17
+ username = splitted[0]
18
+ repo = splitted[1]
19
+ current_repos = Dir.entries '.'
20
+ ['.', '..', '.backup', Name::OLIVER].each do |i|
21
+ current_repos.delete(i)
22
+ end
23
+
24
+ # Clone the repo if it doesn't already exist
25
+ if !File.directory?(repo)
26
+ %x(git clone git://github.com/#{url} --quiet)
27
+ puts "#{Rainbow(repo).green}/ has been successfully cloned."
28
+ else
29
+ puts "#{Rainbow(repo).red}/ already exists."
30
+ end
31
+
32
+ # If the directory doesn't exist
33
+ # in `Name::OLIVER`, move it to .backup
34
+ current_repos.each do |directory_thing|
35
+ if !final["repos"].to_s.include? directory_thing
36
+ %x(mv #{directory_thing} .backup)
37
+ end
38
+ end
39
+
40
+ end
5
41
  end
@@ -1,27 +1,46 @@
1
- require_relative "main"
1
+ # If the user can't even
2
+ # specify basic arguments
3
+ # just give him/her some help
4
+ # and heavy medication
5
+ def are_you_serious?
6
+ if ARGV[0].nil?
7
+ help
8
+ Jib.exit
9
+ end
10
+ end
2
11
 
3
12
  # Help the user with their heavy troubles
4
13
  def help
5
14
 
6
15
  helper = [
16
+ [
17
+ "install",
18
+ "clones / removes directories if they're listed on the #{Name::OLIVER}"
19
+ ],
20
+
21
+ [
22
+ "init",
23
+ "initializes the main directory by creating a base #{Name::OLIVER}"
24
+ ],
25
+
7
26
  [
8
27
  "add username/repo",
9
- "clone repo and add it to tracking list",
28
+ "clone repo and add it to the #{Name::OLIVER}",
10
29
  ],
11
30
 
12
31
  [
13
32
  "remove username/repo",
14
- "delete repo and remove it from tracking list",
33
+ "delete repo and remove it from the #{Name::OLIVER}",
15
34
  ],
16
35
 
17
36
  [
18
37
  "list",
19
- "list repos currently on tracking list"
38
+ "list repos currently on the #{Name::OLIVER}"
20
39
  ],
21
40
 
22
41
  [
23
42
  "update",
24
- "pull updates from each tracked repo"
43
+ "pull updates from each tracked repo on the #{Name::OLIVER}"
25
44
  ]
26
45
  ]
27
46
 
@@ -41,7 +60,8 @@ end
41
60
  # a question like "what version is oliver?"
42
61
  # or "I need some help"
43
62
  def other_things
44
- case ARGV[0].downcase
63
+ are_you_serious?
64
+ case ARGV[0].to_s.downcase
45
65
  when '-v' || '--version'
46
66
  puts "#{Rainbow('oliver').red} #{Rainbow("v#{Oliver::VERSION}").green}"
47
67
  when '-h' || '--help'
@@ -50,19 +70,3 @@ def other_things
50
70
  help
51
71
  end
52
72
  end
53
-
54
- # If the user can't even
55
- # specify basic arguments
56
- # just give him/her some help
57
- # and heavy medication
58
- if ARGV[0].nil?
59
- help
60
- Jib.exit
61
- end
62
-
63
- # the main oliver "project" thing
64
- # I'll probably move this into a
65
- # seperate file in the future
66
- def oliver_main
67
- run_main
68
- end
@@ -1,3 +1,3 @@
1
1
  module Oliver
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/lib/oliver.rb CHANGED
@@ -1,23 +1,39 @@
1
1
  # holy shit, this is massive
2
2
  # twss
3
- require 'launchy'
4
3
  require 'jibry'
5
4
  require 'rainbow'
5
+ require 'YAML'
6
+ require_relative "oliver/oliver_file_name"
7
+ require_relative "oliver/arguments"
6
8
  require_relative "oliver/version"
7
9
  require_relative "oliver/methods"
8
- require_relative "oliver/oliver_file_name"
10
+ require_relative "oliver/main"
9
11
 
10
12
  # if the user doesn't want to use rainbow
11
13
  # just disable it completely
12
14
  Rainbow.enabled = false if ARGV[-1] == 'colour=off'
13
15
 
16
+ if ARGV[0].nil?
17
+ help
18
+ Jib.exit
19
+ end
20
+
21
+ # (Literally) different arguments
22
+ different_arguments
23
+
14
24
  # if `Name::OLIVER` (string)
15
25
  # exists as a file continue with oliver
16
- case File.file?
17
- when Name::OLIVER.downcase
18
- puts "Use \"#{Rainbow('Olivefile').red}\""
19
- when Name::OLIVER
20
- oliver_main
26
+ if File.file? Name::OLIVER
27
+ if ARGV[0].downcase == 'install'
28
+ run_main
29
+ Jib.exit
21
30
  else
22
- other_things
31
+ # name_install = Rainbow('oliver install')
32
+ # puts "#{name_install} requires an #{Name::OLIVER} to do its magic."
33
+ help
34
+ Jib.exit
35
+ end
36
+ else
37
+ other_things
38
+ Jib.exit
23
39
  end
data/oliver.gemspec CHANGED
@@ -17,7 +17,6 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.add_development_dependency "bundler", "~> 1.6"
19
19
  gem.add_development_dependency "rake"
20
- gem.add_dependency 'launchy', '>= 2.4'
21
- gem.add_dependency 'jibry', '>= 0.0.1'
20
+ gem.add_dependency 'jibry', '>= 0.0.3'
22
21
  gem.add_dependency 'rainbow', '>= 2.0.0'
23
22
  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: 0.1.4
4
+ version: 0.1.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-18 00:00:00.000000000 Z
11
+ date: 2014-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,34 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: launchy
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '2.4'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '2.4'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: jibry
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: 0.0.1
47
+ version: 0.0.3
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: 0.0.1
54
+ version: 0.0.3
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rainbow
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +81,7 @@ files:
95
81
  - Rakefile
96
82
  - bin/olive
97
83
  - lib/oliver.rb
84
+ - lib/oliver/arguments.rb
98
85
  - lib/oliver/main.rb
99
86
  - lib/oliver/methods.rb
100
87
  - lib/oliver/oliver_file_name.rb
@@ -120,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
107
  version: '0'
121
108
  requirements: []
122
109
  rubyforge_project:
123
- rubygems_version: 2.4.0
110
+ rubygems_version: 2.4.1
124
111
  signing_key:
125
112
  specification_version: 4
126
113
  summary: Manage your Git(Hub) easier.