class Jobly::Commands::InitCmd

Public Instance Methods

run() click to toggle source
# File lib/jobly/commands/init.rb, line 14
def run
  raise ArgumentError, "#{target_dir} already exists" if File.exist? target_dir

  FileUtils.copy_entry source_dir, target_dir

  say "Created #{template} workspace in #{target_dir}:"
  files.each { |file| say "- #{file}" }
end

Private Instance Methods

files() click to toggle source
# File lib/jobly/commands/init.rb, line 37
def files
  Dir["#{target_dir}/**/{*,.*}"].sort.reject { |f| File.directory? f }
end
source_dir() click to toggle source
# File lib/jobly/commands/init.rb, line 33
def source_dir
  File.expand_path "../templates/#{template}", __dir__
end
target_dir() click to toggle source
# File lib/jobly/commands/init.rb, line 29
def target_dir
  args['NAME']
end
template() click to toggle source
# File lib/jobly/commands/init.rb, line 25
def template
  args['--minimal'] ? 'minimal' : 'full'
end