capitate 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Capfile +3 -11
- data/History.txt +8 -1
- data/Manifest.txt +4 -17
- data/bin/capitate +51 -19
- data/config/hoe.rb +3 -1
- data/lib/capitate/plugins/base.rb +81 -35
- data/lib/capitate/recipes.rb +1 -2
- data/lib/capitate/task_node.rb +157 -0
- data/lib/capitate/version.rb +1 -1
- data/lib/capitate.rb +2 -0
- data/lib/profiles/centos-sick.rb +18 -16
- data/lib/recipes/centos/imagemagick.rb +3 -2
- data/lib/recipes/centos/memcached.rb +18 -3
- data/lib/recipes/centos/mongrel_cluster.rb +15 -5
- data/lib/recipes/centos/monit.rb +14 -3
- data/lib/recipes/centos/mysql.rb +10 -3
- data/lib/recipes/centos/nginx.rb +29 -3
- data/lib/recipes/centos/ruby.rb +2 -2
- data/lib/recipes/centos/sphinx.rb +19 -6
- data/lib/recipes/docs.rb +17 -0
- data/lib/recipes/gems.rb +10 -1
- data/lib/recipes/memcached.rb +11 -1
- data/lib/recipes/mongrel_cluster.rb +13 -1
- data/lib/recipes/mysql.rb +41 -2
- data/lib/recipes/nginx.rb +25 -11
- data/lib/recipes/packages.rb +16 -1
- data/lib/recipes/rails.rb +16 -1
- data/lib/recipes/recipes.rb +30 -0
- data/tasks/website.rake +9 -0
- data/website/index.html +46 -44
- data/website/index.txt +24 -31
- data/website/stylesheets/screen.css +31 -12
- data/website/template.rhtml +19 -5
- data/website/template_recipe.rhtml +25 -0
- metadata +19 -24
- data/lib/capitate/config.rb +0 -106
- data/lib/doc/centos/memcached.yml +0 -18
- data/lib/doc/centos/mongrel_cluster.yml +0 -11
- data/lib/doc/centos/monit.yml +0 -12
- data/lib/doc/centos/mysql.yml +0 -6
- data/lib/doc/centos/nginx.yml +0 -25
- data/lib/doc/centos/sphinx.yml +0 -14
- data/lib/doc/gems.yml +0 -7
- data/lib/doc/install.yml +0 -11
- data/lib/doc/memcached.yml +0 -13
- data/lib/doc/mongrel_cluster.yml +0 -12
- data/lib/doc/mysql.yml +0 -46
- data/lib/doc/nginx.yml +0 -23
- data/lib/doc/packages.yml +0 -17
- data/lib/doc/rails.yml +0 -15
- data/lib/recipes/install.rb +0 -18
- data/tasks/capitate.rake +0 -10
data/Capfile
CHANGED
@@ -7,18 +7,10 @@ load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
|
7
7
|
require 'lib/capitate'
|
8
8
|
|
9
9
|
# Load recipes
|
10
|
-
|
10
|
+
require 'lib/capitate/recipes'
|
11
11
|
|
12
12
|
require 'erb'
|
13
13
|
|
14
|
-
# This should be overriden by project specific Capfile
|
15
|
-
set :user, Proc.new { Capistrano::CLI.ui.ask('Bootstrap user: ') }
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
# Choose a profile
|
21
|
-
set :profile, Proc.new { load profile.choose }
|
22
|
-
|
23
|
-
# Reset the password var
|
24
|
-
reset_password
|
15
|
+
set :recipes_run, [ "centos:setup_for_web", "packages:install", "ruby:centos:install" ]
|
16
|
+
set :user, "root"
|
data/History.txt
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
== 0.1.
|
1
|
+
== 0.1.8 2008-02-22
|
2
|
+
|
3
|
+
* Fixing up documentation
|
4
|
+
* Creating recipe documentation recipe
|
5
|
+
* New website generation
|
6
|
+
* Moved some recipes around
|
7
|
+
|
8
|
+
== 0.1.7 2008-02-21
|
2
9
|
|
3
10
|
* Renamed to 'capitate'
|
4
11
|
* Moving centos specific recipes into separate namespace
|
data/Manifest.txt
CHANGED
@@ -11,7 +11,6 @@ lib/capitate.rb
|
|
11
11
|
lib/capitate/cap_ext/connections.rb
|
12
12
|
lib/capitate/cap_ext/extension_proxy.rb
|
13
13
|
lib/capitate/cap_ext/variables.rb
|
14
|
-
lib/capitate/config.rb
|
15
14
|
lib/capitate/plugins/base.rb
|
16
15
|
lib/capitate/plugins/gem.rb
|
17
16
|
lib/capitate/plugins/package.rb
|
@@ -21,21 +20,8 @@ lib/capitate/plugins/templates.rb
|
|
21
20
|
lib/capitate/plugins/wget.rb
|
22
21
|
lib/capitate/plugins/yum.rb
|
23
22
|
lib/capitate/recipes.rb
|
23
|
+
lib/capitate/task_node.rb
|
24
24
|
lib/capitate/version.rb
|
25
|
-
lib/doc/centos/memcached.yml
|
26
|
-
lib/doc/centos/mongrel_cluster.yml
|
27
|
-
lib/doc/centos/monit.yml
|
28
|
-
lib/doc/centos/mysql.yml
|
29
|
-
lib/doc/centos/nginx.yml
|
30
|
-
lib/doc/centos/sphinx.yml
|
31
|
-
lib/doc/gems.yml
|
32
|
-
lib/doc/install.yml
|
33
|
-
lib/doc/memcached.yml
|
34
|
-
lib/doc/mongrel_cluster.yml
|
35
|
-
lib/doc/mysql.yml
|
36
|
-
lib/doc/nginx.yml
|
37
|
-
lib/doc/packages.yml
|
38
|
-
lib/doc/rails.yml
|
39
25
|
lib/profiles/centos-sick.rb
|
40
26
|
lib/recipes/README
|
41
27
|
lib/recipes/centos/README
|
@@ -49,14 +35,15 @@ lib/recipes/centos/nginx.rb
|
|
49
35
|
lib/recipes/centos/ruby.rb
|
50
36
|
lib/recipes/centos/sphinx.rb
|
51
37
|
lib/recipes/deploy.rb
|
38
|
+
lib/recipes/docs.rb
|
52
39
|
lib/recipes/gems.rb
|
53
|
-
lib/recipes/install.rb
|
54
40
|
lib/recipes/memcached.rb
|
55
41
|
lib/recipes/mongrel_cluster.rb
|
56
42
|
lib/recipes/mysql.rb
|
57
43
|
lib/recipes/nginx.rb
|
58
44
|
lib/recipes/packages.rb
|
59
45
|
lib/recipes/rails.rb
|
46
|
+
lib/recipes/recipes.rb
|
60
47
|
lib/recipes/sphinx.rb
|
61
48
|
lib/templates/capistrano/Capfile
|
62
49
|
lib/templates/centos/setup_for_web.sh
|
@@ -86,7 +73,6 @@ script/destroy
|
|
86
73
|
script/generate
|
87
74
|
script/txt2html
|
88
75
|
setup.rb
|
89
|
-
tasks/capitate.rake
|
90
76
|
tasks/deployment.rake
|
91
77
|
tasks/environment.rake
|
92
78
|
tasks/website.rake
|
@@ -98,3 +84,4 @@ website/index.txt
|
|
98
84
|
website/javascripts/rounded_corners_lite.inc.js
|
99
85
|
website/stylesheets/screen.css
|
100
86
|
website/template.rhtml
|
87
|
+
website/template_recipe.rhtml
|
data/bin/capitate
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
OptionParser.new do |opts|
|
6
|
+
opts.banner = "Usage: #{File.basename($0)} [path]"
|
7
|
+
|
8
|
+
opts.on("-h", "--help", "Displays this help info") do
|
9
|
+
puts opts
|
10
|
+
exit 0
|
11
|
+
end
|
12
|
+
|
13
|
+
begin
|
14
|
+
opts.parse!(ARGV)
|
15
|
+
rescue OptionParser::ParseError => e
|
16
|
+
warn e.message
|
17
|
+
puts opts
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
end
|
3
21
|
|
4
22
|
begin
|
5
23
|
require 'capitate'
|
@@ -8,19 +26,6 @@ rescue LoadError
|
|
8
26
|
require 'capitate'
|
9
27
|
end
|
10
28
|
|
11
|
-
def usage
|
12
|
-
puts <<-EOS
|
13
|
-
|
14
|
-
Capitate your project.
|
15
|
-
|
16
|
-
Usage:
|
17
|
-
|
18
|
-
#{$0} bootstrap
|
19
|
-
|
20
|
-
EOS
|
21
|
-
|
22
|
-
exit 1
|
23
|
-
end
|
24
29
|
|
25
30
|
class CapitateBin
|
26
31
|
class << self
|
@@ -28,19 +33,46 @@ class CapitateBin
|
|
28
33
|
end
|
29
34
|
end
|
30
35
|
|
36
|
+
if ARGV.empty?
|
37
|
+
abort "Please specify the directory to capify, e.g. `#{File.basename($0)} .'"
|
38
|
+
elsif !File.exists?(ARGV.first)
|
39
|
+
abort "`#{ARGV.first}' does not exist."
|
40
|
+
elsif !File.directory?(ARGV.first)
|
41
|
+
abort "`#{ARGV.first}' is not a directory."
|
42
|
+
elsif ARGV.length > 1
|
43
|
+
abort "Too many arguments; please specify only the directory to capitate."
|
44
|
+
end
|
45
|
+
|
46
|
+
base = ARGV.shift
|
47
|
+
|
31
48
|
puts <<-EOS
|
32
49
|
|
33
50
|
Generating capistrano configuration...
|
34
|
-
|
51
|
+
|
35
52
|
EOS
|
36
|
-
|
37
|
-
|
38
|
-
|
53
|
+
|
54
|
+
files = { "Capfile" => "capistrano/Capfile" }
|
55
|
+
|
56
|
+
files.each do |file, template|
|
57
|
+
file = File.join(base, file)
|
58
|
+
if File.exists?(file)
|
59
|
+
warn "`#{file}' already exists"
|
60
|
+
elsif File.exists?(file.downcase)
|
61
|
+
warn "`#{file.downcase}' exists, which could conflict with `#{file}'"
|
62
|
+
elsif !File.exists?(File.dirname(file))
|
63
|
+
warn "Directory `#{File.dirname(file)}' does not exist"
|
64
|
+
else
|
65
|
+
# Write Capfile
|
66
|
+
CapitateBin.write(template, file)
|
67
|
+
end
|
68
|
+
end
|
39
69
|
|
40
70
|
puts <<-EOS
|
41
71
|
|
42
72
|
You now need to create and set you deployment "profile" in the Capfile.
|
43
73
|
This is currently a manual process, see the documentation on profiles
|
44
74
|
for more information.
|
45
|
-
|
75
|
+
|
46
76
|
EOS
|
77
|
+
|
78
|
+
|
data/config/hoe.rb
CHANGED
@@ -2,7 +2,7 @@ require 'capitate/version'
|
|
2
2
|
|
3
3
|
AUTHOR = 'Gabriel Handford' # can also be an array of Authors
|
4
4
|
EMAIL = "gabrielh@gmail.com"
|
5
|
-
DESCRIPTION = "Capistrano
|
5
|
+
DESCRIPTION = "Capistrano recipes, plugins and templates."
|
6
6
|
GEM_NAME = 'capitate' # what ppl will type to install your gem
|
7
7
|
RUBYFORGE_PROJECT = 'capitate' # The unix name for your project
|
8
8
|
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
@@ -55,10 +55,12 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
55
55
|
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
56
56
|
p.test_globs = ["test/**/test_*.rb"]
|
57
57
|
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
58
|
+
p.clean_globs += ['website/recipes/**', 'docs/recipes/**']
|
58
59
|
|
59
60
|
# == Optional
|
60
61
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
61
62
|
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
63
|
+
p.extra_deps = [ [ "capistrano", ">=2.1.0" ] ]
|
62
64
|
|
63
65
|
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
64
66
|
|
@@ -4,7 +4,8 @@ require 'yaml'
|
|
4
4
|
# Capitate base capistrano plugin
|
5
5
|
module Capitate::Plugins::Base
|
6
6
|
|
7
|
-
# Project root
|
7
|
+
# Project root. Fetch from :project_root, or fall back to RAILS_ROOT.
|
8
|
+
#
|
8
9
|
def root
|
9
10
|
if respond_to?(:fetch)
|
10
11
|
return fetch(:project_root)
|
@@ -13,7 +14,16 @@ module Capitate::Plugins::Base
|
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
|
-
# Path relative to project root
|
17
|
+
# Path relative to project root.
|
18
|
+
# Project root is set via, set :project_root, "path/to/project" in Capfile.
|
19
|
+
#
|
20
|
+
# ==== Options
|
21
|
+
# +path+:: Relative path
|
22
|
+
# +check_exist+:: Whether to check its existence and throw error if not found
|
23
|
+
#
|
24
|
+
# ==== Examples
|
25
|
+
# relative_to_root("config/foo.yml") => "path/to/project/config/foo.yml"
|
26
|
+
#
|
17
27
|
def relative_to_root(path = nil, check_exist = false)
|
18
28
|
if path
|
19
29
|
root_path = File.join(root, path)
|
@@ -33,52 +43,88 @@ module Capitate::Plugins::Base
|
|
33
43
|
end
|
34
44
|
|
35
45
|
root_path
|
36
|
-
end
|
46
|
+
end
|
37
47
|
|
38
|
-
#
|
39
|
-
#
|
40
|
-
# ==== Examples
|
41
|
-
# capitate.current_task_docs => { "task_name" => { "variable" => "The usage docs" } }
|
42
|
-
#
|
43
|
-
def current_task_doc
|
44
|
-
path = File.dirname(__FILE__) + "/../../doc/" + current_task.namespace.fully_qualified_name.to_s.gsub(":", "/") + ".yml"
|
45
|
-
puts "Current task doc: #{path}"
|
46
|
-
return YAML.load_file(path) if File.exist?(path)
|
47
|
-
nil
|
48
|
-
end
|
49
|
-
|
50
|
-
# Usage for variable from current task documentation.
|
48
|
+
# Usage for current task.
|
51
49
|
#
|
52
50
|
# ==== Options
|
53
|
-
# +
|
54
|
-
#
|
51
|
+
# +variable+:: Missing variable setting
|
52
|
+
#
|
55
53
|
# ==== Examples
|
56
|
-
# usage(:gem_list) => "
|
54
|
+
# usage(:gem_list) => "Description from task definition."
|
57
55
|
#
|
58
|
-
def usage(
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
Please set :#{var_name} variable in your Capfile, deploy.rb or profile.
|
67
|
-
|
68
|
-
Usage:
|
69
|
-
|
70
|
-
#{indent_doc(var_usage)}
|
71
|
-
|
56
|
+
def usage(variable = nil)
|
57
|
+
message = ""
|
58
|
+
|
59
|
+
if variable
|
60
|
+
message += <<-EOS
|
61
|
+
|
62
|
+
Error: :#{variable} not set.
|
72
63
|
EOS
|
73
64
|
end
|
65
|
+
|
66
|
+
message += <<-EOS
|
67
|
+
|
68
|
+
Usage:
|
69
|
+
|
70
|
+
#{indent_doc(current_task.desc)}
|
71
|
+
|
72
|
+
EOS
|
74
73
|
end
|
75
74
|
|
76
|
-
|
77
|
-
|
75
|
+
# Indent string block.
|
76
|
+
#
|
77
|
+
# ==== Options
|
78
|
+
# +s+:: String block
|
79
|
+
# +amount+:: Amount to indent
|
80
|
+
#
|
81
|
+
def indent_doc(s, amount = 4)
|
78
82
|
return nil if s.blank?
|
79
83
|
indentation = (0..amount).collect { |n| " " }.join
|
80
84
|
s.split("\n").collect { |sp| "#{indentation}#{sp}"}.join("\n")
|
81
85
|
end
|
86
|
+
|
87
|
+
# Unindent, lifted from capistrano bin/capify
|
88
|
+
def unindent(string)
|
89
|
+
return "" if string.blank?
|
90
|
+
if string =~ /\A(\s*)/
|
91
|
+
amount = $1.length
|
92
|
+
return string.strip.gsub(/^#{$1}/, "")
|
93
|
+
end
|
94
|
+
string
|
95
|
+
end
|
96
|
+
|
97
|
+
# Load all tasks
|
98
|
+
def load_all_tasks
|
99
|
+
tasks = []
|
100
|
+
top.namespaces.each do |namespace|
|
101
|
+
load_tasks(namespace, tasks)
|
102
|
+
end
|
103
|
+
tasks
|
104
|
+
end
|
105
|
+
|
106
|
+
def task_tree
|
107
|
+
top_node = Capitate::TaskNode.new("top")
|
108
|
+
|
109
|
+
load_all_tasks.each do |task|
|
110
|
+
Capitate::TaskNode.populate_with_task(top_node, task)
|
111
|
+
end
|
112
|
+
top_node
|
113
|
+
end
|
114
|
+
|
115
|
+
protected
|
116
|
+
|
117
|
+
def load_tasks(namespace, tasks = [])
|
118
|
+
recipe = namespace.last
|
119
|
+
|
120
|
+
recipe.namespaces.each do |nested_namespace|
|
121
|
+
load_tasks(nested_namespace, tasks)
|
122
|
+
end
|
123
|
+
|
124
|
+
recipe.task_list.each do |task|
|
125
|
+
tasks << task
|
126
|
+
end
|
127
|
+
end
|
82
128
|
|
83
129
|
end
|
84
130
|
|
data/lib/capitate/recipes.rb
CHANGED
@@ -0,0 +1,157 @@
|
|
1
|
+
# TODO: Document this class
|
2
|
+
class Capitate::TaskNode
|
3
|
+
|
4
|
+
include Capitate::Plugins::Base
|
5
|
+
|
6
|
+
attr_reader :name, :nodes, :tasks, :parent
|
7
|
+
|
8
|
+
def initialize(name, parent = nil)
|
9
|
+
@name = name
|
10
|
+
@parent = parent
|
11
|
+
@nodes = []
|
12
|
+
@tasks = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_node(task_node)
|
16
|
+
@nodes << task_node
|
17
|
+
end
|
18
|
+
|
19
|
+
def find(name)
|
20
|
+
@nodes.each do |node|
|
21
|
+
return node if node.name == name
|
22
|
+
end
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_task(task)
|
27
|
+
@tasks << task
|
28
|
+
end
|
29
|
+
|
30
|
+
def sorted_nodes
|
31
|
+
nodes.sort_by(&:name)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Depth first iteration
|
35
|
+
def each_node(level = 0, &block)
|
36
|
+
sorted_nodes.each do |node|
|
37
|
+
yield(node, level)
|
38
|
+
node.each_node(level + 1, &block)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def full_name(delimeter = "-")
|
43
|
+
if parent
|
44
|
+
parent_name = parent.full_name
|
45
|
+
return [ parent_name, name ].compact.join(delimeter)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Return nil for top node
|
49
|
+
name == "top" ? nil : name
|
50
|
+
end
|
51
|
+
|
52
|
+
# Write doc for node (recursively)
|
53
|
+
def write_doc(dir, file_name = nil, title = nil, options = {}, &block)
|
54
|
+
|
55
|
+
file_name ||= full_name
|
56
|
+
title ||= full_name(":")
|
57
|
+
|
58
|
+
path = "#{dir}/#{file_name}.txt"
|
59
|
+
puts "%10s %-30s" % [ "create", path ]
|
60
|
+
|
61
|
+
File.open(path, "w") do |file|
|
62
|
+
file.puts "h1. #{title}\n\n"
|
63
|
+
|
64
|
+
#
|
65
|
+
# Breadcrumb generate
|
66
|
+
#
|
67
|
+
bc_full_name = full_name(":")
|
68
|
+
links = []
|
69
|
+
if bc_full_name
|
70
|
+
names = bc_full_name.split(":")
|
71
|
+
links << " #{names.pop} " # Pop off current
|
72
|
+
|
73
|
+
while(!names.empty?) do
|
74
|
+
links << %{ "#{names.last}":#{names.join("-")}.html }
|
75
|
+
names.pop
|
76
|
+
end
|
77
|
+
end
|
78
|
+
# Write breadcrumb
|
79
|
+
file.puts %{ "home":../index.html > "recipes":index.html > #{links.reverse.join(" > ")} }
|
80
|
+
|
81
|
+
#
|
82
|
+
# Namespace
|
83
|
+
#
|
84
|
+
unless sorted_nodes.empty?
|
85
|
+
file.puts "h2. Namespaces\n\n"
|
86
|
+
each_node do |snode, level|
|
87
|
+
li_level = (0..level).collect { "*" }.join
|
88
|
+
file.puts %{#{li_level} "#{snode.full_name(":")}":#{snode.full_name}.html \n}
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
#
|
93
|
+
# Tasks
|
94
|
+
#
|
95
|
+
unless tasks.empty?
|
96
|
+
file.puts "\n\n"
|
97
|
+
file.puts "h2. Tasks\n\n"
|
98
|
+
tasks.each do |task|
|
99
|
+
file.puts "h3. #{task.fully_qualified_name}\n\n"
|
100
|
+
file.puts "#{unindent(task.desc)}\n\n\n\n"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# Write doc (recursively for "child" namespace)
|
106
|
+
sorted_nodes.each do |snode|
|
107
|
+
snode.write_doc(dir)
|
108
|
+
end
|
109
|
+
|
110
|
+
# If block then let it do stuff with open file
|
111
|
+
if block_given?
|
112
|
+
file.puts "\n\n"
|
113
|
+
yield(file)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def to_s(level = 0)
|
119
|
+
spaces = " "
|
120
|
+
indent = (0...level).collect { spaces }.join("")
|
121
|
+
|
122
|
+
# Ignore top node (level = -1)
|
123
|
+
if level >= 0
|
124
|
+
t_indent = "\n#{indent} #{spaces} - "
|
125
|
+
task_names = tasks.collect(&:name).sort_by(&:to_s).join(t_indent)
|
126
|
+
s = "#{indent} -- #{name}:#{t_indent}#{task_names}\n"
|
127
|
+
else
|
128
|
+
s = ""
|
129
|
+
end
|
130
|
+
|
131
|
+
sorted_nodes.each do |node|
|
132
|
+
s += node.to_s(level + 1)
|
133
|
+
end
|
134
|
+
s
|
135
|
+
end
|
136
|
+
|
137
|
+
class << self
|
138
|
+
|
139
|
+
def populate_with_task(top_node, task)
|
140
|
+
node_names = task.namespace.fully_qualified_name.split(":")
|
141
|
+
|
142
|
+
node = top_node
|
143
|
+
|
144
|
+
node_names.each do |name|
|
145
|
+
parent_node = node
|
146
|
+
node = parent_node.find(name)
|
147
|
+
if !node
|
148
|
+
node = self.new(name, parent_node)
|
149
|
+
parent_node.add_node(node)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
node.add_task(task)
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
data/lib/capitate/version.rb
CHANGED
data/lib/capitate.rb
CHANGED
data/lib/profiles/centos-sick.rb
CHANGED
@@ -2,23 +2,20 @@
|
|
2
2
|
# This is an EXAMPLE profile.
|
3
3
|
#
|
4
4
|
# Profile for sick rails app on centos 5.1
|
5
|
-
# Profiles are basically a beefed up deploy.rb
|
6
5
|
#
|
7
6
|
|
8
7
|
set :description, "Sick project deployment for centos 5.1 image"
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
set :recipes, [
|
9
|
+
set :recipes_run, [
|
13
10
|
"centos:setup_for_web",
|
14
11
|
"packages:install",
|
15
|
-
"centos:
|
16
|
-
"centos:
|
17
|
-
"centos:
|
18
|
-
"centos:
|
19
|
-
"centos:
|
20
|
-
"centos:
|
21
|
-
"centos:
|
12
|
+
"ruby:centos:install",
|
13
|
+
"nginx:centos:install",
|
14
|
+
"mysql:centos:install",
|
15
|
+
"sphinx:centos:install",
|
16
|
+
"monit:centos:install",
|
17
|
+
"imagemagick:centos:install",
|
18
|
+
"memcached:centos:install",
|
22
19
|
"nginx:install_monit",
|
23
20
|
"mysql:install_monit",
|
24
21
|
"memcached:install_monit",
|
@@ -75,7 +72,7 @@ set :memcached_port, 11211
|
|
75
72
|
|
76
73
|
|
77
74
|
#
|
78
|
-
# Settings for
|
75
|
+
# Settings for project
|
79
76
|
#
|
80
77
|
|
81
78
|
set :application, "sick"
|
@@ -84,7 +81,7 @@ set :deploy_to, "/var/www/apps/sick"
|
|
84
81
|
set :web_host, "WEB_HOST"
|
85
82
|
set :db_host, "DB_HOST"
|
86
83
|
set :db_user, "sick"
|
87
|
-
set :db_pass, ""
|
84
|
+
set :db_pass, "sick"
|
88
85
|
set :db_name, "sick"
|
89
86
|
# db_port set already
|
90
87
|
set :sphinx_host, "SPHINX_HOST"
|
@@ -99,14 +96,19 @@ set :deploy_via, :copy
|
|
99
96
|
set :copy_strategy, :export
|
100
97
|
|
101
98
|
role :web, "WEB_URL"
|
102
|
-
role :db,
|
99
|
+
role :db, "DB_URL", :primary => true
|
103
100
|
|
104
101
|
|
105
102
|
# Callbacks
|
106
103
|
before "deploy:setup", "centos:add_user_for_app"
|
107
104
|
|
108
|
-
after "deploy:setup", "mysql:setup", "rails:setup", "mongrel_cluster:
|
109
|
-
"nginx:setup_mongrel", "centos:
|
105
|
+
after "deploy:setup", "mysql:setup", "rails:setup", "mongrel_cluster:centos:setup",
|
106
|
+
"nginx:setup_mongrel", "sphinx:centos:setup"
|
107
|
+
|
108
|
+
after "sphinx:centos:setup", "sphinx:setup_monit"
|
109
|
+
after "mongrel_cluster:centos:setup", "mongrel_cluster:setup_monit"
|
110
|
+
|
111
|
+
after "nginx:setup_mongrels", "nginx:centos:restart"
|
110
112
|
|
111
113
|
after "deploy:update_code", "rails:update_code", "sphinx:update_code"
|
112
114
|
|
@@ -1,8 +1,23 @@
|
|
1
|
-
namespace :
|
1
|
+
namespace :memcached do
|
2
2
|
|
3
|
-
namespace :
|
3
|
+
namespace :centos do
|
4
4
|
|
5
|
-
desc
|
5
|
+
desc <<-DESC
|
6
|
+
Install memcached.
|
7
|
+
|
8
|
+
memcached_memory: Memcached memory (in MB).
|
9
|
+
|
10
|
+
set :memcached_memory, 64
|
11
|
+
|
12
|
+
memcached_pid_path: Path to memcached pid file. Defaults to /var/run/memcached.pid
|
13
|
+
|
14
|
+
set :memcached_pid_path, "/var/run/memcached.pid"
|
15
|
+
|
16
|
+
memcached_port: Memcached port. Defaults to 11211.
|
17
|
+
|
18
|
+
set :memcached_port, 11211
|
19
|
+
|
20
|
+
DESC
|
6
21
|
task :install do
|
7
22
|
|
8
23
|
# Settings
|
@@ -1,12 +1,22 @@
|
|
1
|
-
namespace :
|
1
|
+
namespace :mongrel_cluster do
|
2
2
|
|
3
|
-
namespace :
|
3
|
+
namespace :centos do
|
4
4
|
|
5
|
-
|
5
|
+
desc <<-DESC
|
6
|
+
Create mongrel cluster.
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
mongrel_size: Number of mongrels.
|
9
|
+
|
10
|
+
set :mongrel_size, 3
|
11
|
+
|
12
|
+
mongrel_port: Starting port for mongrels. If there are 3 mongrels with port 9000, then instances will be at
|
13
|
+
9000, 9001, and 9002
|
9
14
|
|
15
|
+
set :mongrel_port, 9000
|
16
|
+
|
17
|
+
DESC
|
18
|
+
task :setup do
|
19
|
+
|
10
20
|
# Settings
|
11
21
|
fetch(:mongrel_size)
|
12
22
|
fetch(:mongrel_port)
|