Class: Mines::Generator::Miner
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Mines::Generator::Miner
- 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
-
.source_root ⇒ Object
Define the source template root.
Instance Method Summary collapse
-
#create_miner_file ⇒ Object
Use the appropriate template file according to type and put the generated file in miners directory.
-
#create_miner_spec ⇒ Object
Use the appropriate template file according to type and put the generated file in miners directory.
Class Method Details
.source_root ⇒ Object
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_file ⇒ Object
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_spec ⇒ Object
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 |