gpig 0.0.17 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/gpig +47 -15
- data/lib/gpig/version.rb +1 -1
- 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
|
113
|
+
puts "\nInstalling version #{new_version} of gem locally..."
|
95
114
|
`gem specific_install -l #{opts.repo_url}`
|
96
115
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
puts "
|
105
|
-
|
106
|
-
|
107
|
-
puts "
|
108
|
-
puts "
|
109
|
-
|
110
|
-
|
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"
|
data/lib/gpig/version.rb
CHANGED