Class: Bridgetown::Commands::Configure

Inherits:
Bridgetown::Command show all
Includes:
Automations
Defined in:
bridgetown-core/lib/bridgetown-core/commands/configure.rb

Constant Summary

Constants included from Automations

Automations::CODEBERG_REGEX, Automations::CODEBERG_REPO_REGEX, Automations::CODEBERG_TREE_REGEX, Automations::GITHUB_BLOB_REGEX, Automations::GITHUB_REGEX, Automations::GITHUB_REPO_REGEX, Automations::GITHUB_TREE_REGEX, Automations::GITLAB_BLOB_REGEX, Automations::GITLAB_REGEX, Automations::GITLAB_REPO_REGEX, Automations::GITLAB_TREE_REGEX

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Automations

#add_gem, #add_initializer, #add_npm_for_gem, #add_npm_package, #apply_from_url, #create_builder, included, #javascript_import, #remove_npm_package, #ruby_configure

Methods inherited from Bridgetown::Command

command_line, start, summary

Class Method Details

.source_rootObject



12
13
14
# File 'bridgetown-core/lib/bridgetown-core/commands/configure.rb', line 12

def self.source_root
  File.expand_path("../configurations", __dir__)
end

Instance Method Details

#call(new_site_dir: nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'bridgetown-core/lib/bridgetown-core/commands/configure.rb', line 16

def call(new_site_dir: nil)
  self.source_paths = [self.class.source_root]
  self.destination_root = new_site_dir || Dir.pwd

  unless configurations
    print_usage
    list_configurations
    return
  end

  @logger = Bridgetown.logger

  configurations.each do |configuration|
    configure configuration
  rescue Freyia::Error
    @logger.error "Error:".red, "🚨 Configuration doesn't exist: #{configuration}"
  end
end