summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorAdam Jacob <adam@opscode.com>2009-08-01 21:26:21 -0700
committerAdam Jacob <adam@opscode.com>2009-08-20 13:31:58 -0700
commit89779a4d487ac7dd313e16eb68732835bd13d4e4 (patch)
treed8b867f3a5610ed39bd864149152085af05a1c3d /Rakefile
parent89a2609242a63d6bc85e0ddfed078319b4d4a81b (diff)
downloadchef-89779a4d487ac7dd313e16eb68732835bd13d4e4.tar.gz
Initial pass at a Chef 0.8.0 alpha
Conflicts: Rakefile chef-server-slice/Rakefile chef-server-slice/app/controllers/application.rb chef-server-slice/app/controllers/exceptions.rb chef-server-slice/app/controllers/nodes.rb chef-server-slice/app/controllers/openid_consumer.rb chef-server-slice/app/controllers/openid_server.rb chef-server-slice/app/helpers/nodes_helper.rb chef-server/Rakefile chef-server/config/dependencies.rb chef-server/config/init.rb chef/Rakefile chef/lib/chef.rb chef/lib/chef/application/indexer.rb chef/lib/chef/client.rb chef/lib/chef/config.rb chef/lib/chef/node.rb chef/lib/chef/queue.rb chef/spec/unit/application/indexer_spec.rb chef/spec/unit/client_spec.rb chef/spec/unit/config_spec.rb cucumber.yml features/api/nodes/create_node_api.feature features/api/nodes/delete_node_api.feature features/api/nodes/list_nodes_api.feature features/api/nodes/show_node_api.feature features/api/nodes/update_node_api.feature features/api/roles/list_roles_api.feature features/steps/fixture_steps.rb
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile263
1 files changed, 223 insertions, 40 deletions
diff --git a/Rakefile b/Rakefile
index ad5fe113ff..7d308ed0f9 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,4 +1,4 @@
-gems = %w[chef chef-server-slice chef-server]
+gems = %w[chef chef-server-api chef-server-webui chef-server chef-solr]
require 'rubygems'
require 'cucumber/rake/task'
@@ -26,71 +26,111 @@ end
desc "Run the rspec tests"
task :spec do
Dir.chdir("chef") { sh "rake spec" }
+ Dir.chdir("chef-solr") { sh "rake spec" }
end
task :default => :spec
-def start_dev_environment(type="normal")
- @couchdb_server_pid = nil
- @chef_server_pid = nil
- @chef_indexer_pid = nil
- @stompserver_pid = nil
-
- ccid = fork
- if ccid
- @couchdb_server_pid = ccid
+def start_couchdb(type="normal")
+ @couchdb_server_pid = nil
+ cid = fork
+ if cid
+ @couchdb_server_pid = cid
else
exec("couchdb")
end
+end
- scid = fork
- if scid
- @stompserver_pid = scid
+def start_rabbitmq(type="normal")
+ @rabbitmq_server_pid = nil
+ cid = fork
+ if cid
+ @rabbitmq_server_pid = cid
else
- exec("stompserver")
+ exec("rabbitmq-server")
end
+end
- mcid = fork
- if mcid # parent
- @chef_indexer_pid = mcid
- else # child
+def start_chef_solr(type="normal")
+ @chef_solr_pid = nil
+ cid = fork
+ if cid
+ @chef_solr_pid = cid
+ else
case type
when "normal"
- exec("chef-indexer -l debug")
+ exec("./chef-solr/bin/chef-solr -l debug")
when "features"
- exec("chef-indexer -c #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug")
+ exec("./chef-solr/bin/chef-solr -c #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug")
end
end
+end
+def start_chef_solr_indexer(type="normal")
+ @chef_solr_indexer = nil
+ cid = fork
+ if cid
+ @chef_solr_indexer_pid = cid
+ else
+ case type
+ when "normal"
+ exec("./chef-solr/bin/chef-solr-indexer -l debug")
+ when "features"
+ exec("./chef-solr/bin/chef-solr-indexer -c #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug")
+ end
+ end
+end
+
+def start_chef_server(type="normal")
+ @chef_server_pid = nil
mcid = fork
if mcid # parent
@chef_server_pid = mcid
else # child
case type
when "normal"
- exec("chef-server -l debug -N -c 2")
+ exec("./chef-server/bin/chef-server -a thin -l debug -N")
when "features"
- exec("chef-server -C #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug -N -c 2")
-
+ exec("./chef-server/bin/chef-server -a thin -C #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug -N")
end
end
+end
- puts "Running Chef at #{@chef_server_pid}"
- puts "Running Chef Indexer at #{@chef_indexer_pid}"
+def start_dev_environment(type="normal")
+ start_couchdb(type)
+ start_rabbitmq(type)
+ start_chef_solr(type)
+ start_chef_solr_indexer(type)
+ start_chef_server(type)
puts "Running CouchDB at #{@couchdb_server_pid}"
- puts "Running Stompserver at #{@stompserver_pid}"
+ puts "Running RabbitMQ at #{@rabbitmq_server_pid}"
+ puts "Running Chef Solr at #{@chef_solr_pid}"
+ puts "Running Chef Solr Indexer at #{@chef_solr_indexer_pid}"
+ puts "Running Chef at #{@chef_server_pid}"
end
def stop_dev_environment
- puts "Stopping CouchDB"
- Process.kill("KILL", @couchdb_server_pid)
- puts "Stopping Stomp server"
- Process.kill("KILL", @stompserver_pid)
- puts "Stopping Chef Server"
- Process.kill("INT", @chef_server_pid)
- puts "Stopping Chef Indexer"
- Process.kill("INT", @chef_indexer_pid)
- puts "\nCouchDB, Stomp, Chef Server and Chef Indexer killed - have a nice day!"
+ if @chef_server_pid
+ puts "Stopping Chef"
+ Process.kill("KILL", @chef_server_pid)
+ end
+ if @chef_solr_pid
+ puts "Stopping Chef Solr"
+ Process.kill("INT", @chef_solr_pid)
+ end
+ if @chef_solr_indexer_pid
+ puts "Stopping Chef Solr Indexer"
+ Process.kill("INT", @chef_solr_indexer_pid)
+ end
+ if @couchdb_server_pid
+ puts "Stopping CouchDB"
+ Process.kill("KILL", @couchdb_server_pid)
+ end
+ if @rabbitmq_server_pid
+ puts "Stopping RabbitMQ"
+ Process.kill("KILL", @rabbitmq_server_pid)
+ end
+ puts "Have a nice day!"
end
def wait_for_ctrlc
@@ -106,7 +146,7 @@ def wait_for_ctrlc
end
desc "Run a Devel instance of Chef"
-task :dev => "dev:install" do
+task :dev do
start_dev_environment
wait_for_ctrlc
end
@@ -114,12 +154,77 @@ end
namespace :dev do
desc "Install a test instance of Chef for doing features against"
task :features do
- gems.each do |dir|
- Dir.chdir(dir) { sh "rake install" }
- end
start_dev_environment("features")
wait_for_ctrlc
end
+
+ namespace :features do
+
+ namespace :start do
+ desc "Start CouchDB for testing"
+ task :couchdb do
+ start_couchdb("features")
+ wait_for_ctrlc
+ end
+
+ desc "Start RabbitMQ for testing"
+ task :rabbitmq do
+ start_rabbitmq("features")
+ wait_for_ctrlc
+ end
+
+ desc "Start Chef Solr for testing"
+ task :chef_solr do
+ start_chef_solr("features")
+ wait_for_ctrlc
+ end
+
+ desc "Start Chef Solr Indexer for testing"
+ task :chef_solr_indexer do
+ start_chef_solr_indexer("features")
+ wait_for_ctrlc
+ end
+
+ desc "Start Chef Server for testing"
+ task :chef_server do
+ start_chef_server("features")
+ wait_for_ctrlc
+ end
+
+ end
+ end
+
+ namespace :start do
+ desc "Start CouchDB"
+ task :couchdb do
+ start_couchdb
+ wait_for_ctrlc
+ end
+
+ desc "Start RabbitMQ"
+ task :rabbitmq do
+ start_rabbitmq
+ wait_for_ctrlc
+ end
+
+ desc "Start Chef Solr"
+ task :chef_solr do
+ start_chef_solr
+ wait_for_ctrlc
+ end
+
+ desc "Start Chef Solr Indexer"
+ task :chef_solr_indexer do
+ start_chef_solr_indexer
+ wait_for_ctrlc
+ end
+
+ desc "Start Chef Server"
+ task :chef_server do
+ start_chef_server
+ wait_for_ctrlc
+ end
+ end
end
Cucumber::Rake::Task.new(:features) do |t|
@@ -127,12 +232,13 @@ Cucumber::Rake::Task.new(:features) do |t|
end
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].each do |api|
+ [ :nodes, :roles ].each do |api|
Cucumber::Rake::Task.new(api) do |apitask|
apitask.profile = "api_#{api.to_s}"
end
@@ -144,8 +250,52 @@ namespace :features do
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
+
+ Cucumber::Rake::Task.new(:cookbook_tarballs) do |t|
+ t.profile = "api_cookbooks_tarballs"
+ 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
+
+ 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
+
+ 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
+ end
end
+ desc "Run cucumber tests for the chef client"
Cucumber::Rake::Task.new(:client) do |t|
t.profile = "client"
end
@@ -156,6 +306,17 @@ namespace :features do
end
end
+ desc "Run cucumber tests for the cookbooks"
+ Cucumber::Rake::Task.new(:cookbooks) do |t|
+ t.profile = "cookbooks"
+ 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
@@ -170,12 +331,34 @@ namespace :features do
end
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 directory resources"
+ Cucumber::Rake::Task.new(:directory) do |t|
+ t.profile = "provider_directory"
+ end
+
+ desc "Run cucumber tests for execute resources"
+ Cucumber::Rake::Task.new(:execute) do |t|
+ t.profile = "provider_execute"
+ end
+
+ desc "Run cucumber tests for file resources"
+ Cucumber::Rake::Task.new(:execute) 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 :package do
+ desc "Run cucumber tests for macports packages"
Cucumber::Rake::Task.new(:macports) do |t|
t.profile = "provider_package_macports"
end