motion-conf is an easy to use configuration class generator for your RubyMotion apps maintained by Infinite Red, a web and mobile development company based in Portland, OR and San Francisco, CA. It uses YAML files to statically generate a MotionConf
class with each option in the YAML file defined for easy access.
It uses the RubyMotion environment variable to determine which YAML file to compile into your application.
Add this line to your application's Gemfile:
gem 'motion-conf'
Possible files are:
- config.development.yml
- config.release.yml
- config.test.yml
- config.hockeyapp.yml
- config.testflight.yml
Each file should have the same YAML keys for consistency across builds.
If you had this in your yml file:
team: InfiniteRed
members: 7
email: info@infinitered.com
awesome: true
It would generate a class that looks like this:
module MotionConf
module_function
def team; "InfiniteRed"; end;
def members; 7; end;
def email; "info@infinitered.com"; end;
def awesome; true; end;
end
So you would access this anywhere in your code like so:
def send_email
send_email(to: MotionConf.email)
end
The auto-generated config.rb
should be added to your .gitignore
and should not be added to your source control. It will be auto-generated every time you build the app, bringing in any changes you may have made to the YAML files.
- Write tests
- Test in more environments
- Support nested YAML values?
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
motion-conf, as an open source project, is free to use and always will be. Infinite Red offers premium motion-conf support and general mobile app design/development services. Email us at hello@infinite.red to get in touch with us for more details.