Class: EngineCart::Configuration
- Inherits:
-
Object
- Object
- EngineCart::Configuration
- Defined in:
- lib/engine_cart/configuration.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #default_destination ⇒ Object
- #default_engine_name ⇒ Object
-
#destination ⇒ Object
Destination to generate the test app into.
-
#engine_name ⇒ Object
Name of the engine we’re testing.
-
#initialize(options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #load_configs(config_files) ⇒ Object
-
#rails_options ⇒ Object
Additional options when generating a test rails application.
-
#template ⇒ Object
Path to a Rails application template.
-
#templates_path ⇒ Object
Path to test app templates to make available to the test app generator.
- #verbose? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 |
# File 'lib/engine_cart/configuration.rb', line 7 def initialize( = {}) @verbose = [:verbose] @options = load_configs(Array[[:config]]).merge() end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/engine_cart/configuration.rb', line 5 def @options end |
Instance Method Details
#default_destination ⇒ Object
56 57 58 |
# File 'lib/engine_cart/configuration.rb', line 56 def default_destination '.internal_test_app' end |
#default_engine_name ⇒ Object
60 61 62 |
# File 'lib/engine_cart/configuration.rb', line 60 def default_engine_name File.basename(Dir.glob('*.gemspec').first, '.gemspec') end |
#destination ⇒ Object
Destination to generate the test app into
33 34 35 |
# File 'lib/engine_cart/configuration.rb', line 33 def destination [:destination] end |
#engine_name ⇒ Object
Name of the engine we’re testing
27 28 29 |
# File 'lib/engine_cart/configuration.rb', line 27 def engine_name [:engine_name] end |
#load_configs(config_files) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/engine_cart/configuration.rb', line 13 def load_configs(config_files) config = default_config (default_configuration_paths + config_files.compact).each do |p| path = File.(p) next unless File.exist? path config.merge!(read_config(path)) end config end |
#rails_options ⇒ Object
Additional options when generating a test rails application
52 53 54 |
# File 'lib/engine_cart/configuration.rb', line 52 def [:rails_options] end |
#template ⇒ Object
Path to a Rails application template
39 40 41 |
# File 'lib/engine_cart/configuration.rb', line 39 def template [:template] end |
#templates_path ⇒ Object
Path to test app templates to make available to the test app generator
46 47 48 |
# File 'lib/engine_cart/configuration.rb', line 46 def templates_path [:templates_path] end |
#verbose? ⇒ Boolean
64 65 66 |
# File 'lib/engine_cart/configuration.rb', line 64 def verbose? @verbose || ( && !!.fetch(:verbose, false)) end |