Archive for January 2014

I moved my config into yaml files

January 23, 2014

My rspec tests used to have a before each that looked like this:

 @driver = HAmvc::Configuration.instance.get_driver :ios
 @welcome = MobileTest::Welcome_controller.new @driver
 @signin = MobileTest::SignInController.new @driver
 @menu = MobileTest::MenuController.new @driver

The controllers would be constructed like this

def initialize browser
 @view = SignIn_view.new browser
end

Now the before all looks like this:

 @welcome = MobileTest::Welcome_controller.new
 @signin = MobileTest::SignInController.new
 @menu = MobileTest::MenuController.new

And the the controller does this

 def initialize view = SignIn_view.new
   @view = view
 end

The view class now knows how to get a driver from the singleton that has them. So the an environment variable set to ios_stage would load up the center chunk of this:

android_stage:
 :env: stage
 :os: android
 :artifact: http://jenkins-machine/job/android-stage-build/lastSuccessfulBuild/artifact/HomeAway-app/build/apk/HomeAway-app-release.apk
 :locale: en_US
 :device:
ios_stage:
 :env: stage
 :os: ios
 :artifact: http://jenkins-machine/job/HomeAway-iOS/DEPLOY_ENV=Stage/lastSuccessfulBuild/artifact/artifacts/homeaway-internal-STAGE.ipa
 :locale: en_US
brent_ios_local:
 :env: stage
 :os: ios
 :artifact: /Users/blavelle/iOS.app
 :locale: en_US

I’m much happier with this setup but now the question is, how do I iterate over configurations? ¬†Should I do it within a ruby or have a different Jenkins job for each configuration in that yaml file?