origen 0.59.8 → 0.60.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 105c715afc0bf9d3fb0133656e2bb9b5072598bee921a83e47ed0974ce75de4c
4
- data.tar.gz: e00626fb9e1f477af6884417a9fcc7605ee7a869d4e5cba56c2f456085c93bc1
3
+ metadata.gz: 7b89041bc7a6067a7945d3b9cae3415771f2a270c3f6496a217d8b27916c2211
4
+ data.tar.gz: a6c3ac53db78a810b77c0cb23c99fdb1d35fd05ec451c658f710c2501822bd03
5
5
  SHA512:
6
- metadata.gz: a30e6be68bfe2ccbea6159919c285683a3a996c3b82591e748a37f96407e6aed34bc7500a7b0d2c1593ecfa0b55c08d51490334cc3da5cc5e7946a5ca2350dd3
7
- data.tar.gz: 01cb78307b372f25c1365ff25270772c2ec6eabe7507167a91c6961b2fb49bb306a6c4277985f45d873d4384326090f4d7945fefcef00770ec8e29fb197dc31d
6
+ metadata.gz: c2d17382ac902d0391e7d2f748e5166ff6264ba2c10529b72dc5074bbb33aab30e4558e495082221a29e7365e483e2cc8f7e2517d229200519a5bef9cf1b27e8
7
+ data.tar.gz: 66b8c763603a908bab112da936042f6e6e127b961acc52ba06d2d1e2b2d783d28480dda944d9dfd7fdadb24f3a98aa30a1f065fff069d37ea6d9213f4d64ff9e
data/config/commands.rb CHANGED
@@ -17,7 +17,7 @@ when "tags"
17
17
  when "specs"
18
18
  Origen.app.session.origen_core[:mode] = 'debug'
19
19
  require "rspec"
20
- exit RSpec::Core::Runner.run(['spec'])
20
+ exit RSpec::Core::Runner.run($ARGV.empty? ? ['spec'] : $ARGV)
21
21
 
22
22
  when "examples", "test"
23
23
  Origen.app.session.origen_core[:mode] = 'debug'
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
- MINOR = 59
4
- BUGFIX = 8
3
+ MINOR = 60
4
+ BUGFIX = 0
5
5
  DEV = nil
6
6
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
7
7
  end
data/lib/origen/loader.rb CHANGED
@@ -116,62 +116,75 @@ module Origen
116
116
 
117
117
  # If a block definition exists for the given model, then this will load it and apply it to
118
118
  # the model.
119
+ # if options[:inherit] is passed, it will first try to load the files for the class name contained
120
+ # in that option, even if its from a plugin app
119
121
  # Returns true if a model is found and loaded, otherwise nil.
120
122
  def self.load_block(model, options = {})
121
123
  model = model.model # Ensure we have a handle on the model and not its controller
122
124
  loaded = nil
123
- if app = options[:app] || model.app
125
+ if local_app = options[:app] || model.app
124
126
  if options[:path]
125
- full_paths = Array(options[:path])
127
+ local_full_paths = Array(options[:path])
126
128
  else
127
- full_paths = model.class.to_s.split('::')
128
- full_paths.shift # Throw away the app namespace
129
- full_paths = [full_paths.join('/')]
129
+ local_full_paths = model.class.to_s.split('::')
130
+ local_full_paths.shift # Throw away the app namespace
131
+ local_full_paths = [local_full_paths.join('/')]
130
132
  end
131
- full_paths.each do |full_path|
132
- paths = full_path.to_s.split('/')
133
- key = ''
134
- only = Array(options[:only]) if options[:only]
135
- except = Array(options[:except]) if options[:except]
136
- path = paths.map(&:underscore).join('/')
137
- # If the path refers to a nested sub-block then don't load the full hierarchy since they
138
- # don't support inheritance or derivatives, modify the paths array so that only the sub-block
139
- # level will be loaded and nothing else.
140
- paths = [path] if app.blocks_files[path] && app.blocks_files[path][:_sub_block]
141
- # These will be loaded first, followed by the rest in an undefined order.
142
- # Attributes and parameters are first so that they may be referenced in the other files.
143
- # Sub-blocks was added early due to a corner case issue that could be encountered if the pins or
144
- # regs imported an Origen exported file that defined a module with the same name as a sub-block
145
- # class, in that case the sub-block class would not be auto-loaded.
146
- load_first = [:attributes, :parameters, :sub_blocks]
133
+ app_paths_map = { local_app => local_full_paths }
134
+ if options[:inherit]
135
+ inherit_full_paths = options[:inherit].split('::')
136
+ inherit_app = Origen.app(inherit_full_paths.shift.underscore.to_sym)
137
+ inherit_full_paths = [inherit_full_paths.join('/')]
138
+ # merge to get inherit ordered in the beginning
139
+ app_paths_map = { inherit_app => inherit_full_paths }.merge(app_paths_map)
140
+ end
141
+ # load the inherit files, then the current app's block files
142
+ app_paths_map.each do |app, full_paths|
143
+ full_paths.each do |full_path|
144
+ paths = full_path.to_s.split('/')
145
+ key = ''
146
+ only = Array(options[:only]) if options[:only]
147
+ except = Array(options[:except]) if options[:except]
148
+ path = paths.map(&:underscore).join('/')
149
+ # If the path refers to a nested sub-block then don't load the full hierarchy since they
150
+ # don't support inheritance or derivatives, modify the paths array so that only the sub-block
151
+ # level will be loaded and nothing else.
152
+ paths = [path] if app.blocks_files[path] && app.blocks_files[path][:_sub_block]
153
+ # These will be loaded first, followed by the rest in an undefined order.
154
+ # Attributes and parameters are first so that they may be referenced in the other files.
155
+ # Sub-blocks was added early due to a corner case issue that could be encountered if the pins or
156
+ # regs imported an Origen exported file that defined a module with the same name as a sub-block
157
+ # class, in that case the sub-block class would not be auto-loaded.
158
+ load_first = [:attributes, :parameters, :sub_blocks]
147
159
 
148
- load_first.each do |type|
149
- unless (only && !only.include?(type)) || (except && except.include?(type))
150
- with_parameters_transaction(type) do
151
- paths.each_with_index do |path, i|
152
- key = i == 0 ? path.underscore : "#{key}/#{path.underscore}"
153
- if app.blocks_files[key] && app.blocks_files[key][type]
154
- app.blocks_files[key][type].each do |f|
155
- if type == :attributes
156
- success = load_attributes(f, model)
157
- else
158
- success = load_block_file(f, model)
160
+ load_first.each do |type|
161
+ unless (only && !only.include?(type)) || (except && except.include?(type))
162
+ with_parameters_transaction(type) do
163
+ paths.each_with_index do |path, i|
164
+ key = i == 0 ? path.underscore : "#{key}/#{path.underscore}"
165
+ if app.blocks_files[key] && app.blocks_files[key][type]
166
+ app.blocks_files[key][type].each do |f|
167
+ if type == :attributes
168
+ success = load_attributes(f, model)
169
+ else
170
+ success = load_block_file(f, model)
171
+ end
172
+ loaded ||= success
159
173
  end
160
- loaded ||= success
161
174
  end
162
175
  end
163
176
  end
164
177
  end
165
178
  end
166
- end
167
179
 
168
- # Now load the rest
169
- paths.each_with_index do |path, i|
170
- key = i == 0 ? path.underscore : "#{key}/#{path.underscore}"
171
- if app.blocks_files[key]
172
- app.blocks_files[key].each do |type, files|
173
- unless type == :_sub_block || load_first.include?(type) || (only && !only.include?(type)) || (except && except.include?(type))
174
- files.each { |f| success = load_block_file(f, model); loaded ||= success }
180
+ # Now load the rest
181
+ paths.each_with_index do |path, i|
182
+ key = i == 0 ? path.underscore : "#{key}/#{path.underscore}"
183
+ if app.blocks_files[key]
184
+ app.blocks_files[key].each do |type, files|
185
+ unless type == :_sub_block || load_first.include?(type) || (only && !only.include?(type)) || (except && except.include?(type))
186
+ files.each { |f| success = load_block_file(f, model); loaded ||= success }
187
+ end
175
188
  end
176
189
  end
177
190
  end
@@ -48,7 +48,7 @@ module Origen
48
48
  end
49
49
  if x.respond_to?(:is_an_origen_model?)
50
50
  x.send(:_initialized)
51
- Origen::Loader.load_block(x)
51
+ Origen::Loader.load_block(x, options)
52
52
  end
53
53
  if x.respond_to?(:register_callback_listener)
54
54
  Origen.after_app_loaded do |app|
@@ -317,10 +317,36 @@ module Origen
317
317
  # been instantiated yet. This is not supported yet for instantiated sub-blocks since
318
318
  # there are probably a lot more corner-cases to consider, and hopefully no one will
319
319
  # really need this anyway.
320
- if sub_blocks[name] && !sub_blocks[name].is_a?(Placeholder)
321
- fail "You have already defined a sub-block named #{name} within class #{self.class}"
320
+ # Note that override is to recreate an existing sub-block, not adding additional
321
+ # attributes to an existing one
322
+ if options[:override]
323
+ sub_blocks.delete(name)
324
+ if options[:class_name]
325
+ begin
326
+ constantizable = !!options[:class_name].constantize
327
+ rescue NameError
328
+ constantizable = false
329
+ end
330
+ # this is to handle the case where a previously instantiated subblock wont allow
331
+ # the current class name to exist
332
+ # e.g. NamespaceA::B::C
333
+ # => NameSpaceX::Y::Z
334
+ # After requiring the files, constants become sane again:
335
+ # e.g. NamespaceA::B::C
336
+ # => NameSpaceA::B::C
337
+ if constantizable && (options[:class_name] != options[:class_name].constantize.to_s)
338
+ block_dir = options[:block_file] || _find_block_dir(options)
339
+ Dir.glob("#{block_dir}/*.rb").each do |file|
340
+ require file
341
+ end
342
+ end
343
+ end
344
+ else
345
+ if sub_blocks[name] && !sub_blocks[name].is_a?(Placeholder)
346
+ fail "You have already defined a sub-block named #{name} within class #{self.class}"
347
+ end
322
348
  end
323
- if respond_to?(name)
349
+ if respond_to?(name) && !(singleton_class.instance_methods.include?(name) && options[:override])
324
350
  callers = Origen.split_caller_line caller[0]
325
351
  Origen.log.warning "The sub_block defined at #{Pathname.new(callers[0]).relative_path_from(Pathname.pwd)}:#{callers[1]} is overriding an existing method called #{name}"
326
352
  end
@@ -404,6 +430,33 @@ module Origen
404
430
 
405
431
  private
406
432
 
433
+ # @api private
434
+ # find the block directory path containing the namespace of options[:class_name]
435
+ def _find_block_dir(options, current_path = nil, remaining_namespace = nil)
436
+ current_path ||= Pathname.new("#{Origen.root}/app/blocks")
437
+ remaining_namespace ||= options[:class_name].split('::')[1..-1].map(&:underscore)
438
+ current_namespace = remaining_namespace.shift
439
+ if current_namespace
440
+ if current_path.join(current_namespace).exist?
441
+ return _find_block_dir(options, current_path.join(current_namespace), remaining_namespace)
442
+ elsif current_path.join("derivatives/#{current_namespace}").exist?
443
+ return _find_block_dir(options, current_path.join("derivatives/#{current_namespace}"), remaining_namespace)
444
+ elsif current_path.join("sub_blocks/#{current_namespace}").exist?
445
+ return _find_block_dir(options, current_path.join("sub_blocks/#{current_namespace}"), remaining_namespace)
446
+ else
447
+ Origen.log.error "Could not find block dir for namespace #{options[:class_name]}!"
448
+ fail
449
+ end
450
+ else
451
+ if current_path.join('model.rb').exist?
452
+ return current_path.to_s
453
+ else
454
+ Origen.log.error "Could not find block dir for namespace #{options[:class_name]}!"
455
+ fail
456
+ end
457
+ end
458
+ end
459
+
407
460
  def instantiate_sub_block(name, klass, options)
408
461
  return sub_blocks[name] unless sub_blocks[name].is_a?(Placeholder)
409
462
  sub_blocks[name] = klass.new(options.merge(parent: self, name: name))
@@ -8,16 +8,16 @@ Gem::Specification.new do |s|
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 1.8.11".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Stephen McGinty".freeze]
11
- s.date = "2021-01-11"
11
+ s.date = "2021-04-27"
12
12
  s.email = ["stephen.f.mcginty@gmail.com".freeze]
13
13
  s.files = ["bin/boot.rb".freeze, "config/application.rb".freeze, "config/boot.rb".freeze, "config/commands.rb".freeze, "config/shared_commands.rb".freeze, "config/version.rb".freeze, "lib/origen_app_generators.rb".freeze, "lib/origen_app_generators/application.rb".freeze, "lib/origen_app_generators/base.rb".freeze, "lib/origen_app_generators/empty_application.rb".freeze, "lib/origen_app_generators/empty_plugin.rb".freeze, "lib/origen_app_generators/new.rb".freeze, "lib/origen_app_generators/new_app_tests.rb".freeze, "lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb".freeze, "lib/origen_app_generators/plugin.rb".freeze, "lib/origen_app_generators/test_engineering/common.rb".freeze, "lib/origen_app_generators/test_engineering/stand_alone_application.rb".freeze, "lib/origen_app_generators/test_engineering/test_block.rb".freeze, "templates/app_generators".freeze, "templates/app_generators/application".freeze, "templates/app_generators/application/.gitignore".freeze, "templates/app_generators/application/.irbrc".freeze, "templates/app_generators/application/.rspec".freeze, "templates/app_generators/application/.travis.yml".freeze, "templates/app_generators/application/Gemfile".freeze, "templates/app_generators/application/Rakefile".freeze, "templates/app_generators/application/app".freeze, "templates/app_generators/application/app/blocks".freeze, "templates/app_generators/application/app/blocks/top_level.rb".freeze, "templates/app_generators/application/app/lib".freeze, "templates/app_generators/application/app/lib/module.rb".freeze, "templates/app_generators/application/app/templates".freeze, "templates/app_generators/application/app/templates/web".freeze, "templates/app_generators/application/app/templates/web/index.md.erb".freeze, "templates/app_generators/application/app/templates/web/layouts".freeze, "templates/app_generators/application/app/templates/web/layouts/_basic.html.erb".freeze, "templates/app_generators/application/app/templates/web/partials".freeze, "templates/app_generators/application/app/templates/web/partials/_navbar.html.erb".freeze, "templates/app_generators/application/app/templates/web/release_notes.md.erb".freeze, "templates/app_generators/application/config".freeze, "templates/app_generators/application/config/application.rb".freeze, "templates/app_generators/application/config/boot.rb".freeze, "templates/app_generators/application/config/commands.rb".freeze, "templates/app_generators/application/config/maillist_dev.txt".freeze, "templates/app_generators/application/config/maillist_prod.txt".freeze, "templates/app_generators/application/config/version.rb".freeze, "templates/app_generators/application/doc".freeze, "templates/app_generators/application/doc/history".freeze, "templates/app_generators/application/dot_keep".freeze, "templates/app_generators/application/origen_core_session".freeze, "templates/app_generators/application/spec".freeze, "templates/app_generators/application/spec/spec_helper.rb".freeze, "templates/app_generators/application/target".freeze, "templates/app_generators/application/target/debug.rb".freeze, "templates/app_generators/application/target/default.rb".freeze, "templates/app_generators/application/target/production.rb".freeze, "templates/app_generators/new".freeze, "templates/app_generators/new/generator.rb".freeze, "templates/app_generators/new/info.md.erb".freeze, "templates/app_generators/origen_infrastructure".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/application.rb".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/base.rb".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/module.rb".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/plugin.rb".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/config".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/config/load_generators.rb".freeze, "templates/app_generators/plugin".freeze, "templates/app_generators/plugin/Gemfile".freeze, "templates/app_generators/plugin/Rakefile".freeze, "templates/app_generators/plugin/app".freeze, "templates/app_generators/plugin/app/templates".freeze, "templates/app_generators/plugin/app/templates/web".freeze, "templates/app_generators/plugin/app/templates/web/index.md.erb".freeze, "templates/app_generators/plugin/app/templates/web/partials".freeze, "templates/app_generators/plugin/app/templates/web/partials/_navbar_external.html.erb".freeze, "templates/app_generators/plugin/app/templates/web/partials/_navbar_internal.html.erb".freeze, "templates/app_generators/plugin/config".freeze, "templates/app_generators/plugin/config/boot.rb".freeze, "templates/app_generators/plugin/gemspec.rb".freeze, "templates/app_generators/test_engineering".freeze, "templates/app_generators/test_engineering/environment".freeze, "templates/app_generators/test_engineering/environment/j750.rb".freeze, "templates/app_generators/test_engineering/environment/uflex.rb".freeze, "templates/app_generators/test_engineering/environment/v93k.rb".freeze, "templates/app_generators/test_engineering/stand_alone_application".freeze, "templates/app_generators/test_engineering/stand_alone_application/.keep".freeze, "templates/app_generators/test_engineering/test_block".freeze, "templates/app_generators/test_engineering/test_block/.keep".freeze]
14
14
  s.homepage = "http://origen-sdk.org/origen_app_generators".freeze
15
15
  s.licenses = ["MIT".freeze]
16
16
  s.required_ruby_version = Gem::Requirement.new(">= 1.9.3".freeze)
17
- s.rubygems_version = "3.1.4".freeze
17
+ s.rubygems_version = "3.2.16".freeze
18
18
  s.summary = "Origen application generators".freeze
19
19
 
20
- s.installed_by_version = "3.1.4" if s.respond_to? :installed_by_version
20
+ s.installed_by_version = "3.2.16" if s.respond_to? :installed_by_version
21
21
 
22
22
  if s.respond_to? :specification_version then
23
23
  s.specification_version = 4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.59.8
4
+ version: 0.60.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-28 00:00:00.000000000 Z
11
+ date: 2021-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -296,14 +296,14 @@ dependencies:
296
296
  requirements:
297
297
  - - "~>"
298
298
  - !ruby/object:Gem::Version
299
- version: '2'
299
+ version: '3'
300
300
  type: :runtime
301
301
  prerelease: false
302
302
  version_requirements: !ruby/object:Gem::Requirement
303
303
  requirements:
304
304
  - - "~>"
305
305
  - !ruby/object:Gem::Version
306
- version: '2'
306
+ version: '3'
307
307
  - !ruby/object:Gem::Dependency
308
308
  name: colorize
309
309
  requirement: !ruby/object:Gem::Requirement
@@ -749,7 +749,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
749
749
  - !ruby/object:Gem::Version
750
750
  version: 1.8.11
751
751
  requirements: []
752
- rubygems_version: 3.1.4
752
+ rubygems_version: 3.2.16
753
753
  signing_key:
754
754
  specification_version: 4
755
755
  summary: The Semiconductor Developer's Kit