0.0
No commit activity in last 3 years
No release in over 3 years
Loads environment variables from spore.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.6.9
>= 0
>= 10.3

Runtime

~> 0.10
~> 0.0
 Project Readme

spore-rails

Ruby/Rails gem to load Spore environment variables. See the Spore Website for more information.

Installation

Rails

Add this line to the top of your application's Gemfile:

gem 'spore-rails'

And then execute:

$ bundle

Note on load order

Spore is initialized in your Rails app during the before_configuration callback, which is fired when the Application constant is defined in config/application.rb with class Application < Rails::Application. If you need it to be initialized sooner, you can manually call Spore::Railtie.load.

# config/application.rb
Bundler.require(*Rails.groups)

Spore::Railtie.load

HOSTNAME = ENV['HOSTNAME']

If you use gems that require environment variables to be set before they are loaded, then list spore-rails in the Gemfile before those other gems and require spore/rails-now.

gem 'spore-rails', :require => 'spore/rails-now'
gem 'gem-that-requires-env-variables'

Sinatra or Plain ol' Ruby

Install the gem:

$ gem install spore

As early as possible in your application bootstrap process, load Spore:

require 'spore'
Spore.load

To ensure Spore is loaded in rake, load the tasks:

require 'spore/tasks'

task :mytask => :spore do
    # things that require environment variables
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Notes

The spore-rails gem was based on dotenv by Brandon Keepers.