Class: Bloc::Command::Create

Inherits:
Object
  • Object
show all
Defined in:
lib/bloc/command/create.rb

Constant Summary collapse

MANIFEST_ALREADY_EXISTS =
"Found existing bloc manifest, remove and re-run command.".red

Class Method Summary collapse

Class Method Details

.run(*args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bloc/command/create.rb', line 6

def self.run(*args)
  raise MANIFEST_ALREADY_EXISTS if File.exists?(Bloc::Manifest::MANIFEST_PATH)
  name = ARGV[1] || "My Bloc Course"
  manifest = {
    :course => {
      :name => name,
      :description => ""
    },
    :chapters => []
  }

  Bloc::Manifest.new(manifest).write
end