gpig 0.0.17 → 0.0.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/gpig +47 -15
  2. data/lib/gpig/version.rb +1 -1
  3. metadata +1 -1
data/bin/gpig CHANGED
@@ -27,6 +27,23 @@ def increment_version(vfile)
27
27
  return new_version
28
28
  end
29
29
 
30
+ def set_gem_version(gemfile, gemname, version)
31
+ return if !File.exists?(gemfile)
32
+ file = File.open(gemfile, 'rb')
33
+ str = file.read
34
+ file.close
35
+ str2 = ""
36
+ str.each_line do |line|
37
+ if (!line.strip.start_with?('#') && (!line.index("gem '#{gemname}'").nil? || !line.index("gem \"#{gemname}\"").nil?))
38
+ str2 << "##{line}"
39
+ else
40
+ str2 << line
41
+ end
42
+ end
43
+ str2 << "gem '#{gemname}', '= #{version}'\n"
44
+ File.open(gemfile, 'w') {|file| file.write(str2) }
45
+ end
46
+
30
47
  opts = Trollop::options do
31
48
  # version "gpig version #{Gpig::VERSION}\n"
32
49
  banner <<-EOS
@@ -46,6 +63,8 @@ EOS
46
63
  opt :remote , "The remote to which the local code changes will be pushed.", :type => :string, :default => 'origin'
47
64
  opt :branch , "The branch to which the local code changes will be committed." , :type => :string, :default => 'master'
48
65
  opt :message , "The message when committing files to the repo.", :type => :string, :default => "More changes"
66
+ opt :gemname , "The name of the gem that is being updated.", :type => :string, :default => ""
67
+ opt :gemfile , "A gemfile that should be updated with the new version of the gem.", :type => :string, :default => ""
49
68
  end
50
69
 
51
70
  conf = YAML::load_file(opts.conf_file)
@@ -91,21 +110,34 @@ puts "\nCommitting change of version file..."
91
110
  puts "\nPushing changes to the remote..."
92
111
  `git push #{opts.remote} #{opts.branch}`
93
112
 
94
- puts "\nInstalling new version of gem..."
113
+ puts "\nInstalling version #{new_version} of gem locally..."
95
114
  `gem specific_install -l #{opts.repo_url}`
96
115
 
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."
110
- puts "\nFinished!\n\n"
116
+ if (opts.gemfile.length > 0)
117
+ if (opts.gemname.strip.length == 0)
118
+ str = `ls -a *.gemspec`
119
+ str = str.gsub('.gemspec', '').gsub("\n", '')
120
+ opts[:gemname] = str
121
+ end
122
+ if (opts.gemname.strip.length > 0)
123
+ puts "\nUpdating version of #{opts.gemname} in #{opts.gemfile}..."
124
+ set_gem_version(opts.gemfile, opts.gemname, new_version)
125
+ else
126
+ puts "\nError: could not determine gem name for updating gem file."
127
+ puts "To fix this, add the gem name to your gpig config file."
128
+ end
129
+ end
111
130
 
131
+ puts "\n"
132
+ puts " _"
133
+ puts " '-(-' _ _.....__ _ _"
134
+ puts " '-(-' .' '. | \\_/_|"
135
+ puts " `'-/ \\/ \\"
136
+ puts " | ` 6 6 |_"
137
+ puts " | /..\\"
138
+ puts " \\ | ,_\\__/"
139
+ puts " / / / ___.--'"
140
+ puts " < .-;`----`\\ \\ \\"
141
+ puts " \\ \\ \\ \\ \\ \\"
142
+ puts " \\__\\_\\ \\__\\_\\"
143
+ puts "\n-------- Awwww yeah! You're all finished! --------\n\n"
@@ -1,3 +1,3 @@
1
1
  module Gpig
2
- VERSION = '0.0.17'
2
+ VERSION = '0.0.24'
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.17
4
+ version: 0.0.24
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: