Sha256: f1283681211b5c0a9bc92b965b7b73303d66b7d70f154d78347d92a6b7993731

Contents?: true

Size: 1.54 KB

Versions: 57

Compression:

Stored size: 1.54 KB

Contents

module Origen
  module CodeGenerators
    class Feature < Origen::CodeGenerators::Base
      include BlockCommon

      def self.banner
        'origen new feature NAME'
      end

      desc <<-END
This generator creates a new feature block, which is similar to a regular block but with no model and controller.
Such features can then be loaded (re-used) by multiple blocks within your application code.

The name of the feature should be given in lower case, optionally prefixed by parent feature name(s) separated
by a forward slash.

Any parent features will be created if they don't exist, but they will not be modified if they do.

Examples:
  origen new feature my_feature              # Creates app/blocks/my_feature/...
  origen new feature features/my_feature     # Creates app/blocks/features/my_feature/...

The above can then be loaded to models in your application code via:

  my_model.load_block('my_feature')
  my_model.load_block('features/my_feature')
END

      def validate_args
        if args.size > 1 || args.size == 0
          msg = args.size > 1 ? 'Only one' : 'One'
          msg << " argument is expected by the feature generator, e.g. 'origen new feature my_feature', 'origen new feature features/my_feature"
          puts msg
          exit 1
        end
        validate_args_common
      end

      def setup
        @generate_model = false
        @generate_pins = true
        @generate_timesets = true
        @generate_parameters = true
        extract_model_name
        create_files
        add_acronyms
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
origen-0.60.18 lib/origen/code_generators/feature.rb
origen-0.60.17 lib/origen/code_generators/feature.rb
origen-0.60.16 lib/origen/code_generators/feature.rb
origen-0.60.14 lib/origen/code_generators/feature.rb
origen-0.60.13 lib/origen/code_generators/feature.rb
origen-0.60.12 lib/origen/code_generators/feature.rb
origen-0.60.11 lib/origen/code_generators/feature.rb
origen-0.60.10 lib/origen/code_generators/feature.rb
origen-0.60.9 lib/origen/code_generators/feature.rb
origen-0.60.8 lib/origen/code_generators/feature.rb
origen-0.60.7 lib/origen/code_generators/feature.rb
origen-0.60.6 lib/origen/code_generators/feature.rb
origen-0.60.5 lib/origen/code_generators/feature.rb
origen-0.60.4 lib/origen/code_generators/feature.rb
origen-0.60.3 lib/origen/code_generators/feature.rb
origen-0.60.2 lib/origen/code_generators/feature.rb
origen-0.60.1 lib/origen/code_generators/feature.rb
origen-0.60.0 lib/origen/code_generators/feature.rb
origen-0.59.8 lib/origen/code_generators/feature.rb
origen-0.59.7 lib/origen/code_generators/feature.rb