summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2010-05-09 09:56:21 -0700
committerDaniel DeLeo <dan@opscode.com>2010-05-11 23:50:41 -0700
commit39ff4b937123ae053b2ba61353437ccaf0fcc8ca (patch)
tree79e84df3a279c4b0d67f1f44d340be8adba23328 /Rakefile
parent8774310f3e8658a6b7be0b9915f73811b222734f (diff)
downloadchef-39ff4b937123ae053b2ba61353437ccaf0fcc8ca.tar.gz
allow other rake tasks to run when rspec/cucumber not installed
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile301
1 files changed, 153 insertions, 148 deletions
diff --git a/Rakefile b/Rakefile
index aa7c8f7e9a..0376fbf5ce 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,7 +1,6 @@
#
-# Rakefile for Chef
-#
# Author:: Adam Jacob (<adam@opscode.com>)
+# Author:: Daniel DeLeo (<dan@opscode.com>)
# Copyright:: Copyright (c) 2008, 2010 Opscode, Inc.
# License:: Apache License, Version 2.0
#
@@ -20,7 +19,6 @@
gems = %w[chef chef-server-api chef-server-webui chef-solr]
require 'rubygems'
-require 'cucumber/rake/task'
desc "Build the chef gems"
task :gem do
@@ -213,14 +211,14 @@ def wait_for_ctrlc
end
end
-desc "Run a Devel instance of Chef"
+desc "Run a development instance of Chef"
task :dev do
start_dev_environment
wait_for_ctrlc
end
namespace :dev do
- desc "Install a test instance of Chef for doing features against"
+ desc "Run a test instance of Chef suitable for cucumber tests"
task :features do
start_dev_environment("features")
wait_for_ctrlc
@@ -309,100 +307,122 @@ namespace :dev do
end
end
-Cucumber::Rake::Task.new(:features) do |t|
- t.profile = "default"
-end
+begin
+ require 'cucumber/rake/task'
-namespace :features do
- desc "Run cucumber tests for the REST API"
- Cucumber::Rake::Task.new(:api) do |t|
- t.profile = "api"
+ Cucumber::Rake::Task.new(:features) do |t|
+ t.profile = "default"
end
- namespace :api do
- [ :nodes, :roles, :clients ].each do |api|
- Cucumber::Rake::Task.new(api) do |apitask|
- apitask.profile = "api_#{api.to_s}"
- end
- namespace api do
- %w{create delete list show update}.each do |action|
- Cucumber::Rake::Task.new("#{action}") do |t|
- t.profile = "api_#{api.to_s}_#{action}"
+ namespace :features do
+ desc "Run cucumber tests for the REST API"
+ Cucumber::Rake::Task.new(:api) do |t|
+ t.profile = "api"
+ end
+
+ namespace :api do
+ [ :nodes, :roles, :clients ].each do |api|
+ Cucumber::Rake::Task.new(api) do |apitask|
+ apitask.profile = "api_#{api.to_s}"
+ end
+ namespace api do
+ %w{create delete list show update}.each do |action|
+ Cucumber::Rake::Task.new("#{action}") do |t|
+ t.profile = "api_#{api.to_s}_#{action}"
+ end
end
end
end
- end
- namespace :nodes do
- Cucumber::Rake::Task.new("sync") do |t|
- t.profile = "api_nodes_sync"
+ namespace :nodes do
+ Cucumber::Rake::Task.new("sync") do |t|
+ t.profile = "api_nodes_sync"
+ end
end
- end
- namespace :cookbooks do
- desc "Run cucumber tests for the cookbooks portion of the REST API"
- Cucumber::Rake::Task.new(:cookbooks) do |t|
- t.profile = "api_cookbooks"
- end
+ namespace :cookbooks do
+ desc "Run cucumber tests for the cookbooks portion of the REST API"
+ Cucumber::Rake::Task.new(:cookbooks) do |t|
+ t.profile = "api_cookbooks"
+ end
- Cucumber::Rake::Task.new(:cookbook_tarballs) do |t|
- t.profile = "api_cookbooks_tarballs"
+ Cucumber::Rake::Task.new(:cookbook_tarballs) do |t|
+ t.profile = "api_cookbooks_tarballs"
+ end
end
- end
- namespace :data do
- desc "Run cucumber tests for the data portion of the REST API"
- Cucumber::Rake::Task.new(:data) do |t|
- t.profile = "api_data"
- end
+ namespace :data do
+ desc "Run cucumber tests for the data portion of the REST API"
+ Cucumber::Rake::Task.new(:data) do |t|
+ t.profile = "api_data"
+ end
- desc "Run cucumber tests for deleting data via the REST API"
- Cucumber::Rake::Task.new(:delete) do |t|
- t.profile = "api_data_delete"
+ desc "Run cucumber tests for deleting data via the REST API"
+ Cucumber::Rake::Task.new(:delete) do |t|
+ t.profile = "api_data_delete"
+ end
+ desc "Run cucumber tests for adding items via the REST API"
+ Cucumber::Rake::Task.new(:item) do |t|
+ t.profile = "api_data_item"
+ end
end
- desc "Run cucumber tests for adding items via the REST API"
- Cucumber::Rake::Task.new(:item) do |t|
- t.profile = "api_data_item"
+
+ namespace :search do
+ desc "Run cucumber tests for searching via the REST API"
+ Cucumber::Rake::Task.new(:search) do |t|
+ t.profile = "api_search"
+ end
+
+ desc "Run cucumber tests for listing search endpoints via the REST API"
+ Cucumber::Rake::Task.new(:list) do |t|
+ t.profile = "api_search_list"
+ end
+ desc "Run cucumber tests for searching via the REST API"
+ Cucumber::Rake::Task.new(:show) do |t|
+ t.profile = "api_search_show"
+ end
+ desc "Run cucumber tests for searching via the REST API"
+ Cucumber::Rake::Task.new(:reindex) do |t|
+ t.profile = "api_search_reindex"
+ end
end
end
- namespace :search do
- desc "Run cucumber tests for searching via the REST API"
- Cucumber::Rake::Task.new(:search) do |t|
- t.profile = "api_search"
- end
+ desc "Run cucumber tests for the chef client"
+ Cucumber::Rake::Task.new(:client) do |t|
+ t.profile = "client"
+ end
- desc "Run cucumber tests for listing search endpoints via the REST API"
- Cucumber::Rake::Task.new(:list) do |t|
- t.profile = "api_search_list"
+ namespace :client do
+ Cucumber::Rake::Task.new(:roles) do |t|
+ t.profile = "client_roles"
end
- desc "Run cucumber tests for searching via the REST API"
- Cucumber::Rake::Task.new(:show) do |t|
- t.profile = "api_search_show"
+
+ Cucumber::Rake::Task.new(:run_interval) do |t|
+ t.profile = "client_run_interval"
end
- desc "Run cucumber tests for searching via the REST API"
- Cucumber::Rake::Task.new(:reindex) do |t|
- t.profile = "api_search_reindex"
+
+ Cucumber::Rake::Task.new(:cookbook_sync) do |t|
+ t.profile = "client_cookbook_sync"
end
end
- end
-
- desc "Run cucumber tests for the chef client"
- Cucumber::Rake::Task.new(:client) do |t|
- t.profile = "client"
- end
- namespace :client do
- Cucumber::Rake::Task.new(:roles) do |t|
- t.profile = "client_roles"
+ desc "Run cucumber tests for the cookbooks"
+ Cucumber::Rake::Task.new(:cookbooks) do |t|
+ t.profile = "cookbooks"
end
- Cucumber::Rake::Task.new(:run_interval) do |t|
- t.profile = "client_run_interval"
+ namespace :cookbook do
+
+ desc "Run cucumber tests for the cookbook metadata"
+ Cucumber::Rake::Task.new(:metadata) do |t|
+ t.profile = "cookbook_metadata"
+ end
end
- Cucumber::Rake::Task.new(:cookbook_sync) do |t|
- t.profile = "client_cookbook_sync"
+ desc "Run cucumber tests for the recipe language"
+ Cucumber::Rake::Task.new(:language) do |t|
+ t.profile = "language"
end
Cucumber::Rake::Task.new(:attribute_settings) do |t|
@@ -410,100 +430,85 @@ namespace :features do
end
end
- desc "Run cucumber tests for the cookbooks"
- Cucumber::Rake::Task.new(:cookbooks) do |t|
- t.profile = "cookbooks"
- end
-
- namespace :cookbook do
-
- desc "Run cucumber tests for the cookbook metadata"
- Cucumber::Rake::Task.new(:metadata) do |t|
- t.profile = "cookbook_metadata"
+ desc "Run cucumber tests for searching in recipes"
+ Cucumber::Rake::Task.new(:search) do |t|
+ t.profile = "search"
end
- end
- desc "Run cucumber tests for the recipe language"
- Cucumber::Rake::Task.new(:language) do |t|
- t.profile = "language"
- end
-
- desc "Run cucumber tests for searching in recipes"
- Cucumber::Rake::Task.new(:search) do |t|
- t.profile = "search"
- end
-
- Cucumber::Rake::Task.new(:language) do |t|
- t.profile = "language"
- end
-
- namespace :language do
- Cucumber::Rake::Task.new(:recipe_include) do |t|
- t.profile = "recipe_inclusion"
- end
- Cucumber::Rake::Task.new(:attribute_include) do |t|
- t.profile = "attribute_inclusion"
+ Cucumber::Rake::Task.new(:language) do |t|
+ t.profile = "language"
end
- end
-
- Cucumber::Rake::Task.new(:lwrp) do |t|
- t.profile = "lwrp"
- end
-
- desc "Run cucumber tests for providers"
- Cucumber::Rake::Task.new(:provider) do |t|
- t.profile = "provider"
- end
-
- namespace :provider do
- desc "Run cucumber tests for deploy resources"
- Cucumber::Rake::Task.new(:deploy) do |t|
- t.profile = "provider_deploy"
+ namespace :language do
+ Cucumber::Rake::Task.new(:recipe_include) do |t|
+ t.profile = "recipe_inclusion"
+ end
+ Cucumber::Rake::Task.new(:attribute_include) do |t|
+ t.profile = "attribute_inclusion"
+ end
end
- desc "Run cucumber tests for directory resources"
- Cucumber::Rake::Task.new(:directory) do |t|
- t.profile = "provider_directory"
+ Cucumber::Rake::Task.new(:lwrp) do |t|
+ t.profile = "lwrp"
end
- desc "Run cucumber tests for execute resources"
- Cucumber::Rake::Task.new(:execute) do |t|
- t.profile = "provider_execute"
+ desc "Run cucumber tests for providers"
+ Cucumber::Rake::Task.new(:provider) do |t|
+ t.profile = "provider"
end
- desc "Run cucumber tests for file resources"
- Cucumber::Rake::Task.new(:file) do |t|
- t.profile = "provider_file"
- end
- desc "Run cucumber tests for remote_file resources"
- Cucumber::Rake::Task.new(:remote_file) do |t|
- t.profile = "provider_remote_file"
- end
+ namespace :provider do
+ desc "Run cucumber tests for deploy resources"
+ Cucumber::Rake::Task.new(:deploy) do |t|
+ t.profile = "provider_deploy"
+ end
- desc "Run cucumber tests for template resources"
- Cucumber::Rake::Task.new(:template) do |t|
- t.profile = "provider_template"
- end
+ desc "Run cucumber tests for directory resources"
+ Cucumber::Rake::Task.new(:directory) do |t|
+ t.profile = "provider_directory"
+ end
- Cucumber::Rake::Task.new(:remote_directory) do |t|
- t.profile = "provider_remote_directory"
- end
+ desc "Run cucumber tests for execute resources"
+ Cucumber::Rake::Task.new(:execute) do |t|
+ t.profile = "provider_execute"
+ end
- Cucumber::Rake::Task.new(:git) do |t|
- t.profile = "provider_git"
- end
+ desc "Run cucumber tests for file resources"
+ Cucumber::Rake::Task.new(:file) do |t|
+ t.profile = "provider_file"
+ end
- namespace :package do
- desc "Run cucumber tests for macports packages"
- Cucumber::Rake::Task.new(:macports) do |t|
- t.profile = "provider_package_macports"
+ desc "Run cucumber tests for remote_file resources"
+ Cucumber::Rake::Task.new(:remote_file) do |t|
+ t.profile = "provider_remote_file"
end
- Cucumber::Rake::Task.new(:gems) do |g|
- g.profile = "provider_package_rubygems"
+ desc "Run cucumber tests for template resources"
+ Cucumber::Rake::Task.new(:template) do |t|
+ t.profile = "provider_template"
+ end
+
+ Cucumber::Rake::Task.new(:remote_directory) do |t|
+ t.profile = "provider_remote_directory"
+ end
+
+ Cucumber::Rake::Task.new(:git) do |t|
+ t.profile = "provider_git"
+ end
+
+ namespace :package do
+ desc "Run cucumber tests for macports packages"
+ Cucumber::Rake::Task.new(:macports) do |t|
+ t.profile = "provider_package_macports"
+ end
+
+ Cucumber::Rake::Task.new(:gems) do |g|
+ g.profile = "provider_package_rubygems"
+ end
end
end
end
+rescue LoadError
+ STDERR.puts "\n*** Cucumber is missing. (sudo) gem install cucumber to run integration tests. ***\n\n"
end