Class: HammerCLIForeman::TaskHelper::PluginDraft
- Inherits:
-
Object
- Object
- HammerCLIForeman::TaskHelper::PluginDraft
- Defined in:
- lib/hammer_cli_foreman/task_helper.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #build ⇒ Object
- #fill(&block) ⇒ Object
-
#initialize(name, path, options = {}) ⇒ PluginDraft
constructor
A new instance of PluginDraft.
Constructor Details
#initialize(name, path, options = {}) ⇒ PluginDraft
Returns a new instance of PluginDraft.
8 9 10 11 12 13 14 15 16 |
# File 'lib/hammer_cli_foreman/task_helper.rb', line 8 def initialize(name, path, = {}) @plain_name = name @name = "hammer_cli_foreman_#{name}" @path = File.(@name.tr('_', '-'), path) @capitalized_bits = name.split('_').map(&:capitalize) @plugin_namespace = "HammerCLIForeman#{@capitalized_bits.join}" @core_location = File.('../../', File.dirname(__FILE__)) @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/hammer_cli_foreman/task_helper.rb', line 6 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/hammer_cli_foreman/task_helper.rb', line 6 def path @path end |
Instance Method Details
#build ⇒ Object
18 19 20 21 22 23 |
# File 'lib/hammer_cli_foreman/task_helper.rb', line 18 def build FileUtils.mkpath("#{@path}/lib/#{@name}") FileUtils.mkpath("#{@path}/config") FileUtils.mkpath("#{@path}/test") FileUtils.mkpath("#{@path}/locale") end |
#fill(&block) ⇒ Object
25 26 27 28 29 |
# File 'lib/hammer_cli_foreman/task_helper.rb', line 25 def fill(&block) FileUtils.cd(@path) do self.instance_exec(&block) end end |