mislav / choices Goto Github PK
View Code? Open in Web Editor NEWEasy external settings for your app
License: MIT License
Easy external settings for your app
License: MIT License
Currently using choices with multiple engines though they all use Rails.configuration as the root.
Recommend allowing a scope
config.from_file "my_engine.yml", "my_engine"
So you can avoid clobbering other configs
Rails.configuration.my_engine.some_config_key
I'd like to write yaml settings like this :
development:
action_mailer:
perform_deliveries: true
raise_delivery_errors: false
That would translate in Rails's config block to :
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
Could that be possible ?
Choices is great! Thanks for it!
I'm using Rails 4.0.0.rc1 and Ruby 2.0.0.
When choices is loaded, I'm notified, twice, that "syck has been removed". My research shows that it indeed has. I never noticed that Psych was broken in 1.9.2, but it seems to be working in 2.0.0. Can the code be updated to intelligently check for the Ruby version and not try to load syck in Ruby 2.0?
Choices isn't usable within an Engine.
# ./engines/foo/foo.gemspec
Gem::Specification.new do |s|
s.add_dependency 'choices'
end
# ./engines/foo/lib/foo.rb
require 'choices'
# ./engines/foo/lib/foo/engine.rb
class Engine < ::Rails::Engine
isolate_namespace Foo
config.from_file "settings.yml"
end
# ./engines/foo/config/settings.yml
defaults: &defaults
secret_token: <%= ENV['SECRET_TOKEN'] %>
development:
<<: *defaults
$ bundle exec rails server
railties-3.2.13/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `from_file' for #<Rails::Engine::Configuration:0x007f7fa80fbe58> (NoMethodError)
from /Users/simeon/Sites/lessonplanet/engines/foo/lib/foo/engine.rb:5:in `<class:Engine>'
from /Users/simeon/Sites/lessonplanet/engines/foo/lib/foo/engine.rb:2:in `<module:Foo>'
from /Users/simeon/Sites/lessonplanet/engines/foo/lib/foo/foo.rb:1:in `<top (required)>'
from /Users/simeon/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/simeon/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/simeon/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/simeon/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/simeon/Sites/lessonplanet/engines/foo/lib/foo.rb:11:in `<top (required)>'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.