Sha256: 58b3de81fb7f5e43a09fb242e5d935b7a1f4365c41dd3c1653a3c4bb02984a2c

Contents?: true

Size: 1.55 KB

Versions: 94

Compression:

Stored size: 1.55 KB

Contents

class CookbookKitchen < KitchenAcceptance::Kitchen
  resource_name :cookbook_kitchen

  property :command, default: lazy { name.split(" ")[0] }
  property :kitchen_dir, default: lazy { ::File.join(repository_root, cookbook_relative_dir) }
  property :test_cookbook, String, default: lazy { name.split(" ")[1] }
  property :repository, String, default: lazy { "chef-cookbooks/#{test_cookbook}" },
    coerce: proc { |v|
      # chef-cookbooks/runit -> https://github.com/chef-cookbooks/runit.git
      if !v.include?(':')
        "https://github.com/#{v}.git"
      else
        v
      end
    }
  property :repository_root, String, default: lazy { ::File.join(Chef.node["chef-acceptance"]["suite-dir"], "test_run", test_cookbook) }
  property :branch, String, default: "master"
  property :cookbook_relative_dir, String, default: ""
  property :env, default: lazy {
    {
      "BUNDLE_GEMFILE" => ::File.expand_path("../Gemfile", Chef.node["chef-acceptance"]["suite-dir"]),
#      "KITCHEN_GLOBAL_YAML" => ::File.join(kitchen_dir, ".kitchen.yml"),
      "KITCHEN_YAML" => ::File.join(node["chef-acceptance"]["suite-dir"], ".kitchen.#{test_cookbook}.yml")
    }
  }

  action :run do
    # Ensure the parent directory exists
    directory ::File.expand_path("..", repository_root) do
      recursive true
    end

    # Grab the cookbook
    # TODO Grab the source URL from supermarket
    # TODO get git to include its kitchen tests in the cookbook.
    git repository_root do
      repository new_resource.repository
      branch new_resource.branch
    end

    super()
  end
end

Version data entries

94 entries across 94 versions & 1 rubygems

Version Path
chef-12.21.10 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-12.21.10-universal-mingw32 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-13.3.42-universal-mingw32 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-13.3.42 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-12.21.4 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-12.21.4-universal-mingw32 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-13.2.20-universal-mingw32 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-13.2.20 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-12.21.1-universal-mingw32 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-12.21.1 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-13.1.31-universal-mingw32 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-13.1.31 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-12.20.3 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-12.20.3-universal-mingw32 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-13.0.118-universal-mingw32 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-13.0.118 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-13.0.113-universal-mingw32 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-13.0.113 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-12.19.36-universal-mingw32 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
chef-12.19.36 acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb