Skip to content

Commit

Permalink
Update Rakefile to match changes from CHEF-257, and add optional site…
Browse files Browse the repository at this point in the history
…- prefix for new_cookbook
  • Loading branch information
jtimberman committed Apr 30, 2009
1 parent 58dd958 commit b147d9f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Rakefile
Expand Up @@ -2,7 +2,7 @@
# Rakefile for Chef Server Repository
#
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2008 OpsCode, Inc.
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -54,7 +54,12 @@ end
desc "Test your cookbooks for syntax errors"
task :test do
puts "** Testing your cookbooks for syntax errors"
Dir[ File.join(TOPDIR, "cookbooks", "**", "*.rb") ].each do |recipe|

recipes = ["*cookbooks"].map { |folder|
Dir[File.join(TOPDIR, folder, "**", "*.rb")]
}.flatten

recipes.each do |recipe|
print "Testing recipe #{recipe}: "
sh %{ruby -c #{recipe}} do |ok, res|
if ! ok
Expand All @@ -80,7 +85,7 @@ task :install => [ :update, :test ] do
puts "* Installing new Cookbooks"
sh "sudo rsync -rlP --delete --exclude '.svn' cookbooks/ #{COOKBOOK_PATH}"
puts "* Installing new Site Cookbooks"
sh "sudo rsync -rlP --delete --exclude '.svn' site-cookbooks/ #{SITE_COOKBOOK_PATH}"
sh "sudo rsync -rlP --delete --exclude '.svn' cookbooks/ #{SITE_COOKBOOK_PATH}"
puts "* Installing new Chef Server Config"
sh "sudo cp config/server.rb #{CHEF_SERVER_CONFIG}"
puts "* Installing new Chef Client Config"
Expand All @@ -90,9 +95,9 @@ end
desc "By default, run rake test"
task :default => [ :test ]

desc "Create a new cookbook (with COOKBOOK=name)"
desc "Create a new cookbook (with COOKBOOK=name, optional CB_PREFIX=site-)"
task :new_cookbook do
create_cookbook(File.join(TOPDIR, "cookbooks"))
create_cookbook(File.join(TOPDIR, "#{ENV["CB_PREFIX"]}cookbooks"))
end

def create_cookbook(dir)
Expand Down

0 comments on commit b147d9f

Please sign in to comment.