capistrano-dotenv-tasks 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 056ca56b71307471815b80b2e97a247039ed9161
4
- data.tar.gz: 422bc11b030ba79ba533db0d1dba465a012ec1b7
3
+ metadata.gz: d8a4421fd55fc8db1fc5ea97a66367d8a03eec8f
4
+ data.tar.gz: c79b082956a6ea595ebd2b90395e1e316525f5a2
5
5
  SHA512:
6
- metadata.gz: 28e6b2c618f970c711a4ba098b854572041476ff85ed638918054216ac2999670d2944a71ded6bb5733f50bb09c27ed9628619d891e8432cc362abab2baea0ba
7
- data.tar.gz: 437b2de20eab7b795b40635c35865404f03c8e3e32a156ddc6a5da6decf5f98670c06f4870c49566c3ffc46af03f02483853c11406fd21ad8165d4082afb7d42
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
- ### Create / Update a variable
38
+ ### Set (create or update) a variable
39
39
 
40
40
  ```
41
41
  $ cap production config:set VARNAME=value
42
42
  ```
43
43
 
44
- ### Delete a variable
44
+ ### Remove a variable
45
45
 
46
46
  ```
47
- $ cap production config:remove key=VARNAME
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
- config.remove(ENV['key'])
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
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Dotenv
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  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.3
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-03-25 00:00:00.000000000 Z
11
+ date: 2016-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano