Class: Scorm::Command::Create

Inherits:
Base
  • Object
show all
Defined in:
lib/scorm/commands/create.rb

Instance Attribute Summary

Attributes inherited from Base

#args, #autodetected_package

Instance Method Summary collapse

Methods inherited from Base

#display, #error, #extract_option, #extract_package, #initialize

Constructor Details

This class inherits a constructor from Scorm::Command::Base

Instance Method Details

#indexObject

Raises:


3
4
5
6
7
8
9
10
11
12
13
# File 'lib/scorm/commands/create.rb', line 3

def index
  name = args.shift.strip rescue ''
  raise(CommandFailed, "Invalid package name.") if name == ''

  FileUtils.mkdir_p(name)
  Dir.glob(File.join(File.dirname(File.expand_path(__FILE__)), '../../../skeleton/*')).each do |file|
    FileUtils.cp(file, name)
    display "#{name}/#{File.basename(file)}"
  end
  display "Created new SCORM package \"#{name}\"."
end