gongren 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +12 -6
- data/lib/gongren.rb +1 -1
- metadata +1 -1
data/Rakefile
CHANGED
@@ -84,19 +84,25 @@ end
|
|
84
84
|
namespace :version do
|
85
85
|
task :rewrite do
|
86
86
|
require "erb"
|
87
|
-
require "ostruct"
|
88
87
|
|
89
|
-
version =
|
88
|
+
version = File.read("VERSION").chomp
|
90
89
|
template = ERB.new <<-EOT.gsub(/^\s{6}/, "")
|
91
90
|
# Nothing interesting here: see {Gongren::Server} or {Gongren::Worker}.
|
92
91
|
module Gongren
|
93
92
|
VERSION = "<%= version %>"
|
94
93
|
end
|
95
94
|
EOT
|
96
|
-
File.
|
95
|
+
path = File.join(Dir.pwd, "lib/gongren.rb")
|
96
|
+
contents = template.result(binding)
|
97
|
+
File.open(path, "w") {|out| out.write contents}
|
98
|
+
sha = `git log -n 1 --pretty=format:%H`.chomp
|
99
|
+
raise "Could not determine last commit" if sha.empty?
|
100
|
+
sh "git commit --amend --reuse-message #{sha} -- #{path}"
|
97
101
|
end
|
98
102
|
end
|
99
103
|
|
100
|
-
|
101
|
-
|
102
|
-
|
104
|
+
%w(version:bump:patch version:bump:minor version:bump:major).each do |name|
|
105
|
+
Rake::Task[name].enhance do
|
106
|
+
Rake::Task["version:rewrite"].invoke
|
107
|
+
end
|
108
|
+
end
|
data/lib/gongren.rb
CHANGED