Sha256: 5a9cc197a0f07a81238ee192a50e686ed55f9d830c5b645b1f7d51e21189d834

Contents?: true

Size: 1.56 KB

Versions: 11

Compression:

Stored size: 1.56 KB

Contents

module Noe
  class Main
    #
    # Show the actual noe specification that would be used by 'noe go'
    #
    # SYNOPSIS
    #   #{program_name} #{command_name} [SPEC_FILE]
    #
    # OPTIONS
    # #{summarized_options}
    #
    # DESCRIPTION
    #   This command merges the .noespec file given as first parameter (or found in 
    #   the current folder) with the noespec.yaml file of the template and prints 
    #   the result on the standard output.
    #
    #   When 'noe go' is invoked, the actual specification it works with is the 
    #   merging of what you specify in your .noespec file with default values 
    #   provided by the template specification itself. In other words, your .noespec
    #   file simply overrides the default values provided in the template itself.
    #
    #   Therefore, you can always keep your .noespec files simple by not specifying
    #   entries for which the default value is ok. However, making so could lead you
    #   to forget about some template options and this command is useful is such 
    #   situations.
    #
    class ShowSpec < Quickl::Command(__FILE__, __LINE__)
      include Noe::Commons
      
      options do |opt|
        Commons.add_common_options(opt)
      end
      
      def execute(args)
        raise Quickl::Help if args.size > 1
        spec_file = find_noespec_file(args)
        spec = YAML::load(File.read(spec_file))
        template = template(spec['template-info']['name'])
        template.merge_spec(spec)
        puts template.to_yaml
      end

    end # class ShowSpec
  end # class Main
end # module Noe

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
noe-1.7.3 lib/noe/show_spec.rb
noe-1.7.2 lib/noe/show_spec.rb
noe-1.7.1 lib/noe/show_spec.rb
noe-1.7.0 lib/noe/show_spec.rb
noe-1.6.0 lib/noe/show_spec.rb
noe-1.5.1 lib/noe/show_spec.rb
noe-1.5.0 lib/noe/show_spec.rb
noe-1.4.0 lib/noe/show_spec.rb
noe-1.3.0 lib/noe/show_spec.rb
noe-1.2.0 ./lib/noe/show_spec.rb
noe-1.1.0 ./lib/noe/show_spec.rb