capistrano3-dotenv-check 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +50 -0
- data/capistrano3-dotenv-check.gemspec +15 -0
- data/lib/capistrano3-dotenv-check.rb +0 -0
- data/lib/capistrano3/dotenv-check.rb +1 -0
- data/lib/capistrano3/tasks/dotenv.rake +36 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b65e91b4af3d2b96fb02eea0f170d069720a32a8
|
4
|
+
data.tar.gz: 8f81eba83260ec454494ad8b8f00663be2daf61c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 001c943508b6aa4ae5b74c509d329d57a76768227773cc1a548cb6728722a727c994bb16dddfc9f9f074f579cfd843223608b74743a03ff37885006df01e36fd
|
7
|
+
data.tar.gz: b0324bc74e062551763438c3cfee13e7bf1cd0bb49c18f0c6522e86e01de228990c77452a0614a920b56c3e017e1cf549a64c3fe60aca1270a6a8d64569df335
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 NamNV609
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Capistrano3 Dotenv Check
|
2
|
+
|
3
|
+
Capistrano3 check .env variables
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
### Setup
|
8
|
+
|
9
|
+
Add the library to your `Gemfile`
|
10
|
+
|
11
|
+
```Ruby
|
12
|
+
group :development do
|
13
|
+
gem "capistrano3-dotenv-check", :require => false
|
14
|
+
end
|
15
|
+
```
|
16
|
+
|
17
|
+
Require in `Capfile` to use default task:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
require "capistrano3/dotenv-check"
|
21
|
+
```
|
22
|
+
|
23
|
+
## Configuration
|
24
|
+
|
25
|
+
Configurable options:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
set :dotenv_file_path, "#{shared_dir}/.env" # this is default
|
29
|
+
set :dotenv_checklist, {} # this is default
|
30
|
+
```
|
31
|
+
|
32
|
+
You can set :dotenv_checklist and :dotenv_file_path in the stage which you want. Example:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
# config/deploy/staging.rb
|
36
|
+
|
37
|
+
set :dotenv_checklist, {
|
38
|
+
ENV_KEY: "Expected value for staging",
|
39
|
+
# ...
|
40
|
+
}
|
41
|
+
```
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
# config/deploy/production.rb
|
45
|
+
|
46
|
+
set :dotenv_file_path, "/home/root/.env"
|
47
|
+
set :dotenv_checklist, {
|
48
|
+
ENV_KEY: "Expected value for production"
|
49
|
+
}
|
50
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "capistrano3-dotenv-check"
|
3
|
+
spec.version = "0.0.2"
|
4
|
+
spec.authors = ["NamNV609"]
|
5
|
+
spec.email = ["namnv609@gmail.com"]
|
6
|
+
spec.description = "Capistrano3 check .env variables"
|
7
|
+
spec.summary = "Capistrano3 check .env variables"
|
8
|
+
spec.license = "MIT"
|
9
|
+
spec.homepage = "https://github.com/namnv609/capistrano3-dotenv-check"
|
10
|
+
spec.files = `git ls-files`.split($/)
|
11
|
+
spec.require_paths = ["lib"]
|
12
|
+
spec.add_dependency "terminal-table", "~> 1.8"
|
13
|
+
spec.add_dependency "dotenv-rails", "~> 2.1"
|
14
|
+
spec.add_dependency "dotenv", "~> 2.1"
|
15
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path "../tasks/dotenv.rake", __FILE__
|
@@ -0,0 +1,36 @@
|
|
1
|
+
namespace :dotenv do
|
2
|
+
require "dotenv/parser"
|
3
|
+
require "terminal-table"
|
4
|
+
|
5
|
+
desc "Check .env variables"
|
6
|
+
task :check do
|
7
|
+
on roles(:app) do |host|
|
8
|
+
info "Checking .env variables"
|
9
|
+
|
10
|
+
dotenv_file_path = fetch :dotenv_file_path, "#{shared_path}/.env"
|
11
|
+
dotenv_content = capture "cat #{dotenv_file_path}"
|
12
|
+
dotenv_vars = Dotenv::Parser.call dotenv_content
|
13
|
+
table_rows = []
|
14
|
+
table_headings = %w(Key Value Expect Status)
|
15
|
+
dotenv_checklist = fetch :dotenv_checklist, {}
|
16
|
+
check_status = true
|
17
|
+
|
18
|
+
dotenv_checklist.each do |key, value|
|
19
|
+
key = key.to_s
|
20
|
+
status_text = (dotenv_vars[key] == value ? "✔" : "✘")
|
21
|
+
check_status = false unless status_text == "✔"
|
22
|
+
table_rows << [key, dotenv_vars[key], value, status_text]
|
23
|
+
end
|
24
|
+
|
25
|
+
table = Terminal::Table.new title: host, headings: table_headings,
|
26
|
+
rows: table_rows
|
27
|
+
puts "#{table.to_s}\n"
|
28
|
+
|
29
|
+
unless check_status
|
30
|
+
abort "- #{host}: Some variables is invalid. Please check!\n"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
after "deploy:started", "dotenv:check"
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano3-dotenv-check
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- NamNV609
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: terminal-table
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dotenv-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: dotenv
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.1'
|
55
|
+
description: Capistrano3 check .env variables
|
56
|
+
email:
|
57
|
+
- namnv609@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- CHANGELOG.md
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- capistrano3-dotenv-check.gemspec
|
68
|
+
- lib/capistrano3-dotenv-check.rb
|
69
|
+
- lib/capistrano3/dotenv-check.rb
|
70
|
+
- lib/capistrano3/tasks/dotenv.rake
|
71
|
+
homepage: https://github.com/namnv609/capistrano3-dotenv-check
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.6.4
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: Capistrano3 check .env variables
|
95
|
+
test_files: []
|