Skip to content

Commit

Permalink
rubygems is required for packaging tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
rtomayko committed Jun 7, 2010
1 parent 1c22a73 commit ad3b0d7
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions Rakefile
Expand Up @@ -42,32 +42,31 @@ task :rdoc => ["RDOX"]

# PACKAGING =================================================================

if defined?(Gem)
# load gemspec
$spec = eval(File.read('rack-contrib.gemspec'))
require 'rubygems'
# load gemspec
$spec = eval(File.read('rack-contrib.gemspec'))

def package(ext='')
"pkg/rack-contrib-#{$spec.version}" + ext
end
def package(ext='')
"pkg/rack-contrib-#{$spec.version}" + ext
end

desc 'Build packages'
task :package => %w[.gem .tar.gz].map {|e| package(e)}
desc 'Build packages'
task :package => %w[.gem .tar.gz].map {|e| package(e)}

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/'
directory 'pkg/'

file package('.gem') => %w[pkg/ rack-contrib.gemspec] + $spec.files do |f|
sh "gem build rack-contrib.gemspec"
mv File.basename(f.name), f.name
end
file package('.gem') => %w[pkg/ rack-contrib.gemspec] + $spec.files do |f|
sh "gem build rack-contrib.gemspec"
mv File.basename(f.name), f.name
end

file package('.tar.gz') => %w[pkg/] + $spec.files do |f|
sh "git archive --format=tar HEAD | gzip > #{f.name}"
end
file package('.tar.gz') => %w[pkg/] + $spec.files do |f|
sh "git archive --format=tar HEAD | gzip > #{f.name}"
end

# GEMSPEC ===================================================================
Expand Down

0 comments on commit ad3b0d7

Please sign in to comment.