Top Level Namespace
- Includes:
- Config, RbConfig
Defined Under Namespace
Classes: GemHadar
Instance Method Summary collapse
-
#GemHadar(&block) ⇒ GemHadar
The GemHadar method serves as the primary entry point for configuring and initializing a gem project using the GemHadar framework.
-
#template(src, dst = nil) {|block| ... } ⇒ Pathname
The template method processes an ERB template file and creates a Rake task for its compilation.
Instance Method Details
#GemHadar(&block) ⇒ GemHadar
The GemHadar method serves as the primary entry point for configuring and initializing a gem project using the GemHadar framework.
This method creates a new instance of the GemHadar class, passes the provided block to configure the gem settings, and then invokes the create_all_tasks method to set up all the necessary Rake tasks for the project.
2174 2175 2176 |
# File 'lib/gem_hadar.rb', line 2174 def GemHadar(&block) GemHadar.new(&block).create_all_tasks end |
#template(src, dst = nil) {|block| ... } ⇒ Pathname
The template method processes an ERB template file and creates a Rake task for its compilation.
This method takes a template file path, removes its extension to determine the output file name, and sets up a Rake file task that compiles the template using the provided block configuration. It ensures the source file has an extension and raises an error if not.
2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 |
# File 'lib/gem_hadar.rb', line 2192 def template(src, dst = nil, &block) template_src = Pathname.new(src) template_dst = dst ? Pathname.new(dst) : template_src if template_dst.extname == '.erb' template_dst = template_dst.sub_ext('erb') end template_src == template_dst and raise ArgumentError, "pathname #{pathname.inspect} needs to have a file extension" file template_dst.to_s => template_src.to_s do GemHadar::TemplateCompiler.new(&block).compile(template_src, template_dst) end template_dst end |