capitate 0.2.11 → 0.2.13
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/History.txt +9 -0
- data/Manifest.txt +11 -1
- data/lib/capitate/cap_ext/connections.rb +15 -8
- data/lib/capitate/cap_ext/run_via.rb +2 -0
- data/lib/capitate/cap_ext/variables.rb +9 -2
- data/lib/capitate/plugins/base.rb +17 -12
- data/lib/capitate/plugins/build.rb +14 -11
- data/lib/capitate/plugins/prompt.rb +6 -8
- data/lib/capitate/plugins/script.rb +6 -4
- data/lib/capitate/plugins/templates.rb +16 -7
- data/lib/capitate/plugins/upload.rb +2 -1
- data/lib/capitate/plugins/utils.rb +7 -5
- data/lib/capitate/task_node.rb +30 -32
- data/lib/capitate/version.rb +1 -1
- data/lib/recipes/backgroundrb.rb +18 -4
- data/lib/recipes/centos/backgroundrb.rb +10 -3
- data/lib/recipes/centos/centos.rb +21 -8
- data/lib/recipes/centos/imagemagick.rb +4 -1
- data/lib/recipes/centos/memcached.rb +26 -8
- data/lib/recipes/centos/mongrel_cluster.rb +33 -13
- data/lib/recipes/centos/monit.rb +32 -11
- data/lib/recipes/centos/mysql.rb +7 -2
- data/lib/recipes/centos/nginx.rb +29 -10
- data/lib/recipes/centos/ruby.rb +11 -2
- data/lib/recipes/centos/sphinx.rb +32 -10
- data/lib/recipes/docs.rb +12 -7
- data/lib/recipes/logrotate/backgroundrb.rb +25 -0
- data/lib/recipes/logrotated.rb +18 -12
- data/lib/recipes/memcached.rb +0 -25
- data/lib/recipes/monit/backgroundrb.rb +39 -0
- data/lib/recipes/monit/memcached.rb +22 -0
- data/lib/recipes/{mongrel_cluster.rb → monit/mongrel_cluster.rb} +22 -12
- data/lib/recipes/monit/mysql.rb +21 -0
- data/lib/recipes/monit/nginx.rb +34 -0
- data/lib/recipes/monit/sphinx.rb +29 -0
- data/lib/recipes/monit/sshd.rb +27 -0
- data/lib/recipes/monit.rb +18 -3
- data/lib/recipes/mysql.rb +22 -32
- data/lib/recipes/nginx.rb +15 -30
- data/lib/recipes/rails.rb +17 -6
- data/lib/recipes/sphinx.rb +11 -24
- data/lib/recipes/sshd.rb +4 -22
- data/lib/recipes/syslogd.rb +4 -0
- data/lib/templates/backgroundrb/backgroundrb.monitrc.erb +4 -0
- data/lib/templates/backgroundrb/backgroundrb.yml.erb +4 -0
- data/website/index.html +10 -2
- data/website/javascripts/code_highlighter.js +188 -0
- data/website/javascripts/ruby.js +18 -0
- data/website/stylesheets/screen.css +116 -23
- data/website/template.rhtml +9 -1
- data/website/template_recipe.rhtml +12 -1
- metadata +13 -3
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 0.2.13 2008-03-26
|
2
|
+
|
3
|
+
* Fixing monit re/start for mongrel cluster and backgroundrb
|
4
|
+
|
5
|
+
== 0.2.12 2008-03-26
|
6
|
+
|
7
|
+
* Re-formatting some documentation, experimenting with getting source in the docs (FAIL!)
|
8
|
+
* Including backgroundrb logrotate, monit, restart
|
9
|
+
|
1
10
|
== 0.2.11 2008-03-25
|
2
11
|
|
3
12
|
* Backgroundrb recipes and templates
|
data/Manifest.txt
CHANGED
@@ -38,6 +38,7 @@ lib/recipes/centos/nginx.rb
|
|
38
38
|
lib/recipes/centos/ruby.rb
|
39
39
|
lib/recipes/centos/sphinx.rb
|
40
40
|
lib/recipes/docs.rb
|
41
|
+
lib/recipes/logrotate/backgroundrb.rb
|
41
42
|
lib/recipes/logrotate/mongrel_cluster.rb
|
42
43
|
lib/recipes/logrotate/monit.rb
|
43
44
|
lib/recipes/logrotate/nginx.rb
|
@@ -45,8 +46,14 @@ lib/recipes/logrotate/rails.rb
|
|
45
46
|
lib/recipes/logrotate/sphinx.rb
|
46
47
|
lib/recipes/logrotated.rb
|
47
48
|
lib/recipes/memcached.rb
|
48
|
-
lib/recipes/mongrel_cluster.rb
|
49
49
|
lib/recipes/monit.rb
|
50
|
+
lib/recipes/monit/backgroundrb.rb
|
51
|
+
lib/recipes/monit/memcached.rb
|
52
|
+
lib/recipes/monit/mongrel_cluster.rb
|
53
|
+
lib/recipes/monit/mysql.rb
|
54
|
+
lib/recipes/monit/nginx.rb
|
55
|
+
lib/recipes/monit/sphinx.rb
|
56
|
+
lib/recipes/monit/sshd.rb
|
50
57
|
lib/recipes/mysql.rb
|
51
58
|
lib/recipes/nginx.rb
|
52
59
|
lib/recipes/rails.rb
|
@@ -54,6 +61,7 @@ lib/recipes/sphinx.rb
|
|
54
61
|
lib/recipes/sshd.rb
|
55
62
|
lib/recipes/syslogd.rb
|
56
63
|
lib/templates/backgroundrb/backgroundrb.initd.centos.erb
|
64
|
+
lib/templates/backgroundrb/backgroundrb.monitrc.erb
|
57
65
|
lib/templates/backgroundrb/backgroundrb.yml.erb
|
58
66
|
lib/templates/capistrano/Capfile
|
59
67
|
lib/templates/logrotated/conf.erb
|
@@ -92,7 +100,9 @@ test/test_roles.rb
|
|
92
100
|
test/test_templates.rb
|
93
101
|
website/index.html
|
94
102
|
website/index.txt
|
103
|
+
website/javascripts/code_highlighter.js
|
95
104
|
website/javascripts/rounded_corners_lite.inc.js
|
105
|
+
website/javascripts/ruby.js
|
96
106
|
website/stylesheets/screen.css
|
97
107
|
website/template.rhtml
|
98
108
|
website/template_recipe.rhtml
|
@@ -12,13 +12,21 @@ module Capitate
|
|
12
12
|
# establishes connections to them, and then yields that list of
|
13
13
|
# servers.
|
14
14
|
#
|
15
|
-
#
|
15
|
+
# If you set:
|
16
|
+
#
|
17
|
+
# set :ignore_missing_roles, true
|
18
|
+
#
|
19
|
+
# Overriden to handle NoMatchingServersError as NON-FATAL.
|
16
20
|
#
|
17
|
-
def execute_on_servers_with_capitate(options={}, &block)
|
18
|
-
|
21
|
+
def execute_on_servers_with_capitate(options={}, &block)
|
22
|
+
if exists?(:ignore_missing_roles) && fetch(:ignore_missing_roles)
|
23
|
+
begin
|
24
|
+
execute_on_servers_without_capitate(options, &block)
|
25
|
+
rescue Capistrano::NoMatchingServersError => e
|
26
|
+
logger.important "`#{current_task.fully_qualified_name}' is only run for servers matching #{current_task.options.inspect}, but no servers matched"
|
27
|
+
end
|
28
|
+
else
|
19
29
|
execute_on_servers_without_capitate(options, &block)
|
20
|
-
rescue Capistrano::NoMatchingServersError => e
|
21
|
-
logger.important "`#{current_task.fully_qualified_name}' is only run for servers matching #{current_task.options.inspect}, but no servers matched"
|
22
30
|
end
|
23
31
|
end
|
24
32
|
|
@@ -59,7 +67,7 @@ module Capitate
|
|
59
67
|
clear_sessions
|
60
68
|
end
|
61
69
|
|
62
|
-
# Yields the previous user.
|
70
|
+
# Perform action as a different user. Yields the previous user to the block.
|
63
71
|
#
|
64
72
|
# ==== Options
|
65
73
|
# +new_user+:: User to become
|
@@ -81,8 +89,7 @@ module Capitate
|
|
81
89
|
clear_sessions
|
82
90
|
end
|
83
91
|
|
84
|
-
# Close all open sessions.
|
85
|
-
# Will force user to re-login.
|
92
|
+
# Close all open sessions, and will force user to re-login.
|
86
93
|
def clear_sessions
|
87
94
|
sessions.each do |key, session|
|
88
95
|
logger.info "Closing: #{key}"
|
@@ -7,7 +7,7 @@ module Capitate
|
|
7
7
|
base.send :alias_method, :fetch, :fetch_with_capitate
|
8
8
|
end
|
9
9
|
|
10
|
-
# Fetch
|
10
|
+
# Fetch.
|
11
11
|
# Displays usage message from recipe docs if variable not found.
|
12
12
|
#
|
13
13
|
# See capistrano fetch for usage info.
|
@@ -72,7 +72,7 @@ module Capitate
|
|
72
72
|
nil
|
73
73
|
end
|
74
74
|
|
75
|
-
# Fetch roles with name and options
|
75
|
+
# Fetch roles with name and options.
|
76
76
|
# I don't actually use this.
|
77
77
|
#
|
78
78
|
# ==== Options
|
@@ -124,6 +124,13 @@ module Capitate
|
|
124
124
|
return matched.first if matched
|
125
125
|
nil
|
126
126
|
end
|
127
|
+
|
128
|
+
|
129
|
+
def link_to_source(recipe_path)
|
130
|
+
full_path = File.expand_path(recipe_path)
|
131
|
+
project_path = File.expand_path(File.dirname(__FILE__) + "/../../../")
|
132
|
+
"http://github.com/gabriel/capitate/tree/master#{full_path.sub(project_path, "")}"
|
133
|
+
end
|
127
134
|
|
128
135
|
end
|
129
136
|
end
|
@@ -5,17 +5,16 @@ require 'yaml'
|
|
5
5
|
module Capitate::Plugins::Base
|
6
6
|
|
7
7
|
# Project root. Fetch from :project_root, or fall back to RAILS_ROOT.
|
8
|
-
#
|
9
8
|
def root
|
10
|
-
if
|
11
|
-
|
12
|
-
else
|
13
|
-
RAILS_ROOT
|
14
|
-
end
|
9
|
+
return fetch(:project_root) if exists?(:project_root)
|
10
|
+
RAILS_ROOT
|
15
11
|
end
|
16
12
|
|
17
13
|
# Path relative to project root.
|
18
|
-
#
|
14
|
+
#
|
15
|
+
# To set the project root:
|
16
|
+
#
|
17
|
+
# set :project_root, "path/to/project" in Capfile.
|
19
18
|
#
|
20
19
|
# ==== Options
|
21
20
|
# +path+:: Relative path
|
@@ -48,7 +47,7 @@ module Capitate::Plugins::Base
|
|
48
47
|
# Usage for current task.
|
49
48
|
#
|
50
49
|
# ==== Options
|
51
|
-
# +variable+:: Missing variable setting
|
50
|
+
# +variable+:: Missing variable setting (to display as not set)
|
52
51
|
#
|
53
52
|
# ==== Examples
|
54
53
|
# usage(:gem_list) => "Description from task definition."
|
@@ -86,7 +85,13 @@ module Capitate::Plugins::Base
|
|
86
85
|
s.split("\n").collect { |sp| "#{indentation}#{sp}"}.join("\n")
|
87
86
|
end
|
88
87
|
|
89
|
-
# Unindent
|
88
|
+
# Unindent.
|
89
|
+
#
|
90
|
+
# Lifted from capistrano bin/capify
|
91
|
+
#
|
92
|
+
# ==== Options
|
93
|
+
# +string+:: String to unindent
|
94
|
+
#
|
90
95
|
def unindent(string)
|
91
96
|
return "" if string.blank?
|
92
97
|
if string =~ /\A(\s*)/
|
@@ -96,7 +101,7 @@ module Capitate::Plugins::Base
|
|
96
101
|
string
|
97
102
|
end
|
98
103
|
|
99
|
-
# Load all tasks
|
104
|
+
# Load all tasks into an array.
|
100
105
|
def load_all_tasks
|
101
106
|
tasks = []
|
102
107
|
top.namespaces.each do |namespace|
|
@@ -105,7 +110,7 @@ module Capitate::Plugins::Base
|
|
105
110
|
tasks
|
106
111
|
end
|
107
112
|
|
108
|
-
#
|
113
|
+
# Build a task tree, consisting of task nodes.
|
109
114
|
def task_tree
|
110
115
|
top_node = Capitate::TaskNode.new("top")
|
111
116
|
|
@@ -116,7 +121,7 @@ module Capitate::Plugins::Base
|
|
116
121
|
end
|
117
122
|
|
118
123
|
protected
|
119
|
-
|
124
|
+
|
120
125
|
def load_tasks(namespace, tasks = [])
|
121
126
|
recipe = namespace.last
|
122
127
|
|
@@ -4,16 +4,17 @@ module Capitate::Plugins::Build
|
|
4
4
|
#
|
5
5
|
# ==== Options
|
6
6
|
# +name+:: Name for app
|
7
|
-
# +options+:: Options
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
7
|
+
# +options+:: Options (See Make install options)
|
8
|
+
#
|
9
|
+
# ==== Make install options
|
10
|
+
# +build_dest+:: Place to build from, ex. /usr/src, defaults to /tmp/name
|
11
|
+
# +url+:: URL to download package from
|
12
|
+
# +configure_options+:: Options for ./configure
|
13
|
+
# +symlink+:: After install, list of source, dest pairs to symlink
|
12
14
|
# [ { "/usr/local/sphinx-0.9.8-rc1" => "/usr/local/sphinx" }, ... ]
|
13
15
|
# ln -s /usr/local/sphinx-0.9.8-rc1 /usr/local/sphinx
|
14
|
-
#
|
15
|
-
#
|
16
|
-
# - +to_log+:: If specified, will redirect output to this path
|
16
|
+
# +unpack_dir+:: Directory that is unpacked from tgz (if not matching the file name)
|
17
|
+
# +to_log+:: If specified, will redirect output to this path
|
17
18
|
#
|
18
19
|
# ==== Examples (in capistrano task)
|
19
20
|
# build.make_install("nginx", { :url => "http://sysoev.ru/nginx/nginx-0.5.35.tar.gz", ... })
|
@@ -44,9 +45,11 @@ module Capitate::Plugins::Build
|
|
44
45
|
#
|
45
46
|
# ==== Options
|
46
47
|
# +name+:: Name for app
|
47
|
-
# +options+:: Options
|
48
|
-
#
|
49
|
-
#
|
48
|
+
# +options+:: Options (see Install options)
|
49
|
+
#
|
50
|
+
# ==== Install options
|
51
|
+
# +build_dest+:: Place to build from, ex. /usr/src, defaults to /tmp/name
|
52
|
+
# +url+:: URL to download package from
|
50
53
|
#
|
51
54
|
# ==== Examples (in capistrano task)
|
52
55
|
# script.make("rubygems", { :url => :url => "http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz" }) do |dir|
|
@@ -16,10 +16,12 @@ module Capitate::Plugins::Prompt
|
|
16
16
|
#
|
17
17
|
# ==== Options
|
18
18
|
# +label+:: Label
|
19
|
-
# +options+:: Options
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
19
|
+
# +options+:: Options (see Password options)
|
20
|
+
#
|
21
|
+
# ==== Password options
|
22
|
+
# +verify+:: If true, prompt twice and verify
|
23
|
+
# +lazy+:: If true, returns a Proc. _Defaults to true_
|
24
|
+
# +check_hash+:: If present, checks that md5 is same as password md5
|
23
25
|
#
|
24
26
|
def password(label, options = {})
|
25
27
|
|
@@ -67,10 +69,6 @@ module Capitate::Plugins::Prompt
|
|
67
69
|
password_prompt.call
|
68
70
|
end
|
69
71
|
|
70
|
-
def check_password_hash(password, hash)
|
71
|
-
MD5.md5()
|
72
|
-
end
|
73
|
-
|
74
72
|
end
|
75
73
|
|
76
74
|
Capistrano.plugin :prompt, Capitate::Plugins::Prompt
|
@@ -36,9 +36,11 @@ module Capitate::Plugins::Script
|
|
36
36
|
# ==== Options
|
37
37
|
# +url+:: URL to download
|
38
38
|
# +dest+:: Destination directory
|
39
|
-
# +options+::
|
40
|
-
#
|
41
|
-
#
|
39
|
+
# +options+:: Options (see Unpack options)
|
40
|
+
#
|
41
|
+
# ==== Unpack options
|
42
|
+
# +clean+:: If true will remove the unpacked directory. _Defaults to true_
|
43
|
+
# +unpack_dir+:: Directory that is unpacked from tgz (if not matching the file name)
|
42
44
|
#
|
43
45
|
# ==== Examples
|
44
46
|
# script.unpack("http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz", "/tmp/rubygems") do
|
@@ -80,7 +82,7 @@ module Capitate::Plugins::Script
|
|
80
82
|
#
|
81
83
|
# ==== Options
|
82
84
|
# +cmds+:: Commands (separated by newlines)
|
83
|
-
# +options+:: See invoke_command options
|
85
|
+
# +options+:: See Capistrano invoke_command options
|
84
86
|
#
|
85
87
|
def run_all(cmds, options = {}, &block)
|
86
88
|
cmds.split("\n").each do |cmd|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Capitate::Plugins::Templates
|
2
2
|
|
3
|
-
# Load template. If extension is erb will be evaluated with binding.
|
3
|
+
# Load template. If the extension is .erb will be evaluated with binding.
|
4
4
|
#
|
5
5
|
# You can add to the list of places we search for templates by setting:
|
6
6
|
#
|
@@ -17,8 +17,9 @@ module Capitate::Plugins::Templates
|
|
17
17
|
# +override_binding+:: Binding to override, otherwise uses current (task) binding
|
18
18
|
#
|
19
19
|
# ==== Examples
|
20
|
-
# template.load("memcached/memcached.monitrc.erb")
|
21
|
-
#
|
20
|
+
# template.load("memcached/memcached.monitrc.erb") => "This is the text of eval'ed template found at ..."
|
21
|
+
#
|
22
|
+
# put template.load("memcached/memcached.monitrc.erb"), "/tmp/memcached.monitrc" # Uploads eval'ed template to remote /tmp/ directory
|
22
23
|
#
|
23
24
|
def load(path, override_binding = nil)
|
24
25
|
template_dirs_found = template_dirs.select { |dir| File.exist?("#{dir}/#{path}") }
|
@@ -69,9 +70,16 @@ module Capitate::Plugins::Templates
|
|
69
70
|
|
70
71
|
protected
|
71
72
|
|
72
|
-
# Load all possible places for templates
|
73
|
+
# Load all possible places for templates.
|
74
|
+
#
|
75
|
+
# Returns:
|
76
|
+
# * the <tt>:templates_dirs</tt> setting (if set)
|
77
|
+
# * the current directory
|
78
|
+
# * the <tt>:project_root</tt> setting (if set)
|
79
|
+
# * the gem templates path
|
80
|
+
#
|
73
81
|
def template_dirs
|
74
|
-
@
|
82
|
+
@template_dirs ||= begin
|
75
83
|
template_dirs = []
|
76
84
|
template_dirs += fetch(:templates_dirs) if exists?(:templates_dirs)
|
77
85
|
template_dirs << "."
|
@@ -88,11 +96,12 @@ protected
|
|
88
96
|
|
89
97
|
# Get full template path from relative path.
|
90
98
|
#
|
91
|
-
# Something like <tt>monit/monit.cnf => /usr/lib/..../capitate/lib/templates/monit/monit.cnf</tt>.
|
92
|
-
#
|
93
99
|
# ==== Options
|
94
100
|
# +template_path+:: Relative path
|
95
101
|
#
|
102
|
+
# ==== Examples
|
103
|
+
# gem_template_path("monit/monit.cnf") => /usr/lib/..../capitate/lib/templates/monit/monit.cnf
|
104
|
+
#
|
96
105
|
def gem_template_path(template_path)
|
97
106
|
File.join(gem_templates_root, template_path)
|
98
107
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module Capitate::Plugins::Upload
|
2
2
|
|
3
3
|
# Upload file with source path.
|
4
|
+
#
|
4
5
|
# Data is streamed.
|
5
6
|
#
|
6
7
|
# ==== Options
|
7
8
|
# +src_path+:: Source path
|
8
|
-
# +dest_path
|
9
|
+
# +dest_path+:: Remote destination path
|
9
10
|
# +options+:: Options (see capistrano 'put')
|
10
11
|
#
|
11
12
|
# ==== Examples
|
@@ -27,12 +27,14 @@ module Capitate::Plugins::Utils
|
|
27
27
|
# ==== Options
|
28
28
|
# +template_path+:: Path to template
|
29
29
|
# +destination+:: Remote path to evaluated template
|
30
|
-
# +options+::
|
31
|
-
#
|
32
|
-
#
|
30
|
+
# +options+:: Options (see Install template options)
|
31
|
+
#
|
32
|
+
# ==== Install template options
|
33
|
+
# +user+:: User to install (-o). Defaults to *root*.
|
34
|
+
# +mode+:: Mode to install file (-m)
|
33
35
|
#
|
34
36
|
# ==== Example
|
35
|
-
# utils.install_template("monit/memcached.monitrc.erb", "/etc/monit/memcached.monitrc")
|
37
|
+
# utils.install_template("monit/memcached.monitrc.erb", "/etc/monit/memcached.monitrc", :user => "root", :mode => "600")
|
36
38
|
#
|
37
39
|
def install_template(template_path, destination, options = {})
|
38
40
|
# Truncate extension
|
@@ -96,7 +98,7 @@ module Capitate::Plugins::Utils
|
|
96
98
|
# ==== Options
|
97
99
|
# +path+:: Path to file to append to
|
98
100
|
# +data+:: String data to append
|
99
|
-
# +check+:: If not nil, will check to see if egrep matches
|
101
|
+
# +check+:: If not nil, will check to see if egrep matches this regex and will not re-append
|
100
102
|
# +left_strip+:: If true (default), remove whitespace before lines
|
101
103
|
# +should_exist+:: If true (default), raise error if file does not exist
|
102
104
|
#
|
data/lib/capitate/task_node.rb
CHANGED
@@ -50,13 +50,11 @@ class Capitate::TaskNode
|
|
50
50
|
end
|
51
51
|
|
52
52
|
# Get "child" nodes (sorted).
|
53
|
-
#
|
54
53
|
def sorted_nodes
|
55
54
|
nodes.sort_by(&:name)
|
56
55
|
end
|
57
56
|
|
58
57
|
# Get tasks (sorted).
|
59
|
-
#
|
60
58
|
def sorted_tasks
|
61
59
|
tasks.sort_by(&:fully_qualified_name) # { |t| t.name.to_s }
|
62
60
|
end
|
@@ -107,6 +105,8 @@ class Capitate::TaskNode
|
|
107
105
|
file_name ||= full_name
|
108
106
|
title ||= full_name(":")
|
109
107
|
|
108
|
+
|
109
|
+
|
110
110
|
path = "#{dir}/#{file_name}.txt"
|
111
111
|
puts "%10s %-30s" % [ "create", path ]
|
112
112
|
|
@@ -159,15 +159,18 @@ class Capitate::TaskNode
|
|
159
159
|
unless tasks.empty?
|
160
160
|
file.puts "\n\nh2. Task documentation\n\n"
|
161
161
|
sorted_tasks.each do |task|
|
162
|
+
file.puts %{<div class="recipe">\n\n}
|
162
163
|
file.puts "h3(##{task.fully_qualified_name}). #{task.fully_qualified_name}\n\n"
|
163
|
-
file.puts "#{unindent(task.desc)}\n\n
|
164
|
+
file.puts "#{unindent(task.desc)}\n\n"
|
165
|
+
file.puts "</div>\n\n\n"
|
164
166
|
end
|
165
167
|
end
|
166
168
|
|
167
169
|
#
|
168
170
|
# Write doc (recursively for "child" namespace)
|
171
|
+
#
|
169
172
|
sorted_nodes.each do |snode|
|
170
|
-
snode.write_doc(dir)
|
173
|
+
snode.write_doc(dir, nil, nil, options)
|
171
174
|
end
|
172
175
|
|
173
176
|
# If block then let it do stuff with open file
|
@@ -179,7 +182,6 @@ class Capitate::TaskNode
|
|
179
182
|
end
|
180
183
|
|
181
184
|
# Node to string.
|
182
|
-
#
|
183
185
|
def to_s(level = 0)
|
184
186
|
spaces = " "
|
185
187
|
indent = (0...level).collect { spaces }.join("")
|
@@ -197,37 +199,33 @@ class Capitate::TaskNode
|
|
197
199
|
s += node.to_s(level + 1)
|
198
200
|
end
|
199
201
|
s
|
200
|
-
end
|
202
|
+
end
|
201
203
|
|
202
|
-
#
|
203
|
-
|
204
|
+
# Create nodes and and task to node.
|
205
|
+
#
|
206
|
+
# If task is "mysql:centos:install", the nodes will look like:
|
207
|
+
#
|
208
|
+
# (top node) -> (mysql node) -> (centos node; w/ tasks: install)
|
209
|
+
#
|
210
|
+
# ==== Options
|
211
|
+
# +top_node+:: Node to start at
|
212
|
+
# +task+:: Task to add
|
213
|
+
#
|
214
|
+
def self.populate_with_task(top_node, task)
|
215
|
+
node_names = task.namespace.fully_qualified_name.split(":")
|
204
216
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
# +task+:: Task to add
|
214
|
-
#
|
215
|
-
def populate_with_task(top_node, task)
|
216
|
-
node_names = task.namespace.fully_qualified_name.split(":")
|
217
|
-
|
218
|
-
node = top_node
|
219
|
-
|
220
|
-
node_names.each do |name|
|
221
|
-
parent_node = node
|
222
|
-
node = parent_node.find(name)
|
223
|
-
if !node
|
224
|
-
node = self.new(name, parent_node)
|
225
|
-
parent_node.add_node(node)
|
226
|
-
end
|
217
|
+
node = top_node
|
218
|
+
|
219
|
+
node_names.each do |name|
|
220
|
+
parent_node = node
|
221
|
+
node = parent_node.find(name)
|
222
|
+
if !node
|
223
|
+
node = self.new(name, parent_node)
|
224
|
+
parent_node.add_node(node)
|
227
225
|
end
|
228
|
-
node.add_task(task)
|
229
226
|
end
|
230
|
-
|
227
|
+
node.add_task(task)
|
231
228
|
end
|
229
|
+
|
232
230
|
end
|
233
231
|
|
data/lib/capitate/version.rb
CHANGED
data/lib/recipes/backgroundrb.rb
CHANGED
@@ -7,9 +7,21 @@ namespace :backgroundrb do
|
|
7
7
|
|
8
8
|
pid_file = "\#{CONFIG_FILE[:backgroundrb][:pid_file]}"
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
<dl>
|
11
|
+
<dt>backgroundrb_host</dt>
|
12
|
+
<dd>Backgroundrb host</dd>
|
13
|
+
<dd class="default">Defaults to @0.0.0.0@</dd>
|
14
|
+
|
15
|
+
<dt>backgroundrb_port</dt>
|
16
|
+
<dd>Backgroundrb port</dd>
|
17
|
+
<dd class="default">Defaults to @11006@</dd>
|
18
|
+
|
19
|
+
<dt>backgroundrb_yml_template</dt>
|
20
|
+
<dd>Backgroundrb yml template</dd>
|
21
|
+
<dd class="default">Defaults to @backgroundrb/backgroundrb.yml.erb@ in this gem.</dd>
|
22
|
+
</dl>
|
23
|
+
|
24
|
+
"Source":#{link_to_source(__FILE__)}
|
13
25
|
DESC
|
14
26
|
task :setup do
|
15
27
|
fetch_or_default(:backgroundrb_host, "0.0.0.0")
|
@@ -21,7 +33,9 @@ namespace :backgroundrb do
|
|
21
33
|
end
|
22
34
|
|
23
35
|
desc <<-DESC
|
24
|
-
Symlink backgroundrb config into
|
36
|
+
Symlink backgroundrb config into current path.
|
37
|
+
|
38
|
+
"Source":#{link_to_source(__FILE__)}
|
25
39
|
DESC
|
26
40
|
task :update_code do
|
27
41
|
run "ln -nfs #{shared_path}/config/backgroundrb.yml #{release_path}/config/backgroundrb.yml"
|
@@ -5,13 +5,20 @@ namespace :backgroundrb do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Setup backgroundrb for application.
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
<dl>
|
9
|
+
<dt>backgroundrb_bin_path</dt>
|
10
|
+
<dd>Path to start.
|
11
|
+
<dd class="default">Defaults to @\#{current_path}/script/backgroundrb -e production start@</dd>
|
12
|
+
<dt>backgroundrb_pid_path</dt>
|
13
|
+
<dd>Path to backgroundrb pid file</dd>
|
14
|
+
<dd class="default">Defaults to @\#{shared_path}/pids/backgroundrb.pid@</dd>
|
15
|
+
</dl>
|
16
|
+
"Source":#{link_to_source(__FILE__)}
|
10
17
|
DESC
|
11
18
|
task :setup do
|
12
19
|
|
13
20
|
# Settings
|
14
|
-
fetch_or_default(:backgroundrb_bin_path, "#{current_path}/script/backgroundrb -e production")
|
21
|
+
fetch_or_default(:backgroundrb_bin_path, "#{current_path}/script/backgroundrb -e production start")
|
15
22
|
fetch_or_default(:backgroundrb_pid_path, "#{shared_path}/pids/backgroundrb.pid")
|
16
23
|
|
17
24
|
# Install initscript
|
@@ -5,14 +5,27 @@ namespace :centos do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Add user and set user password for application. Adds user to specified groups.
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
<dl>
|
9
|
+
<dt>user_add</dt>
|
10
|
+
<dd>User to add.</dd>
|
11
|
+
<dd>@set :user_add, "app_user"@</dd>
|
12
|
+
|
13
|
+
<dt>groups</dt>
|
14
|
+
<dd>Groups for user to be in.</dd>
|
15
|
+
<dd class="default">Defaults to @nil@</dd>
|
16
|
+
<dd>@set :groups, "admin,foo"@</dd>
|
17
|
+
|
18
|
+
<dt>home</dt>
|
19
|
+
<dd>Home directory for user.</dd>
|
20
|
+
<dd class="default">Defaults to @:deploy_to@ setting_</dd>
|
21
|
+
<dd>@set :home, "/var/www/apps/app_name"@</dd>
|
22
|
+
|
23
|
+
<dt>home_readable</dt>
|
24
|
+
<dd>Whether home permissions are readable by all. Needed if using deploy dir as home.</dd>
|
25
|
+
<dd class="default">Defaults to @true@</dd>
|
26
|
+
<dd>@set :home_readable, true@</dd>
|
27
|
+
</dl>
|
28
|
+
"Source":#{link_to_source(__FILE__)}
|
16
29
|
DESC
|
17
30
|
task :add_user do
|
18
31
|
|
@@ -3,13 +3,16 @@ namespace :imagemagick do
|
|
3
3
|
|
4
4
|
desc <<-DESC
|
5
5
|
Install imagemagick.\n
|
6
|
-
|
6
|
+
<dl><dt>imagemagick_build_options</dt><dd>Imagemagick build options</dd></dl>
|
7
7
|
<pre>
|
8
|
+
<code class="ruby">
|
8
9
|
set :imagemagick_build_options, {
|
9
10
|
:url => "ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz",
|
10
11
|
:unpack_dir => "ImageMagick-*"
|
11
12
|
}
|
13
|
+
</code>
|
12
14
|
</pre>
|
15
|
+
"Source":#{link_to_source(__FILE__)}
|
13
16
|
DESC
|
14
17
|
task :install do
|
15
18
|
|