figaro 1.1.1 → 1.3.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 +5 -5
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/test.yml +88 -0
- data/.gitignore +1 -1
- data/CHANGELOG.md +14 -0
- data/Gemfile +5 -5
- data/README.md +80 -26
- data/figaro.gemspec +7 -5
- data/gemfiles/rails52.gemfile +11 -0
- data/gemfiles/rails60.gemfile +14 -0
- data/gemfiles/rails61.gemfile +14 -0
- data/gemfiles/rails70.gemfile +14 -0
- data/gemfiles/rails71.gemfile +11 -0
- data/gemfiles/rails72.gemfile +11 -0
- data/gemfiles/rails80.gemfile +11 -0
- data/lib/figaro/cli/heroku_set.rb +1 -1
- data/lib/figaro/cli/install.rb +1 -1
- data/lib/figaro/cli/task.rb +4 -0
- data/lib/figaro/cli.rb +1 -0
- data/spec/figaro/cli/heroku_set_spec.rb +7 -7
- data/spec/figaro/cli/install_spec.rb +13 -13
- data/spec/rails_spec.rb +21 -12
- data/spec/spec_helper.rb +0 -5
- data/spec/support/aruba.rb +2 -3
- metadata +44 -28
- data/.travis.yml +0 -34
- data/gemfiles/rails30.gemfile +0 -12
- data/gemfiles/rails31.gemfile +0 -12
- data/gemfiles/rails32.gemfile +0 -12
- data/gemfiles/rails40.gemfile +0 -12
- data/gemfiles/rails41.gemfile +0 -12
- data/gemfiles/rails42.gemfile +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bdaaa0a7cac3d362062d3d63ef74be9af676e302274f08fd43d443d85422927a
|
4
|
+
data.tar.gz: 05e57a8425d83a1d6eaf8f01cd9f4d037e1a2e4fe9e31284284496f0cd7947ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7194d71d4b22877185bcd260b19f8d03101a051baa76712b8d56626c0418b2a60c5aceaf2b1731b3f496e9879b614e1970ce4fe3fe4dca4643b0ab2afb50a19
|
7
|
+
data.tar.gz: 2a3a0eeeef55d16d98a5ecff47d3da36a893d7ae074fb22e60c45a09305fdbceddb8ff9e5abe94e7f6823eb47eff0b9176625e22b87b5cfe63e598c3f46d4571
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
github: [laserlemon]
|
@@ -0,0 +1,88 @@
|
|
1
|
+
name: Test
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- main
|
6
|
+
pull_request:
|
7
|
+
branches:
|
8
|
+
- main
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
env:
|
12
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
|
13
|
+
name: Test
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
include:
|
19
|
+
- gemfile: gemfiles/rails52.gemfile
|
20
|
+
ruby: "2.5"
|
21
|
+
- gemfile: gemfiles/rails52.gemfile
|
22
|
+
ruby: "2.6"
|
23
|
+
- gemfile: gemfiles/rails52.gemfile
|
24
|
+
ruby: "2.7"
|
25
|
+
- gemfile: gemfiles/rails60.gemfile
|
26
|
+
ruby: "2.5"
|
27
|
+
- gemfile: gemfiles/rails60.gemfile
|
28
|
+
ruby: "2.6"
|
29
|
+
- gemfile: gemfiles/rails60.gemfile
|
30
|
+
ruby: "2.7"
|
31
|
+
- gemfile: gemfiles/rails61.gemfile
|
32
|
+
ruby: "2.5"
|
33
|
+
- gemfile: gemfiles/rails61.gemfile
|
34
|
+
ruby: "2.6"
|
35
|
+
- gemfile: gemfiles/rails61.gemfile
|
36
|
+
ruby: "2.7"
|
37
|
+
- gemfile: gemfiles/rails61.gemfile
|
38
|
+
ruby: "3.0"
|
39
|
+
- gemfile: gemfiles/rails70.gemfile
|
40
|
+
ruby: "2.7"
|
41
|
+
- gemfile: gemfiles/rails70.gemfile
|
42
|
+
ruby: "3.0"
|
43
|
+
- gemfile: gemfiles/rails70.gemfile
|
44
|
+
ruby: "3.1"
|
45
|
+
- gemfile: gemfiles/rails70.gemfile
|
46
|
+
ruby: "3.2"
|
47
|
+
- gemfile: gemfiles/rails71.gemfile
|
48
|
+
ruby: "2.7"
|
49
|
+
- gemfile: gemfiles/rails71.gemfile
|
50
|
+
ruby: "3.0"
|
51
|
+
- gemfile: gemfiles/rails71.gemfile
|
52
|
+
ruby: "3.1"
|
53
|
+
- gemfile: gemfiles/rails71.gemfile
|
54
|
+
ruby: "3.2"
|
55
|
+
- gemfile: gemfiles/rails71.gemfile
|
56
|
+
ruby: "3.3"
|
57
|
+
- gemfile: gemfiles/rails72.gemfile
|
58
|
+
ruby: "3.1"
|
59
|
+
- gemfile: gemfiles/rails72.gemfile
|
60
|
+
ruby: "3.2"
|
61
|
+
- gemfile: gemfiles/rails72.gemfile
|
62
|
+
ruby: "3.3"
|
63
|
+
- gemfile: gemfiles/rails72.gemfile
|
64
|
+
ruby: "3.4"
|
65
|
+
- gemfile: gemfiles/rails80.gemfile
|
66
|
+
ruby: "3.2"
|
67
|
+
- gemfile: gemfiles/rails80.gemfile
|
68
|
+
ruby: "3.3"
|
69
|
+
- gemfile: gemfiles/rails80.gemfile
|
70
|
+
ruby: "3.4"
|
71
|
+
- gemfile: Gemfile
|
72
|
+
ruby: ruby
|
73
|
+
- gemfile: Gemfile
|
74
|
+
ruby: head
|
75
|
+
steps:
|
76
|
+
- uses: actions/checkout@v4
|
77
|
+
- name: Set up Ruby
|
78
|
+
uses: ruby/setup-ruby@v1
|
79
|
+
with:
|
80
|
+
ruby-version: ${{ matrix.ruby }}
|
81
|
+
bundler-cache: true
|
82
|
+
- name: Print dependency versions
|
83
|
+
run: |
|
84
|
+
ruby --version
|
85
|
+
bundle exec rails --version
|
86
|
+
bundle list
|
87
|
+
- name: Run RSpec
|
88
|
+
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## 1.3.0 / 2025-06-25
|
2
|
+
|
3
|
+
* [ENHANCEMENT] Drop support for Rubies before 2.5
|
4
|
+
* [ENHANCEMENT] Add support for Rubies 3.0, 3.1, 3.2, 3.3, and 3.4
|
5
|
+
* [ENHANCEMENT] Add support for Rails 6, 7, and 8
|
6
|
+
|
7
|
+
## 1.2.0 / 2020-05-10
|
8
|
+
|
9
|
+
* [ENHANCEMENT] Drop support for Rubies 1.9.3, 2.0, 2.1, and 2.2
|
10
|
+
* [ENHANCEMENT] Add support for Rubies 2.5, 2.6, and 2.7
|
11
|
+
* [ENHANCEMENT] Drop support for Rails 3 and 4
|
12
|
+
* [ENHANCEMENT] Add support for Rails 5.2 and 6.0
|
13
|
+
* [ENHANCEMENT] Proxy all ENV values via CLI to the "heroku" command
|
14
|
+
|
1
15
|
## 1.1.1 / 2015-04-30
|
2
16
|
|
3
17
|
* [BUGFIX] Fix crash when environment-specific configuration is `nil`
|
data/Gemfile
CHANGED
@@ -2,11 +2,11 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem "rails", ">=
|
5
|
+
gem "rails", ">= 5.2.0", "< 9"
|
6
6
|
|
7
7
|
group :test do
|
8
|
-
gem "aruba", "~>
|
9
|
-
gem "
|
10
|
-
gem "rspec", "~> 3.
|
11
|
-
gem "sqlite3"
|
8
|
+
gem "aruba", "~> 2.1"
|
9
|
+
gem "ostruct"
|
10
|
+
gem "rspec", "~> 3.13"
|
11
|
+
gem "sqlite3"
|
12
12
|
end
|
data/README.md
CHANGED
@@ -1,30 +1,47 @@
|
|
1
|
-
|
1
|
+
> [!IMPORTANT]
|
2
|
+
> Figaro [v2](https://github.com/laserlemon/figaro/tree/v2) development is underway but _stalled_. I need your help! Please consider [sponsoring Figaro's development](https://github.com/sponsors/laserlemon).
|
3
|
+
>
|
4
|
+
> With the constraints of a family and a full-time job, even the _emotional_ support that sponsorship provides is extremely valuable in re-energizing Figaro development. Thank you! 💛
|
5
|
+
|
6
|
+
<h1>
|
7
|
+
<picture>
|
8
|
+
<source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/5fc9ba97-8288-4228-ba4d-03b2bdcdf0f4">
|
9
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/1cd8ae2e-afd4-4930-bdc9-147b787ea3fe">
|
10
|
+
<img alt="Figaro" src="https://github.com/user-attachments/assets/5fc9ba97-8288-4228-ba4d-03b2bdcdf0f4" style="height:2em">
|
11
|
+
</picture>
|
12
|
+
</h1>
|
2
13
|
|
3
14
|
Simple, Heroku-friendly Rails app configuration using `ENV` and a single YAML file
|
4
15
|
|
5
|
-
[](https://codeclimate.com/github/laserlemon/figaro)
|
9
|
-
[](https://gemnasium.com/laserlemon/figaro)
|
16
|
+
[](https://github.com/laserlemon)
|
17
|
+
[](https://rubygems.org/gems/figaro)
|
18
|
+
[](https://github.com/laserlemon/figaro/actions)
|
10
19
|
|
11
|
-
**NOTE:** If you're using Figaro 0.7 or prior, please refer to the
|
20
|
+
**NOTE:** If you're using Figaro 0.7 or prior, please refer to the
|
21
|
+
[appropriate documentation](https://github.com/laserlemon/figaro/tree/0-stable#readme)
|
22
|
+
or [upgrade](#how-do-i-upgrade-to-figaro-10) to Figaro 1.0.
|
12
23
|
|
13
24
|
## Why does Figaro exist?
|
14
25
|
|
15
26
|
Figaro was written to make it easy to securely configure Rails applications.
|
16
27
|
|
17
|
-
Configuration values often include sensitive information. Figaro strives to be
|
28
|
+
Configuration values often include sensitive information. Figaro strives to be
|
29
|
+
secure by default by encouraging a convention that keeps configuration out of
|
30
|
+
Git.
|
18
31
|
|
19
32
|
## How does Figaro work?
|
20
33
|
|
21
|
-
Figaro is inspired by the [Twelve-Factor App](http://12factor.net) methodology,
|
34
|
+
Figaro is inspired by the [Twelve-Factor App](http://12factor.net) methodology,
|
35
|
+
which states:
|
22
36
|
|
23
37
|
> The twelve-factor app stores config in environment variables (often shortened to env vars or env). Env vars are easy to change between deploys without changing any code; unlike config files, there is little chance of them being checked into the code repo accidentally; and unlike custom config files, or other config mechanisms such as Java System Properties, they are a language- and OS-agnostic standard.
|
24
38
|
|
25
|
-
This is straightforward in production environments but local development
|
39
|
+
This is straightforward in production environments but local development
|
40
|
+
environments are often shared between multiple applications, requiring multiple
|
41
|
+
configurations.
|
26
42
|
|
27
|
-
Figaro parses a Git-ignored YAML file in your application and loads its values
|
43
|
+
Figaro parses a Git-ignored YAML file in your application and loads its values
|
44
|
+
into `ENV`.
|
28
45
|
|
29
46
|
### Getting Started
|
30
47
|
|
@@ -38,10 +55,11 @@ Figaro installation is easy:
|
|
38
55
|
|
39
56
|
|
40
57
|
```bash
|
41
|
-
$ figaro install
|
58
|
+
$ bundle exec figaro install
|
42
59
|
```
|
43
60
|
|
44
|
-
This creates a commented `config/application.yml` file and adds it to your
|
61
|
+
This creates a commented `config/application.yml` file and adds it to your
|
62
|
+
`.gitignore`. Add your own configuration to this file and you're done!
|
45
63
|
|
46
64
|
### Example
|
47
65
|
|
@@ -65,11 +83,13 @@ Pusher.key = ENV["pusher_key"]
|
|
65
83
|
Pusher.secret = ENV["pusher_secret"]
|
66
84
|
```
|
67
85
|
|
68
|
-
**Please note:** `ENV` is a simple key/value store. All values will be converted
|
86
|
+
**Please note:** `ENV` is a simple key/value store. All values will be converted
|
87
|
+
to strings. Deeply nested configuration structures are not possible.
|
69
88
|
|
70
89
|
### Environment-Specific Configuration
|
71
90
|
|
72
|
-
Oftentimes, local configuration values change depending on Rails environment. In
|
91
|
+
Oftentimes, local configuration values change depending on Rails environment. In
|
92
|
+
such cases, you can add environment-specific values to your configuration file:
|
73
93
|
|
74
94
|
```yaml
|
75
95
|
# config/application.yml
|
@@ -99,7 +119,9 @@ test:
|
|
99
119
|
|
100
120
|
`Figaro.env` is a convenience that acts as a proxy to `ENV`.
|
101
121
|
|
102
|
-
In testing, it is sometimes more convenient to stub and unstub `Figaro.env` than
|
122
|
+
In testing, it is sometimes more convenient to stub and unstub `Figaro.env` than
|
123
|
+
to set and reset `ENV`. Whether your application uses `ENV` or `Figaro.env` is
|
124
|
+
entirely a matter of personal preference.
|
103
125
|
|
104
126
|
```yaml
|
105
127
|
# config/application.yml
|
@@ -121,7 +143,9 @@ Figaro.env.google_analytics_key? # => false
|
|
121
143
|
|
122
144
|
### Required Keys
|
123
145
|
|
124
|
-
If a particular configuration value is required but not set, it's appropriate to
|
146
|
+
If a particular configuration value is required but not set, it's appropriate to
|
147
|
+
raise an error. With Figaro, you can either raise these errors proactively or
|
148
|
+
lazily.
|
125
149
|
|
126
150
|
To proactively require configuration keys:
|
127
151
|
|
@@ -131,9 +155,12 @@ To proactively require configuration keys:
|
|
131
155
|
Figaro.require_keys("pusher_app_id", "pusher_key", "pusher_secret")
|
132
156
|
```
|
133
157
|
|
134
|
-
If any of the configuration keys above are not set, your application will raise
|
158
|
+
If any of the configuration keys above are not set, your application will raise
|
159
|
+
an error during initialization. This method is preferred because it prevents
|
160
|
+
runtime errors in a production application due to improper configuration.
|
135
161
|
|
136
|
-
To require configuration keys lazily, reference the variables via "bang" methods
|
162
|
+
To require configuration keys lazily, reference the variables via "bang" methods
|
163
|
+
on `Figaro.env`:
|
137
164
|
|
138
165
|
```ruby
|
139
166
|
# config/initializers/pusher.rb
|
@@ -145,7 +172,9 @@ Pusher.secret = Figaro.env.pusher_secret!
|
|
145
172
|
|
146
173
|
### Deployment
|
147
174
|
|
148
|
-
Figaro is written with deployment in mind. In fact, [Heroku](https://www.heroku.com)'s
|
175
|
+
Figaro is written with deployment in mind. In fact, [Heroku](https://www.heroku.com)'s
|
176
|
+
use of `ENV` for application configuration was the original inspiration for
|
177
|
+
Figaro.
|
149
178
|
|
150
179
|
#### Heroku
|
151
180
|
|
@@ -155,7 +184,8 @@ Heroku already makes setting application configuration easy:
|
|
155
184
|
$ heroku config:set google_analytics_key=UA-35722661-5
|
156
185
|
```
|
157
186
|
|
158
|
-
Using the `figaro` command, you can set values from your configuration file all
|
187
|
+
Using the `figaro` command, you can set values from your configuration file all
|
188
|
+
at once:
|
159
189
|
|
160
190
|
```bash
|
161
191
|
$ figaro heroku:set -e production
|
@@ -207,13 +237,15 @@ Figaro and dotenv were written around the same time to solve similar problems.
|
|
207
237
|
* Figaro was written with a focus on Rails development and conventions.
|
208
238
|
* Dotenv was written to accommodate any type of Ruby application.
|
209
239
|
|
210
|
-
Either library may suit your configuration needs. It often boils down to
|
240
|
+
Either library may suit your configuration needs. It often boils down to
|
241
|
+
personal preference.
|
211
242
|
|
212
243
|
## Is application.yml like [secrets.yml](https://github.com/rails/rails/blob/v4.1.0/railties/lib/rails/generators/rails/app/templates/config/secrets.yml)?
|
213
244
|
|
214
245
|
Yes. Kind of.
|
215
246
|
|
216
|
-
Rails 4.1 introduced the `secrets.yml` convention for Rails application
|
247
|
+
Rails 4.1 introduced the `secrets.yml` convention for Rails application
|
248
|
+
configuration. Figaro predated the Rails 4.1 release by two years.
|
217
249
|
|
218
250
|
### Similarities
|
219
251
|
|
@@ -239,7 +271,10 @@ Rails 4.1 introduced the `secrets.yml` convention for Rails application configur
|
|
239
271
|
* Figaro is inspired by Twelve-Factor App's concept of proper [configuration](http://12factor.net/config).
|
240
272
|
* Secrets are… not.
|
241
273
|
|
242
|
-
The emergence of a configuration convention for Rails is an important step, but
|
274
|
+
The emergence of a configuration convention for Rails is an important step, but
|
275
|
+
as long as the last three differences above exist, Figaro will continue to be
|
276
|
+
developed as a more secure, more consistent, and more standards-compliant
|
277
|
+
alternative to `secrets.yml`.
|
243
278
|
|
244
279
|
For more information, read the original [The Marriage of Figaro… and Rails](http://www.collectiveidea.com/blog/archives/2013/12/18/the-marriage-of-figaro-and-rails/) blog post.
|
245
280
|
|
@@ -284,14 +319,33 @@ $ figaro help heroku:set
|
|
284
319
|
**NOTE:** The environment option is required for the `heroku:set` command. The
|
285
320
|
Rake task in Figaro 0.7 used the default of "development" if unspecified.
|
286
321
|
|
322
|
+
### Spring Configuration
|
323
|
+
|
324
|
+
If you're using Spring, either [stop](http://collectiveidea.com/blog/archives/2015/02/04/spring-is-dead-to-me)
|
325
|
+
or add `config/application.yml` to the watch list:
|
326
|
+
|
327
|
+
```rb
|
328
|
+
# config/spring.rb
|
329
|
+
|
330
|
+
%w(
|
331
|
+
...
|
332
|
+
config/application.yml
|
333
|
+
).each { |path| Spring.watch(path) }
|
334
|
+
```
|
335
|
+
|
287
336
|
## Who wrote Figaro?
|
288
337
|
|
289
|
-
My name is Steve Richert and I wrote Figaro in March, 2012 with overwhelming
|
338
|
+
My name is Steve Richert and I wrote Figaro in March, 2012 with overwhelming
|
339
|
+
encouragement from my employer, [Collective Idea](http://www.collectiveidea.com).
|
340
|
+
Figaro has improved very much since then, thanks entirely to [inspiration](https://github.com/laserlemon/figaro/issues)
|
341
|
+
and [contribution](https://github.com/laserlemon/figaro/graphs/contributors)
|
342
|
+
from developers everywhere.
|
290
343
|
|
291
344
|
**Thank you!**
|
292
345
|
|
293
346
|
## How can I help?
|
294
347
|
|
295
|
-
Figaro is open source and contributions from the community are encouraged! No
|
348
|
+
Figaro is open source and contributions from the community are encouraged! No
|
349
|
+
contribution is too small.
|
296
350
|
|
297
351
|
See Figaro's [contribution guidelines](CONTRIBUTING.md) for more information.
|
data/figaro.gemspec
CHANGED
@@ -2,19 +2,21 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "figaro"
|
5
|
-
gem.version = "1.
|
5
|
+
gem.version = "1.3.0"
|
6
6
|
|
7
7
|
gem.author = "Steve Richert"
|
8
|
-
gem.email = "steve.richert@
|
8
|
+
gem.email = "steve.richert@hey.com"
|
9
9
|
gem.summary = "Simple Rails app configuration"
|
10
10
|
gem.description = "Simple, Heroku-friendly Rails app configuration using ENV and a single YAML file"
|
11
11
|
gem.homepage = "https://github.com/laserlemon/figaro"
|
12
12
|
gem.license = "MIT"
|
13
13
|
|
14
|
-
gem.
|
14
|
+
gem.required_ruby_version = ">= 2.5.0"
|
15
15
|
|
16
|
-
gem.
|
17
|
-
|
16
|
+
gem.add_dependency "thor", ">= 0.14.0", "< 2"
|
17
|
+
|
18
|
+
gem.add_development_dependency "bundler", ">= 1.7.0", "< 3"
|
19
|
+
gem.add_development_dependency "rake", ">= 10.4.0", "< 14"
|
18
20
|
|
19
21
|
gem.files = `git ls-files`.split($\)
|
20
22
|
gem.test_files = gem.files.grep(/^spec/)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: ".."
|
4
|
+
|
5
|
+
gem "rails", "~> 6.0.0"
|
6
|
+
|
7
|
+
# See: https://github.com/rails/rails/issues/54263
|
8
|
+
gem "concurrent-ruby", "< 1.3.5"
|
9
|
+
|
10
|
+
group :test do
|
11
|
+
gem "aruba", "~> 2.1"
|
12
|
+
gem "rspec", "~> 3.13"
|
13
|
+
gem "sqlite3", "~> 1.4"
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: ".."
|
4
|
+
|
5
|
+
gem "rails", "~> 6.1.0"
|
6
|
+
|
7
|
+
# See: https://github.com/rails/rails/issues/54263
|
8
|
+
gem "concurrent-ruby", "< 1.3.5"
|
9
|
+
|
10
|
+
group :test do
|
11
|
+
gem "aruba", "~> 2.1"
|
12
|
+
gem "rspec", "~> 3.13"
|
13
|
+
gem "sqlite3", "~> 1.4"
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: ".."
|
4
|
+
|
5
|
+
gem "rails", "~> 7.0.0"
|
6
|
+
|
7
|
+
# See: https://github.com/rails/rails/issues/54263
|
8
|
+
gem "concurrent-ruby", "< 1.3.5"
|
9
|
+
|
10
|
+
group :test do
|
11
|
+
gem "aruba", "~> 2.1"
|
12
|
+
gem "rspec", "~> 3.13"
|
13
|
+
gem "sqlite3", "~> 1.4"
|
14
|
+
end
|
data/lib/figaro/cli/install.rb
CHANGED
data/lib/figaro/cli/task.rb
CHANGED
data/lib/figaro/cli.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
describe "figaro heroku:set" do
|
2
2
|
before do
|
3
|
-
|
3
|
+
create_directory("example")
|
4
4
|
cd("example")
|
5
5
|
write_file("config/application.yml", "foo: bar")
|
6
6
|
end
|
7
7
|
|
8
8
|
it "sends Figaro configuration to Heroku" do
|
9
|
-
|
9
|
+
run_command_and_stop("figaro heroku:set")
|
10
10
|
|
11
11
|
command = commands.last
|
12
12
|
expect(command.name).to eq("heroku")
|
@@ -16,7 +16,7 @@ describe "figaro heroku:set" do
|
|
16
16
|
it "respects path" do
|
17
17
|
write_file("env.yml", "foo: bar")
|
18
18
|
|
19
|
-
|
19
|
+
run_command_and_stop("figaro heroku:set -p env.yml")
|
20
20
|
|
21
21
|
command = commands.last
|
22
22
|
expect(command.name).to eq("heroku")
|
@@ -30,7 +30,7 @@ test:
|
|
30
30
|
foo: baz
|
31
31
|
EOF
|
32
32
|
|
33
|
-
|
33
|
+
run_command_and_stop("figaro heroku:set -e test")
|
34
34
|
|
35
35
|
command = commands.last
|
36
36
|
expect(command.name).to eq("heroku")
|
@@ -38,7 +38,7 @@ EOF
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "targets a specific Heroku app" do
|
41
|
-
|
41
|
+
run_command_and_stop("figaro heroku:set -a foo-bar-app")
|
42
42
|
|
43
43
|
command = commands.last
|
44
44
|
expect(command.name).to eq("heroku")
|
@@ -47,7 +47,7 @@ EOF
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it "targets a specific Heroku git remote" do
|
50
|
-
|
50
|
+
run_command_and_stop("figaro heroku:set -r production")
|
51
51
|
|
52
52
|
command = commands.last
|
53
53
|
expect(command.name).to eq("heroku")
|
@@ -58,7 +58,7 @@ EOF
|
|
58
58
|
it "handles values with special characters" do
|
59
59
|
overwrite_file("config/application.yml", "foo: bar baz")
|
60
60
|
|
61
|
-
|
61
|
+
run_command_and_stop("figaro heroku:set")
|
62
62
|
|
63
63
|
command = commands.last
|
64
64
|
expect(command.name).to eq("heroku")
|
@@ -1,19 +1,19 @@
|
|
1
1
|
describe "figaro install" do
|
2
2
|
before do
|
3
|
-
|
3
|
+
create_directory("example")
|
4
4
|
cd("example")
|
5
5
|
end
|
6
6
|
|
7
7
|
it "creates a configuration file" do
|
8
|
-
|
8
|
+
run_command_and_stop("figaro install")
|
9
9
|
|
10
|
-
|
10
|
+
expect("config/application.yml").to be_an_existing_file
|
11
11
|
end
|
12
12
|
|
13
13
|
it "respects path" do
|
14
|
-
|
14
|
+
run_command_and_stop("figaro install -p env.yml")
|
15
15
|
|
16
|
-
|
16
|
+
expect("env.yml").to be_an_existing_file
|
17
17
|
end
|
18
18
|
|
19
19
|
context "with a .gitignore file" do
|
@@ -25,25 +25,25 @@ EOF
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "Git-ignores the configuration file if applicable" do
|
28
|
-
|
28
|
+
run_command_and_stop("figaro install")
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
expect(".gitignore").to have_file_content(%r(^/foo$))
|
31
|
+
expect(".gitignore").to have_file_content(%r(^/bar$))
|
32
|
+
expect(".gitignore").to have_file_content(%r(^/config/application\.yml$))
|
33
33
|
end
|
34
34
|
|
35
35
|
it "respects path" do
|
36
|
-
|
36
|
+
run_command_and_stop("figaro install -p env.yml")
|
37
37
|
|
38
|
-
|
38
|
+
expect(".gitignore").to have_file_content(%r(^/env\.yml$))
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
context "without a .gitignore file" do
|
43
43
|
it "doesn't generate a new .gitignore file" do
|
44
|
-
|
44
|
+
run_command_and_stop("figaro install")
|
45
45
|
|
46
|
-
|
46
|
+
expect(".gitignore").not_to be_an_existing_file
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
data/spec/rails_spec.rb
CHANGED
@@ -1,15 +1,24 @@
|
|
1
1
|
describe Figaro::Rails do
|
2
2
|
before do
|
3
|
-
|
3
|
+
run_command_and_stop(<<-CMD)
|
4
4
|
rails new example \
|
5
|
-
--
|
5
|
+
--api \
|
6
|
+
--minimal \
|
7
|
+
--no-rc \
|
8
|
+
--skip-asset-pipeline \
|
9
|
+
--skip-bootsnap \
|
6
10
|
--skip-bundle \
|
11
|
+
--skip-gemfile \
|
12
|
+
--skip-git \
|
13
|
+
--skip-javascript \
|
7
14
|
--skip-keeps \
|
15
|
+
--skip-listen \
|
16
|
+
--skip-spring \
|
8
17
|
--skip-sprockets \
|
9
|
-
--skip-
|
10
|
-
--skip-
|
11
|
-
--
|
12
|
-
--
|
18
|
+
--skip-test \
|
19
|
+
--skip-turbolinks \
|
20
|
+
--skip-webpack-install \
|
21
|
+
--skip-yarn
|
13
22
|
CMD
|
14
23
|
cd("example")
|
15
24
|
end
|
@@ -20,9 +29,9 @@ describe Figaro::Rails do
|
|
20
29
|
end
|
21
30
|
|
22
31
|
it "loads application.yml" do
|
23
|
-
|
32
|
+
run_command_and_stop("rails runner 'puts Figaro.env.foo'")
|
24
33
|
|
25
|
-
|
34
|
+
expect(all_stdout).to include("bar")
|
26
35
|
end
|
27
36
|
|
28
37
|
it "happens before database initialization" do
|
@@ -32,9 +41,9 @@ development:
|
|
32
41
|
database: db/<%= ENV["foo"] %>.sqlite3
|
33
42
|
EOF
|
34
43
|
|
35
|
-
|
44
|
+
run_command_and_stop("rake db:migrate")
|
36
45
|
|
37
|
-
|
46
|
+
expect("db/bar.sqlite3").to be_an_existing_file
|
38
47
|
end
|
39
48
|
|
40
49
|
it "happens before application configuration" do
|
@@ -42,9 +51,9 @@ EOF
|
|
42
51
|
config.foo = ENV["foo"]
|
43
52
|
EOL
|
44
53
|
|
45
|
-
|
54
|
+
run_command_and_stop("rails runner 'puts Rails.application.config.foo'")
|
46
55
|
|
47
|
-
|
56
|
+
expect(all_stdout).to include("bar")
|
48
57
|
end
|
49
58
|
end
|
50
59
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/aruba.rb
CHANGED
@@ -2,7 +2,7 @@ require "aruba/api"
|
|
2
2
|
|
3
3
|
module ArubaHelpers
|
4
4
|
def insert_into_file_after(file, pattern, addition)
|
5
|
-
content =
|
5
|
+
content = cd(".") { IO.read(file) }
|
6
6
|
content.sub!(pattern, "\\0\n#{addition}")
|
7
7
|
overwrite_file(file, content)
|
8
8
|
end
|
@@ -13,7 +13,6 @@ RSpec.configure do |config|
|
|
13
13
|
config.include(ArubaHelpers)
|
14
14
|
|
15
15
|
config.before do
|
16
|
-
|
17
|
-
FileUtils.rm_rf(current_dir)
|
16
|
+
setup_aruba
|
18
17
|
end
|
19
18
|
end
|
metadata
CHANGED
@@ -1,68 +1,86 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: figaro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Richert
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: thor
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
|
-
- - "
|
16
|
+
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
18
|
+
version: 0.14.0
|
19
|
+
- - "<"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
23
25
|
requirements:
|
24
|
-
- - "
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 0.14.0
|
29
|
+
- - "<"
|
25
30
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
31
|
+
version: '2'
|
27
32
|
- !ruby/object:Gem::Dependency
|
28
33
|
name: bundler
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
30
35
|
requirements:
|
31
|
-
- - "
|
36
|
+
- - ">="
|
32
37
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
38
|
+
version: 1.7.0
|
39
|
+
- - "<"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '3'
|
34
42
|
type: :development
|
35
43
|
prerelease: false
|
36
44
|
version_requirements: !ruby/object:Gem::Requirement
|
37
45
|
requirements:
|
38
|
-
- - "
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.7.0
|
49
|
+
- - "<"
|
39
50
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
51
|
+
version: '3'
|
41
52
|
- !ruby/object:Gem::Dependency
|
42
53
|
name: rake
|
43
54
|
requirement: !ruby/object:Gem::Requirement
|
44
55
|
requirements:
|
45
|
-
- - "
|
56
|
+
- - ">="
|
46
57
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
58
|
+
version: 10.4.0
|
59
|
+
- - "<"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '14'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 10.4.0
|
69
|
+
- - "<"
|
53
70
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
71
|
+
version: '14'
|
55
72
|
description: Simple, Heroku-friendly Rails app configuration using ENV and a single
|
56
73
|
YAML file
|
57
|
-
email: steve.richert@
|
74
|
+
email: steve.richert@hey.com
|
58
75
|
executables:
|
59
76
|
- figaro
|
60
77
|
extensions: []
|
61
78
|
extra_rdoc_files: []
|
62
79
|
files:
|
80
|
+
- ".github/FUNDING.yml"
|
81
|
+
- ".github/workflows/test.yml"
|
63
82
|
- ".gitignore"
|
64
83
|
- ".rspec"
|
65
|
-
- ".travis.yml"
|
66
84
|
- CHANGELOG.md
|
67
85
|
- CONTRIBUTING.md
|
68
86
|
- Gemfile
|
@@ -71,12 +89,13 @@ files:
|
|
71
89
|
- Rakefile
|
72
90
|
- bin/figaro
|
73
91
|
- figaro.gemspec
|
74
|
-
- gemfiles/
|
75
|
-
- gemfiles/
|
76
|
-
- gemfiles/
|
77
|
-
- gemfiles/
|
78
|
-
- gemfiles/
|
79
|
-
- gemfiles/
|
92
|
+
- gemfiles/rails52.gemfile
|
93
|
+
- gemfiles/rails60.gemfile
|
94
|
+
- gemfiles/rails61.gemfile
|
95
|
+
- gemfiles/rails70.gemfile
|
96
|
+
- gemfiles/rails71.gemfile
|
97
|
+
- gemfiles/rails72.gemfile
|
98
|
+
- gemfiles/rails80.gemfile
|
80
99
|
- lib/figaro.rb
|
81
100
|
- lib/figaro/application.rb
|
82
101
|
- lib/figaro/cli.rb
|
@@ -107,7 +126,6 @@ homepage: https://github.com/laserlemon/figaro
|
|
107
126
|
licenses:
|
108
127
|
- MIT
|
109
128
|
metadata: {}
|
110
|
-
post_install_message:
|
111
129
|
rdoc_options: []
|
112
130
|
require_paths:
|
113
131
|
- lib
|
@@ -115,16 +133,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
133
|
requirements:
|
116
134
|
- - ">="
|
117
135
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
136
|
+
version: 2.5.0
|
119
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
138
|
requirements:
|
121
139
|
- - ">="
|
122
140
|
- !ruby/object:Gem::Version
|
123
141
|
version: '0'
|
124
142
|
requirements: []
|
125
|
-
|
126
|
-
rubygems_version: 2.4.6
|
127
|
-
signing_key:
|
143
|
+
rubygems_version: 3.7.0.dev
|
128
144
|
specification_version: 4
|
129
145
|
summary: Simple Rails app configuration
|
130
146
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
before_install:
|
2
|
-
- gem update bundler rake
|
3
|
-
before_script:
|
4
|
-
- unset RAILS_ENV
|
5
|
-
- unset RACK_ENV
|
6
|
-
branches:
|
7
|
-
only:
|
8
|
-
- master
|
9
|
-
cache: bundler
|
10
|
-
env:
|
11
|
-
global:
|
12
|
-
secure: | # CODECLIMATE_REPO_TOKEN
|
13
|
-
Pm3j2/BtAzMtqRMP83rFvDtpUNeIAdLMzwH62In+3h/AE8gHDArGYS+jmChw
|
14
|
-
2hKVjwzVUTWZlpSEocqAg/YIDB3BJzWmyc6UP+VA0gji6HsufXYTmKAVPSVY
|
15
|
-
TQ7mPPP7hm95e3SkFbLdLbGkQfLdjIKeMY5lY/knX+QKUCjO52Y=
|
16
|
-
gemfile:
|
17
|
-
- gemfiles/rails30.gemfile
|
18
|
-
- gemfiles/rails31.gemfile
|
19
|
-
- gemfiles/rails32.gemfile
|
20
|
-
- gemfiles/rails40.gemfile
|
21
|
-
- gemfiles/rails41.gemfile
|
22
|
-
- gemfiles/rails42.gemfile
|
23
|
-
language: ruby
|
24
|
-
matrix:
|
25
|
-
allow_failures:
|
26
|
-
- rvm: ruby-head
|
27
|
-
rvm:
|
28
|
-
- 1.9.3
|
29
|
-
- "2.0"
|
30
|
-
- "2.1"
|
31
|
-
- "2.2"
|
32
|
-
- ruby-head
|
33
|
-
script: bundle exec rspec
|
34
|
-
sudo: false
|
data/gemfiles/rails30.gemfile
DELETED
data/gemfiles/rails31.gemfile
DELETED
data/gemfiles/rails32.gemfile
DELETED
data/gemfiles/rails40.gemfile
DELETED
data/gemfiles/rails41.gemfile
DELETED
data/gemfiles/rails42.gemfile
DELETED