Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ainame/motion-my_env
motion-my_env is a simple environment managing solution on RubyMotion app.
https://github.com/ainame/motion-my_env
Last synced: about 2 months ago
JSON representation
motion-my_env is a simple environment managing solution on RubyMotion app.
- Host: GitHub
- URL: https://github.com/ainame/motion-my_env
- Owner: ainame
- Created: 2013-08-17T16:09:51.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-08-30T10:34:25.000Z (over 11 years ago)
- Last Synced: 2024-05-01T19:27:16.623Z (8 months ago)
- Language: Ruby
- Size: 130 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# motion-my_env
motion-my_env is a simple environment managing solution on RubyMotion app.
## Installation
Add this line to your application's Gemfile:
gem 'motion-my_env'
And then execute:
$ bundle
Or install it yourself as:
$ gem install motion-my_env
## Usage
in you Rakefile
```ruby
Motion::Project::App.setup do |app|
...
app.my_env.file = './config/environment.yaml'
...
end
```in config/environment.yaml
```yaml
consumer_key: xxx
consumer_secret: XXX
```in app code after build, motion-my_env define `MY_ENV` constant variable as Hash.
```ruby
p MY_ENV #=> { 'consumer_key' => 'xxx', 'consumer_secret' => 'XXX' }
```
## Why don't you use `ENV`?`ENV` constant variable has been already defined by RubyMotion runtime as a NSObject instance,
and, that can't be assigned Fixnum's object.```
(main)> ENV
ENV
=> {}
(main)> ENV.class
ENV.class
=> NSObject
(main)> ENV['aaa'] = 1
ENV['aaa'] = 1
2013-08-18 11:57:00.845 shiori[74941:c07] can't convert Fixnum into String (TypeError)
=> #
(main)> MY_ENV
MY_ENV
2013-08-18 11:55:02.929 shiori[74941:c07] uninitialized constant MY_ENV (NameError)
=> #
```So, I use original constant variable name.
## 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