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.



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

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



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

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

Instance Method Details

#addObject



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

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

  templates[:templates]
end