Class: TogoStanza::CLI::StanzaGenerator

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/togostanza/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



39
40
41
# File 'lib/togostanza/cli.rb', line 39

def self.source_root
  File.expand_path('../../../templates/stanza', __FILE__)
end

Instance Method Details

#create_filesObject



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/togostanza/cli.rb', line 43

def create_files
  template 'Gemfile.erb',       "#{file_name}/Gemfile"
  template 'gemspec.erb',       "#{file_name}/#{file_name}.gemspec"
  template 'lib.rb.erb',        "#{file_name}/lib/#{file_name}.rb"
  template 'stanza.rb.erb',     "#{file_name}/stanza.rb"
  template 'template.hbs.erb',  "#{file_name}/template.hbs"
  template 'metadata.json.erb', "#{file_name}/metadata.json"

  create_file "#{file_name}/sparql/.keep"
  create_file "#{file_name}/assets/#{stanza_id}/.keep"
end

#inject_gemObject



55
56
57
# File 'lib/togostanza/cli.rb', line 55

def inject_gem
  append_to_file 'Gemfile', "gem '#{file_name}', path: './#{file_name}'\n"
end