capistrano-env 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +2 -0
- data/Guardfile +15 -10
- data/README.md +13 -3
- data/capistrano-env.gemspec +1 -1
- data/lib/capistrano/env/config.rb +12 -3
- data/lib/capistrano/env/formatter/dotenv_formatter.rb +15 -0
- data/lib/capistrano/env/formatter/ruby_formatter.rb +2 -2
- data/lib/capistrano/env/version.rb +1 -1
- data/lib/capistrano/env.rb +5 -0
- data/spec/capistrano/env/formatter/dotenv_formatter_spec.rb +12 -0
- data/spec/capistrano/env/formatter/ruby_formatter_spec.rb +1 -0
- data/spec/rails_helper.rb +2 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 550785f8cee8eb6aa25a022631db453481d3bcee
|
4
|
+
data.tar.gz: 13c5af95d7e0b000a192062eef021f1e297f01bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a082f8b3daec5596c9a82567cc9d513524ed91b411d5e53aac5336756e743d8c6448e04b8f3f43631c52ab449b0e91b1989be54c0c82f4eeac8c13562c792f5
|
7
|
+
data.tar.gz: 4a805077d5574262e75bff2b0c159065a8f0c9e7619011b96b7dc63bf63f653d00ecafdf1eba463cd39d54c2fa7834735e00553baf5535ec0e281eec23d7ca42
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -1,16 +1,21 @@
|
|
1
1
|
# A sample Guardfile
|
2
2
|
# More info at https://github.com/guard/guard#readme
|
3
3
|
|
4
|
-
|
4
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
5
|
+
# rspec may be run, below are examples of the most common uses.
|
6
|
+
# * bundler: 'bundle exec rspec'
|
7
|
+
# * bundler binstubs: 'bin/rspec'
|
8
|
+
# * spring: 'bin/rsspec' (This will use spring if running and you have
|
9
|
+
# installed the spring binstubs per the docs)
|
10
|
+
# * zeus: 'zeus rspec' (requires the server to be started separetly)
|
11
|
+
# * 'just' rspec: 'rspec'
|
12
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
5
13
|
watch(%r{^spec/.+_spec\.rb$})
|
6
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
|
-
watch('spec/
|
14
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
15
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
16
|
+
end
|
8
17
|
|
9
|
-
|
10
|
-
watch(%r{
|
11
|
-
watch(%r{
|
12
|
-
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
-
watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
|
14
|
-
watch('config/routes.rb') { 'spec/routing' }
|
15
|
-
watch('app/controllers/application_controller.rb') { 'spec/controllers' }
|
18
|
+
guard :rubocop, cli: '--auto-correct' do
|
19
|
+
watch(%r{.+\.rb$})
|
20
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
16
21
|
end
|
data/README.md
CHANGED
@@ -1,7 +1,16 @@
|
|
1
|
-
|
1
|
+
[![Build Status](https://travis-ci.org/masarakki/capistrano-env.svg?branch=master)](https://travis-ci.org/masarakki/capistrano-env?branch=master)
|
2
|
+
[![Dependency Status](https://gemnasium.com/masarakki/capistrano-env.svg)](https://gemnasium.com/masarakki/capistrano-env)
|
3
|
+
[![Coverage Status](https://img.shields.io/coveralls/masarakki/capistrano-env.svg)](https://coveralls.io/r/masarakki/capistrano-env?branch=master)
|
2
4
|
|
5
|
+
# Capistrano::Env
|
3
6
|
Capistrano with Env via file
|
4
7
|
|
8
|
+
## Notice!
|
9
|
+
|
10
|
+
`ruby_formatter` will deprecated at `0.2.x` and it will be removed at next version (`>= 0.3`).
|
11
|
+
Now `dotenv_formatter` is avaiable, it create `.env` file instead of `capenv.rb` file,
|
12
|
+
and use `dotenv` or `dotenv-rails` gem to read `.env` file.
|
13
|
+
|
5
14
|
## Installation
|
6
15
|
|
7
16
|
Add this line to your application's Gemfile:
|
@@ -29,6 +38,7 @@ capenv.use do |env|
|
|
29
38
|
end
|
30
39
|
env.add 'UNICORN_PROCESSES'
|
31
40
|
env.add 'HOGE', 'hage'
|
41
|
+
env.formatter = :dotenv #=> default is :ruby, but it is deprecated now.
|
32
42
|
end
|
33
43
|
```
|
34
44
|
|
@@ -38,8 +48,8 @@ end
|
|
38
48
|
bundle exec cap production deploy
|
39
49
|
```
|
40
50
|
|
41
|
-
- automaticaly create #{current_path}
|
42
|
-
- automaticaly load #{current_path}
|
51
|
+
- automaticaly create #{current_path}/.env
|
52
|
+
- automaticaly load #{current_path}/.env if you use dotenv-rails
|
43
53
|
- you should load manualy in other framework
|
44
54
|
- you can use ENV['ENV_NAME'] in application
|
45
55
|
|
data/capistrano-env.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
|
-
|
20
|
+
spec.post_install_message = 'formatter :ruby is deprecated! use :dotenv instead of :ruby.'
|
21
21
|
spec.add_dependency 'rails', '>= 3.0', '< 5.0'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
@@ -4,11 +4,20 @@ module Capistrano
|
|
4
4
|
attr_accessor :formatter
|
5
5
|
|
6
6
|
def initialize
|
7
|
-
@formatter = :ruby
|
8
7
|
@values = {}
|
9
8
|
@keys = []
|
10
9
|
end
|
11
10
|
|
11
|
+
def formatter
|
12
|
+
self.formatter = :ruby unless @formatter
|
13
|
+
@formatter
|
14
|
+
end
|
15
|
+
|
16
|
+
def formatter=(value)
|
17
|
+
warn 'formatter :ruby is deprecated! use :dotenv with dotenv(-rails).gem' if value == :ruby
|
18
|
+
@formatter = value
|
19
|
+
end
|
20
|
+
|
12
21
|
def add(name_or_regexp, val = nil, &block)
|
13
22
|
if val && name_or_regexp.is_a?(String)
|
14
23
|
@values[name_or_regexp] = val
|
@@ -19,7 +28,7 @@ module Capistrano
|
|
19
28
|
|
20
29
|
def formatter_class
|
21
30
|
@formatter_class ||= begin
|
22
|
-
require "capistrano/env/formatter/#{
|
31
|
+
require "capistrano/env/formatter/#{formatter}_formatter"
|
23
32
|
Capistrano::Env::Formatter.const_get "#{formatter.capitalize}Formatter"
|
24
33
|
end
|
25
34
|
end
|
@@ -35,7 +44,7 @@ module Capistrano
|
|
35
44
|
end
|
36
45
|
|
37
46
|
def capenv_file
|
38
|
-
|
47
|
+
formatter_class.filename
|
39
48
|
end
|
40
49
|
|
41
50
|
def capenv_content
|
data/lib/capistrano/env.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'capistrano/env/formatter/dotenv_formatter'
|
3
|
+
|
4
|
+
describe Capistrano::Env::Formatter::DotenvFormatter do
|
5
|
+
let(:envs) { { 'HELLO' => 'WORLD', 'HOGE' => '1,2,3' } }
|
6
|
+
expect_string = <<EOF
|
7
|
+
HELLO="WORLD"
|
8
|
+
HOGE="1,2,3"
|
9
|
+
EOF
|
10
|
+
it { expect(described_class.format(envs)).to eq expect_string }
|
11
|
+
it { expect(described_class.filename).to eq '.env' }
|
12
|
+
end
|
data/spec/rails_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-env
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- masarakki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -148,11 +148,13 @@ files:
|
|
148
148
|
- lib/capistrano-env.rb
|
149
149
|
- lib/capistrano/env.rb
|
150
150
|
- lib/capistrano/env/config.rb
|
151
|
+
- lib/capistrano/env/formatter/dotenv_formatter.rb
|
151
152
|
- lib/capistrano/env/formatter/ruby_formatter.rb
|
152
153
|
- lib/capistrano/env/plugin.rb
|
153
154
|
- lib/capistrano/env/railtie.rb
|
154
155
|
- lib/capistrano/env/version.rb
|
155
156
|
- spec/capistrano/env/config_spec.rb
|
157
|
+
- spec/capistrano/env/formatter/dotenv_formatter_spec.rb
|
156
158
|
- spec/capistrano/env/formatter/ruby_formatter_spec.rb
|
157
159
|
- spec/capistrano/env/plugin_spec.rb
|
158
160
|
- spec/capistrano/env/railtie_spec.rb
|
@@ -211,7 +213,7 @@ homepage: https://github.com/masarakki/capistrano-env
|
|
211
213
|
licenses:
|
212
214
|
- MIT
|
213
215
|
metadata: {}
|
214
|
-
post_install_message:
|
216
|
+
post_install_message: formatter :ruby is deprecated! use :dotenv instead of :ruby.
|
215
217
|
rdoc_options: []
|
216
218
|
require_paths:
|
217
219
|
- lib
|
@@ -233,6 +235,7 @@ specification_version: 4
|
|
233
235
|
summary: capistrano with environments
|
234
236
|
test_files:
|
235
237
|
- spec/capistrano/env/config_spec.rb
|
238
|
+
- spec/capistrano/env/formatter/dotenv_formatter_spec.rb
|
236
239
|
- spec/capistrano/env/formatter/ruby_formatter_spec.rb
|
237
240
|
- spec/capistrano/env/plugin_spec.rb
|
238
241
|
- spec/capistrano/env/railtie_spec.rb
|