Permalink
Browse files

skip gem packaging tasks if Gem not defined

  • Loading branch information...
1 parent a5ac872 commit 1c3bca4eb28c0eeaf724037106036e9f9422834f @rtomayko committed Mar 16, 2010
Showing with 27 additions and 35 deletions.
  1. +27 −35 Rakefile
View
@@ -9,51 +9,43 @@ end
# PACKAGING ============================================================
-# Load the gemspec using the same limitations as github
-require 'rubygems/specification'
-$spec = eval(File.read('sinatra-sequel.gemspec'))
+if defined?(Gem)
+ # Load the gemspec using the same limitations as github
+ $spec = eval(File.read('sinatra-sequel.gemspec'))
-def package(ext='')
- "pkg/#{$spec.name}-#{$spec.version}" + ext
-end
+ def package(ext='')
+ "pkg/#{$spec.name}-#{$spec.version}" + ext
+ end
-desc 'Build packages'
-task :package => %w[.gem .tar.gz].map { |ext| package(ext) }
+ desc 'Build packages'
+ task :package => %w[.gem .tar.gz].map { |ext| package(ext) }
-desc 'Build and install as local gem'
-task :install => package('.gem') do
- sh "gem install #{package('.gem')}"
-end
+ desc 'Build and install as local gem'
+ task :install => package('.gem') do
+ sh "gem install #{package('.gem')}"
+ end
-directory 'pkg/'
-CLOBBER.include('pkg')
+ directory 'pkg/'
+ CLOBBER.include('pkg')
-file package('.gem') => %W[pkg/ #{$spec.name}.gemspec] + $spec.files do |f|
- sh "gem build #{$spec.name}.gemspec"
- mv File.basename(f.name), f.name
-end
+ file package('.gem') => %W[pkg/ #{$spec.name}.gemspec] + $spec.files do |f|
+ sh "gem build #{$spec.name}.gemspec"
+ mv File.basename(f.name), f.name
+ end
-file package('.tar.gz') => %w[pkg/] + $spec.files do |f|
- sh <<-SH
- git archive \
- --prefix=#{$spec.name}-#{$spec.version}/ \
- --format=tar \
- HEAD | gzip > #{f.name}
- SH
+ file package('.tar.gz') => %w[pkg/] + $spec.files do |f|
+ sh <<-SH
+ git archive \
+ --prefix=#{$spec.name}-#{$spec.version}/ \
+ --format=tar \
+ HEAD | gzip > #{f.name}
+ SH
+ end
end
-# Rubyforge Release / Publish Tasks ==================================
-
-desc 'Publish gem and tarball to rubyforge'
-task 'release' => [package('.gem'), package('.tar.gz')] do |t|
- sh <<-SH
- rubyforge add_release wink #{$spec.name} #{$spec.version} #{package('.gem')} &&
- rubyforge add_file wink #{$spec.name} #{$spec.version} #{package('.tar.gz')}
- SH
-end
# rebuild the gemspec manifest and update timestamps.
-task "#{$spec.name}.gemspec" => FileList['{lib,spec}/**','Rakefile','COPYING','README.md'] do |f|
+task "sinatra-sequel.gemspec" => FileList['{lib,spec}/**','Rakefile','COPYING','README.md'] do |f|
# read spec file and split out manifest section
spec = File.read(f.name)
head, manifest, tail = spec.split(" # = MANIFEST =\n")

0 comments on commit 1c3bca4

Please sign in to comment.