Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add support for librarian-chef
  • Loading branch information
Zachary Patten committed Jun 22, 2012
1 parent 909ead9 commit dbd6a49
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
4 changes: 4 additions & 0 deletions bin/cucumber-chef
Expand Up @@ -110,6 +110,10 @@ class CucumberChef < Thor
puts puts
@region = ask "Which region are you using?", :bold @region = ask "Which region are you using?", :bold
puts puts
say("One last thing. If your using librarian-chef, we want to be sure all the hooks are in place.")
puts
@librarian_chef = yes?("Does this chef-repo use librarian-chef?", :bold)
puts
say "Awesome. Thank you!" say "Awesome. Thank you!"
puts puts
end end
Expand Down
20 changes: 11 additions & 9 deletions lib/cucumber/chef/config.rb
Expand Up @@ -153,17 +153,19 @@ def self.aws_image_id


################################################################################ ################################################################################


mode :user mode :user
provider :aws prerelease true
prerelease true


aws Hash[ :ubuntu_release => "precise", provider :aws
:aws_instance_arch => "i386", librarian_chef false
:aws_instance_disk_store => "ebs",
:aws_instance_type => "m1.small",
:aws_security_group => "cucumber-chef" ]


vagrant Hash.new aws Hash[ :ubuntu_release => "precise",
:aws_instance_arch => "i386",
:aws_instance_disk_store => "ebs",
:aws_instance_type => "m1.small",
:aws_security_group => "cucumber-chef" ]

vagrant Hash.new


################################################################################ ################################################################################


Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/chef/provisioner.rb
Expand Up @@ -149,7 +149,7 @@ def render_knife_rb
template_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "lib", "cucumber", "chef", "templates", "cucumber-chef", "knife-rb.erb")) template_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "lib", "cucumber", "chef", "templates", "cucumber-chef", "knife-rb.erb"))
knife_rb = File.expand_path(File.join(Cucumber::Chef.locate(:directory, ".cucumber-chef"), "knife.rb")) knife_rb = File.expand_path(File.join(Cucumber::Chef.locate(:directory, ".cucumber-chef"), "knife.rb"))


context = { :chef_server => @server.public_ip_address } context = { :chef_server => @server.public_ip_address, :librarian_chef => Cucumber::Chef::Config[:librarian_chef] }
File.open(knife_rb, 'w') do |f| File.open(knife_rb, 'w') do |f|
f.puts(Cucumber::Chef::Template.render(template_file, context)) f.puts(Cucumber::Chef::Template.render(template_file, context))
end end
Expand Down
5 changes: 1 addition & 4 deletions lib/cucumber/chef/templates/cucumber-chef/config-rb.erb
Expand Up @@ -2,8 +2,8 @@
# Cucumber-Chef # Cucumber-Chef
################################################################################ ################################################################################


mode :user
provider :aws provider :aws
librarian_chef <%= @librarian_chef %>




################################################################################ ################################################################################
Expand All @@ -19,9 +19,6 @@ aws[:identity_file] = "<%= File.join(@aws_ssh_key_dir, @aws_ssh_key)
aws[:region] = "<%= @region %>-1" aws[:region] = "<%= @region %>-1"
aws[:availability_zone] = "<%= @region %>-1a" aws[:availability_zone] = "<%= @region %>-1a"


#aws[:aws_image_id] = "ami-339ca947"
#aws[:ubuntu_release] = "maverick"

#aws[:aws_instance_arch] = "i386" #aws[:aws_instance_arch] = "i386"
#aws[:aws_instance_disk_store] = "instance-store" #aws[:aws_instance_disk_store] = "instance-store"
#aws[:aws_instance_type] = "m1.small" #aws[:aws_instance_type] = "m1.small"
Expand Down
5 changes: 5 additions & 0 deletions lib/cucumber/chef/templates/cucumber-chef/knife-rb.erb
Expand Up @@ -12,3 +12,8 @@ cache_type "BasicFile"
cookbook_path ['#{current_dir}/../cookbooks'] cookbook_path ['#{current_dir}/../cookbooks']


cache_options(:path => "#{current_dir}/checksums") cache_options(:path => "#{current_dir}/checksums")
<% if @config[:librarian_chef] -%>

require 'librarian/chef/integration/knife'
cookbook_path Librarian::Chef.install_path, "#{current_dir}/../site-cookbooks"
<% end -%>

0 comments on commit dbd6a49

Please sign in to comment.