envyable 1.0.0 → 1.1.0
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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +8 -3
- data/CHANGELOG.md +10 -0
- data/Gemfile +5 -0
- data/README.md +20 -1
- data/bin/envyable +6 -0
- data/envyable.gemspec +2 -0
- data/lib/envyable/cli.rb +20 -0
- data/lib/envyable/version.rb +1 -1
- data/spec/envyable/cli_spec.rb +42 -0
- data/spec/spec_helper.rb +21 -0
- metadata +32 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9af9099263d420d122e266e2342e8896eaa656e2
|
|
4
|
+
data.tar.gz: 838d6e0b501c7b82b101cddee16a5804cfd21029
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c15fcfebd3d6f87e7c5a6b3ddebfe0ae5c8ea374e696a49432cf6eb138706e72b65d9a30a712fd5052f52a831ae9a4b972db45d0da45c6c95b2f789072afdbd6
|
|
7
|
+
data.tar.gz: 816bad4d47b57e8830233288c814d2439766cdf587643186e62f71df69a93d340ee866d41d54c1ac5db31f656e1c6010ca86839e80b9442217f6f9608ba8b671
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# ChangeLog
|
|
2
2
|
|
|
3
|
+
## 1.1.0 / 2016-08-31
|
|
4
|
+
|
|
5
|
+
* [FEATURE] New envyable executable with a single command: `envyable install`. Will setup a good default for envyable, including `config/env.yml` and `config/env.yml.example` files and gitignoring the `config/env.yml` file.
|
|
6
|
+
* [ENHANCEMENT] Adds code coverage report
|
|
7
|
+
* [ENHANCEMENT] Adds Code Climate score and coverage report badges to README
|
|
8
|
+
|
|
9
|
+
## 1.0.0 / 2016-01-24
|
|
10
|
+
|
|
11
|
+
* [FEATURE] If you have gems that require variables to be set earlier, then place `envyable` in the `Gemfile` before those gems and require `envyable/rails-now`. Thanks to @mikelkew.
|
|
12
|
+
|
|
3
13
|
## 0.2.0 / 2015-03-16
|
|
4
14
|
|
|
5
15
|
* [FEATURE] Allows user to add default values and then override on an environment by environment basis
|
data/Gemfile
CHANGED
|
@@ -3,6 +3,11 @@ source 'https://rubygems.org'
|
|
|
3
3
|
# Specify your gem's dependencies in envyable.gemspec
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
|
+
group :test do
|
|
7
|
+
gem "codeclimate-test-reporter", :require => nil
|
|
8
|
+
gem "simplecov", "~> 0.12", :require => nil
|
|
9
|
+
end
|
|
10
|
+
|
|
6
11
|
platforms :rbx do
|
|
7
12
|
gem 'racc'
|
|
8
13
|
gem 'rubysl', '~> 2.0'
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The simplest yaml to ENV config loader.
|
|
4
4
|
|
|
5
|
-
[](https://travis-ci.org/philnash/envyable) [](https://codeclimate.com/github/philnash/envyable) [](https://codeclimate.com/github/philnash/envyable/coverage)
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -18,6 +18,25 @@ Or install it yourself as:
|
|
|
18
18
|
|
|
19
19
|
$ gem install envyable
|
|
20
20
|
|
|
21
|
+
### Install task
|
|
22
|
+
|
|
23
|
+
Once the gem is included in your project, you can then use it to generate the
|
|
24
|
+
default required files. Just run:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
$ envyable install
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
and you will get a `config` directory containing an `env.yml` and a
|
|
31
|
+
`env.yml.example` file. If you have a `.gitignore` file this will also append
|
|
32
|
+
the line
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
/config/env.yml
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
to your config so that you do not check in `/config/env.yml`.
|
|
39
|
+
|
|
21
40
|
## Usage
|
|
22
41
|
|
|
23
42
|
### YAML file
|
data/bin/envyable
ADDED
data/envyable.gemspec
CHANGED
|
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
19
|
spec.require_paths = ["lib"]
|
|
20
20
|
|
|
21
|
+
spec.add_dependency "thor", ">= 0.18.1", "< 2.0"
|
|
22
|
+
|
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
|
22
24
|
spec.add_development_dependency "minitest"
|
|
23
25
|
spec.add_development_dependency "rake"
|
data/lib/envyable/cli.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "thor"
|
|
2
|
+
|
|
3
|
+
module Envyable
|
|
4
|
+
class CLI < Thor
|
|
5
|
+
include Thor::Actions
|
|
6
|
+
|
|
7
|
+
namespace :envyable
|
|
8
|
+
|
|
9
|
+
desc "install", "Installs Envyable with sensible defaults"
|
|
10
|
+
def install
|
|
11
|
+
create_file("config/env.yml")
|
|
12
|
+
create_file("config/env.yml.example")
|
|
13
|
+
if File.exists?("#{destination_root}/.gitignore")
|
|
14
|
+
append_to_file(".gitignore") do
|
|
15
|
+
"\n# Don't check in credentials \nconfig/env.yml"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/envyable/version.rb
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
|
2
|
+
require File.expand_path('../../../lib/envyable/cli', __FILE__)
|
|
3
|
+
|
|
4
|
+
describe Envyable::CLI do
|
|
5
|
+
before do
|
|
6
|
+
::FileUtils.rm_rf(destination_root)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
let(:cli) { Envyable::CLI.new([], {}, :destination_root => destination_root) }
|
|
10
|
+
|
|
11
|
+
describe "install" do
|
|
12
|
+
it "should create a file in config/env.yml" do
|
|
13
|
+
env_yml = "#{cli.destination_root}/config/env.yml"
|
|
14
|
+
File.exists?(env_yml).must_equal false
|
|
15
|
+
capture_io { cli.install }
|
|
16
|
+
File.exists?(env_yml).must_equal true
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should create a file in config/env.yml.example" do
|
|
20
|
+
env_yml_example = "#{cli.destination_root}/config/env.yml.example"
|
|
21
|
+
File.exists?(env_yml_example).must_equal false
|
|
22
|
+
capture_io { cli.install }
|
|
23
|
+
File.exists?(env_yml_example).must_equal true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should not create a .gitignore" do
|
|
27
|
+
gitignore = "#{cli.destination_root}/.gitignore"
|
|
28
|
+
File.exists?(gitignore).must_equal false
|
|
29
|
+
capture_io { cli.install }
|
|
30
|
+
File.exists?(gitignore).must_equal false
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "should add config/env.yml to existing .gitignore" do
|
|
34
|
+
gitignore = "#{cli.destination_root}/.gitignore"
|
|
35
|
+
cli = Envyable::CLI.new([], {}, :destination_root => destination_root(:with_gitignore => true))
|
|
36
|
+
File.exists?(gitignore).must_equal true
|
|
37
|
+
File.readlines(gitignore).none? { |line| line == "config/env.yml" }.must_equal true
|
|
38
|
+
capture_io { cli.install }
|
|
39
|
+
File.readlines(gitignore).any? { |line| line == "config/env.yml" }.must_equal true
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
|
+
require 'fileutils'
|
|
1
2
|
require 'rubygems'
|
|
3
|
+
begin
|
|
4
|
+
require "simplecov"
|
|
5
|
+
require "codeclimate-test-reporter"
|
|
6
|
+
SimpleCov.start do
|
|
7
|
+
formatter SimpleCov::Formatter::MultiFormatter.new([
|
|
8
|
+
SimpleCov::Formatter::HTMLFormatter,
|
|
9
|
+
CodeClimate::TestReporter::Formatter
|
|
10
|
+
])
|
|
11
|
+
add_filter "/spec/"
|
|
12
|
+
end
|
|
13
|
+
rescue LoadError
|
|
14
|
+
end
|
|
15
|
+
|
|
2
16
|
gem 'minitest'
|
|
3
17
|
require 'minitest/autorun'
|
|
4
18
|
|
|
5
19
|
require File.join(File.dirname(__FILE__), '..', 'lib', 'envyable')
|
|
20
|
+
|
|
21
|
+
def destination_root(opts={})
|
|
22
|
+
dir = File.join(File.dirname(__FILE__), "sandbox")
|
|
23
|
+
FileUtils.mkdir_p(dir)
|
|
24
|
+
FileUtils.touch("#{dir}/.gitignore") if opts[:with_gitignore]
|
|
25
|
+
dir
|
|
26
|
+
end
|
metadata
CHANGED
|
@@ -1,22 +1,42 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: envyable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Phil Nash
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.18.1
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '2.0'
|
|
22
|
+
name: thor
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: 0.18.1
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.0'
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
15
34
|
requirement: !ruby/object:Gem::Requirement
|
|
16
35
|
requirements:
|
|
17
36
|
- - "~>"
|
|
18
37
|
- !ruby/object:Gem::Version
|
|
19
38
|
version: '1.3'
|
|
39
|
+
name: bundler
|
|
20
40
|
type: :development
|
|
21
41
|
prerelease: false
|
|
22
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -25,12 +45,12 @@ dependencies:
|
|
|
25
45
|
- !ruby/object:Gem::Version
|
|
26
46
|
version: '1.3'
|
|
27
47
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: minitest
|
|
29
48
|
requirement: !ruby/object:Gem::Requirement
|
|
30
49
|
requirements:
|
|
31
50
|
- - ">="
|
|
32
51
|
- !ruby/object:Gem::Version
|
|
33
52
|
version: '0'
|
|
53
|
+
name: minitest
|
|
34
54
|
type: :development
|
|
35
55
|
prerelease: false
|
|
36
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -39,12 +59,12 @@ dependencies:
|
|
|
39
59
|
- !ruby/object:Gem::Version
|
|
40
60
|
version: '0'
|
|
41
61
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: rake
|
|
43
62
|
requirement: !ruby/object:Gem::Requirement
|
|
44
63
|
requirements:
|
|
45
64
|
- - ">="
|
|
46
65
|
- !ruby/object:Gem::Version
|
|
47
66
|
version: '0'
|
|
67
|
+
name: rake
|
|
48
68
|
type: :development
|
|
49
69
|
prerelease: false
|
|
50
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -55,7 +75,8 @@ dependencies:
|
|
|
55
75
|
description: The simplest yaml to ENV config loader
|
|
56
76
|
email:
|
|
57
77
|
- philnash@gmail.com
|
|
58
|
-
executables:
|
|
78
|
+
executables:
|
|
79
|
+
- envyable
|
|
59
80
|
extensions: []
|
|
60
81
|
extra_rdoc_files: []
|
|
61
82
|
files:
|
|
@@ -66,12 +87,15 @@ files:
|
|
|
66
87
|
- LICENSE.txt
|
|
67
88
|
- README.md
|
|
68
89
|
- Rakefile
|
|
90
|
+
- bin/envyable
|
|
69
91
|
- envyable.gemspec
|
|
70
92
|
- lib/envyable.rb
|
|
93
|
+
- lib/envyable/cli.rb
|
|
71
94
|
- lib/envyable/loader.rb
|
|
72
95
|
- lib/envyable/rails-now.rb
|
|
73
96
|
- lib/envyable/railtie.rb
|
|
74
97
|
- lib/envyable/version.rb
|
|
98
|
+
- spec/envyable/cli_spec.rb
|
|
75
99
|
- spec/envyable/loader_spec.rb
|
|
76
100
|
- spec/envyable_spec.rb
|
|
77
101
|
- spec/fixtures/default_env.yml
|
|
@@ -97,11 +121,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
97
121
|
version: '0'
|
|
98
122
|
requirements: []
|
|
99
123
|
rubyforge_project:
|
|
100
|
-
rubygems_version: 2.
|
|
124
|
+
rubygems_version: 2.6.2
|
|
101
125
|
signing_key:
|
|
102
126
|
specification_version: 4
|
|
103
127
|
summary: The simplest yaml to ENV config loader
|
|
104
128
|
test_files:
|
|
129
|
+
- spec/envyable/cli_spec.rb
|
|
105
130
|
- spec/envyable/loader_spec.rb
|
|
106
131
|
- spec/envyable_spec.rb
|
|
107
132
|
- spec/fixtures/default_env.yml
|