Skip to content
This repository
tag: 0.3
Fetching contributors…

Cannot retrieve contributors at this time

file 56 lines (46 sloc) 1.358 kb
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
require 'rake/clean'
require 'rake/testtask'

task :default => [:test]
task :spec => :test

Rake::TestTask.new(:test) do |t|
  t.test_files = FileList['test/spec_*.rb']
  t.ruby_opts = ['-rubygems'] if defined? Gem
end

$spec =
  begin
    require 'rubygems/specification'
    data = File.read('shotgun.gemspec')
    spec = nil
    Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
    spec
  end

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

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

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('.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

desc 'Publish gem and tarball to rubyforge'
task 'release' => [package('.gem'), package('.tar.gz')] do |t|
  sh <<-end
rubyforge add_release wink #{$spec.name} #{$spec.version} #{package('.gem')} &&
rubyforge add_file wink #{$spec.name} #{$spec.version} #{package('.tar.gz')}
end
end
Something went wrong with that request. Please try again.