giga-pro-sys 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/capistrano-3.20.1/CHANGELOG.md +1 -0
- data/capistrano-3.20.1/CONTRIBUTING.md +63 -0
- data/capistrano-3.20.1/DEVELOPMENT.md +112 -0
- data/capistrano-3.20.1/Gemfile +9 -0
- data/capistrano-3.20.1/LICENSE.txt +21 -0
- data/capistrano-3.20.1/README.md +221 -0
- data/capistrano-3.20.1/RELEASING.md +17 -0
- data/capistrano-3.20.1/Rakefile +24 -0
- data/capistrano-3.20.1/UPGRADING-3.7.md +86 -0
- data/capistrano-3.20.1/bin/cap +3 -0
- data/capistrano-3.20.1/bin/capify +8 -0
- data/capistrano-3.20.1/capistrano.gemspec +34 -0
- data/capistrano-3.20.1/docker-compose.yml +8 -0
- data/capistrano-3.20.1/features/configuration.feature +28 -0
- data/capistrano-3.20.1/features/deploy.feature +92 -0
- data/capistrano-3.20.1/features/deploy_failure.feature +17 -0
- data/capistrano-3.20.1/features/doctor.feature +11 -0
- data/capistrano-3.20.1/features/installation.feature +21 -0
- data/capistrano-3.20.1/features/sshconnect.feature +11 -0
- data/capistrano-3.20.1/features/stage_failure.feature +9 -0
- data/capistrano-3.20.1/features/step_definitions/assertions.rb +162 -0
- data/capistrano-3.20.1/features/step_definitions/cap_commands.rb +21 -0
- data/capistrano-3.20.1/features/step_definitions/setup.rb +91 -0
- data/capistrano-3.20.1/features/subdirectory.feature +9 -0
- data/capistrano-3.20.1/features/support/docker_gateway.rb +53 -0
- data/capistrano-3.20.1/features/support/env.rb +1 -0
- data/capistrano-3.20.1/features/support/remote_command_helpers.rb +29 -0
- data/capistrano-3.20.1/features/support/remote_ssh_helpers.rb +33 -0
- data/capistrano-3.20.1/gemfiles/legacy.gemfile +7 -0
- data/capistrano-3.20.1/lib/Capfile +3 -0
- data/capistrano-3.20.1/lib/capistrano/all.rb +17 -0
- data/capistrano-3.20.1/lib/capistrano/application.rb +153 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/empty_filter.rb +9 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/filter.rb +26 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/host_filter.rb +29 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/null_filter.rb +9 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/plugin_installer.rb +51 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/question.rb +76 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/role_filter.rb +29 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/scm_resolver.rb +149 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/server.rb +135 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/servers.rb +76 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/validated_variables.rb +110 -0
- data/capistrano-3.20.1/lib/capistrano/configuration/variables.rb +112 -0
- data/capistrano-3.20.1/lib/capistrano/configuration.rb +189 -0
- data/capistrano-3.20.1/lib/capistrano/console.rb +1 -0
- data/capistrano-3.20.1/lib/capistrano/defaults.rb +36 -0
- data/capistrano-3.20.1/lib/capistrano/deploy.rb +3 -0
- data/capistrano-3.20.1/lib/capistrano/doctor/environment_doctor.rb +19 -0
- data/capistrano-3.20.1/lib/capistrano/doctor/gems_doctor.rb +45 -0
- data/capistrano-3.20.1/lib/capistrano/doctor/output_helpers.rb +79 -0
- data/capistrano-3.20.1/lib/capistrano/doctor/servers_doctor.rb +105 -0
- data/capistrano-3.20.1/lib/capistrano/doctor/variables_doctor.rb +74 -0
- data/capistrano-3.20.1/lib/capistrano/doctor.rb +6 -0
- data/capistrano-3.20.1/lib/capistrano/dotfile.rb +2 -0
- data/capistrano-3.20.1/lib/capistrano/dsl/env.rb +43 -0
- data/capistrano-3.20.1/lib/capistrano/dsl/paths.rb +89 -0
- data/capistrano-3.20.1/lib/capistrano/dsl/stages.rb +31 -0
- data/capistrano-3.20.1/lib/capistrano/dsl/task_enhancements.rb +61 -0
- data/capistrano-3.20.1/lib/capistrano/dsl.rb +95 -0
- data/capistrano-3.20.1/lib/capistrano/framework.rb +2 -0
- data/capistrano-3.20.1/lib/capistrano/i18n.rb +46 -0
- data/capistrano-3.20.1/lib/capistrano/immutable_task.rb +30 -0
- data/capistrano-3.20.1/lib/capistrano/install.rb +1 -0
- data/capistrano-3.20.1/lib/capistrano/plugin.rb +95 -0
- data/capistrano-3.20.1/lib/capistrano/proc_helpers.rb +13 -0
- data/capistrano-3.20.1/lib/capistrano/scm/git.rb +106 -0
- data/capistrano-3.20.1/lib/capistrano/scm/hg.rb +55 -0
- data/capistrano-3.20.1/lib/capistrano/scm/plugin.rb +13 -0
- data/capistrano-3.20.1/lib/capistrano/scm/svn.rb +56 -0
- data/capistrano-3.20.1/lib/capistrano/scm/tasks/git.rake +84 -0
- data/capistrano-3.20.1/lib/capistrano/scm/tasks/hg.rake +53 -0
- data/capistrano-3.20.1/lib/capistrano/scm/tasks/svn.rake +53 -0
- data/capistrano-3.20.1/lib/capistrano/scm.rb +115 -0
- data/capistrano-3.20.1/lib/capistrano/setup.rb +36 -0
- data/capistrano-3.20.1/lib/capistrano/tasks/console.rake +25 -0
- data/capistrano-3.20.1/lib/capistrano/tasks/deploy.rake +280 -0
- data/capistrano-3.20.1/lib/capistrano/tasks/doctor.rake +24 -0
- data/capistrano-3.20.1/lib/capistrano/tasks/framework.rake +67 -0
- data/capistrano-3.20.1/lib/capistrano/tasks/install.rake +41 -0
- data/capistrano-3.20.1/lib/capistrano/templates/Capfile +38 -0
- data/capistrano-3.20.1/lib/capistrano/templates/deploy.rb.erb +39 -0
- data/capistrano-3.20.1/lib/capistrano/templates/stage.rb.erb +61 -0
- data/capistrano-3.20.1/lib/capistrano/upload_task.rb +9 -0
- data/capistrano-3.20.1/lib/capistrano/version.rb +3 -0
- data/capistrano-3.20.1/lib/capistrano/version_validator.rb +32 -0
- data/capistrano-3.20.1/lib/capistrano.rb +0 -0
- data/capistrano-3.20.1/spec/integration/dsl_spec.rb +632 -0
- data/capistrano-3.20.1/spec/integration_spec_helper.rb +5 -0
- data/capistrano-3.20.1/spec/lib/capistrano/application_spec.rb +60 -0
- data/capistrano-3.20.1/spec/lib/capistrano/configuration/empty_filter_spec.rb +17 -0
- data/capistrano-3.20.1/spec/lib/capistrano/configuration/filter_spec.rb +109 -0
- data/capistrano-3.20.1/spec/lib/capistrano/configuration/host_filter_spec.rb +71 -0
- data/capistrano-3.20.1/spec/lib/capistrano/configuration/null_filter_spec.rb +17 -0
- data/capistrano-3.20.1/spec/lib/capistrano/configuration/plugin_installer_spec.rb +98 -0
- data/capistrano-3.20.1/spec/lib/capistrano/configuration/question_spec.rb +92 -0
- data/capistrano-3.20.1/spec/lib/capistrano/configuration/role_filter_spec.rb +80 -0
- data/capistrano-3.20.1/spec/lib/capistrano/configuration/scm_resolver_spec.rb +56 -0
- data/capistrano-3.20.1/spec/lib/capistrano/configuration/server_spec.rb +309 -0
- data/capistrano-3.20.1/spec/lib/capistrano/configuration/servers_spec.rb +331 -0
- data/capistrano-3.20.1/spec/lib/capistrano/configuration_spec.rb +357 -0
- data/capistrano-3.20.1/spec/lib/capistrano/doctor/environment_doctor_spec.rb +44 -0
- data/capistrano-3.20.1/spec/lib/capistrano/doctor/gems_doctor_spec.rb +67 -0
- data/capistrano-3.20.1/spec/lib/capistrano/doctor/output_helpers_spec.rb +47 -0
- data/capistrano-3.20.1/spec/lib/capistrano/doctor/servers_doctor_spec.rb +86 -0
- data/capistrano-3.20.1/spec/lib/capistrano/doctor/variables_doctor_spec.rb +89 -0
- data/capistrano-3.20.1/spec/lib/capistrano/dsl/paths_spec.rb +228 -0
- data/capistrano-3.20.1/spec/lib/capistrano/dsl/task_enhancements_spec.rb +108 -0
- data/capistrano-3.20.1/spec/lib/capistrano/dsl_spec.rb +125 -0
- data/capistrano-3.20.1/spec/lib/capistrano/immutable_task_spec.rb +31 -0
- data/capistrano-3.20.1/spec/lib/capistrano/plugin_spec.rb +84 -0
- data/capistrano-3.20.1/spec/lib/capistrano/scm/git_spec.rb +194 -0
- data/capistrano-3.20.1/spec/lib/capistrano/scm/hg_spec.rb +109 -0
- data/capistrano-3.20.1/spec/lib/capistrano/scm/svn_spec.rb +137 -0
- data/capistrano-3.20.1/spec/lib/capistrano/scm_spec.rb +103 -0
- data/capistrano-3.20.1/spec/lib/capistrano/upload_task_spec.rb +19 -0
- data/capistrano-3.20.1/spec/lib/capistrano/version_validator_spec.rb +118 -0
- data/capistrano-3.20.1/spec/lib/capistrano_spec.rb +7 -0
- data/capistrano-3.20.1/spec/spec_helper.rb +29 -0
- data/capistrano-3.20.1/spec/support/matchers.rb +5 -0
- data/capistrano-3.20.1/spec/support/tasks/database.rake +11 -0
- data/capistrano-3.20.1/spec/support/tasks/fail.rake +8 -0
- data/capistrano-3.20.1/spec/support/tasks/failed.rake +5 -0
- data/capistrano-3.20.1/spec/support/tasks/plugin.rake +6 -0
- data/capistrano-3.20.1/spec/support/tasks/root.rake +11 -0
- data/capistrano-3.20.1/spec/support/test_app.rb +205 -0
- data/giga-pro-sys.gemspec +12 -0
- metadata +168 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Capistrano
|
|
2
|
+
module ProcHelpers
|
|
3
|
+
module_function
|
|
4
|
+
|
|
5
|
+
# Tests whether the given object appears to respond to `call` with
|
|
6
|
+
# zero parameters. In Capistrano, such a proc is used to represent a
|
|
7
|
+
# "deferred value". That is, a value that is resolved by invoking `call` at
|
|
8
|
+
# the time it is first needed.
|
|
9
|
+
def callable_without_parameters?(x)
|
|
10
|
+
x.respond_to?(:call) && (!x.respond_to?(:arity) || x.arity.zero?)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
require "capistrano/scm/plugin"
|
|
2
|
+
require "cgi"
|
|
3
|
+
require "securerandom"
|
|
4
|
+
require "shellwords"
|
|
5
|
+
require "stringio"
|
|
6
|
+
require "uri"
|
|
7
|
+
|
|
8
|
+
class Capistrano::SCM::Git < Capistrano::SCM::Plugin
|
|
9
|
+
def set_defaults
|
|
10
|
+
set_if_empty :git_shallow_clone, false
|
|
11
|
+
set_if_empty :git_wrapper_path, lambda {
|
|
12
|
+
# Use a unique name that won't collide with other deployments, and
|
|
13
|
+
# that cannot be guessed by other processes that have access to /tmp.
|
|
14
|
+
"#{fetch(:tmp_dir)}/git-ssh-#{SecureRandom.hex(10)}.sh"
|
|
15
|
+
}
|
|
16
|
+
set_if_empty :git_environmental_variables, lambda {
|
|
17
|
+
{
|
|
18
|
+
git_askpass: "/bin/echo",
|
|
19
|
+
git_ssh: fetch(:git_wrapper_path)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
set_if_empty :git_max_concurrent_connections, 10
|
|
23
|
+
set_if_empty :git_wait_interval, 0
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def register_hooks
|
|
27
|
+
after "deploy:new_release_path", "git:create_release"
|
|
28
|
+
before "deploy:check", "git:check"
|
|
29
|
+
before "deploy:set_current_revision", "git:set_current_revision"
|
|
30
|
+
before "deploy:set_current_revision_time", "git:set_current_revision_time"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def define_tasks
|
|
34
|
+
eval_rakefile File.expand_path("../tasks/git.rake", __FILE__)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def repo_mirror_exists?
|
|
38
|
+
backend.test " [ -f #{repo_path}/HEAD ] "
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def check_repo_is_reachable
|
|
42
|
+
git :'ls-remote', git_repo_url, "HEAD"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def clone_repo
|
|
46
|
+
if (depth = fetch(:git_shallow_clone))
|
|
47
|
+
git :clone, "--mirror", "--depth", depth, "--no-single-branch", git_repo_url, repo_path.to_s
|
|
48
|
+
else
|
|
49
|
+
git :clone, "--mirror", git_repo_url, repo_path.to_s
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def update_mirror
|
|
54
|
+
# Update the origin URL if necessary.
|
|
55
|
+
git :remote, "set-url", "origin", git_repo_url
|
|
56
|
+
|
|
57
|
+
# Note: Requires git version 1.9 or greater
|
|
58
|
+
if (depth = fetch(:git_shallow_clone))
|
|
59
|
+
git :fetch, "--depth", depth, "origin", fetch(:branch)
|
|
60
|
+
else
|
|
61
|
+
git :remote, :update, "--prune"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def verify_commit
|
|
66
|
+
git :"verify-commit", fetch_revision
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def archive_to_release_path
|
|
70
|
+
if (tree = fetch(:repo_tree))
|
|
71
|
+
tree = tree.slice %r#^/?(.*?)/?$#, 1
|
|
72
|
+
components = tree.split("/").size
|
|
73
|
+
git :archive, fetch(:branch), tree, "| #{SSHKit.config.command_map[:tar]} -x --strip-components #{components} -f - -C", release_path
|
|
74
|
+
else
|
|
75
|
+
git :archive, fetch(:branch), "| #{SSHKit.config.command_map[:tar]} -x -f - -C", release_path
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def fetch_revision
|
|
80
|
+
backend.capture(:git, "rev-list --max-count=1 #{fetch(:branch)}")
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def fetch_revision_time
|
|
84
|
+
backend.capture(:git, "--no-pager log -1 --pretty=format:\"%ct\" #{fetch(:branch)}")
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def git(*args)
|
|
88
|
+
args.unshift :git
|
|
89
|
+
backend.execute(*args)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def git_repo_url
|
|
93
|
+
if fetch(:git_http_username) && fetch(:git_http_password)
|
|
94
|
+
URI.parse(repo_url).tap do |repo_uri|
|
|
95
|
+
repo_uri.user = fetch(:git_http_username)
|
|
96
|
+
repo_uri.password = CGI.escape(fetch(:git_http_password))
|
|
97
|
+
end.to_s
|
|
98
|
+
elsif fetch(:git_http_username)
|
|
99
|
+
URI.parse(repo_url).tap do |repo_uri|
|
|
100
|
+
repo_uri.user = fetch(:git_http_username)
|
|
101
|
+
end.to_s
|
|
102
|
+
else
|
|
103
|
+
repo_url
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require "capistrano/scm/plugin"
|
|
2
|
+
require "securerandom"
|
|
3
|
+
|
|
4
|
+
class Capistrano::SCM::Hg < Capistrano::SCM::Plugin
|
|
5
|
+
def register_hooks
|
|
6
|
+
after "deploy:new_release_path", "hg:create_release"
|
|
7
|
+
before "deploy:check", "hg:check"
|
|
8
|
+
before "deploy:set_current_revision", "hg:set_current_revision"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def define_tasks
|
|
12
|
+
eval_rakefile File.expand_path("../tasks/hg.rake", __FILE__)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def hg(*args)
|
|
16
|
+
args.unshift(:hg)
|
|
17
|
+
backend.execute(*args)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def repo_mirror_exists?
|
|
21
|
+
backend.test " [ -d #{repo_path}/.hg ] "
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def check_repo_is_reachable
|
|
25
|
+
hg "id", repo_url
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def clone_repo
|
|
29
|
+
hg "clone", "--noupdate", repo_url, repo_path.to_s
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def update_mirror
|
|
33
|
+
hg "pull"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def archive_to_release_path
|
|
37
|
+
if (tree = fetch(:repo_tree))
|
|
38
|
+
tree = tree.slice %r#^/?(.*?)/?$#, 1
|
|
39
|
+
components = tree.split("/").size
|
|
40
|
+
temp_tar = "#{fetch(:tmp_dir)}/#{SecureRandom.hex(10)}.tar"
|
|
41
|
+
|
|
42
|
+
hg "archive -p . -I", tree, "--rev", fetch(:branch), temp_tar
|
|
43
|
+
|
|
44
|
+
backend.execute :mkdir, "-p", release_path
|
|
45
|
+
backend.execute :tar, "-x --strip-components #{components} -f", temp_tar, "-C", release_path
|
|
46
|
+
backend.execute :rm, temp_tar
|
|
47
|
+
else
|
|
48
|
+
hg "archive", release_path, "--rev", fetch(:branch)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def fetch_revision
|
|
53
|
+
backend.capture(:hg, "log --rev #{fetch(:branch)} --template \"{node}\n\"")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "capistrano/plugin"
|
|
2
|
+
require "capistrano/scm"
|
|
3
|
+
|
|
4
|
+
# Base class for all built-in and third-party SCM plugins. Notice that this
|
|
5
|
+
# class doesn't really do anything other than provide an `scm?` predicate. This
|
|
6
|
+
# tells Capistrano that the plugin provides SCM functionality. All other plugin
|
|
7
|
+
# features are inherited from Capistrano::Plugin.
|
|
8
|
+
#
|
|
9
|
+
class Capistrano::SCM::Plugin < Capistrano::Plugin
|
|
10
|
+
def scm?
|
|
11
|
+
true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require "capistrano/scm/plugin"
|
|
2
|
+
|
|
3
|
+
class Capistrano::SCM::Svn < Capistrano::SCM::Plugin
|
|
4
|
+
def register_hooks
|
|
5
|
+
after "deploy:new_release_path", "svn:create_release"
|
|
6
|
+
before "deploy:check", "svn:check"
|
|
7
|
+
before "deploy:set_current_revision", "svn:set_current_revision"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def define_tasks
|
|
11
|
+
eval_rakefile File.expand_path("../tasks/svn.rake", __FILE__)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def svn(*args)
|
|
15
|
+
args.unshift(:svn)
|
|
16
|
+
args.push "--username #{fetch(:svn_username)}" if fetch(:svn_username)
|
|
17
|
+
args.push "--password #{fetch(:svn_password)}" if fetch(:svn_password)
|
|
18
|
+
args.push "--revision #{fetch(:svn_revision)}" if fetch(:svn_revision)
|
|
19
|
+
backend.execute(*args)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def repo_mirror_exists?
|
|
23
|
+
backend.test " [ -d #{repo_path}/.svn ] "
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def check_repo_is_reachable
|
|
27
|
+
svn_username = fetch(:svn_username) ? "--username #{fetch(:svn_username)}" : ""
|
|
28
|
+
svn_password = fetch(:svn_password) ? "--password #{fetch(:svn_password)}" : ""
|
|
29
|
+
backend.test :svn, :info, repo_url, svn_username, svn_password
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def clone_repo
|
|
33
|
+
svn :checkout, repo_url, repo_path.to_s
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def update_mirror
|
|
37
|
+
# Switch the repository URL if necessary.
|
|
38
|
+
repo_mirror_url = fetch_repo_mirror_url
|
|
39
|
+
svn :switch, repo_url unless repo_mirror_url == repo_url
|
|
40
|
+
svn :update
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def archive_to_release_path
|
|
44
|
+
svn :export, "--force", ".", release_path
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def fetch_revision
|
|
48
|
+
backend.capture(:svnversion, repo_path.to_s)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def fetch_repo_mirror_url
|
|
52
|
+
backend.capture(:svn, :info, repo_path.to_s).each_line do |line|
|
|
53
|
+
return $1 if /\AURL: (.*)\n\z/ =~ line
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# This trick lets us access the Git plugin within `on` blocks.
|
|
2
|
+
git_plugin = self
|
|
3
|
+
|
|
4
|
+
namespace :git do
|
|
5
|
+
desc "Upload the git wrapper script, this script guarantees that we can script git without getting an interactive prompt"
|
|
6
|
+
task :wrapper do
|
|
7
|
+
on release_roles(:all), in: :groups, limit: fetch(:git_max_concurrent_connections), wait: fetch(:git_wait_interval) do
|
|
8
|
+
execute :mkdir, "-p", File.dirname(fetch(:git_wrapper_path)).shellescape
|
|
9
|
+
upload! StringIO.new("#!/bin/sh -e\nexec /usr/bin/env ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no \"$@\"\n"), fetch(:git_wrapper_path)
|
|
10
|
+
execute :chmod, "700", fetch(:git_wrapper_path).shellescape
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
desc "Check that the repository is reachable"
|
|
15
|
+
task check: :'git:wrapper' do
|
|
16
|
+
fetch(:branch)
|
|
17
|
+
on release_roles(:all), in: :groups, limit: fetch(:git_max_concurrent_connections), wait: fetch(:git_wait_interval) do
|
|
18
|
+
with fetch(:git_environmental_variables) do
|
|
19
|
+
git_plugin.check_repo_is_reachable
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
desc "Clone the repo to the cache"
|
|
25
|
+
task clone: :'git:wrapper' do
|
|
26
|
+
on release_roles(:all), in: :groups, limit: fetch(:git_max_concurrent_connections), wait: fetch(:git_wait_interval) do
|
|
27
|
+
if git_plugin.repo_mirror_exists?
|
|
28
|
+
info t(:mirror_exists, at: repo_path)
|
|
29
|
+
else
|
|
30
|
+
within deploy_path do
|
|
31
|
+
with fetch(:git_environmental_variables) do
|
|
32
|
+
git_plugin.clone_repo
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
desc "Update the repo mirror to reflect the origin state"
|
|
40
|
+
task update: :'git:clone' do
|
|
41
|
+
on release_roles(:all), in: :groups, limit: fetch(:git_max_concurrent_connections), wait: fetch(:git_wait_interval) do
|
|
42
|
+
within repo_path do
|
|
43
|
+
with fetch(:git_environmental_variables) do
|
|
44
|
+
git_plugin.update_mirror
|
|
45
|
+
git_plugin.verify_commit if fetch(:git_verify_commit)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
desc "Copy repo to releases"
|
|
52
|
+
task create_release: :'git:update' do
|
|
53
|
+
on release_roles(:all), in: :groups, limit: fetch(:git_max_concurrent_connections), wait: fetch(:git_wait_interval) do
|
|
54
|
+
with fetch(:git_environmental_variables) do
|
|
55
|
+
within repo_path do
|
|
56
|
+
execute :mkdir, "-p", release_path
|
|
57
|
+
git_plugin.archive_to_release_path
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
desc "Determine the revision that will be deployed"
|
|
64
|
+
task :set_current_revision do
|
|
65
|
+
on release_roles(:all), in: :groups, limit: fetch(:git_max_concurrent_connections), wait: fetch(:git_wait_interval) do
|
|
66
|
+
within repo_path do
|
|
67
|
+
with fetch(:git_environmental_variables) do
|
|
68
|
+
set :current_revision, git_plugin.fetch_revision
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
desc "Determine the unix timestamp that the revision that will be deployed was created"
|
|
75
|
+
task :set_current_revision_time do
|
|
76
|
+
on release_roles(:all), in: :groups, limit: fetch(:git_max_concurrent_connections), wait: fetch(:git_wait_interval) do
|
|
77
|
+
within repo_path do
|
|
78
|
+
with fetch(:git_environmental_variables) do
|
|
79
|
+
set :current_revision_time, git_plugin.fetch_revision_time
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# TODO: this is nearly identical to git.rake. DRY up?
|
|
2
|
+
|
|
3
|
+
# This trick lets us access the Hg plugin within `on` blocks.
|
|
4
|
+
hg_plugin = self
|
|
5
|
+
|
|
6
|
+
namespace :hg do
|
|
7
|
+
desc "Check that the repo is reachable"
|
|
8
|
+
task :check do
|
|
9
|
+
on release_roles :all do
|
|
10
|
+
hg_plugin.check_repo_is_reachable
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
desc "Clone the repo to the cache"
|
|
15
|
+
task :clone do
|
|
16
|
+
on release_roles :all do
|
|
17
|
+
if hg_plugin.repo_mirror_exists?
|
|
18
|
+
info t(:mirror_exists, at: repo_path)
|
|
19
|
+
else
|
|
20
|
+
within deploy_path do
|
|
21
|
+
hg_plugin.clone_repo
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
desc "Pull changes from the remote repo"
|
|
28
|
+
task update: :'hg:clone' do
|
|
29
|
+
on release_roles :all do
|
|
30
|
+
within repo_path do
|
|
31
|
+
hg_plugin.update_mirror
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
desc "Copy repo to releases"
|
|
37
|
+
task create_release: :'hg:update' do
|
|
38
|
+
on release_roles :all do
|
|
39
|
+
within repo_path do
|
|
40
|
+
hg_plugin.archive_to_release_path
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
desc "Determine the revision that will be deployed"
|
|
46
|
+
task :set_current_revision do
|
|
47
|
+
on release_roles :all do
|
|
48
|
+
within repo_path do
|
|
49
|
+
set :current_revision, hg_plugin.fetch_revision
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# TODO: this is nearly identical to git.rake. DRY up?
|
|
2
|
+
|
|
3
|
+
# This trick lets us access the Svn plugin within `on` blocks.
|
|
4
|
+
svn_plugin = self
|
|
5
|
+
|
|
6
|
+
namespace :svn do
|
|
7
|
+
desc "Check that the repo is reachable"
|
|
8
|
+
task :check do
|
|
9
|
+
on release_roles :all do
|
|
10
|
+
svn_plugin.check_repo_is_reachable
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
desc "Clone the repo to the cache"
|
|
15
|
+
task :clone do
|
|
16
|
+
on release_roles :all do
|
|
17
|
+
if svn_plugin.repo_mirror_exists?
|
|
18
|
+
info t(:mirror_exists, at: repo_path)
|
|
19
|
+
else
|
|
20
|
+
within deploy_path do
|
|
21
|
+
svn_plugin.clone_repo
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
desc "Pull changes from the remote repo"
|
|
28
|
+
task update: :'svn:clone' do
|
|
29
|
+
on release_roles :all do
|
|
30
|
+
within repo_path do
|
|
31
|
+
svn_plugin.update_mirror
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
desc "Copy repo to releases"
|
|
37
|
+
task create_release: :'svn:update' do
|
|
38
|
+
on release_roles :all do
|
|
39
|
+
within repo_path do
|
|
40
|
+
svn_plugin.archive_to_release_path
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
desc "Determine the revision that will be deployed"
|
|
46
|
+
task :set_current_revision do
|
|
47
|
+
on release_roles :all do
|
|
48
|
+
within repo_path do
|
|
49
|
+
set :current_revision, svn_plugin.fetch_revision
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
module Capistrano
|
|
2
|
+
# Base class for SCM strategy providers.
|
|
3
|
+
#
|
|
4
|
+
# @abstract
|
|
5
|
+
#
|
|
6
|
+
# @attr_reader [Rake] context
|
|
7
|
+
#
|
|
8
|
+
# @author Hartog de Mik
|
|
9
|
+
#
|
|
10
|
+
class SCM
|
|
11
|
+
attr_reader :context
|
|
12
|
+
|
|
13
|
+
# Provide a wrapper for the SCM that loads a strategy for the user.
|
|
14
|
+
#
|
|
15
|
+
# @param [Rake] context The context in which the strategy should run
|
|
16
|
+
# @param [Module] strategy A module to include into the SCM instance. The
|
|
17
|
+
# module should provide the abstract methods of Capistrano::SCM
|
|
18
|
+
#
|
|
19
|
+
def initialize(context, strategy)
|
|
20
|
+
@context = context
|
|
21
|
+
singleton = class << self; self; end
|
|
22
|
+
singleton.send(:include, strategy)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Call test in context
|
|
26
|
+
def test!(*args)
|
|
27
|
+
context.test(*args)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# The repository URL according to the context
|
|
31
|
+
def repo_url
|
|
32
|
+
context.repo_url
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# The repository path according to the context
|
|
36
|
+
def repo_path
|
|
37
|
+
context.repo_path
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# The release path according to the context
|
|
41
|
+
def release_path
|
|
42
|
+
context.release_path
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Fetch a var from the context
|
|
46
|
+
# @param [Symbol] variable The variable to fetch
|
|
47
|
+
# @param [Object] default The default value if not found
|
|
48
|
+
#
|
|
49
|
+
def fetch(*args)
|
|
50
|
+
context.fetch(*args)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# @abstract
|
|
54
|
+
#
|
|
55
|
+
# Your implementation should check the existence of a cache repository on
|
|
56
|
+
# the deployment target
|
|
57
|
+
#
|
|
58
|
+
# @return [Boolean]
|
|
59
|
+
#
|
|
60
|
+
def test
|
|
61
|
+
raise NotImplementedError, "Your SCM strategy module should provide a #test method"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# @abstract
|
|
65
|
+
#
|
|
66
|
+
# Your implementation should check if the specified remote-repository is
|
|
67
|
+
# available.
|
|
68
|
+
#
|
|
69
|
+
# @return [Boolean]
|
|
70
|
+
#
|
|
71
|
+
def check
|
|
72
|
+
raise NotImplementedError, "Your SCM strategy module should provide a #check method"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# @abstract
|
|
76
|
+
#
|
|
77
|
+
# Create a (new) clone of the remote-repository on the deployment target
|
|
78
|
+
#
|
|
79
|
+
# @return void
|
|
80
|
+
#
|
|
81
|
+
def clone
|
|
82
|
+
raise NotImplementedError, "Your SCM strategy module should provide a #clone method"
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# @abstract
|
|
86
|
+
#
|
|
87
|
+
# Update the clone on the deployment target
|
|
88
|
+
#
|
|
89
|
+
# @return void
|
|
90
|
+
#
|
|
91
|
+
def update
|
|
92
|
+
raise NotImplementedError, "Your SCM strategy module should provide a #update method"
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# @abstract
|
|
96
|
+
#
|
|
97
|
+
# Copy the contents of the cache-repository onto the release path
|
|
98
|
+
#
|
|
99
|
+
# @return void
|
|
100
|
+
#
|
|
101
|
+
def release
|
|
102
|
+
raise NotImplementedError, "Your SCM strategy module should provide a #release method"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# @abstract
|
|
106
|
+
#
|
|
107
|
+
# Identify the SHA of the commit that will be deployed. This will most likely involve SshKit's capture method.
|
|
108
|
+
#
|
|
109
|
+
# @return void
|
|
110
|
+
#
|
|
111
|
+
def fetch_revision
|
|
112
|
+
raise NotImplementedError, "Your SCM strategy module should provide a #fetch_revision method"
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require "capistrano/doctor"
|
|
2
|
+
require "capistrano/immutable_task"
|
|
3
|
+
include Capistrano::DSL
|
|
4
|
+
|
|
5
|
+
namespace :load do
|
|
6
|
+
task :defaults do
|
|
7
|
+
load "capistrano/defaults.rb"
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
require "airbrussh/capistrano"
|
|
12
|
+
# We don't need to show the "using Airbrussh" banner announcement since
|
|
13
|
+
# Airbrussh is now the built-in formatter. Also enable command output by
|
|
14
|
+
# default; hiding the output might be confusing to users new to Capistrano.
|
|
15
|
+
Airbrussh.configure do |airbrussh|
|
|
16
|
+
airbrussh.banner = false
|
|
17
|
+
airbrussh.command_output = true
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
stages.each do |stage|
|
|
21
|
+
Rake::Task.define_task(stage) do
|
|
22
|
+
set(:stage, stage.to_sym)
|
|
23
|
+
|
|
24
|
+
invoke "load:defaults"
|
|
25
|
+
Rake.application["load:defaults"].extend(Capistrano::ImmutableTask)
|
|
26
|
+
env.variables.untrusted! do
|
|
27
|
+
load deploy_config_path
|
|
28
|
+
load stage_config_path.join("#{stage}.rb")
|
|
29
|
+
end
|
|
30
|
+
configure_scm
|
|
31
|
+
I18n.locale = fetch(:locale, :en)
|
|
32
|
+
configure_backend
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
require "capistrano/dotfile"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
desc "Execute remote commands"
|
|
2
|
+
task :console do
|
|
3
|
+
stage = fetch(:stage)
|
|
4
|
+
puts I18n.t("console.welcome", scope: :capistrano, stage: stage)
|
|
5
|
+
loop do
|
|
6
|
+
print "#{stage}> "
|
|
7
|
+
|
|
8
|
+
command = (input = $stdin.gets) ? input.chomp : "exit"
|
|
9
|
+
|
|
10
|
+
next if command.empty?
|
|
11
|
+
|
|
12
|
+
if %w{quit exit q}.include? command
|
|
13
|
+
puts t("console.bye")
|
|
14
|
+
break
|
|
15
|
+
else
|
|
16
|
+
begin
|
|
17
|
+
on roles :all do
|
|
18
|
+
execute command
|
|
19
|
+
end
|
|
20
|
+
rescue => e
|
|
21
|
+
puts e
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|