capistrano-secrets-yml 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 92c88d7979d7b310daac29ae043c02b728a8c085
4
+ data.tar.gz: de32134712eadaf043ec6333dd540d354c8366a8
5
+ SHA512:
6
+ metadata.gz: 6f79f1eb349ed50b9997e3cfa4b01956175cdf874e0aa68b635fe9da88e526cb5eab764a933a8b9208c64d37d4cd8580462a4fa1f08afe9e2f03b5a1d8cc1702
7
+ data.tar.gz: 98d72f548463a9f78e1c3adfff6cefa904856667043470f0007754ce9212840ef96f46a9c54e84400b1f2c505506cbad4284484efdb22034f05f0a30b0fbff5b
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ ### master
4
+ - started the project
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in *.gemspec
4
+ gemspec
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2014 Bruno Sutic
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the "Software"),
5
+ to deal in the Software without restriction, including without limitation
6
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
+ and/or sell copies of the Software, and to permit persons to whom the
8
+ Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included
11
+ in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
19
+ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ # Capistrano::SecretsYml
2
+
3
+ Capistrano tasks for handling `secrets.yml` file in Rails 4+.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "capistrano/secrets_yml/version"
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "capistrano-secrets-yml"
8
+ gem.version = Capistrano::SecretsYml::VERSION
9
+ gem.authors = ["Bruno Sutic"]
10
+ gem.email = ["bruno.sutic@gmail.com"]
11
+ gem.description = <<-EOF.gsub(/^\s+/, "")
12
+ Capistrano tasks for automating `secrets.yml` file handling for Rails 4+ apps.
13
+
14
+ This plugins syncs contents of your local secrets file and copies that to
15
+ the remote server.
16
+ EOF
17
+ gem.summary = "Capistrano tasks for automating `secrets.yml` file handling for Rails 4+ apps."
18
+ gem.homepage = "https://github.com/capistrano-plugins/capistrano-secrets-yml"
19
+
20
+ gem.files = `git ls-files`.split($/)
21
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
22
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
23
+ gem.require_paths = ["lib"]
24
+
25
+ gem.add_dependency "capistrano", ">= 3.1"
26
+ gem.add_dependency "sshkit", ">= 1.2.0"
27
+
28
+ gem.add_development_dependency "rake"
29
+ end
@@ -0,0 +1,3 @@
1
+ require "capistrano/secrets_yml/paths"
2
+ require "capistrano/secrets_yml/helpers"
3
+ load File.expand_path("../tasks/secrets_yml.rake", __FILE__)
@@ -0,0 +1,19 @@
1
+ module Capistrano
2
+ module SecretsYml
3
+ module Helpers
4
+
5
+ def read_local_secrets_yml
6
+ @local_secrets_yml ||= YAML.load_file(secrets_yml_local_path)
7
+ end
8
+
9
+ def secrets_yml_content
10
+ @content ||= begin
11
+ env = fetch(:secrets_yml_env).to_s
12
+ Hash[env => read_local_secrets_yml.fetch(env)].to_yaml
13
+ end
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,15 @@
1
+ module Capistrano
2
+ module SecretsYml
3
+ module Paths
4
+
5
+ def secrets_yml_local_path
6
+ Pathname.new fetch(:secrets_yml_local_path)
7
+ end
8
+
9
+ def secrets_yml_remote_path
10
+ shared_path.join fetch(:secrets_yml_remote_path)
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module SecretsYml
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,35 @@
1
+ include Capistrano::SecretsYml::Paths
2
+ include Capistrano::SecretsYml::Helpers
3
+
4
+ namespace :load do
5
+ task :defaults do
6
+ set :secrets_yml_local_path, "config/secrets.yml"
7
+ set :secrets_yml_remote_path, "config/secrets.yml"
8
+ set :secrets_yml_env, -> { fetch(:rails_env) || fetch(:stage) }
9
+ end
10
+ end
11
+
12
+ namespace :secrets_yml do
13
+
14
+ desc "Setup `secrets.yml` file on the server(s)"
15
+ task :setup do
16
+ content = secrets_yml_content
17
+ on release_roles :all do
18
+ execute :mkdir, "-pv", File.dirname(secrets_yml_remote_path)
19
+ upload! StringIO.new(content), secrets_yml_remote_path
20
+ end
21
+ end
22
+
23
+ # Update `linked_files` after the deploy starts so that users'
24
+ # `secrets_yml_remote_path` override is respected.
25
+ task :secrets_yml_symlink do
26
+ set :linked_files, fetch(:linked_files, []).push(fetch(:secrets_yml_remote_path))
27
+ end
28
+ after "deploy:started", "secrets_yml:secrets_yml_symlink"
29
+
30
+ end
31
+
32
+ desc "Server setup tasks"
33
+ task :setup do
34
+ invoke "secrets_yml:setup"
35
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-secrets-yml
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Bruno Sutic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sshkit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: |
56
+ Capistrano tasks for automating `secrets.yml` file handling for Rails 4+ apps.
57
+ This plugins syncs contents of your local secrets file and copies that to
58
+ the remote server.
59
+ email:
60
+ - bruno.sutic@gmail.com
61
+ executables: []
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - CHANGELOG.md
66
+ - Gemfile
67
+ - LICENSE.md
68
+ - README.md
69
+ - Rakefile
70
+ - capistrano-secrets-yml.gemspec
71
+ - lib/capistrano/capistrano-secrets-yml.rb
72
+ - lib/capistrano/secrets_yml.rb
73
+ - lib/capistrano/secrets_yml/helpers.rb
74
+ - lib/capistrano/secrets_yml/paths.rb
75
+ - lib/capistrano/secrets_yml/version.rb
76
+ - lib/capistrano/tasks/secrets_yml.rake
77
+ homepage: https://github.com/capistrano-plugins/capistrano-secrets-yml
78
+ licenses: []
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.2.2
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Capistrano tasks for automating `secrets.yml` file handling for Rails 4+
100
+ apps.
101
+ test_files: []