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.
- #extra_fingerprinted_files ⇒ Object
-
#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.
9 10 11 12 13 |
# File 'lib/engine_cart/configuration.rb', line 9 def initialize( = {}) @verbose = [:verbose] @options = load_configs(Array[[:config]]).merge() end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/engine_cart/configuration.rb', line 7 def @options end |
Instance Method Details
#default_destination ⇒ Object
62 63 64 |
# File 'lib/engine_cart/configuration.rb', line 62 def default_destination '.internal_test_app' end |
#default_engine_name ⇒ Object
66 67 68 |
# File 'lib/engine_cart/configuration.rb', line 66 def default_engine_name File.basename(Dir.glob('*.gemspec').first, '.gemspec') end |
#destination ⇒ Object
Destination to generate the test app into
35 36 37 |
# File 'lib/engine_cart/configuration.rb', line 35 def destination [:destination] end |
#engine_name ⇒ Object
Name of the engine we’re testing
29 30 31 |
# File 'lib/engine_cart/configuration.rb', line 29 def engine_name [:engine_name] end |
#extra_fingerprinted_files ⇒ Object
58 59 60 |
# File 'lib/engine_cart/configuration.rb', line 58 def extra_fingerprinted_files [:extra_fingerprinted_files] end |
#load_configs(config_files) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/engine_cart/configuration.rb', line 15 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
54 55 56 |
# File 'lib/engine_cart/configuration.rb', line 54 def Array([:rails_options]) end |
#template ⇒ Object
Path to a Rails application template
41 42 43 |
# File 'lib/engine_cart/configuration.rb', line 41 def template [:template] end |
#templates_path ⇒ Object
Path to test app templates to make available to the test app generator
48 49 50 |
# File 'lib/engine_cart/configuration.rb', line 48 def templates_path [:templates_path] end |
#verbose? ⇒ Boolean
70 71 72 |
# File 'lib/engine_cart/configuration.rb', line 70 def verbose? @verbose || ( && !!.fetch(:verbose, false)) end |