lib/frontman/commands/init.rb in frontman-ssg-0.0.3 vs lib/frontman/commands/init.rb in frontman-ssg-0.0.4
- old
+ new
@@ -4,10 +4,11 @@
require 'thor'
module Frontman
class CLI < Thor
option :template
+ option :force, type: :boolean
desc 'init', 'Bootstrap a new Frontman project'
def init(path)
template = options[:template] || 'default'
unless template_exists?(template)
raise "Template #{template} does not exist!"
@@ -36,9 +37,10 @@
dest
)
end
def allowed_to_modify_dir?(dir)
+ return true if options[:force]
return true if !Dir.exist?(dir) || Dir.empty?(dir)
say 'This folder already contains files. '
say 'Initializing a new Frontman project here may override these files.'
answer = ask('Are you sure you want to continue? [y/N]')