env_lint 0.0.2 → 0.0.3
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 +4 -4
- data/README.md +21 -5
- data/lib/env_lint/capistrano.rb +1 -1
- data/lib/env_lint/tasks.rb +5 -3
- data/lib/env_lint/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fd240de9e5e9e0ac7af95569c5b53be92d3e053
|
4
|
+
data.tar.gz: d6a635c729e9f4204bbb55becd4285867ae8e6ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0fc2ab83fd65c552e272c1a100cedb9af0ede1b7136fb84d00856b2b7196331c88a7c6bceb5ab81dc69afcc5b3915998f304b470e77c7aac9fc2c6a4c789dea
|
7
|
+
data.tar.gz: e674ab0cd397ddc9b8a671f72467545c9043ef86f5d711be393f029171af623a29083323cadc092527527b61458a9d7c1a875447e0c6656fb77b14a4c15c0ca5
|
data/README.md
CHANGED
@@ -13,10 +13,10 @@ according to to a `.env.example` file.
|
|
13
13
|
deploying a new version of an app
|
14
14
|
* Ease setting up a new development machine
|
15
15
|
|
16
|
-
|
16
|
+
## Status
|
17
17
|
|
18
|
-
Only tested with
|
19
|
-
tasks.
|
18
|
+
Still young, but used in production. Only tested with
|
19
|
+
[recap](https://github.com/tomafro/recap) capistrano tasks.
|
20
20
|
|
21
21
|
## Installation
|
22
22
|
|
@@ -49,7 +49,18 @@ Now you can check your environment:
|
|
49
49
|
$ rake env:lint
|
50
50
|
=> Complains if non optional variables are missing
|
51
51
|
|
52
|
-
If special steps are needed
|
52
|
+
If special steps are needed to setup your env, you can define a
|
53
|
+
`env:load` task. For example to integrate with
|
54
|
+
[Dotenv](https://github.com/bkeepers/dotenv):
|
55
|
+
|
56
|
+
require 'env_lint/tasks'
|
57
|
+
require 'dotenv'
|
58
|
+
|
59
|
+
namespace :env do
|
60
|
+
task :load do
|
61
|
+
Dotenv.load
|
62
|
+
end
|
63
|
+
end
|
53
64
|
|
54
65
|
### Capistrano Task
|
55
66
|
|
@@ -63,10 +74,15 @@ Now you can check your servers:
|
|
63
74
|
=> Complains if non optional variables are missing
|
64
75
|
|
65
76
|
You might want to lint the environment automatically before each
|
66
|
-
deploy
|
77
|
+
deploy:
|
67
78
|
|
68
79
|
before 'deploy', 'env:lint'
|
69
80
|
|
81
|
+
By default, env_lint tries to run `export` as your recap application
|
82
|
+
user. The probe command can be configured:
|
83
|
+
|
84
|
+
set(:env_probe_command, "su - deploy -c 'export'")
|
85
|
+
|
70
86
|
Lint variable names before setting them:
|
71
87
|
|
72
88
|
before 'env:set', 'env:lint_args'
|
data/lib/env_lint/capistrano.rb
CHANGED
data/lib/env_lint/tasks.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
namespace :env do
|
2
2
|
desc 'Ensure every non optional ENV variable is defined.'
|
3
3
|
task :lint => :load do
|
4
|
+
formatter = EnvLint::Formatter.new
|
5
|
+
|
4
6
|
begin
|
5
7
|
EnvLint.verify_hash(env_definition_file, ENV)
|
6
|
-
|
8
|
+
formatter.ok('env looks ok')
|
7
9
|
rescue EnvLint::MissingVariables => e
|
8
|
-
|
10
|
+
formatter.missing_variables(e.dot_env_file, e.missing_variables)
|
9
11
|
abort
|
10
12
|
rescue EnvLint::Error => e
|
11
|
-
|
13
|
+
formatter.error(e.message)
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
data/lib/env_lint/version.rb
CHANGED