Class: Metanorma::Cli::TemplateRepo

Inherits:
Object
  • Object
show all
Defined in:
lib/metanorma/cli/template_repo.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ TemplateRepo

Returns a new instance of TemplateRepo.



8
9
10
11
12
13
# File 'lib/metanorma/cli/template_repo.rb', line 8

def initialize(options = {})
  @name = options.fetch(:name)
  @source = options.fetch(:source)
  @type = options.fetch(:type, "custom")
  @overwrite = options.fetch(:overwrite, false)
end

Class Method Details

.add(name, source, options = {}) ⇒ Object



23
24
25
# File 'lib/metanorma/cli/template_repo.rb', line 23

def self.add(name, source, options = {})
  new(options.merge(name: name, source: source)).add
end

Instance Method Details

#addObject



15
16
17
18
19
20
21
# File 'lib/metanorma/cli/template_repo.rb', line 15

def add
  create_template_config
  add_new_template(name, source, type)
  write_to_template_config(templates)

  templates[:templates]
end