Class: CC::CLI::ConfigGenerator
- Inherits:
-
Object
- Object
- CC::CLI::ConfigGenerator
- Defined in:
- lib/cc/cli/config_generator.rb
Direct Known Subclasses
Constant Summary collapse
- CODECLIMATE_YAML =
Command::CODECLIMATE_YAML
- AUTO_EXCLUDE_PATHS =
%w(config/ db/ dist/ features/ node_modules/ script/ spec/ test/ tests/ vendor/).freeze
Class Method Summary collapse
Instance Method Summary collapse
- #can_generate? ⇒ Boolean
- #eligible_engines ⇒ Object
- #errors ⇒ Object
- #exclude_paths ⇒ Object
-
#initialize(filesystem, engine_registry) ⇒ ConfigGenerator
constructor
A new instance of ConfigGenerator.
- #post_generation_verb ⇒ Object
Constructor Details
#initialize(filesystem, engine_registry) ⇒ ConfigGenerator
Returns a new instance of ConfigGenerator.
17 18 19 20 |
# File 'lib/cc/cli/config_generator.rb', line 17 def initialize(filesystem, engine_registry) @filesystem = filesystem @engine_registry = engine_registry end |
Class Method Details
.for(filesystem, engine_registry, upgrade_requested) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/cc/cli/config_generator.rb', line 9 def self.for(filesystem, engine_registry, upgrade_requested) if upgrade_requested && upgrade_needed?(filesystem) UpgradeConfigGenerator.new(filesystem, engine_registry) else ConfigGenerator.new(filesystem, engine_registry) end end |
Instance Method Details
#can_generate? ⇒ Boolean
22 23 24 |
# File 'lib/cc/cli/config_generator.rb', line 22 def can_generate? true end |
#eligible_engines ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cc/cli/config_generator.rb', line 26 def eligible_engines return @eligible_engines if @eligible_engines engines = engine_registry.list @eligible_engines = engines.each_with_object({}) do |(name, config), result| if engine_eligible?(config) result[name] = config end end end |
#errors ⇒ Object
37 38 39 |
# File 'lib/cc/cli/config_generator.rb', line 37 def errors [] end |
#exclude_paths ⇒ Object
41 42 43 |
# File 'lib/cc/cli/config_generator.rb', line 41 def exclude_paths @exclude_paths ||= AUTO_EXCLUDE_PATHS.select { |path| filesystem.exist?(path) } end |
#post_generation_verb ⇒ Object
45 46 47 |
# File 'lib/cc/cli/config_generator.rb', line 45 def post_generation_verb "generated" end |