-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
39 lines (28 loc) · 1.22 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
$LOAD_PATH.unshift(File.expand_path("../lib", __FILE__))
desc "Run specs (without Rails integration spec - requires rvm, run manually with `spec ./spec/rails_integration_spec.rb')"
task :spec do
sh "spec #{ (Dir["./spec/*_spec.rb"] - ["./spec/rails_integration_spec.rb"]).join(" ") }"
end
GEM_NAME = "reflexive"
desc "Relese next version of reflexive gem (do that just after `git commit')"
task :release => :spec do
require "rubygems"
require "rubygems/version"
require "yaml"
if ENV["GEM_VERSION"]
# release version passed in ENV["GEM_VERSION"]
new_version = ENV["GEM_VERSION"]
else
# by default release next minor version
current_version = YAML.load(`gem specification #{ GEM_NAME } -r`)["version"] || Gem::Version.new("0.0.0")
new_version = (current_version.segments[0..-2] + [current_version.segments[-1].succ]).join(".")
ENV["GEM_VERSION"] = new_version
end
puts "Releasing #{ GEM_NAME } #{ new_version }"
sh "gem build #{ GEM_NAME }.gemspec --verbose"
sh "gem push #{ GEM_NAME }-#{ new_version }.gem --verbose"
sh "gem install #{ GEM_NAME } --version=#{ new_version } --local --verbose"
File.delete("#{ GEM_NAME }-#{ new_version }.gem")
sh "git push"
end
task :default => :spec