capistrano 2.15.11 → 3.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +17 -8
  3. data/Gemfile +1 -12
  4. data/LICENSE.txt +18 -0
  5. data/README.md +65 -68
  6. data/Rakefile +4 -10
  7. data/bin/cap +2 -3
  8. data/bin/capify +7 -91
  9. data/capistrano.gemspec +20 -34
  10. data/lib/Capfile +2 -0
  11. data/lib/capistrano/application.rb +28 -0
  12. data/lib/capistrano/bundler.rb +1 -0
  13. data/lib/capistrano/configuration/question.rb +42 -0
  14. data/lib/capistrano/configuration/server.rb +24 -0
  15. data/lib/capistrano/configuration/servers.rb +43 -95
  16. data/lib/capistrano/configuration.rb +81 -44
  17. data/lib/capistrano/console.rb +1 -0
  18. data/lib/capistrano/defaults.rb +11 -0
  19. data/lib/capistrano/deploy.rb +3 -0
  20. data/lib/capistrano/dotfile.rb +3 -0
  21. data/lib/capistrano/dsl/env.rb +57 -0
  22. data/lib/capistrano/dsl/paths.rb +74 -0
  23. data/lib/capistrano/dsl/stages.rb +15 -0
  24. data/lib/capistrano/dsl/task_enhancements.rb +15 -0
  25. data/lib/capistrano/dsl.rb +38 -0
  26. data/lib/capistrano/git.rb +1 -0
  27. data/lib/capistrano/i18n.rb +33 -0
  28. data/lib/capistrano/install.rb +1 -0
  29. data/lib/capistrano/setup.rb +17 -0
  30. data/lib/capistrano/tasks/bundler.rake +13 -0
  31. data/lib/capistrano/tasks/console.rake +21 -0
  32. data/lib/capistrano/tasks/deploy.rake +153 -0
  33. data/lib/capistrano/tasks/framework.rake +45 -0
  34. data/lib/capistrano/tasks/git.rake +65 -0
  35. data/lib/capistrano/tasks/install.rake +39 -0
  36. data/lib/capistrano/templates/Capfile +43 -0
  37. data/lib/capistrano/templates/deploy.rb.erb +17 -0
  38. data/lib/capistrano/templates/stage.rb.erb +20 -0
  39. data/lib/capistrano/version.rb +1 -11
  40. data/lib/capistrano.rb +9 -3
  41. data/spec/lib/capistrano/configuration/question_spec.rb +54 -0
  42. data/spec/lib/capistrano/configuration/server_spec.rb +48 -0
  43. data/spec/lib/capistrano/configuration/servers_spec.rb +79 -0
  44. data/spec/lib/capistrano/configuration_spec.rb +80 -0
  45. data/spec/lib/capistrano/dsl/env_spec.rb +83 -0
  46. data/spec/lib/capistrano/dsl/paths_spec.rb +69 -0
  47. data/spec/lib/capistrano/dsl_spec.rb +51 -0
  48. data/spec/lib/capistrano_spec.rb +8 -0
  49. data/spec/spec_helper.rb +14 -0
  50. metadata +89 -215
  51. data/.travis.yml +0 -9
  52. data/CHANGELOG +0 -1203
  53. data/lib/capistrano/callback.rb +0 -45
  54. data/lib/capistrano/cli/execute.rb +0 -85
  55. data/lib/capistrano/cli/help.rb +0 -125
  56. data/lib/capistrano/cli/help.txt +0 -81
  57. data/lib/capistrano/cli/options.rb +0 -243
  58. data/lib/capistrano/cli/ui.rb +0 -40
  59. data/lib/capistrano/cli.rb +0 -47
  60. data/lib/capistrano/command.rb +0 -303
  61. data/lib/capistrano/configuration/actions/file_transfer.rb +0 -50
  62. data/lib/capistrano/configuration/actions/inspect.rb +0 -46
  63. data/lib/capistrano/configuration/actions/invocation.rb +0 -329
  64. data/lib/capistrano/configuration/alias_task.rb +0 -26
  65. data/lib/capistrano/configuration/callbacks.rb +0 -147
  66. data/lib/capistrano/configuration/connections.rb +0 -237
  67. data/lib/capistrano/configuration/execution.rb +0 -142
  68. data/lib/capistrano/configuration/loading.rb +0 -205
  69. data/lib/capistrano/configuration/log_formatters.rb +0 -75
  70. data/lib/capistrano/configuration/namespaces.rb +0 -223
  71. data/lib/capistrano/configuration/roles.rb +0 -83
  72. data/lib/capistrano/configuration/variables.rb +0 -127
  73. data/lib/capistrano/errors.rb +0 -19
  74. data/lib/capistrano/ext/multistage.rb +0 -67
  75. data/lib/capistrano/ext/string.rb +0 -5
  76. data/lib/capistrano/extensions.rb +0 -57
  77. data/lib/capistrano/fix_rake_deprecated_dsl.rb +0 -8
  78. data/lib/capistrano/logger.rb +0 -166
  79. data/lib/capistrano/processable.rb +0 -55
  80. data/lib/capistrano/recipes/compat.rb +0 -32
  81. data/lib/capistrano/recipes/deploy/assets.rb +0 -202
  82. data/lib/capistrano/recipes/deploy/dependencies.rb +0 -44
  83. data/lib/capistrano/recipes/deploy/local_dependency.rb +0 -54
  84. data/lib/capistrano/recipes/deploy/remote_dependency.rb +0 -117
  85. data/lib/capistrano/recipes/deploy/scm/accurev.rb +0 -169
  86. data/lib/capistrano/recipes/deploy/scm/base.rb +0 -200
  87. data/lib/capistrano/recipes/deploy/scm/bzr.rb +0 -86
  88. data/lib/capistrano/recipes/deploy/scm/cvs.rb +0 -153
  89. data/lib/capistrano/recipes/deploy/scm/darcs.rb +0 -96
  90. data/lib/capistrano/recipes/deploy/scm/git.rb +0 -299
  91. data/lib/capistrano/recipes/deploy/scm/mercurial.rb +0 -137
  92. data/lib/capistrano/recipes/deploy/scm/none.rb +0 -55
  93. data/lib/capistrano/recipes/deploy/scm/perforce.rb +0 -152
  94. data/lib/capistrano/recipes/deploy/scm/subversion.rb +0 -121
  95. data/lib/capistrano/recipes/deploy/scm.rb +0 -19
  96. data/lib/capistrano/recipes/deploy/strategy/base.rb +0 -92
  97. data/lib/capistrano/recipes/deploy/strategy/checkout.rb +0 -20
  98. data/lib/capistrano/recipes/deploy/strategy/copy.rb +0 -338
  99. data/lib/capistrano/recipes/deploy/strategy/export.rb +0 -20
  100. data/lib/capistrano/recipes/deploy/strategy/remote.rb +0 -52
  101. data/lib/capistrano/recipes/deploy/strategy/remote_cache.rb +0 -57
  102. data/lib/capistrano/recipes/deploy/strategy/unshared_remote_cache.rb +0 -21
  103. data/lib/capistrano/recipes/deploy/strategy.rb +0 -20
  104. data/lib/capistrano/recipes/deploy.rb +0 -625
  105. data/lib/capistrano/recipes/standard.rb +0 -37
  106. data/lib/capistrano/recipes/templates/maintenance.rhtml +0 -53
  107. data/lib/capistrano/role.rb +0 -102
  108. data/lib/capistrano/server_definition.rb +0 -56
  109. data/lib/capistrano/shell.rb +0 -265
  110. data/lib/capistrano/ssh.rb +0 -95
  111. data/lib/capistrano/task_definition.rb +0 -77
  112. data/lib/capistrano/transfer.rb +0 -218
  113. data/test/cli/execute_test.rb +0 -132
  114. data/test/cli/help_test.rb +0 -165
  115. data/test/cli/options_test.rb +0 -329
  116. data/test/cli/ui_test.rb +0 -28
  117. data/test/cli_test.rb +0 -17
  118. data/test/command_test.rb +0 -322
  119. data/test/configuration/actions/file_transfer_test.rb +0 -61
  120. data/test/configuration/actions/inspect_test.rb +0 -76
  121. data/test/configuration/actions/invocation_test.rb +0 -306
  122. data/test/configuration/alias_task_test.rb +0 -118
  123. data/test/configuration/callbacks_test.rb +0 -201
  124. data/test/configuration/connections_test.rb +0 -439
  125. data/test/configuration/execution_test.rb +0 -175
  126. data/test/configuration/loading_test.rb +0 -148
  127. data/test/configuration/namespace_dsl_test.rb +0 -332
  128. data/test/configuration/roles_test.rb +0 -157
  129. data/test/configuration/servers_test.rb +0 -183
  130. data/test/configuration/variables_test.rb +0 -190
  131. data/test/configuration_test.rb +0 -77
  132. data/test/deploy/local_dependency_test.rb +0 -76
  133. data/test/deploy/remote_dependency_test.rb +0 -146
  134. data/test/deploy/scm/accurev_test.rb +0 -23
  135. data/test/deploy/scm/base_test.rb +0 -55
  136. data/test/deploy/scm/bzr_test.rb +0 -51
  137. data/test/deploy/scm/darcs_test.rb +0 -37
  138. data/test/deploy/scm/git_test.rb +0 -274
  139. data/test/deploy/scm/mercurial_test.rb +0 -134
  140. data/test/deploy/scm/none_test.rb +0 -35
  141. data/test/deploy/scm/perforce_test.rb +0 -23
  142. data/test/deploy/scm/subversion_test.rb +0 -68
  143. data/test/deploy/strategy/copy_test.rb +0 -360
  144. data/test/extensions_test.rb +0 -69
  145. data/test/fixtures/cli_integration.rb +0 -5
  146. data/test/fixtures/config.rb +0 -5
  147. data/test/fixtures/custom.rb +0 -3
  148. data/test/logger_formatting_test.rb +0 -149
  149. data/test/logger_test.rb +0 -134
  150. data/test/recipes_test.rb +0 -25
  151. data/test/role_test.rb +0 -11
  152. data/test/server_definition_test.rb +0 -121
  153. data/test/shell_test.rb +0 -96
  154. data/test/ssh_test.rb +0 -113
  155. data/test/task_definition_test.rb +0 -117
  156. data/test/transfer_test.rb +0 -168
  157. data/test/utils.rb +0 -37
  158. data/test/version_test.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 2bbbdc546cc7bf99f6279f5b9e646b278e6a8afd1019610162e4487734b47f9e
4
- data.tar.gz: 57448a1d53a918a5180ebb6f7e30b5f33b9145b27cc088f250e8218fdba7f7a6
2
+ SHA1:
3
+ metadata.gz: c688937076353e672e483049ea38a97d6000864f
4
+ data.tar.gz: eace1bc67b4b34e947afecd46370f25c1cfae865
5
5
  SHA512:
6
- metadata.gz: 13aad84b057a8b6d856d00c8ee921a82abda3239840ff75535e58ee3e0349446860b0037c85d1622a98a2b8cd081995bcbfc1b374998b72d1d9e6900875b336a
7
- data.tar.gz: 760398ba57d0b509d16fe0ec8163e0af6f443eb624ec63276fd6b870cc3a3a24866472fde768190fd54d67933850bd12dd4b690700fd82993815ff22d5984d5c
6
+ metadata.gz: d6b5223d084c7fae6f9b94d10adddccbdf6e84bbf3e147192242096526b8056062764b975e33e7d2907cd915ea47578a829a021eee2b19f1f8563578dd3bbb2a
7
+ data.tar.gz: 9e1e8f12c083f26d10cde152f0175c9606faca0eb885dd3f432ab07a56f8a2b7eea6e51637b9ae0b60e2abc983cfc0c9ae06e0f6abb62e47eeaa8ae8d677a1bd
data/.gitignore CHANGED
@@ -1,10 +1,19 @@
1
- coverage
2
- doc
3
- pkg
4
- *.swp
5
- *.patch
6
1
  *.gem
7
- *.sh
8
- .DS_Store
9
- .bundle/*
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
10
6
  Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .rspec-local
19
+ .ruby-version
data/Gemfile CHANGED
@@ -1,15 +1,4 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in capistrano.gemspec
4
4
  gemspec
5
-
6
- #
7
- # Development Dependencies from the Gemfile
8
- # are merged here.
9
- #
10
- group :development do
11
- gem "rake"
12
- gem "rexml"
13
- gem "pry"
14
- gem "test-unit"
15
- end
data/LICENSE.txt ADDED
@@ -0,0 +1,18 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining
2
+ a copy of this software and associated documentation files (the
3
+ "Software"), to deal in the Software without restriction, including
4
+ without limitation the rights to use, copy, modify, merge, publish,
5
+ distribute, sublicense, and/or sell copies of the Software, and to
6
+ permit persons to whom the Software is furnished to do so, subject to
7
+ the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be
10
+ included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,94 +1,91 @@
1
- ## Capistrano
1
+ # Capistrano [![Build Status](https://travis-ci.org/capistrano/capistrano.png?branch=v3)](https://travis-ci.org/capistrano/capistrano)
2
2
 
3
- [![Build
4
- Status](https://secure.travis-ci.org/capistrano/capistrano.png)](http://travis-ci.org/capistrano/capistrano)[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/capistrano/capistrano)
3
+ TODO
5
4
 
5
+ ## Installation
6
6
 
7
- Capistrano is a utility and framework for executing commands in parallel on
8
- multiple remote machines, via SSH. It uses a simple DSL (borrowed in part from
9
- [Rake](http://rake.rubyforge.org/)) that allows you to define _tasks_, which may
10
- be applied to machines in certain roles. It also supports tunneling connections
11
- via some gateway machine to allow operations to be performed behind VPN's and
12
- firewalls.
7
+ Add this line to your application's Gemfile:
13
8
 
14
- Capistrano was originally designed to simplify and automate deployment of web
15
- applications to distributed environments, and originally came bundled with a set
16
- of tasks designed for deploying Rails applications.
9
+ gem 'capistrano', github: 'capistrano/capistrano', branch: :v3
17
10
 
18
- ## Documentation
11
+ And then execute:
19
12
 
20
- * [https://github.com/capistrano/capistrano/wiki](https://github.com/capistrano/capistrano/wiki)
13
+ $ bundle --binstubs
21
14
 
22
- ## DEPENDENCIES
15
+ Capify:
23
16
 
24
- * [Net::SSH](http://net-ssh.rubyforge.org)
25
- * [Net::SFTP](http://net-ssh.rubyforge.org)
26
- * [Net::SCP](http://net-ssh.rubyforge.org)
27
- * [Net::SSH::Gateway](http://net-ssh.rubyforge.org)
28
- * [HighLine](http://highline.rubyforge.org)
29
- * [Ruby](http://www.ruby-lang.org/en/) ≥ 1.8.7
17
+ $ cap install
30
18
 
31
- If you want to run the tests, you'll also need to install the dependencies with
32
- Bundler, see the `Gemfile` within .
19
+ This creates the following files:
33
20
 
34
- ## ASSUMPTIONS
21
+ - `Capfile`
22
+ - `lib/deploy/tasks`
23
+ - `config/deploy/staging.rb`
24
+ - `config/deploy/production.rb`
35
25
 
36
- Capistrano is "opinionated software", which means it has very firm ideas about
37
- how things ought to be done, and tries to force those ideas on you. Some of the
38
- assumptions behind these opinions are:
26
+ To create different stages:
39
27
 
40
- * You are using SSH to access the remote servers.
41
- * You either have the same password to all target machines, or you have public
42
- keys in place to allow passwordless access to them.
28
+ $ cap install STAGES=local,sandbox,qa,production
43
29
 
44
- Do not expect these assumptions to change.
30
+ ## Usage
45
31
 
46
- ## USAGE
32
+ $ cap -vT
47
33
 
48
- In general, you'll use Capistrano as follows:
34
+ $ cap staging deploy
35
+ $ cap production deploy
49
36
 
50
- * Create a recipe file ("capfile" or "Capfile").
51
- * Use the `cap` script to execute your recipe.
37
+ $ cap production deploy --dry-run
38
+ $ cap production deploy --prereqs
39
+ $ cap production deploy --trace
52
40
 
53
- Use the `cap` script as follows:
41
+ ## Configuration
54
42
 
55
- cap sometask
43
+ # config/deploy.rb
44
+ set :application, 'example app'
56
45
 
57
- By default, the script will look for a file called one of `capfile` or
58
- `Capfile`. The `sometask` text indicates which task to execute. You can do
59
- "cap -h" to see all the available options and "cap -T" to see all the available
60
- tasks.
46
+ # config/deploy/production.rb
47
+ set :stage, :production
61
48
 
62
- ## CONTRIBUTING:
49
+ ask :branch, :master
63
50
 
64
- * Fork Capistrano
65
- * Create a topic branch - `git checkout -b my_branch`
66
- * Rebase your branch so that all your changes are reflected in one
67
- commit
68
- * Push to your branch - `git push origin my_branch`
69
- * Create a Pull Request from your branch, include as much documentation
70
- as you can in the commit message/pull request, following these
71
- [guidelines on writing a good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
72
- * That's it!
51
+ role :app, %w{example.com example2.com}
52
+ role :web, %w{example.com}
53
+ role :db, %w{example.com}
73
54
 
55
+ # the first server in the array is considered primary
74
56
 
75
- ## LICENSE:
57
+ ## Tasks
58
+
59
+ ## Before / After
60
+
61
+ Where calling on the same task name, executed in order of inclusion
62
+
63
+
64
+ # call an existing task
65
+ before :starting, :ensure_user
66
+
67
+ after :finishing, :notify
68
+
69
+
70
+ # or define in block
71
+ before :starting, :ensure_user do
72
+ #
73
+ end
74
+
75
+ after :finishing, :notify do
76
+ #
77
+ end
78
+
79
+ ## Console
80
+
81
+ Execute arbitrary remote commands
82
+
83
+ $ cap staging console
84
+
85
+ ## Configuration
86
+
87
+
88
+ ## SSHKit
76
89
 
77
- Permission is hereby granted, free of charge, to any person obtaining
78
- a copy of this software and associated documentation files (the
79
- 'Software'), to deal in the Software without restriction, including
80
- without limitation the rights to use, copy, modify, merge, publish,
81
- distribute, sublicense, and/or sell copies of the Software, and to
82
- permit persons to whom the Software is furnished to do so, subject to
83
- the following conditions:
84
90
 
85
- The above copyright notice and this permission notice shall be
86
- included in all copies or substantial portions of the Software.
87
91
 
88
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
89
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
90
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
91
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
92
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
93
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
94
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,11 +1,5 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
1
+ require "bundler/gem_tasks"
3
2
 
4
- require 'rake/testtask'
5
- Rake::TestTask.new(:test) do |test|
6
- test.libs << 'lib' << 'test'
7
- test.pattern = 'test/**/*_test.rb'
8
- test.verbose = true
9
- end
10
-
11
- task :default => :test
3
+ task :default => :spec
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new
data/bin/cap CHANGED
@@ -1,4 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
-
3
- require 'capistrano/cli'
4
- Capistrano::CLI.execute
2
+ require 'capistrano'
3
+ Capistrano::Application.new.run
data/bin/capify CHANGED
@@ -1,92 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
-
3
- require 'optparse'
4
- require 'fileutils'
5
-
6
- OptionParser.new do |opts|
7
- opts.banner = "Usage: #{File.basename($0)} [path]"
8
-
9
- opts.on("-h", "--help", "Displays this help info") do
10
- puts opts
11
- exit 0
12
- end
13
-
14
- begin
15
- opts.parse!(ARGV)
16
- rescue OptionParser::ParseError => e
17
- warn e.message
18
- puts opts
19
- exit 1
20
- end
21
- end
22
-
23
- if ARGV.empty?
24
- abort "Please specify the directory to capify, e.g. `#{File.basename($0)} .'"
25
- elsif !File.exist?(ARGV.first)
26
- abort "`#{ARGV.first}' does not exist."
27
- elsif !File.directory?(ARGV.first)
28
- abort "`#{ARGV.first}' is not a directory."
29
- elsif ARGV.length > 1
30
- abort "Too many arguments; please specify only the directory to capify."
31
- end
32
-
33
- def unindent(string)
34
- indentation = string[/\A\s*/]
35
- string.strip.gsub(/^#{indentation}/, "")
36
- end
37
-
38
- files = {
39
- "Capfile" => unindent(<<-FILE),
40
-
41
- load 'deploy'
42
-
43
- # Uncomment if you are using Rails' asset pipeline
44
- # load 'deploy/assets'
45
-
46
- load 'config/deploy' # remove this line to skip loading any of the default tasks
47
- FILE
48
-
49
- "config/deploy.rb" => 'set :application, "set your application name here"
50
- set :repository, "set your repository location here"
51
-
52
- # set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
53
- # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
54
-
55
- role :web, "your web-server here" # Your HTTP server, Apache/etc
56
- role :app, "your app-server here" # This may be the same as your `Web` server
57
- role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
58
- role :db, "your slave db-server here"
59
-
60
- # if you want to clean up old releases on each deploy uncomment this:
61
- # after "deploy:restart", "deploy:cleanup"
62
-
63
- # if you\'re still using the script/reaper helper you will need
64
- # these http://github.com/rails/irs_process_scripts
65
-
66
- # If you are using Passenger mod_rails uncomment this:
67
- # namespace :deploy do
68
- # task :start do ; end
69
- # task :stop do ; end
70
- # task :restart, :roles => :app, :except => { :no_release => true } do
71
- # run "#{try_sudo} touch #{File.join(current_path,\'tmp\',\'restart.txt\')}"
72
- # end
73
- # end'}
74
-
75
- base = ARGV.shift
76
- files.each do |file, content|
77
- file = File.join(base, file)
78
- if File.exist?(file)
79
- warn "[skip] '#{file}' already exists"
80
- elsif File.exist?(file.downcase)
81
- warn "[skip] '#{file.downcase}' exists, which could conflict with `#{file}'"
82
- else
83
- unless File.exist?(File.dirname(file))
84
- puts "[add] making directory '#{File.dirname(file)}'"
85
- FileUtils.mkdir(File.dirname(file))
86
- end
87
- puts "[add] writing '#{file}'"
88
- File.open(file, "w") { |f| f.write(content) }
89
- end
90
- end
91
-
92
- puts "[done] capified!"
2
+ puts "-" * 80
3
+ puts "Capistrano 3.x is incompatible with Capistrano 2.x. "
4
+ puts
5
+ puts "This command has become `cap install` in Capistrano 3.x"
6
+ puts
7
+ puts "For more information see http://www.capistranorb.com/"
8
+ puts "-" * 80
data/capistrano.gemspec CHANGED
@@ -1,40 +1,26 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "capistrano/version"
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/version'
4
5
 
5
- Gem::Specification.new do |s|
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "capistrano"
8
+ gem.version = Capistrano::VERSION
9
+ gem.authors = ["Tom Clements"]
10
+ gem.email = ["seenmyfate@gmail.com"]
11
+ gem.description = %q{PENDING: Write a gem description}
12
+ gem.summary = %q{PENDING: Write a gem summary}
13
+ gem.homepage = ""
6
14
 
7
- s.name = "capistrano"
8
- s.version = Capistrano::Version.to_s
9
- s.platform = Gem::Platform::RUBY
10
- s.authors = ["Jamis Buck", "Lee Hambley"]
11
- s.email = ["jamis@jamisbuck.org", "lee.hambley@gmail.com"]
12
- s.homepage = "http://github.com/capistrano/capistrano"
13
- s.summary = %q{Capistrano - Welcome to easy deployment with Ruby over SSH}
14
- s.description = %q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
15
- s.files = `git ls-files`.split("\n")
16
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
- s.require_paths = ["lib"]
19
- s.extra_rdoc_files = [
20
- "README.md"
21
- ]
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = 'cap'
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
22
19
 
23
- s.specification_version = 3 if s.respond_to? :specification_version
20
+ gem.add_dependency 'sshkit', '>= 0.0.23'
21
+ gem.add_dependency 'rake', '>= 10.0.0'
22
+ gem.add_dependency 'i18n'
24
23
 
25
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_runtime_dependency(%q<highline>, [">= 0"])
27
- s.add_runtime_dependency(%q<net-ssh>, [">= 2.0.14"])
28
- s.add_runtime_dependency(%q<net-sftp>, [">= 2.0.0"])
29
- s.add_runtime_dependency(%q<net-scp>, [">= 1.0.0"])
30
- s.add_runtime_dependency(%q<net-ssh-gateway>, [">= 1.1.0"])
31
- s.add_development_dependency(%q<mocha>, ["0.9.12"])
32
- else
33
- s.add_dependency(%q<net-ssh>, [">= 2.0.14"])
34
- s.add_dependency(%q<net-sftp>, [">= 2.0.0"])
35
- s.add_dependency(%q<net-scp>, [">= 1.0.0"])
36
- s.add_dependency(%q<net-ssh-gateway>, [">= 1.1.0"])
37
- s.add_dependency(%q<highline>, [">= 0"])
38
- s.add_dependency(%q<mocha>, ["0.9.12"])
39
- end
24
+ gem.add_development_dependency 'rspec'
25
+ gem.add_development_dependency 'mocha'
40
26
  end
data/lib/Capfile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env cap
2
+ require 'capistrano/install'
@@ -0,0 +1,28 @@
1
+ module Capistrano
2
+ class Application < Rake::Application
3
+ include Rake::DSL
4
+
5
+ def initialize
6
+ super
7
+ @rakefiles = %w{capfile Capfile capfile.rb Capfile.rb} << capfile
8
+ end
9
+
10
+ def run
11
+ Rake.application = self
12
+ super
13
+ end
14
+
15
+ def load_rakefile
16
+ @name = 'cap'
17
+ super
18
+ end
19
+
20
+ private
21
+
22
+ # allows the `cap install` task to load without a capfile
23
+ def capfile
24
+ File.expand_path(File.join(File.dirname(__FILE__),'..','Capfile'))
25
+ end
26
+ end
27
+
28
+ end
@@ -0,0 +1 @@
1
+ load File.expand_path("../tasks/bundler.rake", __FILE__)
@@ -0,0 +1,42 @@
1
+ module Capistrano
2
+ class Configuration
3
+ class Question
4
+
5
+ def initialize(env, key, default)
6
+ @env, @key, @default = env, key, default
7
+ end
8
+
9
+ def call
10
+ ask_question
11
+ save_response
12
+ end
13
+
14
+ private
15
+ attr_reader :env, :key, :default
16
+
17
+ def ask_question
18
+ $stdout.puts question
19
+ end
20
+
21
+ def save_response
22
+ env.set(key, value)
23
+ end
24
+
25
+ def value
26
+ if response.empty?
27
+ default
28
+ else
29
+ response
30
+ end
31
+ end
32
+
33
+ def response
34
+ @response ||= $stdin.gets.chomp
35
+ end
36
+
37
+ def question
38
+ I18n.t(:question, key: key, default_value: default, scope: :capistrano)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,24 @@
1
+ require 'set'
2
+ module Capistrano
3
+ class Configuration
4
+ class Server < SSHKit::Host
5
+
6
+ def add_role(role)
7
+ roles << role.to_sym
8
+ end
9
+
10
+ def has_role?(role)
11
+ roles.include? role.to_sym
12
+ end
13
+
14
+ def matches?(host)
15
+ hostname == Server.new(host).hostname
16
+ end
17
+
18
+ def roles
19
+ properties.roles ||= Set.new
20
+ end
21
+
22
+ end
23
+ end
24
+ end