gpig 0.0.7 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/bin/gpig +37 -10
  2. data/lib/gpig/version.rb +1 -1
  3. metadata +2 -2
data/bin/gpig CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # Author: William Barry (william@nine.is)
4
+ # http://github.com/williambarry007/gpig
5
+ # Description: Gpig is a tool that makes gem development quick and easy.
6
+
3
7
  require 'gpig/version'
4
8
  require 'trollop'
5
9
  require 'yaml'
@@ -8,17 +12,19 @@ def increment_version(vfile)
8
12
  str = File.open(vfile).read
9
13
  str.gsub!(/\r\n?/, "\n")
10
14
  str2 = ""
15
+ new_version = ""
11
16
  str.each_line do |line|
12
17
  if (!line.index('VERSION').nil?)
13
18
  arr = line.split('=')
14
19
  arr = arr[1].gsub('"', '').gsub("'", '').strip.split('.')
15
20
  arr[arr.count-1] = arr[arr.count-1].to_i + 1
16
- v = arr.join('.')
17
- line = " VERSION = '#{v}'\n"
21
+ new_version = arr.join('.')
22
+ line = " VERSION = '#{new_version}'\n"
18
23
  end
19
24
  str2 << line
20
25
  end
21
26
  File.open(vfile, 'w') { |file| file.write(str2) }
27
+ return new_version
22
28
  end
23
29
 
24
30
  opts = Trollop::options do
@@ -39,7 +45,7 @@ EOS
39
45
  opt :repo_url , "The URL of the git repo from which the new gem will be installed.", :type => :string
40
46
  opt :remote , "The remote to which the local code changes will be pushed.", :type => :string, :default => 'origin'
41
47
  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"
48
+ opt :message , "The message when committing files to the repo.", :type => :string, :default => "More changes"
43
49
  end
44
50
 
45
51
  conf = YAML::load_file(opts.conf_file)
@@ -61,24 +67,45 @@ if (!str.index('nothing to commit').nil?)
61
67
  exit
62
68
  end
63
69
 
64
- if (opts.increment)
65
- puts "\nModifying the version..."
66
- increment_version(opts.version_file)
67
- end
68
-
69
70
  puts "\nAdding files to git repo..."
70
71
  `git add -A`
71
72
 
72
73
  puts "\nCommitting files to git repo..."
73
- `git commit -m "#{opts.commit_message}"`
74
+ `git commit -m "#{opts.message}"`
74
75
 
75
76
  puts "\nPulling in any changes..."
76
77
  `git pull #{opts.remote} #{opts.branch}`
77
78
 
78
- puts "\nPushing in any changes..."
79
+ new_version = false
80
+ if (opts.increment)
81
+ puts "\nModifying the version..."
82
+ new_version = increment_version(opts.version_file)
83
+ end
84
+
85
+ puts "\nAdding version file to git repo..."
86
+ `git add -A`
87
+
88
+ puts "\nCommitting change of version file..."
89
+ `git commit -m "Updated version file"`
90
+
91
+ puts "\nPushing changes to the remote..."
79
92
  `git push #{opts.remote} #{opts.branch}`
80
93
 
81
94
  puts "\nInstalling new version of gem..."
82
95
  `gem specific_install -l #{opts.repo_url}`
83
96
 
97
+ puts "\n"
98
+ puts " _"
99
+ puts " '-(-' _ _.....__ _ _"
100
+ puts " '-(-' .' '. | \\_/_|"
101
+ puts " `'-/ \\/ \\"
102
+ puts " | ` 6 6 |_"
103
+ puts " | /..\\"
104
+ puts " \\ | ,_\\__/"
105
+ puts " / / / ___.--'"
106
+ puts " < .-;`----`\\ \\ \\"
107
+ puts " \\ \\ \\ \\ \\ \\"
108
+ puts " \\__\\_\\ \\__\\_\\"
109
+ puts "\nSuccess! Version #{new_version} of your gem has been installed locally."
84
110
  puts "\nFinished!\n\n"
111
+
@@ -1,3 +1,3 @@
1
1
  module Gpig
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.17'
3
3
  end
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.7
4
+ version: 0.0.17
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-05 00:00:00.000000000 Z
12
+ date: 2013-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: specific_install