capistrano_deploy_generator 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +80 -0
- data/Rakefile +1 -0
- data/capistrano_deploy_generator.gemspec +25 -0
- data/lib/generators/capistrano_deploy/USAGE +16 -0
- data/lib/generators/capistrano_deploy/capistrano_deploy_generator.rb +169 -0
- data/lib/generators/capistrano_deploy/config.rb +8 -0
- data/lib/generators/capistrano_deploy/lib/core_extensions.rb +8 -0
- data/lib/generators/capistrano_deploy/lib/helpers.rb +43 -0
- data/lib/generators/capistrano_deploy/templates/Capfile +4 -0
- data/lib/generators/capistrano_deploy/templates/deploy.rb.erb +138 -0
- data/lib/generators/capistrano_deploy/templates/git.tpl +3 -0
- data/lib/generators/capistrano_deploy/templates/passthrough.tpl +5 -0
- data/lib/generators/capistrano_deploy/templates/staging.rb.erb +22 -0
- data/lib/generators/capistrano_deploy/version.rb +4 -0
- metadata +119 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f5296a9e851a433d01a7e542984686eb8db26911
|
4
|
+
data.tar.gz: 302833b411128ef298cf610a0aac7dab1327f5a0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c2ab914b531755ec048c1850e4e73c0e030b575ce2f3e40904758fa7947d24ed1401fcdd0f00db1740a016b11a934144958c2eb4dea90694f478be72169801b2
|
7
|
+
data.tar.gz: d5fb56e26d538f2e5692c7c33cb9b0a763a00572828e4b57b11dbb0d641e6b02c866e526afba8468b747cce0313930a2bca803d0c5f978665a5059e1add6c7d1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Dmytro Kovalov
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# CapistranoDeployGenerator
|
2
|
+
|
3
|
+
Generate deployment configuration to be used with Capistrano.
|
4
|
+
|
5
|
+
Following options are supported:
|
6
|
+
|
7
|
+
* capify - simply run `capify .` command in project
|
8
|
+
* deploy - Create config/deploy.rb file and config/deploy directory subtree with required componenets for capistrano.
|
9
|
+
* modules - Install supporting Git repositories as submodules.
|
10
|
+
|
11
|
+
|
12
|
+
Example:
|
13
|
+
rails generate capistrano_deploy deploy
|
14
|
+
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Add this line to your application's Gemfile:
|
19
|
+
|
20
|
+
gem 'capistrano_deploy_generator'
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install capistrano_deploy_generator
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
Run to get help:
|
33
|
+
|
34
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bash
|
35
|
+
rails generate capistrano_deploy
|
36
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
37
|
+
|
38
|
+
### Submodules
|
39
|
+
|
40
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bash
|
41
|
+
rails generate capistrano_deploy modules
|
42
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
43
|
+
|
44
|
+
This command will install github repositories used in the cap deploy. These repositories are installed in `./config/deploy/` subdirectory.
|
45
|
+
|
46
|
+
Following submodules are configured for installation:
|
47
|
+
|
48
|
+
* recipes: `git@github.com:dmytro/capistrano-recipes.git` Collection of recipes for Capistrano deployment. Each of the recipe needs to be added to `deploy.rb` file.
|
49
|
+
* chef-solo: `git@github.com:dmytro/chef-solo.git` Some of the recipes use Chef-solo configuration to install packages. Also Chef-solo can be used to bootstrap server before deploying. This repository implements chef-solo integration.
|
50
|
+
|
51
|
+
|
52
|
+
### Deploy
|
53
|
+
|
54
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bash
|
55
|
+
rails generate capistrano_deploy deploy
|
56
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
57
|
+
|
58
|
+
Generator for the `deploy.rb` file. Generator uses menu system to create the file. It will guide user throught the set of basic questions and build the file bsed on the user answers.
|
59
|
+
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
1. Fork it
|
63
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
64
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
65
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
66
|
+
5. Create new Pull Request
|
67
|
+
|
68
|
+
# Author
|
69
|
+
|
70
|
+
Dmytro Kovalov
|
71
|
+
|
72
|
+
dmytro.kovalov@gmail.com
|
73
|
+
|
74
|
+
http://dmytro.github.com
|
75
|
+
|
76
|
+
May, 2013
|
77
|
+
|
78
|
+
# License
|
79
|
+
|
80
|
+
MIT, see LICENSE.txt file
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'generators/capistrano_deploy/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "capistrano_deploy_generator"
|
8
|
+
spec.version = CapistranoDeployGenerator::VERSION
|
9
|
+
spec.authors = ["Dmytro Kovalov"]
|
10
|
+
spec.email = ["dmytro.kovalov@gmail.com"]
|
11
|
+
spec.description = %q{Create config/deploy.rb file and config/deploy directory subtree with required componenets for capistrano. Install support Git repositories as submodules.}
|
12
|
+
spec.summary = %q{Generate deployment configuration to be used with Capistrano.}
|
13
|
+
spec.homepage = "http://dmytro.github.com"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "highline"
|
22
|
+
spec.add_runtime_dependency "rails", "~> 3.2.13"
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Description:
|
2
|
+
Generate deployment configuration to be used with Capistrano.
|
3
|
+
|
4
|
+
Following options are supported:
|
5
|
+
|
6
|
+
* capify - install Capfile
|
7
|
+
|
8
|
+
* deploy - Create config/deploy.rb file and config/deploy
|
9
|
+
directory subtree with required componenets for capistrano.
|
10
|
+
|
11
|
+
* modules - Install supporting Git repositories as submodules.
|
12
|
+
|
13
|
+
* all - all of the above.
|
14
|
+
|
15
|
+
Example:
|
16
|
+
rails generate capistrano_deploy deploy
|
@@ -0,0 +1,169 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require_relative "config"
|
3
|
+
require_relative "lib/helpers"
|
4
|
+
require_relative "lib/core_extensions"
|
5
|
+
|
6
|
+
class CapistranoDeployGenerator < Rails::Generators::NamedBase
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
|
9
|
+
def runner
|
10
|
+
case file_name.to_sym
|
11
|
+
when :capify then capify
|
12
|
+
when :modules then install_submodules
|
13
|
+
when :deploy then create_deploy
|
14
|
+
when :all
|
15
|
+
capify
|
16
|
+
install_submodules
|
17
|
+
create_deploy
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def capify
|
24
|
+
template "Capfile"
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Installs required repositories as project's submodules.
|
29
|
+
#
|
30
|
+
def install_submodules
|
31
|
+
|
32
|
+
if agree(
|
33
|
+
(["OK to add git submodules to your application?",
|
34
|
+
"If you select 'No' here some of the fuctionality can be lost",
|
35
|
+
"\n"
|
36
|
+
] +
|
37
|
+
SUBMODULES.values).join "\n"
|
38
|
+
)
|
39
|
+
|
40
|
+
SUBMODULES.each do |path, submodule|
|
41
|
+
run "git submodule add #{submodule} config/deploy/#{path}"
|
42
|
+
end
|
43
|
+
else
|
44
|
+
say "OK. Skipping submodules"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Create deploy rb file
|
50
|
+
def create_deploy
|
51
|
+
@@tpl = source_paths.first
|
52
|
+
empty_directory "config/deploy"
|
53
|
+
|
54
|
+
say <<-EOF
|
55
|
+
|
56
|
+
config/deploy.rb generator
|
57
|
+
|
58
|
+
This menu will help you creating deployment configuration file
|
59
|
+
deploy.rb for Capistrano. It is safe to acceppt defulat values for
|
60
|
+
most or all questions. Just hit Enter if default is provided.
|
61
|
+
|
62
|
+
All values can be changed later in the file itself or you can re-run
|
63
|
+
generator again.
|
64
|
+
|
65
|
+
EOF
|
66
|
+
template "deploy.rb.erb", "config/deploy.rb"
|
67
|
+
@stages.each do |stage|
|
68
|
+
template "staging.rb.erb", "config/deploy/#{stage}.rb"
|
69
|
+
end
|
70
|
+
say "Please edit manually configuration of the multi-staging files:"
|
71
|
+
@stages.map { |x| say "./confg/deploy/#{x}.rb\n"}
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
#
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
# set :application
|
82
|
+
def application
|
83
|
+
ask ("Application name : ") { |x| x.default = File.basename %x{pwd}.chomp }
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
# For passthrough scm use also
|
89
|
+
def scm
|
90
|
+
@scm = menu_with_default "Which SCM to use for deployment",
|
91
|
+
[:git,:passthrough ], :git
|
92
|
+
|
93
|
+
case @scm
|
94
|
+
when :passthrough
|
95
|
+
%W{ capistrano-deploy-scm-passthrough capistrano-improved-rsync-with-remote-cache}.each do |g|
|
96
|
+
append_to_file "Gemfile", "gem '#{g}', :group => :development\n"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
@scm
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Try find name of the GIT repo from git remote
|
104
|
+
def git_remote
|
105
|
+
repos = begin
|
106
|
+
%x{git remote --verbose 2>/dev/null}.split("\n").map(&:split).map {|x| [x[0],x[1]] }.uniq
|
107
|
+
rescue
|
108
|
+
[]
|
109
|
+
end
|
110
|
+
default = repos.find { |x| x.first == 'origin'}
|
111
|
+
items = repos.map { |x| x.last }
|
112
|
+
|
113
|
+
menu_with_default "Select repository ", items.compact, default
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
# Select version for :rvm_ruby_string
|
118
|
+
def ruby_version
|
119
|
+
default = %x{ rvm current}.strip
|
120
|
+
items = %x{ rvm ls strings }.split.compact
|
121
|
+
|
122
|
+
ruby = menu_with_default "RVM Ruby version to use for deployment:", items,default
|
123
|
+
ruby = ask "Enter alternative RVM Ruby string: " if ruby =~ /Other/
|
124
|
+
ruby
|
125
|
+
end
|
126
|
+
|
127
|
+
##
|
128
|
+
# List of the stages for multistage extension and default stage
|
129
|
+
#
|
130
|
+
def multistage
|
131
|
+
@stages = %w(development production staging)
|
132
|
+
catch :exit do
|
133
|
+
loop do
|
134
|
+
choose do |menu|
|
135
|
+
menu.header = "List stages for multistage deployments"
|
136
|
+
menu.prompt = "Type number to delete, 1 to add new, Enter - complete."
|
137
|
+
menu.choice '*** Add ***' do
|
138
|
+
@stages << ask("New stage: ")
|
139
|
+
end
|
140
|
+
menu.hidden("") { throw :exit }
|
141
|
+
|
142
|
+
menu.choices(*@stages) { |x| @stages.delete x }
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
@stages2 = @stages.dup
|
148
|
+
{
|
149
|
+
stages: @stages,
|
150
|
+
default: menu_with_default("Default stage:", @stages2, "production")
|
151
|
+
}
|
152
|
+
end
|
153
|
+
|
154
|
+
##
|
155
|
+
# Try to detect DB from confing file and add necessary components.
|
156
|
+
def database
|
157
|
+
default = begin
|
158
|
+
YAML.load_file("config/database.yml")['production']['adapter'].strip
|
159
|
+
rescue
|
160
|
+
nil
|
161
|
+
end
|
162
|
+
menu_with_default "Select a database for production:", ["postgres", "mysql", "sqlite3"], default
|
163
|
+
end
|
164
|
+
|
165
|
+
def comment_block text
|
166
|
+
say text
|
167
|
+
text
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
|
3
|
+
class CapistranoDeployGenerator < Rails::Generators::NamedBase
|
4
|
+
private
|
5
|
+
|
6
|
+
# See http://stackoverflow.com/questions/2903200/watir-changes-highlines-ask-method
|
7
|
+
def ask(*p, &b)
|
8
|
+
HighLine.new.ask(*p, &b)
|
9
|
+
end
|
10
|
+
|
11
|
+
def ask_default propmt, default, &b
|
12
|
+
ask(propmt) { |q| q.default = default; q.readline = true }
|
13
|
+
end
|
14
|
+
|
15
|
+
def agree_default quest, default=nil
|
16
|
+
agree(quest) { |q| q.default = default }
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Menu with default element and add own item.
|
21
|
+
def menu_with_default header, items, default
|
22
|
+
|
23
|
+
idx = items.index default
|
24
|
+
items[idx] = "=> [ #{default} ]" if idx
|
25
|
+
|
26
|
+
choose do |menu|
|
27
|
+
menu.header = header
|
28
|
+
menu.prompt =%Q{
|
29
|
+
> Type 1 to add, number or name or Enter to accept default.
|
30
|
+
> Default is specified by '=>' mark.
|
31
|
+
: }
|
32
|
+
|
33
|
+
menu.choice ('*** Other ***') { return ask "Enter new item: " }
|
34
|
+
menu.choices *(items)
|
35
|
+
menu.readline = true
|
36
|
+
menu.hidden("") { puts default; return default } if default
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def recipe file
|
41
|
+
"load File.expand_path(\"deploy/recipes/#{file}.rb\")"
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
<%= recipe 'base' %>
|
2
|
+
<%= recipe 'chef_solo' %>
|
3
|
+
<%= recipe 'application_yml_file' %>
|
4
|
+
|
5
|
+
<%= comment_block %Q{
|
6
|
+
# --------------------------------------------
|
7
|
+
# Rails application name
|
8
|
+
# --------------------------------------------
|
9
|
+
|
10
|
+
}%>
|
11
|
+
set :application, '<%= ask_default "Application name : ", File.basename(%x{pwd}.chomp) %>'
|
12
|
+
|
13
|
+
# For precompiling assets rails_env should be set to production
|
14
|
+
set :rails_env, 'production'
|
15
|
+
<%= comment_block %Q{
|
16
|
+
|
17
|
+
# --------------------------------------------
|
18
|
+
# Remote user and application location
|
19
|
+
# --------------------------------------------
|
20
|
+
|
21
|
+
}-%>
|
22
|
+
set :user, '<%= ask_default "User to deploy as: ", 'ubuntu' %>'
|
23
|
+
set :use_sudo, <%= agree_default "Use sudo for deployment? " , :yes %>
|
24
|
+
set :deploy_to, "<%= ask_default "Deploy directory: ", '/home/#{user}/#{application}' %>"
|
25
|
+
set :keep_releases, <%= ask("Number of rollback releases : ", Integer) { |q| q.in = 1..30; q.default = 5 } %>
|
26
|
+
|
27
|
+
set :web_domain, "#{application}.com"
|
28
|
+
|
29
|
+
<%= comment_block %Q{
|
30
|
+
# --------------------------------------------
|
31
|
+
# Ruby, RVM Configuration
|
32
|
+
# --------------------------------------------
|
33
|
+
|
34
|
+
}-%>
|
35
|
+
require 'rvm/capistrano'
|
36
|
+
require 'bundler/capistrano'
|
37
|
+
set :rvm_ruby_string, '<%= ruby_version %>'
|
38
|
+
set :rvm_path, "/usr/local/rvm"
|
39
|
+
set :rvm_type, :system
|
40
|
+
|
41
|
+
<%= comment_block %Q{
|
42
|
+
# --------------------------------------------
|
43
|
+
# Multistage extension configuraion
|
44
|
+
# --------------------------------------------
|
45
|
+
|
46
|
+
}-%>
|
47
|
+
|
48
|
+
require 'capistrano/ext/multistage'
|
49
|
+
<% x = multistage %>
|
50
|
+
set :stages, <%= x[:stages].to_s %>
|
51
|
+
set :default_stage, '<%= x[:default] %>'
|
52
|
+
|
53
|
+
<%= comment_block %Q{
|
54
|
+
|
55
|
+
# --------------------------------------------
|
56
|
+
# Source code management
|
57
|
+
# --------------------------------------------
|
58
|
+
|
59
|
+
}-%>
|
60
|
+
<% @scm = scm -%>
|
61
|
+
<%= File.read "#{source_paths.first}/#{@scm}.tpl" -%>
|
62
|
+
<% if @scm =~ /git/ -%>
|
63
|
+
set :repository, "<%= git_remote %>"
|
64
|
+
<% end -%>
|
65
|
+
|
66
|
+
|
67
|
+
<%= comment_block %Q{
|
68
|
+
|
69
|
+
# --------------------------------------------
|
70
|
+
# Production database configuration
|
71
|
+
# --------------------------------------------
|
72
|
+
|
73
|
+
}-%>
|
74
|
+
set :create_database_yaml, true
|
75
|
+
<% db = database -%>
|
76
|
+
|
77
|
+
<%= recipe 'database' %>
|
78
|
+
set :database_adapter, '<%= db %>'
|
79
|
+
<% case db -%>
|
80
|
+
<% when 'postgres' -%>
|
81
|
+
<%= recipe 'posgresql' %>
|
82
|
+
<%= recipe 'posgresql_backup' %>
|
83
|
+
<% when 'sqlite3' -%>
|
84
|
+
set :production_password, ""
|
85
|
+
<% end -%>
|
86
|
+
|
87
|
+
<%= comment_block %Q{
|
88
|
+
|
89
|
+
# --------------------------------------------
|
90
|
+
# Web server configuration
|
91
|
+
# --------------------------------------------
|
92
|
+
|
93
|
+
}-%>
|
94
|
+
|
95
|
+
<%
|
96
|
+
case menu_with_default "Production uses Unicorn server. Which webserver to use with it?",
|
97
|
+
['nginx', 'apache'],
|
98
|
+
'nginx'
|
99
|
+
|
100
|
+
when 'nginx'
|
101
|
+
%>
|
102
|
+
<%= recipe 'nginx' %>
|
103
|
+
<% when 'apache' -%>
|
104
|
+
<%= recipe 'apache_unicorn' %>
|
105
|
+
<% end -%>
|
106
|
+
<%= recipe 'unicorn' %>
|
107
|
+
set :unicorn_workers, <%= ask("Number of Unicorn workers : ", Integer) { |q| q.in = 1..30; q.default = 10 } %>
|
108
|
+
<%= comment_block %Q{
|
109
|
+
# --------------------------------------------
|
110
|
+
# Load additional capistrano recipes
|
111
|
+
# --------------------------------------------
|
112
|
+
}-%>
|
113
|
+
<%= recipe 'logs' %>
|
114
|
+
|
115
|
+
|
116
|
+
<%= comment_block %Q{
|
117
|
+
# --------------------------------------------
|
118
|
+
# Common tasks
|
119
|
+
# --------------------------------------------
|
120
|
+
}-%>
|
121
|
+
task :setup do
|
122
|
+
top.deploy.setup
|
123
|
+
top.unicorn.setup
|
124
|
+
end
|
125
|
+
|
126
|
+
after "deploy", "deploy:migrate"
|
127
|
+
after "deploy", "deploy:reload"
|
128
|
+
after "deploy", "deploy:cleanup"
|
129
|
+
|
130
|
+
namespace :deploy do
|
131
|
+
task :reload do
|
132
|
+
top.unicorn.restart
|
133
|
+
end
|
134
|
+
|
135
|
+
task :migrate do
|
136
|
+
run "cd #{current_path} && RAILS_ENV=production bundle exec rake --TRACE db:migrate"
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# Add you deployment keys here
|
3
|
+
#
|
4
|
+
ssh_options[:keys] = ["~/.ssh/id_dsa"]
|
5
|
+
|
6
|
+
# Use one of the application server configuration blocks: single
|
7
|
+
# server or multiple server roles.
|
8
|
+
|
9
|
+
server "127.0.0.1" , :web, :app, :db, primary: true
|
10
|
+
|
11
|
+
# role :web, "your web-server here" # Your HTTP server, Apache/etc
|
12
|
+
# role :app, "your app-server here" # This may be the same as your `Web` server
|
13
|
+
# role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
|
14
|
+
# role :db, "your slave db-server here"
|
15
|
+
|
16
|
+
before "deploy", "setup"
|
17
|
+
|
18
|
+
set :branch, 'master'
|
19
|
+
|
20
|
+
|
21
|
+
# if you want to clean up old releases on each deploy uncomment this:
|
22
|
+
# after "deploy:restart", "deploy:cleanup"
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano_deploy_generator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dmytro Kovalov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: highline
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.2.13
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.2.13
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Create config/deploy.rb file and config/deploy directory subtree with
|
70
|
+
required componenets for capistrano. Install support Git repositories as submodules.
|
71
|
+
email:
|
72
|
+
- dmytro.kovalov@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- capistrano_deploy_generator.gemspec
|
83
|
+
- lib/generators/capistrano_deploy/USAGE
|
84
|
+
- lib/generators/capistrano_deploy/capistrano_deploy_generator.rb
|
85
|
+
- lib/generators/capistrano_deploy/config.rb
|
86
|
+
- lib/generators/capistrano_deploy/lib/core_extensions.rb
|
87
|
+
- lib/generators/capistrano_deploy/lib/helpers.rb
|
88
|
+
- lib/generators/capistrano_deploy/templates/Capfile
|
89
|
+
- lib/generators/capistrano_deploy/templates/deploy.rb.erb
|
90
|
+
- lib/generators/capistrano_deploy/templates/git.tpl
|
91
|
+
- lib/generators/capistrano_deploy/templates/passthrough.tpl
|
92
|
+
- lib/generators/capistrano_deploy/templates/staging.rb.erb
|
93
|
+
- lib/generators/capistrano_deploy/version.rb
|
94
|
+
homepage: http://dmytro.github.com
|
95
|
+
licenses:
|
96
|
+
- MIT
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.0.3
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: Generate deployment configuration to be used with Capistrano.
|
118
|
+
test_files: []
|
119
|
+
has_rdoc:
|