Skip to content

Instantly share code, notes, and snippets.

@jamtur01
Created April 21, 2013 19:33
Show Gist options
  • Save jamtur01/5430766 to your computer and use it in GitHub Desktop.
Save jamtur01/5430766 to your computer and use it in GitHub Desktop.
require 'hashr'
require 'test-kitchen/project'
require 'test-kitchen/platform'
require 'test-kitchen/runner/openstack/dsl'
module TestKitchen
module DSL
module BasicDSL
def integration_test(name, &block)
env.project = Project::Ruby.new(name.to_s, &block)
end
def platform(name, &block)
env.platforms[name.to_s] = Platform.new(name, &block)
end
def default_runner(name)
env.default_runner = name
end
end
module CookbookDSL
def cookbook(name, &block)
env.project = Project::Cookbook.new(name.to_s, &block)
end
end
module ModuleDSL
def module(name, &block)
puts name, &block
env.project = Project::Module.new(name.to_s, &block)
end
end
class File
include BasicDSL
include CookbookDSL
include ModuleDSL
attr_reader :env
def load(path, env)
@env = env
begin
self.instance_eval(::File.read(path))
rescue SyntaxError
env.ui.info('Your Kitchenfile could not be loaded. Please check it for errors.', :red)
raise
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment