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