Class: Mines::Generator::Miner

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

Overview

Miner Generator generates files with boilerblate code in the miners directory. According to arguments it generates the following types of miners:

  • Network

  • Process

  • Metrics

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject

Define the source template root



24
25
26
# File 'lib/generators/miner.rb', line 24

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#create_miner_fileObject

Use the appropriate template file according to type and put the generated file in miners directory



30
31
32
33
34
# File 'lib/generators/miner.rb', line 30

def create_miner_file
  puts "Copy miner template"
  #puts options[:evented]
  template "templates/#{type}_miner.erb", "miners/#{name}.rb"
end

#create_miner_specObject

Use the appropriate template file according to type and put the generated file in miners directory



38
39
40
41
42
# File 'lib/generators/miner.rb', line 38

def create_miner_spec
  puts "Copy miner spec template"
  #puts options[:evented]
  template "templates/miner_spec.erb", "spec/#{name}_spec.rb"
end