origen 0.7.24 → 0.7.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96077b0fbaaf9abb787b9db8aa77e996da1035b9
4
- data.tar.gz: 9c54cb2a4381a4176e683a5818660f5e69a979df
3
+ metadata.gz: f00de9cfd35bf3b781f46b122cdba834cc4e463e
4
+ data.tar.gz: b7bd2adf089d4ed70c76ed834fbcbf1a2afba6bb
5
5
  SHA512:
6
- metadata.gz: c0a59431d8da8766af067d96397e11fb0d22b78a3e8a6f8ebb34b6b1cdd8f2f5ed21e73ea57bb0cd4a1897030e2a4aa292aa4f936afdcc166ba7cf5a7be470fe
7
- data.tar.gz: a192b3b3d8a0982d7302570899709f70b8ad44b585ef1d2e034c0d7b3baf227a4fe2ad9bd85b4918938efddd747032e62cbed515882cc223b17e8aa355005555
6
+ metadata.gz: 9714b2e319c3aaef19d537801f97969d2852e7b843a91f88fe7a9cd19786e58a28b79a7a0036defacfe2bb292f522ef13053c90ab14c189dcc8d16ccd36cf6c8
7
+ data.tar.gz: ad47dec90e2fa07fe5c9c19840681d715716c8913b1871bca2e30685471240902bff5761ec789a29adcdf06067e5da68b041d1e6a6db3f9edb890939742e8259
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
3
  MINOR = 7
4
- BUGFIX = 24
4
+ BUGFIX = 25
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
data/lib/origen.rb CHANGED
@@ -105,9 +105,10 @@ unless defined? RGen::ORIGENTRANSITION
105
105
  Origen.app.plugins
106
106
  end
107
107
 
108
- def app_loaded?
108
+ def application_loaded?
109
109
  @application_loaded
110
110
  end
111
+ alias_method :app_loaded?, :application_loaded?
111
112
 
112
113
  def plugins_loaded?
113
114
  @plugins_loaded
@@ -452,10 +453,29 @@ unless defined? RGen::ORIGENTRANSITION
452
453
  validate_origen_dev_configuration!
453
454
  ([@application] + Origen.app.plugins).each(&:on_loaded)
454
455
  @application_loaded = true
456
+ Array(@after_app_loaded_blocks).each { |b| b.call(@application) }
455
457
  @application
456
458
  end
457
459
  end
458
460
 
461
+ # Sometimes it is necessary to refer to the app instance before it is fully loaded, which can lead to runtime
462
+ # errors.
463
+ #
464
+ # Such code can be wrapped in this method to ensure that it will run safely by differing it until the app
465
+ # is fully loaded.
466
+ #
467
+ # Origen.after_app_loaded do
468
+ # Origen.app.do_something
469
+ # end
470
+ def after_app_loaded(&block)
471
+ if application_loaded?
472
+ yield app
473
+ else
474
+ @after_app_loaded_blocks ||= []
475
+ @after_app_loaded_blocks << block
476
+ end
477
+ end
478
+
459
479
  # @api private
460
480
  def loading_top_level?
461
481
  @loading_top_level
@@ -36,7 +36,7 @@ module Origen
36
36
  app = base.instance
37
37
  app.root = root.to_s
38
38
  if Origen.plugins_loaded? && !Origen.loading_top_level?
39
- Origen.log.warning "The #{app.name} plugin is using a non-standard loading mechanism, upgrade to a newer version to get rid of this error (please report a bug if that does not remove this warning)"
39
+ Origen.log.warning "The #{app.name} plugin is using a non-standard loading mechanism, upgrade to a newer version of it to get rid of this warning (please report a bug to its owner if this warning persists)"
40
40
  Origen.app.plugins << app
41
41
  else
42
42
  Origen.register_application(app)
@@ -260,10 +260,10 @@ module Origen
260
260
  def current?
261
261
  # If this is called before the plugins are loaded (i.e. by a plugin's application file), then
262
262
  # it is definitely not the top-level app
263
- if Origen.plugins_loaded?
263
+ if Origen.application_loaded?
264
264
  Origen.app == self
265
265
  else
266
- false
266
+ Origen.root == root
267
267
  end
268
268
  end
269
269
  alias_method :standalone?, :current?
@@ -272,7 +272,7 @@ module Origen
272
272
  # Returns true if the given application instance is
273
273
  # the current plugin
274
274
  def current_plugin?
275
- if Origen.plugins_loaded?
275
+ if Origen.application_loaded?
276
276
  Origen.app.plugins.current == self
277
277
  else
278
278
  puts <<-END
@@ -74,7 +74,9 @@ module Origen
74
74
 
75
75
  def create_iterator
76
76
  iterator = PatternIterator.new
77
- Origen.app.pattern_iterators << iterator
77
+ Origen.after_app_loaded do |app|
78
+ app.pattern_iterators << iterator
79
+ end
78
80
  iterator
79
81
  end
80
82
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.24
4
+ version: 0.7.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty