features/step_definitions/cookbook_steps.rb in stove-1.1.2 vs features/step_definitions/cookbook_steps.rb in stove-2.0.0.beta.1

- old
+ new

@@ -1,24 +1,46 @@ -Given /^I have a cookbook named "(.+)"(?: (?:at|with) version "(.+)")?$/ do |name, version| +Given /^I have a cookbook named "(\w+)" at version "([\d\.]+)"$/ do |name, version| create_cookbook(name, version) end -Given /^I have a cookbook named "(.+)"(?: (?:at|with) version "(.+)")? with git support$/ do |name, version| - create_cookbook(name, version, git: true) +Given /^I have a cookbook named "(\w+)"$/ do |name| + create_cookbook(name, '0.0.0') end +Given /^I have a cookbook named "(\w+)" with git support$/ do |name| + create_cookbook(name, '0.0.0', git: true) +end + +# # Create a new cookbook with the given name and version. # # @param [String] name # @param [String] version (default: 0.0.0.0) # @param [Hash] options +# def create_cookbook(name, version, options = {}) create_dir(name) cd(name) - write_file('CHANGELOG.md', "#{name} Cookbook CHANGELOG\n=====\n\nv0.0.0\n-----") - write_file('README.md', 'This is a README') - write_file('metadata.rb', "name '#{name}'\nversion '#{version || '0.0.0'}'") + + write_file('CHANGELOG.md', <<-EOH.gsub(/^ {4}/, '')) + Changelog + ========= + + v#{version} (#{Time.now.to_date}) + ---------------------------- + - This is an entry + - This is another entry + EOH + + write_file('README.md', <<-EOH.gsub(/^ {4}/, '')) + This is the README for #{name} + EOH + + write_file('metadata.rb', <<-EOH.gsub(/^ {4}/, '')) + name '#{name}' + version '#{version}' + EOH if options[:git] git_init(current_dir) end end