Module: Aladdin::Commands::New
Overview
Constant Summary collapse
- FILES =
Array of skeleton files to be copied over.
['images', Spirit::MANIFEST, Spirit::INDEX]
- DOT_FILES =
Array of dot files to be copied over and renamed.
%w(gitignore)
- COPY_FLAGS =
Flags for FileUtils.cp_r
{verbose: true}
Instance Method Summary collapse
-
#copy_files(dest, flags = {}) ⇒ Void
Copies skeleton files to given destination.
-
#parse!(argv) ⇒ Void
Parses the command line arguments.
-
#path_to(file) ⇒ String
Prefixes
file
with the skeleton directory.
Instance Method Details
#copy_files(dest, flags = {}) ⇒ Void
Copies skeleton files to given destination.
27 28 29 30 31 32 33 34 |
# File 'lib/aladdin/commands/new.rb', line 27 def copy_files(dest, flags={}) flags = COPY_FLAGS.merge flags paths = FILES.map { |file| path_to file } FileUtils.cp_r paths, dest, flags DOT_FILES.each do |file| FileUtils.cp_r path_to(file), File.join(dest, '.' + file), flags end end |
#parse!(argv) ⇒ Void
Parses the command line arguments.
46 47 48 49 50 51 |
# File 'lib/aladdin/commands/new.rb', line 46 def parse!(argv) opt_parser = OptionParser.new do |opts| opts. = "Usage: aladdin new [options] [LESSON_PATH]" end opt_parser.parse! argv end |