capistrano 3.4.1 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -5
  3. data/.rubocop.yml +49 -0
  4. data/.travis.yml +5 -4
  5. data/CHANGELOG.md +72 -9
  6. data/CONTRIBUTING.md +61 -93
  7. data/DEVELOPMENT.md +122 -0
  8. data/Gemfile +2 -2
  9. data/LICENSE.txt +1 -1
  10. data/README.md +121 -43
  11. data/RELEASING.md +16 -0
  12. data/Rakefile +4 -1
  13. data/bin/cap +1 -1
  14. data/capistrano.gemspec +16 -21
  15. data/features/doctor.feature +11 -0
  16. data/features/step_definitions/assertions.rb +17 -17
  17. data/features/step_definitions/cap_commands.rb +0 -1
  18. data/features/step_definitions/setup.rb +12 -8
  19. data/features/support/env.rb +5 -5
  20. data/features/support/remote_command_helpers.rb +8 -6
  21. data/features/support/vagrant_helpers.rb +5 -4
  22. data/issue_template.md +21 -0
  23. data/lib/Capfile +5 -1
  24. data/lib/capistrano/all.rb +9 -10
  25. data/lib/capistrano/application.rb +36 -26
  26. data/lib/capistrano/configuration.rb +56 -41
  27. data/lib/capistrano/configuration/empty_filter.rb +9 -0
  28. data/lib/capistrano/configuration/filter.rb +18 -47
  29. data/lib/capistrano/configuration/host_filter.rb +30 -0
  30. data/lib/capistrano/configuration/null_filter.rb +9 -0
  31. data/lib/capistrano/configuration/plugin_installer.rb +33 -0
  32. data/lib/capistrano/configuration/question.rb +10 -7
  33. data/lib/capistrano/configuration/role_filter.rb +30 -0
  34. data/lib/capistrano/configuration/server.rb +22 -23
  35. data/lib/capistrano/configuration/servers.rb +6 -7
  36. data/lib/capistrano/configuration/variables.rb +136 -0
  37. data/lib/capistrano/defaults.rb +13 -3
  38. data/lib/capistrano/deploy.rb +1 -1
  39. data/lib/capistrano/doctor.rb +5 -0
  40. data/lib/capistrano/doctor/environment_doctor.rb +19 -0
  41. data/lib/capistrano/doctor/gems_doctor.rb +45 -0
  42. data/lib/capistrano/doctor/output_helpers.rb +79 -0
  43. data/lib/capistrano/doctor/variables_doctor.rb +66 -0
  44. data/lib/capistrano/dotfile.rb +1 -2
  45. data/lib/capistrano/dsl.rb +12 -14
  46. data/lib/capistrano/dsl/env.rb +11 -42
  47. data/lib/capistrano/dsl/paths.rb +12 -13
  48. data/lib/capistrano/dsl/stages.rb +2 -4
  49. data/lib/capistrano/dsl/task_enhancements.rb +5 -7
  50. data/lib/capistrano/framework.rb +1 -1
  51. data/lib/capistrano/git.rb +17 -9
  52. data/lib/capistrano/hg.rb +4 -4
  53. data/lib/capistrano/i18n.rb +24 -24
  54. data/lib/capistrano/immutable_task.rb +29 -0
  55. data/lib/capistrano/install.rb +1 -1
  56. data/lib/capistrano/plugin.rb +95 -0
  57. data/lib/capistrano/scm.rb +7 -20
  58. data/lib/capistrano/setup.rb +19 -5
  59. data/lib/capistrano/svn.rb +9 -5
  60. data/lib/capistrano/tasks/console.rake +4 -8
  61. data/lib/capistrano/tasks/deploy.rake +75 -62
  62. data/lib/capistrano/tasks/doctor.rake +19 -0
  63. data/lib/capistrano/tasks/framework.rake +13 -14
  64. data/lib/capistrano/tasks/git.rake +10 -11
  65. data/lib/capistrano/tasks/hg.rake +7 -7
  66. data/lib/capistrano/tasks/install.rake +14 -15
  67. data/lib/capistrano/tasks/svn.rake +7 -7
  68. data/lib/capistrano/templates/Capfile +3 -3
  69. data/lib/capistrano/templates/deploy.rb.erb +6 -5
  70. data/lib/capistrano/upload_task.rb +1 -1
  71. data/lib/capistrano/version.rb +1 -1
  72. data/lib/capistrano/version_validator.rb +4 -6
  73. data/spec/integration/dsl_spec.rb +286 -239
  74. data/spec/integration_spec_helper.rb +3 -5
  75. data/spec/lib/capistrano/application_spec.rb +22 -14
  76. data/spec/lib/capistrano/configuration/empty_filter_spec.rb +17 -0
  77. data/spec/lib/capistrano/configuration/filter_spec.rb +82 -84
  78. data/spec/lib/capistrano/configuration/host_filter_spec.rb +61 -0
  79. data/spec/lib/capistrano/configuration/null_filter_spec.rb +17 -0
  80. data/spec/lib/capistrano/configuration/question_spec.rb +12 -16
  81. data/spec/lib/capistrano/configuration/role_filter_spec.rb +64 -0
  82. data/spec/lib/capistrano/configuration/server_spec.rb +102 -110
  83. data/spec/lib/capistrano/configuration/servers_spec.rb +124 -141
  84. data/spec/lib/capistrano/configuration_spec.rb +150 -61
  85. data/spec/lib/capistrano/doctor/environment_doctor_spec.rb +44 -0
  86. data/spec/lib/capistrano/doctor/gems_doctor_spec.rb +61 -0
  87. data/spec/lib/capistrano/doctor/output_helpers_spec.rb +47 -0
  88. data/spec/lib/capistrano/doctor/variables_doctor_spec.rb +79 -0
  89. data/spec/lib/capistrano/dsl/paths_spec.rb +58 -50
  90. data/spec/lib/capistrano/dsl/task_enhancements_spec.rb +62 -32
  91. data/spec/lib/capistrano/dsl_spec.rb +6 -8
  92. data/spec/lib/capistrano/git_spec.rb +35 -7
  93. data/spec/lib/capistrano/hg_spec.rb +14 -5
  94. data/spec/lib/capistrano/immutable_task_spec.rb +31 -0
  95. data/spec/lib/capistrano/plugin_spec.rb +84 -0
  96. data/spec/lib/capistrano/scm_spec.rb +6 -7
  97. data/spec/lib/capistrano/svn_spec.rb +40 -14
  98. data/spec/lib/capistrano/upload_task_spec.rb +7 -7
  99. data/spec/lib/capistrano/version_validator_spec.rb +37 -45
  100. data/spec/lib/capistrano_spec.rb +2 -3
  101. data/spec/spec_helper.rb +8 -8
  102. data/spec/support/Vagrantfile +9 -10
  103. data/spec/support/tasks/database.rake +3 -3
  104. data/spec/support/tasks/fail.rake +4 -3
  105. data/spec/support/tasks/failed.rake +2 -2
  106. data/spec/support/tasks/plugin.rake +6 -0
  107. data/spec/support/tasks/root.rake +4 -4
  108. data/spec/support/test_app.rb +31 -30
  109. metadata +93 -14
data/Gemfile CHANGED
@@ -1,10 +1,10 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in capistrano.gemspec
4
4
  gemspec
5
5
 
6
6
  group :cucumber do
7
- gem 'cucumber'
7
+ gem "cucumber"
8
8
  gem "rspec"
9
9
  gem "rspec-core", "~> 3.4.4"
10
10
  end
@@ -1,6 +1,6 @@
1
1
  MIT License (MIT)
2
2
 
3
- Copyright (c) 2012-2013 Tom Clements, Lee Hambley
3
+ Copyright (c) 2012-2016 Tom Clements, Lee Hambley
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,48 +1,127 @@
1
- # Capistrano [![Build Status](https://travis-ci.org/capistrano/capistrano.svg?branch=master)](https://travis-ci.org/capistrano/capistrano) [![Code Climate](http://img.shields.io/codeclimate/github/capistrano/capistrano.svg)](https://codeclimate.com/github/capistrano/capistrano) <a href="http://codersclan.net/?repo_id=325&source=small"><img src="http://img.shields.io/badge/get-support-blue.svg"></a>
2
1
 
3
- ## Documentation
2
+ # Capistrano: A deployment automation tool built on Ruby, Rake, and SSH.
4
3
 
5
- Check out the [online documentation](http://capistranorb.com) of Capistrano 3 hosted via this [repository](https://github.com/capistrano/capistrano.github.io).
4
+ [![Gem Version](https://badge.fury.io/rb/capistrano.svg)](http://badge.fury.io/rb/capistrano) [![Build Status](https://travis-ci.org/capistrano/capistrano.svg?branch=master)](https://travis-ci.org/capistrano/capistrano) [![Code Climate](https://img.shields.io/codeclimate/github/capistrano/capistrano.svg)](https://codeclimate.com/github/capistrano/capistrano) <a href="http://codersclan.net/?repo_id=325&source=small"><img src="https://img.shields.io/badge/get-support-blue.svg"></a>
6
5
 
7
- ## Support
6
+ Capistrano is framework for building automated deployment scripts. Although Capistrano itself is written in Ruby, it can easily be used to deploy projects of any language or framework, be it Rails, Java, or PHP.
8
7
 
9
- Need help with getting Capistrano up and running? Got a code problem you want to get solved quickly?
8
+ Once installed, Capistrano gives you a `cap` tool to perform your deployments from the comfort of your command line.
10
9
 
11
- Get <a href="http://codersclan.net/?repo_id=325&source=link">Capistrano support on CodersClan.</a> <a href="http://codersclan.net/?repo_id=325&source=big"><img src="http://www.codersclan.net/gs_button/?repo_id=325" width="150"></a>
10
+ ```
11
+ $ cd my-capistrano-enabled-project
12
+ $ cap production deploy
13
+ ```
14
+
15
+ When you run `cap`, Capistrano dutifully connects to your server(s) via SSH and executes the steps necessary to deploy your project. You can define those steps yourself by writing [Rake](https://github.com/ruby/rake) tasks, or by using pre-built task libraries provided by the Capistrano community.
16
+
17
+ Tasks are simple to make. Here's an example:
18
+
19
+ ```ruby
20
+ task :restart_sidekiq do
21
+ on roles(:worker) do
22
+ execute :service, "sidekiq restart"
23
+ end
24
+ end
25
+ after "deploy:published", "restart_sidekiq"
26
+ ```
27
+
28
+ *Note: This documentation is for the current version of Capistrano (3.x). If you are looking for Capistrano 2.x documentation, you can find it in [this archive](https://github.com/capistrano/capistrano-2.x-docs).*
29
+
30
+ ---
31
+
32
+ ## Contents
33
+
34
+ * [Features](#features)
35
+ * [Gotchas](#gotchas)
36
+ * [Quick start](#quick-start)
37
+ * [Finding help and documentation](#finding-help-and-documentation)
38
+ * [How to contribute](#how-to-contribute)
39
+ * [License](#license)
40
+
41
+ ## Features
42
+
43
+ There are many ways to automate deployments, from simple rsync bash scripts to complex containerized toolchains. Capistrano sits somewhere in the middle: it automates what you already know how to do manually with SSH, but in a repeatable, scalable fashion. There is no magic here!
44
+
45
+ Here's what makes Capistrano great:
46
+
47
+ #### Strong conventions
48
+
49
+ Capistrano defines a standard deployment process that all Capistrano-enabled projects follow by default. You don't have to decide how to structure your scripts, where deployed files should be placed on the server, or how to perform common tasks: Capistrano has done this work for you.
50
+
51
+ #### Multiple stages
52
+
53
+ Define your deployment once, and then easily parameterize it for multiple *stages* (environments), e.g. `qa`, `staging`, and `production`. No copy-and-paste necessary: you only need to specify what is different for each stage, like IP addresses.
54
+
55
+ #### Parallel execution
56
+
57
+ Deploying to a fleet of app servers? Capistrano can run each deployment task concurrently across those servers and uses connection pooling for speed.
58
+
59
+ #### Server roles
12
60
 
13
- ## Requirements
61
+ Your application may need many different types of servers: a database server, an app server, two app servers, and a job queue work server, for example. Capistrano lets you tag each server with one or more roles, so you can control what tasks are executed where.
14
62
 
15
- * Ruby >= 1.9.3 (JRuby and C-Ruby/YARV are supported)
63
+ #### Community driven
16
64
 
17
- Capistrano support these source code version control systems out of the box:
65
+ Capistrano is easily extensible using the rubygems package manager. Deploying a Rails app? Wordpress? Laravel? Chances are, someone has already written Capistrano tasks for your framework of choice and has distributed it as a gem. Many Ruby projects also come with Capistrano tasks built-in.
18
66
 
19
- * Git 1.8 or higher
20
- * Mercurial
21
- * SVN
67
+ #### It's just SSH
22
68
 
23
- Binaries for these VCS might be required on the local and/or the remote systems.
69
+ Everything in Capistrano comes down to running SSH commands on remote servers. On the one hand, that makes Capistrano simple. On the other hand, if you aren't comfortable SSH-ing into a Linux box and doing stuff on the command-line, then Capistrano is probably not for you.
24
70
 
25
- ## Installation
71
+ ## Gotchas
26
72
 
27
- Add this line to your application's Gemfile:
73
+ While Capistrano ships with a strong set of conventions that are common for all types of deployments, it needs help understanding the specifics of your project, and there are some things Capistrano is not suited to do.
74
+
75
+ #### Project specifics
76
+
77
+ Out of the box, Capistrano can deploy your code to server(s), but it does not know how to *execute* your code. Does `foreman` need to be run? Does Apache need to be restarted? You'll need to tell Capistrano how to do this part by writing these deployment steps yourself, or by finding a gem in the Capistrano community that does it for you.
78
+
79
+ #### Key-based SSH
80
+
81
+ Capistrano depends on connecting to your server(s) with SSH using key-based (i.e. password-less) authentication. You'll need this working before you can use Capistrano.
82
+
83
+ #### Provisioning
84
+
85
+ Likewise, your server(s) will likely need supporting software installed before you can perform a deployment. Capistrano itself has no requirements other than SSH, but your application probably needs database software, a web server like Apache or Nginx, and a language runtime like Java, Ruby, or PHP. These *server provisioning* steps are not done by Capistrano.
86
+
87
+ #### `sudo`, etc.
88
+
89
+ Capistrano is designed to deploy using a single, non-privileged SSH user, using a *non-interactive* SSH session. If your deployment requires `sudo`, interactive prompts, authenticating as one user but running commands as another, you can probably accomplish this with Capistrano, but it may be difficult. Your automated deployments will be much smoother if you can avoid such requirements.
90
+
91
+ ## Quick start
92
+
93
+ ### Requirements
94
+
95
+ * Ruby version 2.0 or higher on your local machine (MRI or Rubinius)
96
+ * A project that uses source control (Git, Mercurial, and Subversion support is built-in)
97
+ * The SCM binaries (e.g. `git`, `hg`) needed to check out your project must be installed on the server(s) you are deploying to
98
+ * [Bundler](http://bundler.io), along with a Gemfile for your project, are recommended
99
+
100
+ ### Install the Capistrano gem
101
+
102
+ Add Capistrano to your project's Gemfile:
28
103
 
29
104
  ``` ruby
30
- gem 'capistrano', '~> 3.3.0'
105
+ group :development do
106
+ gem "capistrano", "~> 3.4"
107
+ end
31
108
  ```
32
109
 
33
- And then execute:
110
+ Then run Bundler to ensure Capistrano is downloaded and installed:
34
111
 
35
112
  ``` sh
36
113
  $ bundle install
37
114
  ```
38
115
 
39
- Capify:
40
- *make sure there's no "Capfile" or "capfile" present*
116
+ ### "Capify" your project
117
+
118
+ Make sure your project doesn't already have a "Capfile" or "capfile" present. Then run:
119
+
41
120
  ``` sh
42
121
  $ bundle exec cap install
43
122
  ```
44
123
 
45
- This creates the following files:
124
+ This creates all the necessary configuration files and directory structure for a Capistrano-enabled project with two stages, `staging` and `production`:
46
125
 
47
126
  ```
48
127
  ├── Capfile
@@ -56,13 +135,15 @@ This creates the following files:
56
135
  └── tasks
57
136
  ```
58
137
 
59
- To create different stages:
138
+ To customize the stages that are created, use:
60
139
 
61
140
  ``` sh
62
141
  $ bundle exec cap install STAGES=local,sandbox,qa,production
63
142
  ```
64
143
 
65
- ## Usage
144
+ Note that the files that Capistrano creates are simply templates to get you started. Make sure to edit the `deploy.rb` and stage files so they contain values appropriate for your project and your target servers.
145
+
146
+ ### Command-line usage
66
147
 
67
148
  ``` sh
68
149
  # list all available tasks
@@ -83,35 +164,32 @@ $ bundle exec cap production deploy --prereqs
83
164
 
84
165
  # trace through task invocations
85
166
  $ bundle exec cap production deploy --trace
167
+
168
+ # lists all config variable before deployment tasks
169
+ $ bundle exec cap production deploy --print-config-variables
86
170
  ```
87
171
 
88
- ## Testing
172
+ ## Finding help and documentation
89
173
 
90
- Capistrano has two test suites: an RSpec suite and a Cucumber suite. The
91
- RSpec suite handles quick feedback unit specs. The Cucumber features are
92
- an integration suite that uses Vagrant to deploy to a real virtual
93
- server. In order to run the Cucumber suite you will need to install
94
- [Vagrant](http://www.vagrantup.com/) and Vagrant supported
95
- virtualization software like
96
- [VirtualBox](https://www.virtualbox.org/wiki/Downloads).
174
+ Capistrano is a large project encompassing multiple GitHub repositories and a community of plugins, and it can be overwhelming when you are just getting started. Here are resources that can help:
97
175
 
98
- ```
99
- # To run the RSpec suite
100
- $ rake spec
176
+ * **[The Capistrano website](http://capistranorb.com) is the best place for official documentation**
177
+ * [Stack Overflow](http://stackoverflow.com/questions/tagged/capistrano) has a Capistrano tag with lots of activity
178
+ * [The Capistrano mailing list](https://groups.google.com/forum/#!forum/capistrano) is low-traffic but is monitored by Capistrano contributors
179
+ * [CodersClan](http://codersclan.net/?repo_id=325&source=link) has Capistrano experts available to solve problems for bounties
101
180
 
102
- # To run the Cucumber suite
103
- $ rake features
181
+ Related GitHub repositories:
104
182
 
105
- # To run the Cucumber suite and leave the VM running (faster for subsequent runs)
106
- $ rake features KEEP_RUNNING=1
107
- ```
183
+ * [capistrano/sshkit](https://github.com/capistrano/sshkit) provides the SSH behavior that underlies Capistrano (when you use `execute` in a Capistrano task, you are using SSHKit)
184
+ * [capistrano/documentation](https://github.com/capistrano/documentation) is what generates the official Capistrano website
185
+ * [capistrano/rails](https://github.com/capistrano/rails) is a very popular gem that adds Ruby on Rails deployment tasks
186
+ * [mattbrictson/airbrussh](https://github.com/mattbrictson/airbrussh) provides Capistrano's default log formatting
187
+
188
+ GitHub issues are for bug reports and feature requests. Please refer to the [CONTRIBUTING](CONTRIBUTING.md) document for guidelines on submitting GitHub issues.
108
189
 
109
- ## SSHKit
190
+ ## How to contribute
110
191
 
111
- [SSHKit](https://github.com/leehambley/sshkit) is the driver for SSH
112
- connections behind the scenes in Capistrano. Depending on how deep you dig, you
113
- might run into interfaces that come directly from SSHKit (the configuration is
114
- a good example).
192
+ Contributions to Capistrano, in the form of code, documentation or idea, are gladly accepted. Read the [DEVELOPMENT](DEVELOPMENT.md) document to learn how to hack on Capistrano's code, run the tests, and contribute your first pull request.
115
193
 
116
194
  ## License
117
195
 
@@ -0,0 +1,16 @@
1
+ # Releasing
2
+
3
+ ## Prerequisites
4
+
5
+ * You must have commit rights to the Capistrano repository.
6
+ * You must have push rights for the capistrano gem on rubygems.org.
7
+
8
+ ## How to release
9
+
10
+ 1. Run `bundle install` to make sure that you have all the gems necessary for testing and releasing.
11
+ 2. **Ensure all tests are passing by running `rake spec` and `rake features`.**
12
+ 3. Determine which would be the correct next version number according to [semver](http://semver.org/).
13
+ 4. Update the version in `./lib/capistrano/version.rb`.
14
+ 5. Update the `CHANGELOG`.
15
+ 6. Commit the changelog and version in a single commit, the message should be "Preparing vX.Y.Z"
16
+ 7. Run `rake release`; this will tag, push to GitHub, and publish to rubygems.org.
data/Rakefile CHANGED
@@ -1,9 +1,12 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "cucumber/rake/task"
3
3
  require "rspec/core/rake_task"
4
+ require "rubocop/rake_task"
4
5
 
5
- task :default => :spec
6
+ task default: [:spec, :rubocop]
6
7
  RSpec::Core::RakeTask.new
7
8
 
8
9
  Cucumber::Rake::Task.new(:features)
9
10
 
11
+ desc "Run RuboCop checks"
12
+ RuboCop::RakeTask.new
data/bin/cap CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- require 'capistrano/all'
2
+ require "capistrano/all"
3
3
  Capistrano::Application.new.run
@@ -1,37 +1,32 @@
1
1
  # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'capistrano/version'
4
+ require "capistrano/version"
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "capistrano"
8
8
  gem.version = Capistrano::VERSION
9
9
  gem.authors = ["Tom Clements", "Lee Hambley"]
10
10
  gem.email = ["seenmyfate@gmail.com", "lee.hambley@gmail.com"]
11
- gem.description = %q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
12
- gem.summary = %q{Capistrano - Welcome to easy deployment with Ruby over SSH}
11
+ gem.description = "Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH."
12
+ gem.summary = "Capistrano - Welcome to easy deployment with Ruby over SSH"
13
13
  gem.homepage = "http://capistranorb.com/"
14
14
 
15
- gem.files = `git ls-files`.split($/)
16
- gem.executables = ['cap', 'capify']
15
+ gem.files = `git ls-files -z`.split("\x0")
16
+ gem.executables = %w(cap capify)
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.licenses = ['MIT']
20
+ gem.licenses = ["MIT"]
21
21
 
22
- gem.post_install_message = <<eos
23
- Capistrano 3.1 has some breaking changes. Please check the CHANGELOG: http://goo.gl/SxB0lr
22
+ gem.required_ruby_version = ">= 1.9.3"
23
+ gem.add_dependency "airbrussh", ">= 1.0.0"
24
+ gem.add_dependency "i18n"
25
+ gem.add_dependency "rake", ">= 10.0.0"
26
+ gem.add_dependency "sshkit", ">= 1.9.0"
27
+ gem.add_dependency "capistrano-harrow"
24
28
 
25
- If you're upgrading Capistrano from 2.x, we recommend to read the upgrade guide: http://goo.gl/4536kB
26
-
27
- The `deploy:restart` hook for passenger applications is now in a separate gem called capistrano-passenger. Just add it to your Gemfile and require it in your Capfile.
28
- eos
29
-
30
- gem.required_ruby_version = '>= 1.9.3'
31
- gem.add_dependency 'sshkit', '~> 1.3'
32
- gem.add_dependency 'rake', '>= 10.0.0'
33
- gem.add_dependency 'i18n'
34
-
35
- gem.add_development_dependency 'rspec'
36
- gem.add_development_dependency 'mocha'
29
+ gem.add_development_dependency "rspec"
30
+ gem.add_development_dependency "mocha"
31
+ gem.add_development_dependency "rubocop"
37
32
  end
@@ -0,0 +1,11 @@
1
+ Feature: Doctor
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+
6
+ Scenario: Running the doctor task
7
+ When I run cap "doctor"
8
+ Then the task is successful
9
+ And contains "Environment" in the output
10
+ And contains "Gems" in the output
11
+ And contains "Variables" in the output
@@ -1,5 +1,5 @@
1
1
  Then(/^references in the remote repo are listed$/) do
2
- expect(@output).to include('refs/heads/master')
2
+ expect(@output).to include("refs/heads/master")
3
3
  end
4
4
 
5
5
  Then(/^the shared path is created$/) do
@@ -18,7 +18,7 @@ end
18
18
 
19
19
  Then(/^directories referenced in :linked_files are created in shared$/) do
20
20
  dirs = TestApp.linked_files.map { |path| TestApp.shared_path.join(path).dirname }
21
- dirs.each do | dir|
21
+ dirs.each do |dir|
22
22
  run_vagrant_command(test_dir_exists(dir))
23
23
  end
24
24
  end
@@ -49,27 +49,27 @@ Then(/^the current directory will be a symlink to the release$/) do
49
49
  end
50
50
 
51
51
  Then(/^the deploy\.rb file is created$/) do
52
- file = TestApp.test_app_path.join('config/deploy.rb')
53
- expect(File.exists?(file)).to be true
52
+ file = TestApp.test_app_path.join("config/deploy.rb")
53
+ expect(File.exist?(file)).to be true
54
54
  end
55
55
 
56
56
  Then(/^the default stage files are created$/) do
57
- staging = TestApp.test_app_path.join('config/deploy/staging.rb')
58
- production = TestApp.test_app_path.join('config/deploy/production.rb')
59
- expect(File.exists?(staging)).to be true
60
- expect(File.exists?(production)).to be true
57
+ staging = TestApp.test_app_path.join("config/deploy/staging.rb")
58
+ production = TestApp.test_app_path.join("config/deploy/production.rb")
59
+ expect(File.exist?(staging)).to be true
60
+ expect(File.exist?(production)).to be true
61
61
  end
62
62
 
63
63
  Then(/^the tasks folder is created$/) do
64
- path = TestApp.test_app_path.join('lib/capistrano/tasks')
65
- expect(Dir.exists?(path)).to be true
64
+ path = TestApp.test_app_path.join("lib/capistrano/tasks")
65
+ expect(Dir.exist?(path)).to be true
66
66
  end
67
67
 
68
68
  Then(/^the specified stage files are created$/) do
69
- qa = TestApp.test_app_path.join('config/deploy/qa.rb')
70
- production = TestApp.test_app_path.join('config/deploy/production.rb')
71
- expect(File.exists?(qa)).to be true
72
- expect(File.exists?(production)).to be true
69
+ qa = TestApp.test_app_path.join("config/deploy/qa.rb")
70
+ production = TestApp.test_app_path.join("config/deploy/production.rb")
71
+ expect(File.exist?(qa)).to be true
72
+ expect(File.exist?(production)).to be true
73
73
  end
74
74
 
75
75
  Then(/^it creates the file with the remote_task prerequisite$/) do
@@ -91,18 +91,18 @@ Then(/^the task fails$/) do
91
91
  end
92
92
 
93
93
  Then(/^the failure task will run$/) do
94
- failed = TestApp.shared_path.join('failed')
94
+ failed = TestApp.shared_path.join("failed")
95
95
  run_vagrant_command(test_file_exists(failed))
96
96
  end
97
97
 
98
98
  Then(/^the failure task will not run$/) do
99
- failed = TestApp.shared_path.join('failed')
99
+ failed = TestApp.shared_path.join("failed")
100
100
  expect { run_vagrant_command(test_file_exists(failed)) }
101
101
  .to raise_error(VagrantHelpers::VagrantSSHCommandError)
102
102
  end
103
103
 
104
104
  When(/^an error is raised$/) do
105
- error = TestApp.shared_path.join('fail')
105
+ error = TestApp.shared_path.join("fail")
106
106
  run_vagrant_command(test_file_exists(error))
107
107
  end
108
108
 
@@ -9,4 +9,3 @@ end
9
9
  When(/^I run "(.*?)"$/) do |command|
10
10
  @success, @output = TestApp.run(command)
11
11
  end
12
-
@@ -3,7 +3,11 @@ Given(/^a test app with the default configuration$/) do
3
3
  end
4
4
 
5
5
  Given(/^servers with the roles app and web$/) do
6
- vagrant_cli_command('up') rescue nil
6
+ begin
7
+ vagrant_cli_command("up")
8
+ rescue
9
+ nil
10
+ end
7
11
  end
8
12
 
9
13
  Given(/^a linked file "(.*?)"$/) do |file|
@@ -24,11 +28,11 @@ Given(/^file "(.*?)" does not exist in shared path$/) do |file|
24
28
  end
25
29
 
26
30
  Given(/^a custom task to generate a file$/) do
27
- TestApp.copy_task_to_test_app('spec/support/tasks/database.rake')
31
+ TestApp.copy_task_to_test_app("spec/support/tasks/database.rake")
28
32
  end
29
33
 
30
34
  Given(/^a task which executes as root$/) do
31
- TestApp.copy_task_to_test_app('spec/support/tasks/root.rake')
35
+ TestApp.copy_task_to_test_app("spec/support/tasks/root.rake")
32
36
  end
33
37
 
34
38
  Given(/config stage file has line "(.*?)"/) do |line|
@@ -36,15 +40,15 @@ Given(/config stage file has line "(.*?)"/) do |line|
36
40
  end
37
41
 
38
42
  Given(/^the configuration is in a custom location$/) do
39
- TestApp.move_configuration_to_custom_location('app')
43
+ TestApp.move_configuration_to_custom_location("app")
40
44
  end
41
45
 
42
46
  Given(/^a custom task that will simulate a failure$/) do
43
- safely_remove_file(TestApp.shared_path.join('failed'))
44
- TestApp.copy_task_to_test_app('spec/support/tasks/fail.rake')
47
+ safely_remove_file(TestApp.shared_path.join("failed"))
48
+ TestApp.copy_task_to_test_app("spec/support/tasks/fail.rake")
45
49
  end
46
50
 
47
51
  Given(/^a custom task to run in the event of a failure$/) do
48
- safely_remove_file(TestApp.shared_path.join('failed'))
49
- TestApp.copy_task_to_test_app('spec/support/tasks/failed.rake')
52
+ safely_remove_file(TestApp.shared_path.join("failed"))
53
+ TestApp.copy_task_to_test_app("spec/support/tasks/failed.rake")
50
54
  end