Class: Bashly::Commands::Init

Inherits:
Base
  • Object
show all
Defined in:
lib/bashly/commands/init.rb

Instance Method Summary collapse

Methods inherited from Base

#config, #config_validator, #validate_config, #with_valid_config

Methods included from AssetHelper

#asset, #asset_content

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/bashly/commands/init.rb', line 12

def run
  if Dir.exist?(target_dir) && !Dir.empty?(target_dir)
    raise InitError, "Directory g`#{target_dir}` already exists and is not empty"
  end

  FileUtils.mkdir_p target_dir
  File.write "#{target_dir}/bashly.yml", yaml_content
  say "g`created` #{target_dir}/bashly.yml"
  say 'run m`bashly generate` to create the bash script'
end