- `rake spec' no longer installs dependencies
  - no shelling out
  - single Rakefile
  - separate gemspec
  - replaced obsoleted gempackagetask with Gem::PackageTask
  - `rake install` continues to build and install stager gem

Change-Id: If55229379ec28504f68d3f8d1bf92da3bf3c76c9
This commit is contained in:
Jesse Zhang 2012-02-29 14:40:27 -08:00
Родитель e82227c93d
Коммит 0580179d18
2 изменённых файлов: 13 добавлений и 70 удалений

Просмотреть файл

@ -1,57 +1,20 @@
require 'rubygems'
require 'rake'
require 'rake/gempackagetask'
require 'rubygems/package_task'
require 'rspec/core/rake_task'
require 'ci/reporter/rake/rspec'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
require 'vcap/stager/version'
GEM_NAME = 'vcap_stager'
GEM_VERSION = VCAP::Stager::VERSION
gemspec = Gem::Specification.new do |s|
s.name = GEM_NAME
s.version = GEM_VERSION
s.platform = Gem::Platform::RUBY
s.summary = 'Component responsible for staging apps'
s.description = 'Takes an app package, environment, and services' \
+ ' and produces a droplet that is executable by the DEA'
s.authors = ['Matt Page']
s.email = 'mpage@vmware.com'
s.homepage = 'http://www.cloudfoundry.com'
s.executables = []
s.bindir = 'bin'
s.require_path = 'lib'
s.files = %w(Rakefile Gemfile) + Dir.glob("{lib,spec,vendor}/**/*")
end
Rake::GemPackageTask.new(gemspec) do |pkg|
pkg.gem_spec = gemspec
end
gemspec = Gem::Specification.load('vcap_stager.gemspec')
gem_package_task = Gem::PackageTask.new(gemspec) {}
gem_path = File.join(gem_package_task.package_dir, gemspec.full_name)
desc "Install #{gem_path}"
task :install => [:package] do
sh "gem install --no-ri --no-rdoc pkg/#{GEM_NAME}-#{GEM_VERSION}"
sh "gem install --no-ri --no-rdoc #{gem_path}"
end
task :spec => ['bundler:install:test'] do
desc 'Run tests'
sh('cd spec && rake spec')
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/**/*_spec.rb'
t.rspec_opts = ['--color', '--format nested']
end
task 'ci:spec' do
desc 'Run tests for CI'
sh('cd spec && rake ci:spec')
end
namespace 'bundler' do
task 'install' do
sh('bundle install')
end
environments = %w(test development production)
environments.each do |env|
desc "Install gems for #{env}"
task "install:#{env}" do
sh("bundle install --local --without #{(environments - [env]).join(' ')}")
end
end
end
desc "Run specs producing results for CI"
task 'ci:spec' => ['ci:setup:rspec', :spec]

Просмотреть файл

@ -1,20 +0,0 @@
require 'rake'
BASE_DIR = File.expand_path(File.join('..', '..'), __FILE__)
ENV["BUNDLE_GEMFILE"] ||= File.join(BASE_DIR, 'Gemfile')
require 'rubygems'
require 'bundler'
Bundler.setup(:default, :test)
require 'rspec/core/rake_task'
require 'ci/reporter/rake/rspec'
ENV['CI_REPORTS'] = File.expand_path('reports', File.dirname(__FILE__))
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = '**/*_spec.rb'
t.rspec_opts = ['--color', '--format nested']
end
task :default => [:spec]
task 'ci:spec' => ['ci:setup:rspec', :spec]