capistrano-dotenv-tasks 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -4
- data/lib/capistrano/dotenv/config.rb +3 -4
- data/lib/capistrano/dotenv/tasks.rb +6 -5
- data/lib/capistrano/dotenv/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8a4421fd55fc8db1fc5ea97a66367d8a03eec8f
|
4
|
+
data.tar.gz: c79b082956a6ea595ebd2b90395e1e316525f5a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba20ee830e956397f75a79b4b59324aea0fd15dfaadbbc4a347c4af24daa4419e8609c534139fcf2841f397f97addb5739dd0c9e748a1d73d5f32bdaff72b0ee
|
7
|
+
data.tar.gz: 5c0f7087f8eda044d78ac956978708aa7867c58f06d036696dc538a1ea8a5621074cebfa0269b97240410a140f5d04c14868422cbc80c91da6699fbe1da7872c
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Show, set and delete env vars in your `.env` remote file with Capistrano 3.
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem 'capistrano-dotenv-tasks'
|
10
|
+
gem 'capistrano-dotenv-tasks', require: false
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -35,16 +35,22 @@ Then use it from the `cap` command.
|
|
35
35
|
$ cap production config:show
|
36
36
|
```
|
37
37
|
|
38
|
-
###
|
38
|
+
### Set (create or update) a variable
|
39
39
|
|
40
40
|
```
|
41
41
|
$ cap production config:set VARNAME=value
|
42
42
|
```
|
43
43
|
|
44
|
-
###
|
44
|
+
### Remove a variable
|
45
45
|
|
46
46
|
```
|
47
|
-
$ cap production config:remove
|
47
|
+
$ cap production config:remove[VARNAME]
|
48
|
+
```
|
49
|
+
|
50
|
+
Or multiple at once:
|
51
|
+
|
52
|
+
```
|
53
|
+
$ cap production config:remove[VARNAME1,VARNAME2]
|
48
54
|
```
|
49
55
|
|
50
56
|
## Contributing
|
@@ -18,10 +18,11 @@ module Capistrano
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def compile
|
21
|
-
variables.map do |key, value|
|
21
|
+
Hash[variables.sort].map do |key, value|
|
22
22
|
%(#{ key }=#{ value })
|
23
|
-
end.join("\n")
|
23
|
+
end.join("\n") << "\n"
|
24
24
|
end
|
25
|
+
alias_method :to_s, :compile
|
25
26
|
|
26
27
|
def add(*args)
|
27
28
|
args.each do |string|
|
@@ -38,8 +39,6 @@ module Capistrano
|
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
41
|
-
alias_method :to_s, :compile
|
42
|
-
|
43
42
|
def to_io
|
44
43
|
StringIO.new(compile)
|
45
44
|
end
|
@@ -38,17 +38,18 @@ namespace :config do
|
|
38
38
|
|
39
39
|
desc "Removes an environment variable from the .env config file"
|
40
40
|
task :remove do |t, args|
|
41
|
-
unless ENV['key']
|
42
|
-
raise "You need to set `key=KEY_TO_BE_REMOVED` to remove a key"
|
43
|
-
end
|
44
|
-
|
45
41
|
dotenv_path = fetch(:capistrano_dotenv_path_escaped)
|
46
42
|
|
47
43
|
on roles(fetch(:capistrano_dotenv_role)) do
|
48
44
|
contents = capture(:cat, dotenv_path) if test fetch(:capistrano_dotenv_path_exists)
|
49
45
|
config = Capistrano::Dotenv::Config.new(contents)
|
50
46
|
|
51
|
-
|
47
|
+
if ENV['key']
|
48
|
+
$stderr.puts "DEPRECATION WARNING: Using `key=KEY_TO_BE_REMOVED` is deprecated, just pass the keys as arguments to the task; `config:remove[KEY_A,KEY_B]`"
|
49
|
+
config.remove(ENV['key'])
|
50
|
+
else
|
51
|
+
config.remove(*args.extras)
|
52
|
+
end
|
52
53
|
upload!(config.to_io, dotenv_path)
|
53
54
|
end
|
54
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-dotenv-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valentin Ballestrino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|