Module: Skap::CLI::Init

Extended by:
Init
Includes:
Skap::Command
Included in:
Init
Defined in:
lib/skap/cli/init.rb

Overview

CLI command for repository initialization.

Constant Summary

Constants included from Skap::Command

Skap::Command::CURRENT_DIR

Instance Method Summary collapse

Instance Method Details

#start(dir, args) ⇒ void

This method returns an undefined value.

Parameters:

  • dir (String)
  • args (Array<String>)


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/skap/cli/init.rb', line 11

def start(dir, args)
  assert_empty_options(args)

  FileUtils.mkdir_p(dir)

  shell("git init", dir:)
  shell("echo '---\n' > #{Skap::Files::Sources.file_name}", dir:)
  shell("echo '---\n' > #{Skap::Files::Versions.file_name}", dir:)

  puts "Git repo initialized in #{dir}"
end