mina-vault 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: f39320b5bf1da729712355caac224151fd3364b5
4
+ data.tar.gz: de79a2ac92c37d9d2253fb7f2db63e848eac2b1d
5
+ SHA512:
6
+ metadata.gz: fd0800743aaa2ea7493a3271f687f2f9627f9f4baa11f623a7d7b6168a8f9f27ce1ef333f47a849f2cd5346712c985650333a19cc161d62ebd83d87c080865cb
7
+ data.tar.gz: 63c70501fd5e6add316e24575077a7b0d5d612d1f2dae0a92e704b80f2efc7501b5b0b620d35241d3a60d7285ae0cfda375674065f148617554da9c454c00fc7
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /config/
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mina-delayed_job.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Stjepan Hadjic
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,65 @@
1
+ # Modules: Vault
2
+
3
+ Mina plugin to manage vaults
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'mina-vault', require: false
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install mina-vault
20
+
21
+ ## Usage
22
+
23
+ ### Settings
24
+ Any and all of these settings can be overriden in your `deploy.rb`.
25
+
26
+ Sets the path to vault.
27
+
28
+ set_default :vault, lambda { "bin/vault" }
29
+
30
+ Sets the dir to the pid files of a vault workers
31
+
32
+ set_default :vault_pid_dir, lambda { "#{deploy_to}/#{shared_path}/pids" }
33
+
34
+ Sets the number of vault processes launched
35
+
36
+ set_default :vault_processes, 1
37
+
38
+ ### Usage example
39
+
40
+ require 'mina/vault'
41
+ ...
42
+ task :setup do
43
+ # vault needs a place to store its pid file
44
+ invoke :'vault:setup'
45
+ end
46
+
47
+ task :deploy do
48
+ deploy do
49
+ invoke :'git:clone'
50
+ ...
51
+
52
+ to :launch do
53
+ ...
54
+ invoke :'vault:restart'
55
+ end
56
+ end
57
+ end
58
+
59
+ ## Contributing
60
+
61
+ 1. Fork it ( https://github.com/[my-github-username]/mina-vault/fork )
62
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
63
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
64
+ 4. Push to the branch (`git push origin my-new-feature`)
65
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ arch = case RUBY_PLATFORM
4
+ when /64.*linux/
5
+ 'linux-amd64'
6
+ when /linux/
7
+ 'linux-x86'
8
+ when /64.*darwin/
9
+ 'darwin-amd64'
10
+ when /darwin/
11
+ 'darwin-x86'
12
+ else
13
+ raise "Windows not yet supported"
14
+ end
15
+
16
+ args = $*.map { |x| x.include?(' ') ? "'" + x + "'" : x }
17
+ cmd = File.expand_path "#{File.dirname(__FILE__)}/../libexec/vault-#{arch}"
18
+
19
+ exec "#{cmd} #{args.join(' ')}"
@@ -0,0 +1,3 @@
1
+ require "mina/vault/tasks"
2
+ require "mina/vault/helpers"
3
+ require "mina/vault/version"
@@ -0,0 +1,30 @@
1
+ def vault_auth_cmd
2
+ 'vault auth' + method_options
3
+ end
4
+
5
+ def vault_read_cmd
6
+ "vault read -field=#{mina_vault_secrets_field} #{secrets_key}"
7
+ end
8
+
9
+ private
10
+
11
+ def method_options
12
+ return mina_vault_auth_options unless mina_vault_auth_options.nil?
13
+ die('mina_vault_auth_token is not set') if mina_vault_auth_token.nil?
14
+ case mina_vault_auth_method
15
+ when 'token'
16
+ " #{mina_vault_auth_token}"
17
+ when 'github'
18
+ " -method=github token=#{mina_vault_auth_token}"
19
+ end
20
+ end
21
+
22
+ def vault_repo
23
+ return mina_vault_repo unless mina_vault_repo.nil?
24
+ repository.match(%r{\/(.*)\..*})[1]
25
+ end
26
+
27
+ def secrets_key
28
+ return mina_vault_secrets_key unless mina_vault_secrets_key.nil?
29
+ "rails/#{rails_env}/#{vault_repo}"
30
+ end
@@ -0,0 +1,27 @@
1
+ require 'mina/bundler'
2
+ require 'mina/rails'
3
+
4
+ # Any and all of these settings can be overriden in your `deploy.rb`.
5
+ set_default :mina_vault_auth_token, -> { ENV['MINA_VAULT_AUTH_TOKEN'] }
6
+ set_default :mina_vault_auth_method, -> { ENV['MINA_VAULT_AUTH_METHOD'] || 'token' }
7
+ set_default :mina_vault_secrets_field, -> { 'secrets' }
8
+ # mina_vault_auth_options
9
+ # mina_vault_repo
10
+ # mina_vault_secrets_file
11
+ # mina_vault_secrets_key
12
+
13
+ namespace :vault do
14
+ set :term_mode, :pretty
15
+
16
+ desc 'Vault auth'
17
+ task auth: :environment do
18
+ queue %(echo "-----> Vault auth")
19
+ queue! %(#{vault_auth_cmd})
20
+ end
21
+
22
+ desc 'vault read'
23
+ task read: :auth do
24
+ queue %(echo "-----> Vault read")
25
+ queue! %(#{vault_read_cmd} > #{deploy_to}/#{shared_path}/#{mina_vault_secrets_file})
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ module Mina
2
+ module Vault
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
Binary file
Binary file
Binary file
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mina/vault/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'mina-vault'
8
+ spec.version = Mina::Vault::VERSION
9
+ spec.authors = ['Stjepan Hadjic']
10
+ spec.email = ['d4be4st@gmail.com']
11
+ spec.summary = 'Mina plugin for vault'
12
+ spec.description = 'Added tasks for working with vault'
13
+ spec.homepage = 'https://github.com/d4be4st/mina-vault'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.7'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+
24
+ spec.add_dependency 'mina', '~> 0'
25
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina-vault
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Stjepan Hadjic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mina
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Added tasks for working with vault
56
+ email:
57
+ - d4be4st@gmail.com
58
+ executables:
59
+ - vault
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/vault
69
+ - lib/mina/vault.rb
70
+ - lib/mina/vault/helpers.rb
71
+ - lib/mina/vault/tasks.rb
72
+ - lib/mina/vault/version.rb
73
+ - libexec/vault-darwin-amd64
74
+ - libexec/vault-darwin-x86
75
+ - libexec/vault-linux-amd64
76
+ - libexec/vault-linux-x86
77
+ - mina-vault.gemspec
78
+ homepage: https://github.com/d4be4st/mina-vault
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.4.5
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: Mina plugin for vault
102
+ test_files: []
103
+ has_rdoc: