Last active
October 29, 2019 18:53
-
-
Save bradland/2c32e298e24afade1205127be3e05ffb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Server is defined in stage file deploy/staging.rb | |
# server 'staging.example.com', user: 'staginguser', roles: %i(app db web) | |
# Expect `say_hello` task to output: | |
# echo 'hello from "staginguser"' | |
# What `say_hello` task actually outputs: | |
# echo 'hello from nil' | |
task :say_hello do | |
on roles(:app) do | |
execute "echo 'hello from #{fetch(:user).inspect}'" | |
end | |
end | |
# By inspecting the output of `Capistrano::Configuration.env`, we can see | |
# that the server user is in the servers collection under configuration, but | |
# this variable is not exposed in the variables available through `fetch`. | |
namespace :dump do | |
task :env do | |
pp Capistrano::Configuration.env | |
end | |
task :servers do | |
pp Capistrano::Configuration.env.servers | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment