Created
April 21, 2013 19:33
-
-
Save jamtur01/5430766 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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