capistrano-dotenv 0.0.4 → 0.0.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
- SHA1:
3
- metadata.gz: 96946aa2407b74c6dcaef0287f3ed24e1229eadf
4
- data.tar.gz: 58813f8093d3a73cf866f461b51b924cf8cd76e7
2
+ SHA256:
3
+ metadata.gz: dced089659d848dc1a8e6d81bd63d2c8b3f2439086cd474555b4cd18bb40eac2
4
+ data.tar.gz: dfa4aad24ef71a2d267a28e930a906e05eebc991f0fc6f4f709fe18d48c8bc27
5
5
  SHA512:
6
- metadata.gz: 00ef981dda708890a2fb99b9579d7c9a1562ca6c4855944fab17208d2bf1fdfc0505c7b3b4372bbf305a3627b40ce10d6967812b81fbf33309d4711859a8691b
7
- data.tar.gz: d2fccdfffc9d85cf485c4df364e70f81a447c6f7226fd0496c71c27fc8bd95131fc2c010b9759cc5c50ef8ed81fc7bcdfec284b55d3bf98a6239bdb605fdd657
6
+ metadata.gz: 99a062d875d6de56a95d469d6278b08e21c1177b304c9ebd5ffd806aed4bf8388d5e0d7720c2aed5cb9ff9ea32580feec9893213e61ebcc9353f105ec99a3bb2
7
+ data.tar.gz: cdef63a1d40118e2c737e5c1a94dee3b5a8a594e73fe7fe545e51726a514b8cbb9c37acd549414808c70d88505f6e0ad15409cc674ef60c12b6587368d25df88
data/README.md CHANGED
@@ -26,18 +26,35 @@ Or install it yourself as:
26
26
 
27
27
  ## Usage
28
28
 
29
- You should ensure there is a `rails` binstub in the `current/bin` directory on the server otherwise
30
- this gem won't work (because rails itself won't work).
31
- If you experience any problems please verify that manually running `rails console` on the server does work.
32
- If it doesn't you are deploying your rails application wrong (check [#18](https://github.com/ydkn/capistrano-rails-console/issues/18) or [#26](https://github.com/ydkn/capistrano-rails-console/issues/26) for details)!
33
-
34
29
  Require in `Capfile`:
35
30
 
36
31
  ```ruby
37
32
  require 'capistrano/dotenv'
38
33
  ```
39
34
 
40
- TODO: adds examples how to use
35
+ To check and ensure that deploy contains invoke both `dotenv:read` and `dotenv:check` tasks before to invoke `dotenv:setup`
36
+
37
+ ```ruby
38
+ invoke 'dotenv:read'
39
+ invoke 'dotenv:check'
40
+ invoke 'dotenv:setup'
41
+ ```
42
+
43
+ If you do not want to check, invoke only `dotenv:read` and `dotenv:setup` to just read and upload the env vars
44
+
45
+ ```ruby
46
+ invoke 'dotenv:read'
47
+ invoke 'dotenv:setup'
48
+ ```
49
+
50
+ If you want to auto prefix `dotenv` to yout `bundle`/`ruby`/`gem`/`rake` commands, add `dotenv:hook` to your invokes.
51
+
52
+ ```ruby
53
+ invoke 'dotenv:read'
54
+ invoke 'dotenv:check'
55
+ invoke 'dotenv:setup'
56
+ invoke 'dotenv:hook'
57
+ ```
41
58
 
42
59
  ## Options
43
60
 
@@ -55,6 +72,12 @@ Or use the same file for every environment(default)
55
72
  set :env_file, '.env'
56
73
  ```
57
74
 
75
+ If you use [dotgpg](https://github.com/ConradIrwin/dotgpg) to secure your env vars on git, just set the env_file passing the gpg file, and it will ask your gpg password and read it from gpg file correctly. For example:
76
+
77
+ ```ruby
78
+ set :env_file, ".env_#{stage}.gpg"
79
+ ```
80
+
58
81
  ### Optional env vars
59
82
 
60
83
  There are env vars that you want to set only in some enviroments or you will use a default value if it is not defined, so it is not required to be set a value for them. To be able to run check without fail the deployment if those env vars do not have a value set, just set it as optional
@@ -79,6 +102,20 @@ By default, the setup task will upload generated .env file to all roles(:all), b
79
102
  set :dotenv_roles, :app
80
103
  ```
81
104
 
105
+ ### Hook
106
+
107
+ By default, `dotenv:hook` will work on `bundle`, `ruby`, `gem` and `rake`. You can change this setting `dotenv_hook_commands`.
108
+
109
+ ```ruby
110
+ set :dotenv_hook_commands, %w(bundle ruby gem rake my_custom_command)
111
+ ```
112
+
113
+ By default, `dotenv:hook` will add the `dotenv` prefix before the commands. You can change this setting `dotenv_hook_prefix`.
114
+
115
+ ```ruby
116
+ set :dotenv_hook_prefix, 'dotenv -f ".my_custom_env_file"'
117
+ ```
118
+
82
119
 
83
120
  ## Contributing
84
121
 
@@ -34,15 +34,22 @@ namespace :dotenv do
34
34
  task :setup do
35
35
  dotenv_contents = fetch(:dotenv_contents)
36
36
 
37
- dotenv = StringIO.new
38
- dotenv << dotenv_contents
39
- dotenv.rewind
40
-
41
37
  on roles(fetch(:dotenv_roles, :all)) do
38
+ dotenv = StringIO.new(dotenv_contents)
39
+
42
40
  upload! dotenv, File.join(shared_path, '.env')
43
41
  end
44
42
  end
45
43
 
44
+ task :hook do
45
+ commands = fetch(:dotenv_hook_commands, %w{gem rake ruby bundle})
46
+ hook_prefix = fetch(:dotenv_hook_prefix, 'dotenv')
47
+
48
+ commands.each do |command|
49
+ SSHKit.config.command_map.prefix[command.to_sym].append(hook_prefix)
50
+ end
51
+ end
52
+
46
53
  task :read do
47
54
  env_file = fetch(:env_file, '.env')
48
55
  dotenv_contents = ''
@@ -3,6 +3,6 @@ module Capistrano
3
3
  # Dotenv
4
4
  module Dotenv
5
5
  # Gem version
6
- VERSION = '0.0.4'
6
+ VERSION = '0.0.5'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-dotenv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Paulo Lethier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-10 00:00:00.000000000 Z
11
+ date: 2019-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -94,8 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  requirements: []
97
- rubyforge_project:
98
- rubygems_version: 2.6.8
97
+ rubygems_version: 3.0.1
99
98
  signing_key:
100
99
  specification_version: 4
101
100
  summary: Dotenv tasks for capistrano deployment