1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00
Commit graph

24 commits

Author SHA1 Message Date
Matt Brictson
ba8115a8f7
Allow cap to be run within subdir and still work
Much like rake can find its Rakefile even when run in a subdirectory,
cap can now find its Capfile. Since cap is built on top of rake, this
was really just restoring default behavior that was accidentally
overridden.

Also add a feature test to ensure it works.
2017-03-06 07:33:47 -08:00
Matt Brictson
55c684f8a0
Properly shell escape git:wrapper steps
The `upload!` method does escaping of its own internally, so we don't
need to do anything special there. Likewise environment variables are
already handled. The only place we need to explicitly `shellescape` is
when executing the `chmod` command.

Verify this all works as expected by changing the user in the Cucumber
features to be `(GitHub Web Flow) via ShipIt`. This user is now used
when exercising the `git:check` task.

Fixes #1842.
2017-02-09 21:45:06 -08:00
Matt Brictson
1adf2508bd Raise if a stage has an invalid name like "deploy" 2016-05-21 11:55:57 -07:00
Maciek Dubinski
b3f7c46c19 Restricting the uploaded git wrapper file permissions to 700.
Additional step in the 'Creating the repo' scenario to test this adjustment.
2016-05-17 16:25:38 +02:00
William Johnston
b33df2fe4d Enable CommandLiteral cop 2016-03-10 07:58:12 -06:00
Lee Hambley
5e266d56e2 Merge pull request #1617 from will-in-wi/rubocop_special_global_vars
Enable SpecialGlobalVars cop
2016-03-07 13:12:36 +01:00
Matt Brictson
04238cb040 Use heredoc for multiline string 2016-03-01 20:13:36 -08:00
William Johnston
a22b5865fb Add english require to affected files. 2016-03-01 09:51:47 -06:00
William Johnston
5f8e7c2cc9 Enable SpecialGlobalVars cop 2016-03-01 09:36:05 -06:00
William Johnston
dc2cbace0b Fix Style/EmptyLinesAroundModuleBody 2016-02-28 17:56:07 -06:00
William Johnston
b53e550fc0 Fix Style/StringLiterals 2016-02-28 17:56:07 -06:00
Matt Brictson
d6a3b3efa6 Make Airbrussh the default format; add format opts
To accommodate Airbrussh, this commit makes the following changes:

1. Adds the airbrussh gem as a dependency
2. Bumps the sshkit dependency to 1.8.0 (for the new `use_format` method)
3. Introduces a `:format_options` setting

Out of the box, Capistrano now defaults to the following:

set :format, :airbussh

It also requires the airbrussh gem at the appropriate point in the Capistrano
boot process, which allows Airbrussh to register its `deploy:failed` hook.

We also change the default Airbrussh settings slightly, to acknowledge the fact
that Airbrussh will now be the first impression new Capistrano users have of the
tool.

Specifically:

* Enable command output (hiding the command output is tidy but probably will
  confuse new users who will not know what their deploy script is doing)
* Disable the "using airbrussh format" banner at startup

Finally, this commit adds an official mechanism for sending a hash of options to
the formatter initializer. This lets users easily change Airbrussh's settings.

set :format_options, color: false, truncate: false, ...

If `:format_options` are set, Capistrano will send them to the formatter object
using SSHKit's `use_format` factory method. As of the latest SSHKit, all
formatters inheriting from `Formatter::Abstract` now accept an options hash
(although currently only Airbrussh does anything with them).
2016-02-24 09:03:54 -08:00
ojab
310da9740a Remove 'vendor/bundle' from default :linked_dirs
capistrano-bundler uses "#{fetch(:deploy_to)}/shared/bundle" directory
2015-06-03 17:00:38 +00:00
Nick Townsend
837eaca8b1 Copy the servers yielded to on()
This allows the SSH connection attributes to be temporarily overridden
2015-02-13 17:11:26 -08:00
Travis Petticrew
2e13a1319c Cucumber tests will now run on the latest Vagrant
This removes the dependency on the `kuroko` gem and uses the Vagrant
command line application to control the virtual environment. The
`vagrant` command should be in your path, but if it isn't the path can
be set with the `VAGRANT_BIN` environment variable. This may even work
on older versions of Vagrant, but they are untested.

The `VagrantHelpers` module was added to mimic some of the API that was
provided by `kuroko`. The `RemoteCommandHelpers` module was modified to
accommodate those changes. Any non-zero exit status on a remote command
will raise a `VagrantHelpers::VagrantSSHCommandError` and should be
expected by any tests using the command helpers. All existing tests
work as expected.

In addition, a couple of minor changes were made. The TestApp utilizes
the Pathname library but does not require it. This was causing the suite
to fail for me so I added an explicit require. Also, the test for the
existence of a release directory would give a false positive on
subsequent runs if the `KEEP_RUNNING` option was used. I added an
`at_exit` that removes the test deployment directory to clean up the
box for the next run.

Documentation was also added to the README for how to run the test
suites.
2014-04-23 10:19:20 -05:00
Michael Nikitochkin
816b137930 🐼 Updated the loading default config tasks and stages config tasks.
To show all tasks decalred in default config and stages files was missed from the tasks list.
Added default value for :stage and load all default configs. Also added cucumber tests.
2014-01-18 23:18:55 +02:00
seenmyfate
22a98f30a6 Merge branch '3.1.x'
Conflicts:
	CHANGELOG.md
	README.md
	lib/capistrano/tasks/git.rake
	lib/capistrano/templates/deploy.rb.erb
2013-11-02 11:08:10 +00:00
seenmyfate
f056c0e4ec Merge branch 'master' into 3.1.x 2013-10-18 11:41:15 +01:00
Kir Shatrov
362fb86fff Default stage template cleanup
Since `stage` is already set (https://github.com/capistrano/capistrano/pull/712), we don't need to declare it twice here.
2013-10-17 14:09:27 +02:00
seenmyfate
d8b9b695bb Allow configuration location to be configurable
This change allows both the `deploy_config_path` and `stage_config_path`
to be moved from the default locations of `config/deploy.rb` and
`config/deploy` respectively.  These values __must__ be set in the
`Capfile` prior to `capistrano/setup` being called, for example:

    set :deploy_config_path, 'app/config/deploy.rb'
    set :stage_config_path, 'app/config/deploy'

    # Load DSL and Setup Up Stages
    require 'capistrano/setup'

Fixes #610
2013-10-14 12:44:38 +01:00
seenmyfate
e7399f4692 Integration tests with Vagrant and Cucumber
This commit removes the existing 'local' integration tests and replaces
them with Cucumber features running against VMs.  At this stage,
some of the assertions are pending due to the limited nature of the
response returned when executing commands through Vagrant, but the
framework is there as a starting point to build upon.

To run the suite:

    bundle exec cucumber

During development, avoid scraping the VM between runs:

    bundle exec cucumber KEEPING_RUNNING=1

Ultimately I would like to see the `TestApp` helpers along with the Vagrant
integration packaged and available for use when developing gems that work with
Cap. For now though, this closes #641
2013-09-27 11:45:55 +01:00
seenmyfate
ba0d313440 Remote file task
The commit introduces a `remote_file` task, allowing the existence of a remote
file to be set as a prerequisite.  These tasks can in turn depend on local
files if required. In this implementation, the fact that we're dealing with a
file in the shared path is assumed.

As as example, this task can be used to ensure that files to be linked exist
before running the `check:linked_files` task:

      namespace :deploy do
        namespace :check do
          task :linked_files => 'config/newrelic.yml'
        end
      end

      remote_file 'config/newrelic.yml' => '/tmp/newrelic.yml', roles: :app

      file '/tmp/newrelic.yml' do |t|
        sh "curl -o #{t.name} https://rpm.newrelic.com/accounts/xx/newrelic.yml"
      end
2013-08-16 17:01:50 +01:00
seenmyfate
f5a585b3a4 Add integration tests for deploy task
This commit adds the outlines of a testing framework for Cap tasks.
Currently just the `cap install` and `cap deploy` tasks are covered. For
now, these tests can only be run if it is `ssh localhost` will work for
you and are currently excluded from the suite. It is my intention to
eventually replace the `sshkit` backend with a test backend, but for now
this is good enough to prevent simple regressions.
2013-06-16 13:08:15 +01:00
seenmyfate
dd4c99e04b refactor integration test 2013-06-14 17:09:32 +01:00