capistrano-dotenv-tasks 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8a4421fd55fc8db1fc5ea97a66367d8a03eec8f
4
- data.tar.gz: c79b082956a6ea595ebd2b90395e1e316525f5a2
3
+ metadata.gz: 1d428478e6c029b84dc870701567ccce81fc8115
4
+ data.tar.gz: 6be2707a1fa2089f32f7e78ebb67f10dd60443b8
5
5
  SHA512:
6
- metadata.gz: ba20ee830e956397f75a79b4b59324aea0fd15dfaadbbc4a347c4af24daa4419e8609c534139fcf2841f397f97addb5739dd0c9e748a1d73d5f32bdaff72b0ee
7
- data.tar.gz: 5c0f7087f8eda044d78ac956978708aa7867c58f06d036696dc538a1ea8a5621074cebfa0269b97240410a140f5d04c14868422cbc80c91da6699fbe1da7872c
6
+ metadata.gz: 0f74451db21561e28d1c859f6c80db301f924628aa9516bc2b14f90e8bf3a028241d31c5f05d9b5e1f4d61ffda88bd4fc57981593ee28ce6ca39de40cf89f867
7
+ data.tar.gz: 265858c57740ac5311c160d596bfc51ffaa6a2980f72050522666085ed72ac279575f18914a6857193106c465a03445b40f64745fef01716255d208b88c6dd0a
data/README.md CHANGED
@@ -4,9 +4,10 @@ Show, set and delete env vars in your `.env` remote file with Capistrano 3.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ Add these lines to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
+ gem 'dotenv' # if you haven't added it, already
10
11
  gem 'capistrano-dotenv-tasks', require: false
11
12
  ```
12
13
 
@@ -20,13 +21,23 @@ Or install it yourself as:
20
21
 
21
22
  ## Usage
22
23
 
23
- Require it in your Capfile :
24
+ Require it in your Capfile:
24
25
 
25
26
  ```ruby
26
27
  require 'capistrano/dotenv/tasks'
27
28
  ```
28
29
 
29
- Then use it from the `cap` command.
30
+ Make the `.env` file
31
+ [a file that is shared between releases](http://capistranorb.com/documentation/getting-started/structure/)
32
+ by adding one of the following lines to your `config/deploy.rb` script:
33
+
34
+ ```ruby
35
+ append :linked_files, '.env' # for capistrano >= 3.5
36
+ set :linked_files, fetch(:linked_file, []).push('.env') # for capistrano < 3.5
37
+ ```
38
+
39
+ Then, access the capistrano rake tasks to edit your remote `.env` file from
40
+ the `cap` command.
30
41
 
31
42
 
32
43
  ### Show your config
@@ -61,6 +72,6 @@ $ cap production config:remove[VARNAME1,VARNAME2]
61
72
  4. Push to the branch (`git push origin my-new-feature`)
62
73
  5. Create a new Pull Request
63
74
 
64
- ## Licence
75
+ ## License
65
76
 
66
77
  MIT
@@ -50,11 +50,9 @@ module Capistrano
50
50
  key = matches[1]
51
51
  value = matches[2]
52
52
 
53
- return unless key && value
54
-
55
- value.gsub!(/^['"]|['"]$/, '')
56
-
57
- [key, value]
53
+ if key && value
54
+ [key, value]
55
+ end
58
56
  end
59
57
  end
60
58
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Dotenv
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
data/spec/config_spec.rb CHANGED
@@ -4,7 +4,7 @@ RSpec.describe Capistrano::Dotenv::Config do
4
4
 
5
5
  shared_examples_for '#to_s' do
6
6
  subject { config.to_s }
7
- it { is_expected.to eq(contents) }
7
+ it { is_expected.to eq(contents + "\n") }
8
8
  end
9
9
 
10
10
  subject(:config) { described_class.new(contents) }
@@ -15,12 +15,12 @@ RSpec.describe Capistrano::Dotenv::Config do
15
15
  it_behaves_like '#to_s' do
16
16
  describe '#add' do
17
17
  before { config.add('NAME=value') }
18
- it { is_expected.to eq("VAR=foo\nNAME=value")}
18
+ it { is_expected.to eq("NAME=value\nVAR=foo\n")}
19
19
  end
20
20
 
21
21
  describe '#remove' do
22
22
  before { config.remove('VAR') }
23
- it { is_expected.to eq('') }
23
+ it { is_expected.to eq("\n") }
24
24
  end
25
25
  end
26
26
  end
@@ -29,4 +29,36 @@ RSpec.describe Capistrano::Dotenv::Config do
29
29
  let(:contents) { 'VAR=foo bar' }
30
30
  it_behaves_like '#to_s'
31
31
  end
32
+
33
+ context 'VAR="double#quoted#string"' do
34
+ let(:contents) {'VAR="double#quoted#string"'}
35
+
36
+ it_behaves_like '#to_s' do
37
+ describe '#add' do
38
+ before { config.add('NAME=value') }
39
+ it { is_expected.to eq("NAME=value\nVAR=\"double#quoted#string\"\n")}
40
+ end
41
+
42
+ describe '#remove' do
43
+ before { config.remove('VAR') }
44
+ it { is_expected.to eq("\n") }
45
+ end
46
+ end
47
+ end
48
+
49
+ context "VAR='single#quoted#string'" do
50
+ let(:contents) {"VAR='single#quoted#string'"}
51
+
52
+ it_behaves_like '#to_s' do
53
+ describe '#add' do
54
+ before { config.add('NAME=value') }
55
+ it { is_expected.to eq("NAME=value\nVAR='single#quoted#string'\n")}
56
+ end
57
+
58
+ describe '#remove' do
59
+ before { config.remove('VAR') }
60
+ it { is_expected.to eq("\n") }
61
+ end
62
+ end
63
+ end
32
64
  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
4
+ version: 0.1.5
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-28 00:00:00.000000000 Z
11
+ date: 2018-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.5.1
108
+ rubygems_version: 2.6.11
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: Capistrano tasks to configure your remote dotenv files