site_variables 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: eabe42e48502d263c392ff290c4c9269aa123f6c9eff63b2e32a18e5538c1114
4
- data.tar.gz: 996fd1b3f9a811d3cb21fec7ae03f76a55f17f9e6bdf957f2a87e7b0eb4f1525
3
+ metadata.gz: 7140f304b85e733be6e67b8ab8b40feaeabd244d6760d1ab94236467627dbfad
4
+ data.tar.gz: f72d1ebc70f40441d7941af9a35d38254cd997bf99a86153e7dc2b675b7866fc
5
5
  SHA512:
6
- metadata.gz: da4022f52b40c1495302e295783e94d39d436c8d110499538889c790ad669641e731fc27ad2030d2a170ed81cb3bb211c98269b62312c84ece97f0594950036a
7
- data.tar.gz: d30f44313efbe5e2ab38c8b8a0bda4849d4e43af4e8ba6bd9522776e16e9d865ebfb221a7fca9a210c7d2695ad92931ae5b8eaaa0d9bbda9bcba7de8b08816ad
6
+ metadata.gz: d41e4c9a4cb8f9a99f35574eecc94ea8407e5064823e1a1969932ebf6ced820b69ea7ca27d0a793bad5a21accee865bf4e9e348c2ec46ae681dfc1e0ffe1072a
7
+ data.tar.gz: 32f50c1e8e5b52b6333a4722ce7811128b9a33b2004bc08c1b1c9a6f12c32db10b1f5f43d5b6a7912f0346c3a499630c0a9b3789f4ee338ee1e37f61db9b7d96
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # SiteVariables
2
+ Over the years I have become accustomed to using the Rails `secrets.yml` file as a nice config file for any non-sensitve constant variables I'd like to use throughout my application. With Rails 5.2 `secrets.yml` is now removed in favor of encrypted credentials. Overall this is a good thing as it was bad practice to store and commit any sensitive variables into `secrets.yml`.
2
3
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/site_variables`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
4
+ The [site_variables](https://rubygems.org/gems/site_variables) gem allows me to continue my practice of using a YAML file for environment specific non-sensitive variables.
6
5
 
7
6
  ## Installation
8
7
 
@@ -22,13 +21,42 @@ Or install it yourself as:
22
21
 
23
22
  ## Usage
24
23
 
25
- TODO: Write usage instructions here
24
+ After installation run:
25
+
26
+ $rails generate site_variables
27
+
28
+ This gives us two files:
29
+
30
+ 1. `config/initializers/site_variables.rb`
31
+ 2. `config/site_variables.yml`
32
+
33
+ The important file is `site_variables.yml`
34
+ Edit the YAML file with the variables you would like to use. Any environment specific variables (in the `development` or `production` sections for example) will override any variables in the `shared` section.
26
35
 
27
- ## Development
36
+ You now can access your hash of site variables inside your Rails app with the `SITE_VARIABLES` constant.
28
37
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
38
+ ### Example
39
+
40
+ `config/site_variables.yml`:
41
+
42
+ ```
43
+ shared:
44
+ base_url: this will be overriden by the environments
45
+ site_name: My Awesome Site
46
+ support_email: support@myawesomesite.com
30
47
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
48
+ development:
49
+ base_url: https://somengroksubdomain.ngrok.io
50
+
51
+ production:
52
+ base_url: https://myawesomesite.com
53
+ ```
54
+
55
+ In a view:
56
+
57
+ ```
58
+ Welcome to <%= SITE_VARIABLES['site_name'] %>
59
+ ```
32
60
 
33
61
  ## Contributing
34
62
 
@@ -1,3 +1,3 @@
1
1
  module SiteVariables
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: site_variables
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deekor