Class: EasyType::Generators::EasyTypeGenerator
- Inherits:
-
EasyGenerator
- Object
- Base
- EasyGenerator
- EasyType::Generators::EasyTypeGenerator
- Defined in:
- lib/easy_type/generators/easy_type_generator.rb
Overview
Docs
Constant Summary collapse
- PROVIDER_TEMPLATE =
'easy_type_provider.rb.erb'.freeze
- TYPE_TEMPLATE =
'easy_type.rb.erb'.freeze
- PARAMETER_TEMPLATE =
'easy_type_name_attribute.rb.erb'.freeze
Instance Method Summary collapse
-
#create_easy_type_source ⇒ Object
Create the easy type source file.
-
#create_name_attribute_source ⇒ Object
Create the easy type name attribute source file.
-
#create_simple_provider_source ⇒ Object
Create the easy_type provider source file.
-
#initialize(type_name, options) ⇒ EasyTypeGenerator
constructor
A new instance of EasyTypeGenerator.
-
#run ⇒ Object
Run the scaffolder It created the directories and the nescessary files.
Methods inherited from Base
#create_provider_directory, #create_type_directory, load
Methods included from Helpers
#camelize, #convert_csv_data_to_hash, #get_puppet_file, included
Methods included from PathHelpers
#attribute_path, #create_directory, #create_source, included, #modulepath, #name_attribute_path, #provider_directory, #provider_path, #puppet_lib, #puppet_lib?, #save_file, #shared_attribute_path, #template_path, #type_attribute_directory, #type_directory, #type_path, #type_shared_directory, #write_file
Constructor Details
#initialize(type_name, options) ⇒ EasyTypeGenerator
Returns a new instance of EasyTypeGenerator.
16 17 18 19 20 21 |
# File 'lib/easy_type/generators/easy_type_generator.rb', line 16 def initialize(type_name, ) super(type_name, ) @provider = .fetch(:provider) { 'default_provider' } @description = .fetch(:description) { 'A custom type' } @namevar = .fetch(:namevar) { 'name' } end |
Instance Method Details
#create_easy_type_source ⇒ Object
Create the easy type source file. ./lib/puppet/type/type_name.rb
38 39 40 |
# File 'lib/easy_type/generators/easy_type_generator.rb', line 38 def create_easy_type_source create_source(TYPE_TEMPLATE, type_path) end |
#create_name_attribute_source ⇒ Object
Create the easy type name attribute source file. ./lib/puppet/type/type_name/parameter_name.rb
54 55 56 |
# File 'lib/easy_type/generators/easy_type_generator.rb', line 54 def create_name_attribute_source create_source(PARAMETER_TEMPLATE, name_attribute_path) end |
#create_simple_provider_source ⇒ Object
Create the easy_type provider source file. ./lib/puppet/provider/type_name/provider_name.rb
46 47 48 |
# File 'lib/easy_type/generators/easy_type_generator.rb', line 46 def create_simple_provider_source create_source(PROVIDER_TEMPLATE, provider_path) end |
#run ⇒ Object
Run the scaffolder It created the directories and the nescessary files
27 28 29 30 31 32 |
# File 'lib/easy_type/generators/easy_type_generator.rb', line 27 def run super create_easy_type_source create_simple_provider_source create_name_attribute_source end |