Class: Bashly::Commands::Init

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

Instance Method Summary collapse

Methods included from AssetHelper

#asset

Instance Method Details

#runObject



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

def run
  if Dir.exist? target_dir and !Dir.empty? target_dir
    raise InitError, "Directory !txtgrn!#{target_dir}!txtrst! already exists and is not empty"
  end
  Dir.mkdir target_dir unless Dir.exist? target_dir
  File.write "#{target_dir}/bashly.yml", yaml_content
  say "created !txtgrn!#{target_dir}/bashly.yml"
  say "run !txtpur!bashly generate!txtrst! to create the bash script"
end