Permalink
Browse files

add gem tasks to Rakefile

  • Loading branch information...
1 parent 4216e21 commit 994734189e2bb963c695ea3196de3c69b33e27b8 @semmons99 semmons99 committed Sep 14, 2010
Showing with 28 additions and 1 deletion.
  1. +28 −1 Rakefile
View
@@ -1,7 +1,14 @@
require 'rubygems'
require 'rake/clean'
-CLOBBER.include('.yardoc', 'doc', '*.gem')
+CLOBBER.include('.yardoc', 'doc')
+
+def gemspec
+ @gemspec ||= begin
+ file = File.expand_path("../google_currency.gemspec", __FILE__)
+ eval(File.read(file), binding, file)
+ end
+end
begin
require 'spec/rake/spectask'
@@ -19,3 +26,23 @@ begin
rescue LoadError
task(:yardoc){abort "`gem install yard` to generate documentation"}
end
+
+begin
+ require 'rake/gempackagetask'
+ Rake::GemPackageTask.new(gemspec) do |pkg|
+ pkg.gem_spec = gemspec
+ end
+ task :gem => :gemspec
+rescue LoadError
+ task(:gem){abort "`gem install rake` to package gems"}
+end
+
+desc "Install the gem locally"
+task :install => :gem do
+ sh "gem install pkg/#{gemspec.full_name}.gem"
+end
+
+desc "Validate the gemspec"
+task :gemspec do
+ gemspec.validate
+end

0 comments on commit 9947341

Please sign in to comment.