gpig 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/gpig +50 -40
- data/lib/gpig.rb +2 -1
- data/lib/gpig/version.rb +1 -1
- metadata +18 -3
- data/lib/gpig/engine.rb +0 -5
data/bin/gpig
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'gpig/version'
|
4
|
+
require 'trollop'
|
5
|
+
require 'yaml'
|
6
|
+
|
3
7
|
def increment_version(vfile)
|
4
8
|
str = File.open(vfile).read
|
5
9
|
str.gsub!(/\r\n?/, "\n")
|
@@ -17,39 +21,37 @@ def increment_version(vfile)
|
|
17
21
|
File.open(vfile, 'w') { |file| file.write(str2) }
|
18
22
|
end
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
24
|
+
opts = Trollop::options do
|
25
|
+
# version "gpig version #{Gpig::VERSION}\n"
|
26
|
+
banner <<-EOS
|
27
|
+
--------------------------------------------------------------------------------
|
28
|
+
GPIG (Git Push Install Gem)
|
29
|
+
Gpig is a nice little tool to help speed up gem development. It allows you
|
30
|
+
to make a change in your gem code, then quickly increment the version of
|
31
|
+
the gem code, push changes to a git repository, and install the new version
|
32
|
+
of the gem locally so you can test it.
|
33
|
+
--------------------------------------------------------------------------------
|
34
|
+
EOS
|
35
|
+
version "gpig Version #{Gpig::VERSION}\n"
|
36
|
+
opt :conf_file , "The configuration file.", :type => :string, :default => File.join(Dir.pwd,'.gpig')
|
37
|
+
opt :increment , "Whether or not to increment the version.", :default => true
|
38
|
+
opt :version_file , "The version file that holds the VERSION variable that will be incremented.", :type => :string
|
39
|
+
opt :repo_url , "The URL of the git repo from which the new gem will be installed.", :type => :string
|
40
|
+
opt :remote , "The remote to which the local code changes will be pushed.", :type => :string, :default => 'origin'
|
41
|
+
opt :branch , "The branch to which the local code changes will be committed." , :type => :string, :default => 'master'
|
42
|
+
opt :commit_message , "The message when committing files to the repo.", :type => :string, :default => "More changes"
|
33
43
|
end
|
34
44
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
PigConfig.repo = ARGV.count > 1 ? ARGV[1] : false
|
39
|
-
|
40
|
-
if (ARGV.count == 0 && File.exists?(File.join(Dir.pwd, '.gpig')))
|
41
|
-
load File.join(Dir.pwd, '.gpig')
|
45
|
+
conf = YAML::load_file(opts.conf_file)
|
46
|
+
conf.each do |key,val|
|
47
|
+
opts[key.to_sym] = val
|
42
48
|
end
|
43
49
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
if (!vfile || !repo || vfile.strip.length == 0 || repo.strip.length == 0)
|
48
|
-
puts "Usage: gpig <version_file> <git_repo_url>\n\n"
|
49
|
-
puts " or have a .gpig config file with those arguments on the first line."
|
50
|
+
if (!opts.version_file || !opts.repo_url || opts.version_file.strip.length == 0 || opts.repo_url.strip.length == 0)
|
51
|
+
opts.help
|
50
52
|
exit
|
51
|
-
elsif (!File.exists?(
|
52
|
-
puts "Error: the version file (#{
|
53
|
+
elsif (!File.exists?(opts.version_file))
|
54
|
+
puts "Error: the version file (#{opts.version_file}) doesn't seem to exist.\n";
|
53
55
|
exit
|
54
56
|
end
|
55
57
|
|
@@ -59,16 +61,24 @@ if (!str.index('nothing to commit').nil?)
|
|
59
61
|
exit
|
60
62
|
end
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
64
|
+
if (opts.increment)
|
65
|
+
puts "\nModifying the version..."
|
66
|
+
increment_version(opts.version_file)
|
67
|
+
end
|
68
|
+
|
69
|
+
puts "\nAdding files to git repo..."
|
65
70
|
`git add -A`
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
puts "
|
71
|
-
`git
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
|
72
|
+
puts "\nCommitting files to git repo..."
|
73
|
+
`git commit -m "#{opts.commit_message}"`
|
74
|
+
|
75
|
+
puts "\nPulling in any changes..."
|
76
|
+
`git pull #{opts.remote} #{opts.branch}`
|
77
|
+
|
78
|
+
puts "\nPushing in any changes..."
|
79
|
+
`git push #{opts.remote} #{opts.branch}`
|
80
|
+
|
81
|
+
puts "\nInstalling new version of gem..."
|
82
|
+
`gem specific_install -l #{opts.repo_url}`
|
83
|
+
|
84
|
+
puts "\nFinished!\n\n"
|
data/lib/gpig.rb
CHANGED
data/lib/gpig/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gpig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: specific_install
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: trollop
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
description: A tool to quickly add files to a git repo, push, and then use specific_install
|
31
47
|
to install the new gem.
|
32
48
|
email:
|
@@ -37,7 +53,6 @@ extensions: []
|
|
37
53
|
extra_rdoc_files: []
|
38
54
|
files:
|
39
55
|
- bin/gpig
|
40
|
-
- lib/gpig/engine.rb
|
41
56
|
- lib/gpig/version.rb
|
42
57
|
- lib/gpig.rb
|
43
58
|
- MIT-LICENSE
|