Rakefile in dpl-1.9.1.travis.2711.5 vs Rakefile in dpl-1.9.1
- old
+ new
@@ -34,10 +34,14 @@
@ready = true
end
end
+def dpl_bin
+ File.join(Gem.bindir, 'dpl')
+end
+
gemspecs = FileList[File.join(top, "dpl-*.gemspec")]
providers = gemspecs.map { |f| /dpl-(?<provider>.*)\.gemspec/ =~ f && provider }
task :default => [:spec, :install] do
@@ -64,10 +68,19 @@
providers.each do |provider|
Rake::Task["dpl-#{provider}-#{gem_version}.gem"].invoke
end
end
+desc "Uninstall all gems"
+task :uninstall do
+ providers.each do |provider|
+ Rake::Task["uninstall-#{provider}"].invoke
+ end
+ logger.info red("Uninstalling dpl")
+ sh "gem uninstall -aIx dpl"
+end
+
desc "Release all gems"
task :release do
confirm
threads = []
providers.each { |provider| threads << Thread.new { Rake::Task["release-#{provider}"].invoke } }
@@ -93,10 +106,12 @@
end
task :clean do
rm_rf "stubs"
rm_rf "vendor"
+ rm_rf "dpl-*.gem"
+ Rake::Task[:uninstall].invoke
end
desc "Run dpl specs"
task :spec do
ruby '-S rspec spec/cli_spec.rb spec/provider_spec.rb'
@@ -107,11 +122,11 @@
logger.info green("Building dpl gem")
ruby "-S gem build dpl.gemspec"
end
desc "Install dpl gem"
-task :install => "dpl-#{gem_version}.gem" do
+file dpl_bin => "dpl-#{gem_version}.gem" do
logger.info green("Installing dpl gem")
ruby "-S gem install dpl-#{gem_version}.gem"
end
providers.each do |provider|
@@ -121,11 +136,11 @@
logger.info green("Writing #{gemfile}")
gemfile.write %Q(source 'https://rubygems.org'\ngemspec :name => "dpl-#{provider}"\n)
end
desc %Q(Run dpl-#{provider} specs)
- task "spec-#{provider}" => [:install, "Gemfile-#{provider}"] do
+ task "spec-#{provider}" => [Rake::FileTask[dpl_bin], "Gemfile-#{provider}"] do
sh "rm -f $HOME/.npmrc"
logger.info green("Running `bundle install` for #{provider}")
sh 'bash', '-cl', "bundle install --gemfile=Gemfile-#{provider} --path=vendor/cache/dpl-#{provider} --retry=3 --binstubs=stubs"
logger.info green("Running specs for #{provider}")
sh "env BUNDLE_GEMFILE=Gemfile-#{provider} ./stubs/rspec spec/provider/#{provider}_spec.rb"
@@ -136,14 +151,20 @@
logger.info green("Building dpl-#{provider} gem")
ruby "-S gem build --silent dpl-#{provider}.gemspec"
end
desc "Test dpl-#{provider} gem"
- task "check-#{provider}" => [:install, "dpl-#{provider}-#{gem_version}.gem"] do
+ task "check-#{provider}" => [Rake::FileTask[dpl_bin], "dpl-#{provider}-#{gem_version}.gem"] do
logger.info green("Installing dpl-#{provider} gem")
sh "gem install --no-post-install-message dpl-#{provider}-#{gem_version}.gem"
logger.info green("Testing dpl-#{provider} loads correctly")
ruby "-S dpl --provider=#{provider} --skip-cleanup=true --no-deploy"
+ end
+
+ desc "Uninstall dpl-#{provider}"
+ task "uninstall-#{provider}" do
+ logger.info red("Uninstalling dpl-#{provider}")
+ sh "gem uninstall -aIx dpl-#{provider}"
end
desc "Release dpl-#{provider} gem"
task "release-#{provider}" => "dpl-#{provider}-#{gem_version}.gem" do
confirm