capistrano 3.4.0 → 3.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +129 -0
  3. data/.github/issue_template.md +19 -0
  4. data/.github/pull_request_template.md +22 -0
  5. data/.github/release-drafter.yml +17 -0
  6. data/.github/workflows/push.yml +12 -0
  7. data/.gitignore +8 -5
  8. data/.rubocop.yml +62 -0
  9. data/CHANGELOG.md +1 -307
  10. data/CONTRIBUTING.md +63 -93
  11. data/DEVELOPMENT.md +127 -0
  12. data/Dangerfile +1 -0
  13. data/Gemfile +40 -3
  14. data/LICENSE.txt +1 -1
  15. data/README.md +127 -44
  16. data/RELEASING.md +17 -0
  17. data/Rakefile +13 -2
  18. data/UPGRADING-3.7.md +86 -0
  19. data/bin/cap +1 -1
  20. data/capistrano.gemspec +21 -24
  21. data/features/deploy.feature +35 -1
  22. data/features/doctor.feature +11 -0
  23. data/features/installation.feature +8 -3
  24. data/features/stage_failure.feature +9 -0
  25. data/features/step_definitions/assertions.rb +51 -18
  26. data/features/step_definitions/cap_commands.rb +9 -0
  27. data/features/step_definitions/setup.rb +53 -9
  28. data/features/subdirectory.feature +9 -0
  29. data/features/support/env.rb +5 -5
  30. data/features/support/remote_command_helpers.rb +12 -6
  31. data/features/support/vagrant_helpers.rb +17 -11
  32. data/lib/Capfile +1 -1
  33. data/lib/capistrano/all.rb +10 -10
  34. data/lib/capistrano/application.rb +47 -34
  35. data/lib/capistrano/configuration/empty_filter.rb +9 -0
  36. data/lib/capistrano/configuration/filter.rb +17 -47
  37. data/lib/capistrano/configuration/host_filter.rb +29 -0
  38. data/lib/capistrano/configuration/null_filter.rb +9 -0
  39. data/lib/capistrano/configuration/plugin_installer.rb +51 -0
  40. data/lib/capistrano/configuration/question.rb +31 -9
  41. data/lib/capistrano/configuration/role_filter.rb +29 -0
  42. data/lib/capistrano/configuration/scm_resolver.rb +149 -0
  43. data/lib/capistrano/configuration/server.rb +29 -23
  44. data/lib/capistrano/configuration/servers.rb +21 -14
  45. data/lib/capistrano/configuration/validated_variables.rb +110 -0
  46. data/lib/capistrano/configuration/variables.rb +112 -0
  47. data/lib/capistrano/configuration.rb +91 -44
  48. data/lib/capistrano/defaults.rb +26 -4
  49. data/lib/capistrano/deploy.rb +1 -1
  50. data/lib/capistrano/doctor/environment_doctor.rb +19 -0
  51. data/lib/capistrano/doctor/gems_doctor.rb +45 -0
  52. data/lib/capistrano/doctor/output_helpers.rb +79 -0
  53. data/lib/capistrano/doctor/servers_doctor.rb +105 -0
  54. data/lib/capistrano/doctor/variables_doctor.rb +74 -0
  55. data/lib/capistrano/doctor.rb +6 -0
  56. data/lib/capistrano/dotfile.rb +1 -2
  57. data/lib/capistrano/dsl/env.rb +9 -47
  58. data/lib/capistrano/dsl/paths.rb +11 -25
  59. data/lib/capistrano/dsl/stages.rb +14 -2
  60. data/lib/capistrano/dsl/task_enhancements.rb +7 -12
  61. data/lib/capistrano/dsl.rb +47 -16
  62. data/lib/capistrano/framework.rb +1 -1
  63. data/lib/capistrano/i18n.rb +32 -24
  64. data/lib/capistrano/immutable_task.rb +30 -0
  65. data/lib/capistrano/install.rb +1 -1
  66. data/lib/capistrano/plugin.rb +95 -0
  67. data/lib/capistrano/proc_helpers.rb +13 -0
  68. data/lib/capistrano/scm/git.rb +100 -0
  69. data/lib/capistrano/scm/hg.rb +55 -0
  70. data/lib/capistrano/scm/plugin.rb +13 -0
  71. data/lib/capistrano/scm/svn.rb +56 -0
  72. data/lib/capistrano/scm/tasks/git.rake +73 -0
  73. data/lib/capistrano/scm/tasks/hg.rake +53 -0
  74. data/lib/capistrano/scm/tasks/svn.rake +53 -0
  75. data/lib/capistrano/scm.rb +7 -20
  76. data/lib/capistrano/setup.rb +20 -6
  77. data/lib/capistrano/tasks/console.rake +4 -8
  78. data/lib/capistrano/tasks/deploy.rake +105 -73
  79. data/lib/capistrano/tasks/doctor.rake +24 -0
  80. data/lib/capistrano/tasks/framework.rake +13 -14
  81. data/lib/capistrano/tasks/install.rake +14 -15
  82. data/lib/capistrano/templates/Capfile +21 -10
  83. data/lib/capistrano/templates/deploy.rb.erb +17 -26
  84. data/lib/capistrano/templates/stage.rb.erb +9 -9
  85. data/lib/capistrano/upload_task.rb +1 -1
  86. data/lib/capistrano/version.rb +1 -1
  87. data/lib/capistrano/version_validator.rb +5 -10
  88. data/spec/integration/dsl_spec.rb +289 -240
  89. data/spec/integration_spec_helper.rb +3 -5
  90. data/spec/lib/capistrano/application_spec.rb +23 -39
  91. data/spec/lib/capistrano/configuration/empty_filter_spec.rb +17 -0
  92. data/spec/lib/capistrano/configuration/filter_spec.rb +83 -85
  93. data/spec/lib/capistrano/configuration/host_filter_spec.rb +71 -0
  94. data/spec/lib/capistrano/configuration/null_filter_spec.rb +17 -0
  95. data/spec/lib/capistrano/configuration/plugin_installer_spec.rb +98 -0
  96. data/spec/lib/capistrano/configuration/question_spec.rb +58 -26
  97. data/spec/lib/capistrano/configuration/role_filter_spec.rb +80 -0
  98. data/spec/lib/capistrano/configuration/scm_resolver_spec.rb +55 -0
  99. data/spec/lib/capistrano/configuration/server_spec.rb +106 -113
  100. data/spec/lib/capistrano/configuration/servers_spec.rb +129 -145
  101. data/spec/lib/capistrano/configuration_spec.rb +224 -63
  102. data/spec/lib/capistrano/doctor/environment_doctor_spec.rb +44 -0
  103. data/spec/lib/capistrano/doctor/gems_doctor_spec.rb +67 -0
  104. data/spec/lib/capistrano/doctor/output_helpers_spec.rb +47 -0
  105. data/spec/lib/capistrano/doctor/servers_doctor_spec.rb +86 -0
  106. data/spec/lib/capistrano/doctor/variables_doctor_spec.rb +89 -0
  107. data/spec/lib/capistrano/dsl/paths_spec.rb +97 -59
  108. data/spec/lib/capistrano/dsl/task_enhancements_spec.rb +57 -37
  109. data/spec/lib/capistrano/dsl_spec.rb +84 -11
  110. data/spec/lib/capistrano/immutable_task_spec.rb +31 -0
  111. data/spec/lib/capistrano/plugin_spec.rb +84 -0
  112. data/spec/lib/capistrano/scm/git_spec.rb +184 -0
  113. data/spec/lib/capistrano/scm/hg_spec.rb +109 -0
  114. data/spec/lib/capistrano/scm/svn_spec.rb +137 -0
  115. data/spec/lib/capistrano/scm_spec.rb +7 -8
  116. data/spec/lib/capistrano/upload_task_spec.rb +7 -7
  117. data/spec/lib/capistrano/version_validator_spec.rb +61 -46
  118. data/spec/lib/capistrano_spec.rb +2 -3
  119. data/spec/spec_helper.rb +21 -8
  120. data/spec/support/Vagrantfile +9 -10
  121. data/spec/support/tasks/database.rake +3 -3
  122. data/spec/support/tasks/fail.rake +4 -3
  123. data/spec/support/tasks/failed.rake +2 -2
  124. data/spec/support/tasks/plugin.rake +6 -0
  125. data/spec/support/tasks/root.rake +4 -4
  126. data/spec/support/test_app.rb +64 -39
  127. metadata +100 -55
  128. data/.travis.yml +0 -13
  129. data/features/remote_file_task.feature +0 -14
  130. data/lib/capistrano/git.rb +0 -46
  131. data/lib/capistrano/hg.rb +0 -43
  132. data/lib/capistrano/svn.rb +0 -38
  133. data/lib/capistrano/tasks/git.rake +0 -81
  134. data/lib/capistrano/tasks/hg.rake +0 -52
  135. data/lib/capistrano/tasks/svn.rake +0 -52
  136. data/spec/lib/capistrano/git_spec.rb +0 -81
  137. data/spec/lib/capistrano/hg_spec.rb +0 -81
  138. data/spec/lib/capistrano/svn_spec.rb +0 -79
@@ -1,81 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'capistrano/git'
4
-
5
- module Capistrano
6
- describe Git do
7
- let(:context) { Class.new.new }
8
- subject { Capistrano::Git.new(context, Capistrano::Git::DefaultStrategy) }
9
-
10
- describe "#git" do
11
- it "should call execute git in the context, with arguments" do
12
- context.expects(:execute).with(:git, :init)
13
- subject.git(:init)
14
- end
15
- end
16
- end
17
-
18
- describe Git::DefaultStrategy do
19
- let(:context) { Class.new.new }
20
- subject { Capistrano::Git.new(context, Capistrano::Git::DefaultStrategy) }
21
-
22
- describe "#test" do
23
- it "should call test for repo HEAD" do
24
- context.expects(:repo_path).returns("/path/to/repo")
25
- context.expects(:test).with " [ -f /path/to/repo/HEAD ] "
26
-
27
- subject.test
28
- end
29
- end
30
-
31
- describe "#check" do
32
- it "should test the repo url" do
33
- context.expects(:repo_url).returns(:url)
34
- context.expects(:execute).with(:git, :'ls-remote --heads', :url).returns(true)
35
-
36
- subject.check
37
- end
38
- end
39
-
40
- describe "#clone" do
41
- it "should run git clone" do
42
- context.expects(:repo_url).returns(:url)
43
- context.expects(:repo_path).returns(:path)
44
-
45
- context.expects(:execute).with(:git, :clone, '--mirror', :url, :path)
46
-
47
- subject.clone
48
- end
49
- end
50
-
51
- describe "#update" do
52
- it "should run git update" do
53
- context.expects(:execute).with(:git, :remote, :update)
54
-
55
- subject.update
56
- end
57
- end
58
-
59
- describe "#release" do
60
- it "should run git archive without a subtree" do
61
- context.expects(:fetch).with(:repo_tree).returns(nil)
62
- context.expects(:fetch).with(:branch).returns(:branch)
63
- context.expects(:release_path).returns(:path)
64
-
65
- context.expects(:execute).with(:git, :archive, :branch, '| tar -x -f - -C', :path)
66
-
67
- subject.release
68
- end
69
-
70
- it "should run git archive with a subtree" do
71
- context.expects(:fetch).with(:repo_tree).returns('tree')
72
- context.expects(:fetch).with(:branch).returns(:branch)
73
- context.expects(:release_path).returns(:path)
74
-
75
- context.expects(:execute).with(:git, :archive, :branch, 'tree', '| tar -x --strip-components 1 -f - -C', :path)
76
-
77
- subject.release
78
- end
79
- end
80
- end
81
- end
@@ -1,81 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'capistrano/hg'
4
-
5
- module Capistrano
6
- describe Hg do
7
- let(:context) { Class.new.new }
8
- subject { Capistrano::Hg.new(context, Capistrano::Hg::DefaultStrategy) }
9
-
10
- describe "#hg" do
11
- it "should call execute hg in the context, with arguments" do
12
- context.expects(:execute).with(:hg, :init)
13
- subject.hg(:init)
14
- end
15
- end
16
- end
17
-
18
- describe Hg::DefaultStrategy do
19
- let(:context) { Class.new.new }
20
- subject { Capistrano::Hg.new(context, Capistrano::Hg::DefaultStrategy) }
21
-
22
- describe "#test" do
23
- it "should call test for repo HEAD" do
24
- context.expects(:repo_path).returns("/path/to/repo")
25
- context.expects(:test).with " [ -d /path/to/repo/.hg ] "
26
-
27
- subject.test
28
- end
29
- end
30
-
31
- describe "#check" do
32
- it "should test the repo url" do
33
- context.expects(:repo_url).returns(:url)
34
- context.expects(:execute).with(:hg, "id", :url)
35
-
36
- subject.check
37
- end
38
- end
39
-
40
- describe "#clone" do
41
- it "should run hg clone" do
42
- context.expects(:repo_url).returns(:url)
43
- context.expects(:repo_path).returns(:path)
44
-
45
- context.expects(:execute).with(:hg, "clone", '--noupdate', :url, :path)
46
-
47
- subject.clone
48
- end
49
- end
50
-
51
- describe "#update" do
52
- it "should run hg update" do
53
- context.expects(:execute).with(:hg, "pull")
54
-
55
- subject.update
56
- end
57
- end
58
-
59
- describe "#release" do
60
- it "should run hg archive without a subtree" do
61
- context.expects(:fetch).with(:repo_tree).returns(nil)
62
- context.expects(:fetch).with(:branch).returns(:branch)
63
- context.expects(:release_path).returns(:path)
64
-
65
- context.expects(:execute).with(:hg, "archive", :path, "--rev", :branch)
66
-
67
- subject.release
68
- end
69
-
70
- it "should run hg archive with a subtree" do
71
- context.expects(:fetch).with(:repo_tree).returns('tree')
72
- context.expects(:fetch).with(:branch).returns(:branch)
73
- context.expects(:release_path).returns(:path)
74
-
75
- context.expects(:execute).with(:hg, "archive --type tgz -p . -I", 'tree', "--rev", :branch, '| tar -x --strip-components 1 -f - -C', :path)
76
-
77
- subject.release
78
- end
79
- end
80
- end
81
- end
@@ -1,79 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'capistrano/svn'
4
-
5
- module Capistrano
6
- describe Svn do
7
- let(:context) { Class.new.new }
8
- subject { Capistrano::Svn.new(context, Capistrano::Svn::DefaultStrategy) }
9
-
10
- describe "#svn" do
11
- it "should call execute svn in the context, with arguments" do
12
- context.expects(:execute).with(:svn, :init)
13
- subject.svn(:init)
14
- end
15
- end
16
- end
17
-
18
- describe Svn::DefaultStrategy do
19
- let(:context) { Class.new.new }
20
- subject { Capistrano::Svn.new(context, Capistrano::Svn::DefaultStrategy) }
21
-
22
- describe "#test" do
23
- it "should call test for repo HEAD" do
24
- context.expects(:repo_path).returns("/path/to/repo")
25
- context.expects(:test).with " [ -d /path/to/repo/.svn ] "
26
-
27
- subject.test
28
- end
29
- end
30
-
31
- describe "#check" do
32
- it "should test the repo url" do
33
- context.expects(:repo_url).returns(:url)
34
- context.expects(:test).with(:svn, :info, :url).returns(true)
35
-
36
- subject.check
37
- end
38
- end
39
-
40
- describe "#clone" do
41
- it "should run svn checkout" do
42
- context.expects(:repo_url).returns(:url)
43
- context.expects(:repo_path).returns(:path)
44
-
45
- context.expects(:execute).with(:svn, :checkout, :url, :path)
46
-
47
- subject.clone
48
- end
49
- end
50
-
51
- describe "#update" do
52
- it "should run svn update" do
53
- context.expects(:execute).with(:svn, :update)
54
-
55
- subject.update
56
- end
57
- end
58
-
59
- describe "#release" do
60
- it "should run svn export" do
61
- context.expects(:release_path).returns(:path)
62
-
63
- context.expects(:execute).with(:svn, :export, '--force', '.', :path)
64
-
65
- subject.release
66
- end
67
- end
68
-
69
- describe "#fetch_revision" do
70
- it "should run fetch revision" do
71
- context.expects(:repo_path).returns(:path)
72
-
73
- context.expects(:capture).with(:svnversion, :path)
74
-
75
- subject.fetch_revision
76
- end
77
- end
78
- end
79
- end