https://github.com/watson1978/motion-env-vars
https://github.com/watson1978/motion-env-vars
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/watson1978/motion-env-vars
- Owner: Watson1978
- Created: 2013-08-30T09:28:00.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-10-26T09:30:48.000Z (over 12 years ago)
- Last Synced: 2024-12-28T12:48:13.823Z (over 1 year ago)
- Language: Ruby
- Size: 101 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# motion-env-vars
Set ENV_VARS hash which is available in RubyMotion app.
You can set variables from yaml file or hash in Rakefile.
## Installation
Add this line to your application's Gemfile:
gem 'motion-env-vars'
And then execute:
$ bundle
Or install it yourself as:
$ gem install motion-env-vars
## Usage
in you Rakefile
#### From yaml file
```
Motion::Project::App.setup do |app|
...
app.env_vars = './config/environment.yaml'
...
end
```
in config/environment.yaml
```
consumer_key: xxx
consumer_secret: XXX
```
in app code after build, motion-env-vars define ENV_VARS constant variable as Hash.
```
p ENV_VARS #=> { 'consumer_key' => 'xxx', 'consumer_secret' => 'XXX' }
```
#### From hash
```
Motion::Project::App.setup do |app|
...
app.env_vars = { 'consumer_key' => 'xxx', 'consumer_secret' => 'XXX' }
...
end
```
You can also use shell ENV
```
app.env_vars = ENV.to_hash
```
Or selectively
```
app.env_vars = { 'CUSTOMER_KEY' => ENV['CUSTOMER_KEY'], 'CUSTOMER_SECRET' => ENV['CUSTOMER_SECRET'] }
```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request