aboutsummaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-03-23 11:23:21 -0700
committerCarl Lerche <carllerche@mac.com>2010-03-23 11:23:21 -0700
commit195cc1402284d0e965cd96e572514fe2ff300788 (patch)
tree928588a9cc5cb2346d4324b3a9d9842d2b1f00aa /Rakefile
parent30fb25d3abfc002b85f290587b979d54c35a2e98 (diff)
downloadrails-195cc1402284d0e965cd96e572514fe2ff300788.tar.gz
rails-195cc1402284d0e965cd96e572514fe2ff300788.tar.bz2
rails-195cc1402284d0e965cd96e572514fe2ff300788.zip
Rake is a better build tool than Thor. Move the gem building and releasing tasks to the Rakefile.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile41
1 files changed, 41 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index ef633c0042..bc4fe6f839 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,12 @@
require "rubygems"
+def gemspec
+ @gemspec ||= begin
+ gemspec_file = File.expand_path('../arel.gemspec', __FILE__)
+ gemspec = eval(File.read(gemspec_file), binding, gemspec_file)
+ end
+end
+
begin
require "spec/rake/spectask"
rescue LoadError
@@ -46,3 +53,37 @@ desc 'Removes trailing whitespace'
task :whitespace do
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
end
+
+desc "Build pkg/#{gemspec.full_name}.gem"
+task :build => "gemspec:validate" do
+ sh %{gem build arel.gemspec}
+ FileUtils.mkdir_p "pkg"
+ FileUtils.mv gemspec.file_name, "pkg"
+end
+
+desc "Install the latest built gem"
+task :install => :build do
+ sh "gem install --local pkg/#{gemspec.file_name}"
+end
+
+namespace :release do
+ task :tag do
+ release_tag = "v#{gemspec.version}"
+ sh "git tag -a #{release_tag} -m 'Tagging #{release_tag}'"
+ sh "git push origin #{release_tag}"
+ end
+
+ task :gem => :build do
+ sh "gem push pkg/#{gemspec.file_name}"
+ end
+end
+
+desc "Release the current branch to GitHub and Gemcutter"
+task :release => %w(release:tag release:gem)
+
+namespace :gemspec do
+ desc 'Validate the gemspec'
+ task :validate do
+ gemspec.validate
+ end
+end \ No newline at end of file