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.



13
14
15
16
17
18
# File 'lib/metanorma/cli/template_repo.rb', line 13

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



28
29
30
# File 'lib/metanorma/cli/template_repo.rb', line 28

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

Instance Method Details

#addObject



20
21
22
23
24
25
26
# File 'lib/metanorma/cli/template_repo.rb', line 20

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

  templates[:templates]
end