recap 1.2.1 → 1.2.2
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 +4 -4
- data/lib/recap/support/capistrano_extensions.rb +7 -1
- data/lib/recap/support/compatibility.rb +2 -2
- data/lib/recap/tasks/bootstrap.rb +3 -3
- data/lib/recap/tasks/bundler.rb +6 -6
- data/lib/recap/tasks/deploy.rb +13 -13
- data/lib/recap/tasks/env.rb +2 -2
- data/lib/recap/tasks/foreman.rb +7 -7
- data/lib/recap/tasks/preflight.rb +1 -1
- data/lib/recap/tasks/rails.rb +1 -1
- data/lib/recap/tasks/ruby.rb +2 -2
- data/lib/recap/version.rb +1 -1
- data/spec/tasks/deploy_spec.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ce0fd67a3a5eca2575897507013976d255d2cdf
|
4
|
+
data.tar.gz: 84fe27ce735df0abeafe7728f56bcaf69f4e1086
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df47ca9c62c0ac5160c64d48f659d7562302b1713e27bb571b06e06f46942a357868f1bba30254d5e481dfa340a28f4e1d60209b3ee25ffd66510aea8967356a
|
7
|
+
data.tar.gz: 00db9075c0fdc5c0591c52f77750ffacf5d0562b0cf65bca026bd1aa69403fa91fd90e10947858c116ffd1df5c5c58c577359fa4a20a9f7ad25126adce4f1005
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
|
3
3
|
# These methods are used by recap tasks to run commands and detect when files have changed
|
4
|
-
# as part of a
|
4
|
+
# as part of a deployment.
|
5
5
|
|
6
6
|
module Recap::Support::CapistranoExtensions
|
7
7
|
# Run a command as the application user
|
@@ -113,5 +113,11 @@ and try again.
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
def _cset(name, *args, &block)
|
117
|
+
unless exists?(name)
|
118
|
+
set(name, *args, &block)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
116
122
|
Capistrano::Configuration.send :include, self
|
117
123
|
end
|
@@ -10,5 +10,5 @@ module Recap::Support::Compatibility
|
|
10
10
|
|
11
11
|
# As `git` to manages releases, all deployments are placed directly in the `deploy_to` folder. The
|
12
12
|
# `current_path` is always this directory (no symlinking required).
|
13
|
-
|
14
|
-
end
|
13
|
+
_cset(:current_path) { deploy_to }
|
14
|
+
end
|
@@ -15,10 +15,10 @@ module Recap::Tasks::Bootstrap
|
|
15
15
|
extend Recap::Support::Namespace
|
16
16
|
|
17
17
|
# The bootstrap namespace has a couple of task that help configure application and personal accounts
|
18
|
-
#
|
18
|
+
# to meet these requirements.
|
19
19
|
namespace :bootstrap do
|
20
|
-
|
21
|
-
|
20
|
+
_cset(:remote_username) { capture('whoami').strip }
|
21
|
+
_cset(:application_home) { "/home/#{application_user}"}
|
22
22
|
|
23
23
|
# The `bootstrap:application` task sets up the account on the server the application itself uses. This
|
24
24
|
# account should be dedicated to running this application.
|
data/lib/recap/tasks/bundler.rb
CHANGED
@@ -7,22 +7,22 @@ module Recap::Tasks::Bundler
|
|
7
7
|
|
8
8
|
namespace :bundle do
|
9
9
|
# Each bundle is declared in a `Gemfile`, by default in the root of the application directory.
|
10
|
-
|
10
|
+
_cset(:bundle_gemfile) { "Gemfile" }
|
11
11
|
|
12
12
|
# As well as a `Gemfile`, application repositories should also contain a `Gemfile.lock`.
|
13
|
-
|
13
|
+
_cset(:bundle_gemfile_lock) { "#{bundle_gemfile}.lock" }
|
14
14
|
|
15
15
|
# An application's gems are installed within the application directory. By default they are
|
16
16
|
# placed under `vendor/gems`.
|
17
|
-
|
17
|
+
_cset(:bundle_path) { "#{deploy_to}/vendor/gems" }
|
18
18
|
|
19
19
|
# Not all gems are needed for production environments, so by default the `development`, `test` and
|
20
20
|
# `assets` groups are skipped.
|
21
|
-
|
21
|
+
_cset(:bundle_without) { "development test" }
|
22
22
|
|
23
23
|
# The main bundle install command uses all the settings above, together with the `--deployment`,
|
24
24
|
# `--binstubs` and `--quiet` flags
|
25
|
-
|
25
|
+
_cset(:bundle_install_command) { "bundle install --gemfile #{bundle_gemfile} --path #{bundle_path} --deployment --quiet --binstubs --without #{bundle_without}" }
|
26
26
|
|
27
27
|
namespace :install do
|
28
28
|
# After cloning or updating the code, we only install the bundle if the `Gemfile` or `Gemfile.lock` have changed.
|
@@ -61,4 +61,4 @@ module Recap::Tasks::Bundler
|
|
61
61
|
after 'deploy:clone_code', 'bundle:install:if_changed'
|
62
62
|
after 'deploy:update_code', 'bundle:install:if_changed'
|
63
63
|
end
|
64
|
-
end
|
64
|
+
end
|
data/lib/recap/tasks/deploy.rb
CHANGED
@@ -17,47 +17,47 @@ module Recap::Tasks::Deploy
|
|
17
17
|
|
18
18
|
namespace :deploy do
|
19
19
|
# To use this recipe, both the application's name and its git repository are required.
|
20
|
-
|
21
|
-
|
20
|
+
_cset(:application) { abort "You must set the name of your application in your Capfile, e.g.: set :application, 'tomafro.net'" }
|
21
|
+
_cset(:repository) { abort "You must set the git respository location in your Capfile, e.g.: set :respository, 'git@github.com/tomafro/tomafro.net'" }
|
22
22
|
|
23
23
|
# The recipe assumes that the application code will be run as a dedicated user. Any user who
|
24
24
|
# can deploy the application should be added as a member of the application's group. By default,
|
25
25
|
# both the application user and group take the same name as the application.
|
26
|
-
|
27
|
-
|
26
|
+
_cset(:application_user) { application }
|
27
|
+
_cset(:application_group) { application_user }
|
28
28
|
|
29
29
|
# Deployments can be made from any branch. `master` is used by default.
|
30
|
-
|
30
|
+
_cset(:branch, 'master')
|
31
31
|
|
32
32
|
# Unlike a standard capistrano deployment, all releases are stored directly in the `deploy_to`
|
33
33
|
# directory. The default is `/home/#{application_user}/app`.
|
34
|
-
|
34
|
+
_cset(:deploy_to) { "/home/#{application_user}/app" }
|
35
35
|
|
36
36
|
# Each release is marked by a unique tag, generated with the current timestamp. This should
|
37
37
|
# not be changed, as the format is matched in the list of tags to find deploy tags.
|
38
|
-
|
38
|
+
_cset(:release_tag) { Time.now.utc.strftime("%Y%m%d%H%M%S") }
|
39
39
|
|
40
40
|
# If `release_tag` is changed, then `release_matcher` must be too, to a regular expression
|
41
41
|
# that will match all generated release tags. In general it's best to leave both unchanged.
|
42
|
-
|
42
|
+
_cset(:release_matcher) { /\A[0-9]{14}\Z/ }
|
43
43
|
|
44
44
|
# On tagging a release, a message is also recorded alongside the tag. This message can contain
|
45
45
|
# anything useful - its contents are not important for the recipe.
|
46
|
-
|
46
|
+
_cset(:release_message, "Deployed at #{Time.now}")
|
47
47
|
|
48
48
|
# Some tasks need to know the `latest_tag` - the most recent successful deployment. If no
|
49
49
|
# deployments have been made, this will be `nil`.
|
50
|
-
|
50
|
+
_cset(:latest_tag) { latest_tag_from_repository }
|
51
51
|
|
52
52
|
# Force a complete deploy, even if no trigger files have changed
|
53
|
-
|
53
|
+
_cset(:force_full_deploy, false)
|
54
54
|
|
55
55
|
# A lock file is used to ensure deployments don't overlap
|
56
|
-
|
56
|
+
_cset(:deploy_lock_file) { "#{deploy_to}/.recap-lock"}
|
57
57
|
|
58
58
|
# The lock file is set to include a message that can be displayed
|
59
59
|
# if claiming the lock fails
|
60
|
-
|
60
|
+
_cset(:deploy_lock_message) { "Deployment in progress (started #{Time.now.to_s})" }
|
61
61
|
|
62
62
|
# To authenticate with github or other git servers, it is easier (and cleaner) to forward the
|
63
63
|
# deploying user's ssh key than manage keys on deployment servers.
|
data/lib/recap/tasks/env.rb
CHANGED
@@ -24,7 +24,7 @@ module Recap::Tasks::Env
|
|
24
24
|
extend Recap::Support::Namespace
|
25
25
|
|
26
26
|
namespace :env do
|
27
|
-
|
27
|
+
_cset(:environment_file) { "/home/#{application_user}/.env" }
|
28
28
|
|
29
29
|
# The `env` task displays the current configuration environment. Note that this doesn't
|
30
30
|
# include all environment variables, only those stored in the `.env` file.
|
@@ -108,4 +108,4 @@ module Recap::Tasks::Env
|
|
108
108
|
def env_argv
|
109
109
|
ARGV[1..-1]
|
110
110
|
end
|
111
|
-
end
|
111
|
+
end
|
data/lib/recap/tasks/foreman.rb
CHANGED
@@ -7,24 +7,24 @@ module Recap::Tasks::Foreman
|
|
7
7
|
|
8
8
|
namespace :foreman do
|
9
9
|
# Processes are declared in a `Procfile`, by default in the root of the application directory.
|
10
|
-
|
10
|
+
_cset(:procfile) { "Procfile" }
|
11
11
|
|
12
12
|
# Foreman startup scripts are exported in `upstart` format by default.
|
13
|
-
|
13
|
+
_cset(:foreman_export_format, "upstart")
|
14
14
|
|
15
15
|
# Foreman startup scripts are generated based on the standard templates by default
|
16
|
-
|
16
|
+
_cset(:foreman_template, nil)
|
17
17
|
|
18
|
-
|
18
|
+
_cset(:foreman_template_option) { foreman_template ? "--template #{foreman_template}" : nil}
|
19
19
|
|
20
20
|
# Scripts are exported (as the the application user) to a temporary location first.
|
21
|
-
|
21
|
+
_cset(:foreman_tmp_location) { "#{deploy_to}/tmp/foreman" }
|
22
22
|
|
23
23
|
# After exports, the scripts are moved to their final location, usually `/etc/init`.
|
24
|
-
|
24
|
+
_cset(:foreman_export_location, "/etc/init")
|
25
25
|
|
26
26
|
# The standard foreman export.
|
27
|
-
|
27
|
+
_cset(:foreman_export_command) { "./bin/foreman export #{foreman_export_format} #{foreman_tmp_location} --procfile #{procfile} --app #{application} --user #{application_user} --log #{deploy_to}/log #{foreman_template_option}" }
|
28
28
|
|
29
29
|
namespace :export do
|
30
30
|
# After each deployment, the startup scripts are exported if either the `Procfile` or any custom Foreman templates have changed.
|
@@ -27,7 +27,7 @@ module Recap::Tasks::Preflight
|
|
27
27
|
before 'deploy:setup', 'preflight:check'
|
28
28
|
before 'deploy', 'preflight:check'
|
29
29
|
|
30
|
-
|
30
|
+
_cset(:remote_username) { capture('whoami').strip }
|
31
31
|
|
32
32
|
task :check do
|
33
33
|
# First check the `application_user` exists.
|
data/lib/recap/tasks/rails.rb
CHANGED
@@ -20,7 +20,7 @@ module Recap::Tasks::Rails
|
|
20
20
|
# assets to be compiled, and which don't. By default, recap will watch
|
21
21
|
# the following files and directories and compile assets if they change
|
22
22
|
# between deploys.
|
23
|
-
|
23
|
+
_cset(:asset_precompilation_triggers, %w(app/assets vendor/assets Gemfile.lock config))
|
24
24
|
|
25
25
|
namespace :db do
|
26
26
|
task :load_schema do
|
data/lib/recap/tasks/ruby.rb
CHANGED
@@ -2,7 +2,7 @@ module Recap::Tasks::Ruby
|
|
2
2
|
extend Recap::Support::Namespace
|
3
3
|
|
4
4
|
namespace :ruby do
|
5
|
-
|
5
|
+
_cset(:skip_rails_recipe_not_used_warning, false)
|
6
6
|
|
7
7
|
task :preflight do
|
8
8
|
if exit_code("grep rails #{deploy_to}/Gemfile") == "0"
|
@@ -20,4 +20,4 @@ suppress this warning, set :skip_rails_recipe_not_used_warning to true.
|
|
20
20
|
|
21
21
|
after "preflight:check", "ruby:preflight"
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|
data/lib/recap/version.rb
CHANGED
data/spec/tasks/deploy_spec.rb
CHANGED
@@ -59,6 +59,12 @@ describe Recap::Tasks::Deploy do
|
|
59
59
|
it 'defaults to master' do
|
60
60
|
config.branch.should eql('master')
|
61
61
|
end
|
62
|
+
|
63
|
+
it 'honours value in pre-set variable' do
|
64
|
+
config.set(:branch, 'branch-from-command-line')
|
65
|
+
Recap::Tasks::Deploy.load_into(config)
|
66
|
+
config.branch.should eql('branch-from-command-line')
|
67
|
+
end
|
62
68
|
end
|
63
69
|
|
64
70
|
describe '#deploy_to' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Ward
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
version: '0'
|
224
224
|
requirements: []
|
225
225
|
rubyforge_project:
|
226
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.1.5
|
227
227
|
signing_key:
|
228
228
|
specification_version: 4
|
229
229
|
summary: GIT based deployment recipes for Capistrano
|