Class: Packwerk::Generators::ConfigurationFile
- Inherits:
-
Object
- Object
- Packwerk::Generators::ConfigurationFile
- Defined in:
- lib/packwerk/generators/configuration_file.rb
Constant Summary collapse
- CONFIGURATION_TEMPLATE_FILE_PATH =
"templates/packwerk.yml.erb"
Class Method Summary collapse
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(root:, out: $stdout) ⇒ ConfigurationFile
constructor
A new instance of ConfigurationFile.
Constructor Details
#initialize(root:, out: $stdout) ⇒ ConfigurationFile
Returns a new instance of ConfigurationFile.
19 20 21 22 |
# File 'lib/packwerk/generators/configuration_file.rb', line 19 def initialize(root:, out: $stdout) @root = root @out = out end |
Class Method Details
.generate(root:, out:) ⇒ Object
13 14 15 |
# File 'lib/packwerk/generators/configuration_file.rb', line 13 def generate(root:, out:) new(root: root, out: out).generate end |
Instance Method Details
#generate ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/packwerk/generators/configuration_file.rb', line 25 def generate @out.puts("📦 Generating Packwerk configuration file...") default_config_path = File.join(@root, Configuration::DEFAULT_CONFIG_PATH) if File.exist?(default_config_path) @out.puts("⚠️ Packwerk configuration file already exists.") return true end File.write(default_config_path, render) @out.puts("✅ Packwerk configuration file generated in #{default_config_path}") true end |