lib/reality/generators/standard_artifact_dsl.rb
#
# Define an artifact and attach it to template_set.
# This assumes that the the template is named with the convention "<facet_templates_directory>/<artifact_key>.<file_extension>"
# with the file extension derived from the supplied filename pattern.
#
# The template set is prefixed with the name of the facet from which this is extended.
#
# The options supported include:
# * :facets - additional facets that must be enabled for the facet to be generated.
# * :helpers - additional helpers that are added to the default helpers.
# * :guard - The :guard option passed to the template.
#
Define an artifact and attach it to template_set.
This assumes that the the template is named with the convention "/."
with the file extension derived from the supplied filename pattern.

The template set is prefixed with the name of the facet from which this is extended.

The options supported include:
:facets - additional facets that must be enabled for the facet to be generated.
:helpers - additional helpers that are added to the default helpers.
:guard - The :guard option passed to the template.
Define an artifact and attach it to template_set . This assumes that the the template is named with the convention " / . " with the file extension derived from the supplied filename pattern . The template set is prefixed with the name of the facet from which this is extended . The options supported include : : facets - additional facets that must be enabled for the facet to be generated . : helpers - additional helpers that are added to the default helpers . : guard - The : guard option passed to the template .
def file_artifact(template_set_suffix, artifact_key, filename_pattern, options = {})
        Reality::Options.check(options, [:facets, :guard, :helpers], Reality::Generators, 'define artifact')
        file_extension = File.extname(filename_pattern)[1...9999]
        params = options.merge(:file_type => file_extension)
        artifact(template_set_suffix, params) do |template_set, facets, helpers, template_options|
          base_template_filename = "#{facet_templates_directory}/#{artifact_key}.#{file_extension}"
          template_extension =
            File.exist?("#{base_template_filename}.erb") ?
              'erb' :
              File.exist?("#{base_template_filename}.rb") ? 'rb' : nil
          template_filename = "#{base_template_filename}.#{template_extension}"
          if 'erb' == template_extension
            template_set.erb_template(facets, self.target_key, template_filename, filename_pattern, helpers, template_options)
          else
            template_set.ruby_template(facets, self.target_key, template_filename, filename_pattern, helpers, template_options)
          end
        end
      end
def file_artifact ( template_set_suffix , artifact_key , filename_pattern , options = { } ) Reality :: Options . check ( options , [ :facets , :guard , :helpers ] , Reality :: Generators , 'define artifact' ) file_extension = File . extname ( filename_pattern ) [ 1 ... 9999 ] params = options . merge ( :file_type => file_extension ) artifact ( template_set_suffix , params ) do | template_set , facets , helpers , template_options | base_template_filename = "#{facet_templates_directory}/#{artifact_key}.#{file_extension}" template_extension = File . exist? ( "#{base_template_filename}.erb" ) ? 'erb' : File . exist? ( "#{base_template_filename}.rb" ) ? 'rb' : nil template_filename = "#{base_template_filename}.#{template_extension}" if 'erb' == template_extension template_set . erb_template ( facets , self . target_key , template_filename , filename_pattern , helpers , template_options ) else template_set . ruby_template ( facets , self . target_key , template_filename , filename_pattern , helpers , template_options ) end end end
Define an artifact and attach it to template_set.
Define an artifact and attach it to template_set .
template_set_suffix
<not_specific>
artifact_key
<not_specific>
filename_pattern
<not_specific>
options
<not_specific>