Class: TRMNLP::Commands::Clone

Inherits:
Base
  • Object
show all
Defined in:
lib/trmnlp/commands/clone.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from TRMNLP::Commands::Base

Instance Method Details

#call(directory_name, id) ⇒ Object

Raises:



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/trmnlp/commands/clone.rb', line 7

def call(directory_name, id)
  authenticate!

  destination_path = Pathname.new(options.dir).join(directory_name)
  raise Error, "directory #{destination_path} already exists, aborting" if destination_path.exist?

  Init.new(dir: options.dir, skip_liquid: true, quiet: true).call(directory_name)

  Pull.new(dir: destination_path.to_s, force: true, id: id).call

  output <<~HEREDOC

  To start the local server:

      cd #{Pathname.new(destination_path).relative_path_from(Dir.pwd)} && trmnlp serve
  HEREDOC
end