Permalink
Browse files

[stager] Minimal and Configurable Test Manifests

  - Picks up ruby18 runtime info from CI environment
  - Falls back on example manifests (with hardcoded path and versions)
    - Only copy Sinatra manifests

  This allows Continuous Integration environment to set a different ruby
version than that specified by the example manifest.

Change-Id: If5ed2ba4180acfc193ee1137597d18659ace5184
  • Loading branch information...
1 parent 75977e6 commit 013e3f0d3924d69d5aaf379e479325187e8083f7 @d d committed Feb 23, 2012
Showing with 19 additions and 1 deletion.
  1. +19 −1 stager/spec/spec_helper.rb
View
@@ -22,7 +22,25 @@
RSpec.configure do |config|
config.before(:all) do
begin
- VCAP::Subprocess.run("cp -a #{File.join(StagingPlugin::DEFAULT_MANIFEST_ROOT, '*.yml')} #{STAGING_TEMP}")
+ VCAP::Subprocess.run("cp -a #{File.join(StagingPlugin::DEFAULT_MANIFEST_ROOT, 'sinatra.yml')} #{STAGING_TEMP}")
+ if ENV["CI_VCAP_STAGER_RUBY18"] && ENV["CI_VCAP_STAGER_RUBY18_VER"] then
+ sinatra_manifest = {
+ 'name' => "sinatra",
+ 'runtimes' => [
+ 'ruby18' => {
+ 'version' => ENV["CI_VCAP_STAGER_RUBY18_VER"],
+ 'executable' => ENV["CI_VCAP_STAGER_RUBY18"],
+ },
+ ],
+ 'detection' => [
+ {'*.rb' => "require 'sinatra'|require \"sinatra\""},
+ ],
+ }
+ File.open(File.join(STAGING_TEMP, "sinatra.yml"), "w") do |file|
+ YAML.dump sinatra_manifest, file
+ end
+ puts File.join(STAGING_TEMP, "sinatra.yml")
+ end
rescue VCAP::SubprocessStatusError => e
puts "Unable to copy staging manifests. Permissions problem?"
puts "#{e}"

0 comments on commit 013e3f0

Please sign in to comment.