Rakefile in bosh-cloudfoundry-0.6.1 vs Rakefile in bosh-cloudfoundry-0.7.0.alpha.1
- old
+ new
@@ -1,7 +1,5 @@
-# Copyright (c) 2012-2013 Stark & Wayne, LLC
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __FILE__)
require "rubygems"
require "bundler"
Bundler.setup(:default, :test, :development)
@@ -10,26 +8,52 @@
require "rake/dsl_definition"
require "rake"
require "rspec/core/rake_task"
+bosh_release = "cf-release"
+target_bosh_release_path = File.expand_path("../bosh_release", __FILE__)
-if defined?(RSpec)
- namespace :spec do
- desc "Run Unit Tests"
- unit_rspec_task = RSpec::Core::RakeTask.new(:unit) do |t|
- t.pattern = "spec/unit/**/*_spec.rb"
- t.rspec_opts = %w(--format progress --color)
+namespace :bosh do
+ namespace :release do
+ desc "Import latest #{bosh_release}"
+ task :import, :path do |t, args|
+ source_bosh_release = File.expand_path(args[:path])
+ unless File.directory?(source_bosh_release)
+ $stderr.puts "Please pass path to source bosh release"
+ exit 1
+ end
+
+ sh "rm -rf #{target_bosh_release_path}"
+
+ # required directories to pass bosh_cli validations
+ %w[config jobs packages src].each do |dir|
+ sh "mkdir -p #{target_bosh_release_path}/#{dir}"
+ sh "touch #{target_bosh_release_path}/#{dir}/.gitkeep"
+ end
+
+ chdir(target_bosh_release_path) do
+ sh "cp -R #{source_bosh_release}/releases #{target_bosh_release_path}"
+ sh "cp -R #{source_bosh_release}/.final_builds #{target_bosh_release_path}"
+ sh "cp -R #{source_bosh_release}/config/final.yml #{target_bosh_release_path}/config"
+ end
end
- desc "Run Integration Tests"
- functional_rspec_task = RSpec::Core::RakeTask.new(:functional) do |t|
- t.pattern = "spec/functional/**/*_spec.rb"
- t.rspec_opts = %w(--format progress --color)
+ desc "Remove any large temporary tgz from internal bosh_release"
+ task :clean do
+ chdir(target_bosh_release_path) do
+ sh "ls .final_builds/**/*.tgz | xargs rm; true"
+ sh "ls releases/**/*.tgz | xargs rm; true"
+ end
end
end
+end
- desc "Install dependencies and run tests"
- task :spec => %w(spec:unit spec:functional)
+task :release => "bosh:release:clean"
+
+desc "Run specs"
+unit_rspec_task = RSpec::Core::RakeTask.new(:spec) do |t|
+ t.pattern = "spec/*_spec.rb"
+ t.rspec_opts = %w(--format progress --color)
end
-task :default => :spec
\ No newline at end of file
+task :default => :spec