Class: Ace::Support::Config::Organisms::ConfigInitializer
- Inherits:
-
Object
- Object
- Ace::Support::Config::Organisms::ConfigInitializer
- Defined in:
- lib/ace/support/config/organisms/config_initializer.rb
Constant Summary collapse
- PROJECT_ROOT_DIR =
"project-root"- GITIGNORE_ACE_LOCAL_ENTRY =
".ace-local/"
Instance Method Summary collapse
- #init_all ⇒ Object
- #init_gem(gem_name) ⇒ Object
-
#initialize(force: false, dry_run: false, global: false, verbose: false) ⇒ ConfigInitializer
constructor
A new instance of ConfigInitializer.
Constructor Details
#initialize(force: false, dry_run: false, global: false, verbose: false) ⇒ ConfigInitializer
Returns a new instance of ConfigInitializer.
15 16 17 18 19 20 21 22 |
# File 'lib/ace/support/config/organisms/config_initializer.rb', line 15 def initialize(force: false, dry_run: false, global: false, verbose: false) @force = force @dry_run = dry_run @global = global @verbose = verbose @copied_files = [] @skipped_files = [] end |
Instance Method Details
#init_all ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/ace/support/config/organisms/config_initializer.rb', line 24 def init_all puts "Initializing all ace-* gem configurations..." if @verbose Models::ConfigTemplates.all_gems.each do |gem_name| init_gem(gem_name) end print_summary end |
#init_gem(gem_name) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ace/support/config/organisms/config_initializer.rb', line 34 def init_gem(gem_name) gem_name = normalize_gem_name(gem_name) unless Models::ConfigTemplates.gem_exists?(gem_name) puts "Warning: No configuration found for #{gem_name}" return end puts "\nInitializing #{gem_name}..." if @verbose source_dir = Models::ConfigTemplates.example_dir_for(gem_name) target_dir = target_directory unless File.exist?(source_dir) puts "Warning: No .ace-defaults directory found for #{gem_name}" return end show_config_docs_if_needed(gem_name, target_dir) copy_config_files(source_dir, target_dir) end |