Class: CreateBlock
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- CreateBlock
- Includes:
- Thor::Actions
- Defined in:
- lib/blocks/create_block.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
6 7 8 |
# File 'lib/blocks/create_block.rb', line 6 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#create_directory ⇒ Object
10 11 12 13 |
# File 'lib/blocks/create_block.rb', line 10 def create_directory say "✍️ Setting up #{name}..." directory '../templates/block', name end |
#create_infra ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/blocks/create_block.rb', line 15 def create_infra namespace_config = Config.load(".byld/config.yml") success, res = Infra.create_project(namespace_config['namespace']['id'], name, 'domain') if success block_config = Config.load("#{name}/.byld/config.yml") block_config.merge!(project: res) say "👍 Block created successfully!" else say "⚠️ Error creating block. Reason: #{res}" unless success end end |