Module: OrigenAppGenerators
- Extended by:
- Origen::Utility::InputCapture
- Defined in:
- lib/origen_app_generators.rb,
lib/origen_app_generators/new.rb,
lib/origen_app_generators/base.rb,
lib/origen_app_generators/plugin.rb,
lib/origen_app_generators/application.rb,
lib/origen_app_generators/empty_plugin.rb,
lib/origen_app_generators/sub_block_parser.rb,
lib/origen_app_generators/empty_application.rb,
lib/origen_app_generators/test_engineering/test_block.rb,
lib/origen_app_generators/test_engineering/stand_alone_application.rb,
lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb
Defined Under Namespace
Modules: OrigenInfrastructure, TestEngineering Classes: Application, Base, EmptyApplication, EmptyPlugin, New, Plugin, SubBlockParser
Constant Summary collapse
- TEST_INPUTS =
[ # 0 - Empty app ['0', '0', :default, :default, :default], # 1 - Empty plugin ['0', '1', :default, :default, 'A test block', 'yes', :default], # 2 - Stand alone test engineering app ['2', '0', :default, :default, 'Falcon, Eagle', 'Falcon[ram, atd(2), comm[ram(2), osc](3)], Eagle[ram(2), atd(4)]', [:default, 'origen g example']], # 3 - Test module ['2', '1', :default, :default, 'Test module for all flash IPs', 'FLASH_512K, FLASH_1024K', 'flash', [:default, 'origen g example']], # 4 - An app generators plugin ['1', '0', :default, :default, 'My application generators', :default] ]
- AVAILABLE =
As you add new generators to this app they will be entered here, this enables the mechanism to register them with the ‘origen new’ command. You should generally not modify this by hand, instead use the ‘origen app_gen:new’ command every time you want to create a new generator, and this will be filled in for you.
{ 'Test Engineering' => [ OrigenAppGenerators::TestEngineering::TestBlock, OrigenAppGenerators::TestEngineering::StandAloneApplication ], 'Origen Infrastructure' => [ OrigenAppGenerators::OrigenInfrastructure::AppGeneratorPlugin ] }
Class Method Summary collapse
- .add_generators(new_generators, options = {}) ⇒ Object private
- .generators ⇒ Object private
- .invoke(path) ⇒ Object private
- .template_dirs ⇒ Object private
- .unload_generators ⇒ Object private
Class Method Details
.add_generators(new_generators, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/origen_app_generators.rb', line 46 def self.add_generators(new_generators, = {}) new_generators.each do |domain, gens| gens.each { |gen| template_dirs[gen] ||= [:template_dir] if [:template_dir] } if generators[domain] gens.each { |g| generators[domain].unshift(g) } new_generators.delete(domain) end end @generators = new_generators.merge(generators) end |
.generators ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
63 64 65 |
# File 'lib/origen_app_generators.rb', line 63 def self.generators @generators ||= AVAILABLE end |
.invoke(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/origen_app_generators.rb', line 73 def self.invoke(path) puts puts 'CHOOSE AN APPLICATION DOMAIN' puts puts "Domain-specific application templates are available for the following areas (enter '0' to build an empty generic one)" puts i = 0 accept = [0] puts '0 - Empty / Not listed' generators.reverse_each do |domain, _generators| i += 1 accept << i puts "#{i} - #{domain}" end puts selection = get_text(single: true, default: '0', accept: accept).to_i if selection == 0 puts puts "WHAT TYPE OF APPLICATION DO YOU WANT TO BUILD? (if you don't know go with 'application')" puts puts '0 - Application' puts '1 - Plugin' puts accept = [0, 1] selection = get_text(single: true, accept: accept, default: 0).to_i case selection when 0 OrigenAppGenerators::EmptyApplication.start [path] when 1 OrigenAppGenerators::EmptyPlugin.start [path] end else domain = generators.to_a domain = domain[domain.size - selection] puts puts "CHOOSE FROM THE FOLLOWING #{domain[0].upcase} APPLICATION TEMPLATES" puts accept = [] i = 0 domain[1].reverse_each do |generator| accept << i puts "#{i} - #{generator.desc}" i += 1 end puts selection = get_text(single: true, accept: accept).to_i domain[1][domain[1].size - 1 - selection].start [path] end end |
.template_dirs ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
68 69 70 |
# File 'lib/origen_app_generators.rb', line 68 def self.template_dirs @template_dirs ||= {} end |
.unload_generators ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 |
# File 'lib/origen_app_generators.rb', line 58 def self.unload_generators @generators = {} end |