Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

gem packaging tasks only available when Gem is defined

  • Loading branch information...
commit b2cbe44e385a26abdfc6f73168293b92c6b0a7f3 1 parent 835ae2c
@rtomayko authored
Showing with 32 additions and 31 deletions.
  1. +32 −31 Rakefile
View
63 Rakefile
@@ -5,38 +5,39 @@ task :default => [:test]
task :spec => :test
Rake::TestTask.new(:test) do |t|
- t.test_files = FileList['test/spec_*.rb']
+ t.test_files = FileList['test/*_test.rb']
t.ruby_opts = ['-rubygems'] if defined? Gem
end
-require 'rubygems'
-$spec = eval(File.read('shotgun.gemspec'))
-
-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
+if defined? Gem
+ $spec = eval(File.read('shotgun.gemspec'))
+
+ 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 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/ shotgun.gemspec] + $spec.files do |f|
+ sh "gem build shotgun.gemspec"
+ mv File.basename(f.name), f.name
+ end
+
+ file package('.tar.gz') => %w[pkg/] + $spec.files do |f|
+ sh <<-SH
+ git archive \
+ --prefix=shotgun-#{$spec.version}/ \
+ --format=tar \
+ HEAD | gzip > #{f.name}
+ SH
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.