Class: Plans::Init

Inherits:
Command show all
Defined in:
lib/plans/init.rb

Instance Attribute Summary

Attributes inherited from Command

#options, #shell

Instance Method Summary collapse

Methods inherited from Command

#check_plans_pathname_exists, #initialize, #pathname, #plans_pathname, #raise_error, source_root

Constructor Details

This class inherits a constructor from Plans::Command

Instance Method Details

#doObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/plans/init.rb', line 5

def do
  plans_path = plans_pathname(options[:'plans-path'])
  if plans_path.exist?
    say 'The .plans directory already exists!', :red
    say 'If you want to recreate it, you will need to manually delete it first.'
    say 'The .plans directory is located here:'
    say "  #{plans_path}"
    raise_error('Plans directory exists.')
  end
  FileUtils.makedirs(plans_path)
  template_path = pathname(Plans.source_root) + 'template/.'
  FileUtils.cp_r(template_path, plans_path)
end