revans-git_tools 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -67,3 +67,14 @@ Now, create a new Rake task in lib/tasks directory. I call mine submodules.rake.
67
67
 
68
68
  end
69
69
  </pre>
70
+
71
+
72
+ ## Command Line
73
+
74
+ When creating a new project, it would be nice to just write your submodule.yml file and then shoot a command off in the terminal and have all your submodules installed for you. Well, now you can! Just do:
75
+
76
+ <pre>
77
+ gitools all
78
+ </pre>
79
+
80
+ That will install all the submodules from your config/submodule.yml file. I'll be adding individual submodule adds via command line next as well as other command line tools.
data/bin/gitools ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'git_tools'
5
+
6
+
7
+ options = GitTools::Options.parse!(ARGV)
8
+ GitTools::CI.get(options)
data/lib/git_tools.rb CHANGED
@@ -1,9 +1,12 @@
1
1
  module GitTools
2
- Version = "0.2.0"
2
+ Version = "0.3.0"
3
3
  end
4
4
 
5
5
  # Required Gems
6
+ %w[optparse ostruct].each { |library| require library }
6
7
 
7
8
  # Gem specific Requires
8
9
  require File.dirname(__FILE__) + "/git_tools/submodules.rb"
10
+ require File.dirname(__FILE__) + "/git_tools/parse.rb"
11
+ require File.dirname(__FILE__) + "/git_tools/ci.rb"
9
12
  # require File.dirname(__FILE__) + "/git_tools/"
@@ -0,0 +1,12 @@
1
+ module GitTools
2
+ class CI
3
+
4
+ def self.get(options)
5
+ init = new
6
+ @options = options
7
+ @yaml = File.join(@options.yaml, 'config/submodules.yml')
8
+ GitTools::Submodule.install_all(@yaml)
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,39 @@
1
+ module GitTools
2
+ class Options
3
+
4
+ def self.parse!(args)
5
+ options = OpenStruct.new
6
+ options.library = args.first.sub(/(\s+)/, '_') unless args.first.nil?
7
+ options.yaml = Dir.pwd
8
+
9
+ opts = OptionParser.new do |opts|
10
+
11
+ opts.banner = "\nGit Tools Usage: gitools all will install all your git submodules"
12
+ opts.separator "You must be in your Application Root Directory when running this command."
13
+ opts.separator ""
14
+
15
+ opts.on_tail('-v', '--version', "Show GitTools' current version.") do
16
+ puts "\nGit Tools is at version #{GitTools::Version}\n"
17
+ exit(0)
18
+ end
19
+
20
+ opts.on_tail('-h', '--help', "Help Me!") do
21
+ puts "#{opts}\n"
22
+ exit(0)
23
+ end
24
+
25
+ opts.on_tail do
26
+ if options.library.nil? || options.library == ''
27
+ puts "\nYou need to tell me what you want library you want to add to git submodule."
28
+ puts "#{opts}\n"
29
+ exit(0)
30
+ end
31
+ end
32
+ end # OptionParser
33
+
34
+ opts.parse!(args)
35
+ options
36
+ end # parse!
37
+
38
+ end
39
+ end
@@ -18,19 +18,11 @@ module GitTools
18
18
  system("git submodule add #{repo} #{location}")
19
19
  end
20
20
 
21
- def self.init
21
+ def self.checkout
22
22
  system("git submodule init")
23
- end
24
-
25
- def self.update
26
23
  system("git submodule update")
27
24
  end
28
25
 
29
- def self.checkout
30
- init
31
- update
32
- end
33
-
34
26
  def self.remove(submodule)
35
27
  system("git rm --cache vendor/plugins/#{submodule}")
36
28
  end
@@ -55,7 +47,7 @@ module GitTools
55
47
  def self.individual_tasks(yaml, &block)
56
48
  @config = load_yaml(yaml)
57
49
  @config.each_key { |name| yield name }
58
- end
50
+ end
59
51
 
60
52
  end
61
53
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revans-git_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert R Evans
@@ -15,8 +15,8 @@ dependencies: []
15
15
 
16
16
  description: An easy way to manage your git submodules in a Rails Application.
17
17
  email: robert@codewranglers.org
18
- executables: []
19
-
18
+ executables:
19
+ - gitools
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files:
@@ -28,9 +28,12 @@ files:
28
28
  - LICENSE
29
29
  - ChangeLog.rdoc
30
30
  - Rakefile
31
+ - bin/gitools
31
32
  - lib/git_tools.rb
32
33
  - lib/git_tools/submodules.rb
33
34
  - lib/git_tools/config/submodules.yml
35
+ - lib/git_tools/parse.rb
36
+ - lib/git_tools/ci.rb
34
37
  has_rdoc: true
35
38
  homepage: http://codewranglers.org
36
39
  post_install_message: