Method: Monograph::CLI#init
- Defined in:
- lib/monograph/cli.rb
#init(path = nil) ⇒ Object
Initialize a new book in the given path
7 8 9 10 11 12 13 14 |
# File 'lib/monograph/cli.rb', line 7 def init(path = nil) raise Error, "You must specify a path to create your new book in" if path.nil? raise Error, "File already exists at #{path}" if File.exist?(path) FileUtils.mkdir_p(path) FileUtils.cp_r(File.join(Monograph.root, 'test', 'fixtures', 'book1', '.'), path) puts "Initialized new monograph book at #{path}" Book.new(path) end |