Sha256: a75cb608512d61c0699710e4a24871b4176fd0f2503f28bb0251145431acfef8
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 KB
Contents
include Capistrano::SecretsYml::Paths include Capistrano::SecretsYml::Helpers namespace :load do task :defaults do set :secrets_yml_local_path, "config/secrets.yml" set :secrets_yml_remote_path, "config/secrets.yml" set :secrets_yml_env, -> { fetch(:rails_env) || fetch(:stage) } end end namespace :secrets_yml do task :check_secrets_file_exists do next if File.exists?(secrets_yml_local_path) check_secrets_file_exists_error exit 1 end task :check_git_tracking do next unless system("git ls-files #{fetch(:secrets_yml_local_path)} --error-unmatch >/dev/null 2>&1") check_git_tracking_error exit 1 end task :check_config_present do next unless local_secrets_yml(secrets_yml_env).nil? check_config_present_error exit 1 end desc "secrets.yml file checks" task :check do raise(":deploy_to in your app/config/deploy/\#{environment}.rb file cannot contain ~") if shared_path.to_s.include?('~') # SCP doesn't support ~ in the path invoke "secrets_yml:check_secrets_file_exists" invoke "secrets_yml:check_git_tracking" invoke "secrets_yml:check_config_present" end desc "Setup `secrets.yml` file on the server(s)" task setup: [:check] do content = secrets_yml_content on release_roles :all do execute :mkdir, "-pv", File.dirname(secrets_yml_remote_path) Net::SCP.upload!(self.host.hostname, self.host.user, StringIO.new(content), secrets_yml_remote_path, ssh: { port: self.host.port }) end end # Update `linked_files` after the deploy starts so that users' # `secrets_yml_remote_path` override is respected. task :secrets_yml_symlink do set :linked_files, fetch(:linked_files, []).push(fetch(:secrets_yml_remote_path)) end after "deploy:started", "secrets_yml:secrets_yml_symlink" end desc "Server setup tasks" task :setup do invoke "secrets_yml:setup" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capistrano-secrets-yml-1.2.1 | lib/capistrano/tasks/secrets_yml.rake |