Class: Origen::Application
- Inherits:
-
Object
show all
- Includes:
- Users
- Defined in:
- lib/origen/application.rb,
lib/origen/application/lsf.rb,
lib/origen/application/runner.rb,
lib/origen/application/target.rb,
lib/origen/application/release.rb,
lib/origen/application/deployer.rb,
lib/origen/application/statistics.rb,
lib/origen/application/environment.rb,
lib/origen/application/lsf_manager.rb,
lib/origen/application/configuration.rb,
lib/origen/application/plugins_manager.rb,
lib/origen/application/version_tracker.rb,
lib/origen/application/workspace_manager.rb,
lib/origen/application/command_dispatcher.rb,
lib/origen/application/configuration_manager.rb
Overview
In Origen v2 this class was introduced to formally co-ordinate application level configuration of Origen.
Configuration
See Origen::Application::Configuration for the available options.
Defined Under Namespace
Classes: CommandDispatcher, Configuration, ConfigurationManager, Deployer, Environment, LSF, LSFManager, PluginsManager, RakeLoader, Release, Runner, Statistics, Target, VersionTracker, WorkspaceManager
Instance Attribute Summary collapse
-
#current_job ⇒ Object
Returns the value of attribute current_job.
-
#name ⇒ Object
Returns the name of the given application, this is the name that will be used to refer to the application when it is used as a plugin.
-
#namespace ⇒ Object
Returns the namespace used by the application as a string.
Class Method Summary
collapse
Instance Method Summary
collapse
-
#add_callback_listener(obj) ⇒ Object
-
#add_lib_to_load_path! ⇒ Object
This method is called just after an application inherits from Origen::Application, allowing the developer to load classes in lib and use them during application configuration.
-
#add_persistant_callback_listener(obj) ⇒ Object
-
#add_pin_to_pin_map(id, pin) ⇒ Object
-
#add_pingroup_to_pingroup_map(id, pins) ⇒ Object
-
#add_toplevel_listener(obj) ⇒ Object
-
#author(version = Origen.app.version.prefixed) ⇒ Object
Returns the author (committer) for the current or given application version.
-
#branch(version = Origen.app.version.prefixed) ⇒ Object
(also: #selector)
Returns the branch for the current or given application version.
-
#callback_listeners ⇒ Object
-
#clear_dynamic_resources(type = :transient) ⇒ Object
-
#config ⇒ Object
-
#configuration_manager ⇒ Object
(also: #cm)
-
#contributors ⇒ Object
-
#current? ⇒ Boolean
Returns true if the given application instance is the current top level application.
-
#current_plugin? ⇒ Boolean
Returns true if the given application instance is the current plugin.
-
#db ⇒ Object
-
#deployer ⇒ Object
-
#dynamic_resource(name, default, options = {}) ⇒ Object
Enable for debugging to see what the currently tracked objects are def object_store [@load_event, @static_resources, @transient_resources] end.
-
#environment ⇒ Object
-
#gem_name ⇒ Object
-
#inspect ⇒ Object
-
#instantiated_callback_listeners ⇒ Object
-
#listeners_for(*args) ⇒ Object
-
#load_console ⇒ Object
-
#load_event(type) ⇒ Object
-
#load_target!(options = {}) ⇒ Object
-
#load_tasks ⇒ Object
Load all rake tasks defined in the application’s lib/task directory.
-
#lsf ⇒ Object
-
#lsf_manager ⇒ Object
-
#mailer ⇒ Object
-
#on_loaded ⇒ Object
This callback handler will fire once the main app and all of its plugins have been loaded.
-
#origen_core? ⇒ Boolean
Convenience method to check if the given application instance is Origen core.
-
#pattern_iterators ⇒ Object
-
#pdm_component ⇒ Object
-
#pin_map ⇒ Object
-
#pin_names ⇒ Object
-
#pin_pattern_exclude ⇒ Object
-
#pin_pattern_order ⇒ Object
-
#pingroup_map ⇒ Object
-
#plugins_manager ⇒ Object
(also: #plugin_manager, #current_plugin)
-
#previous_versions ⇒ Object
-
#release(options) ⇒ Object
-
#release_date(version = Origen.app.version.prefixed) ⇒ Object
Returns the release date for the current or given application version.
-
#release_note(version = Origen.app.version.prefixed) ⇒ Object
Returns the release note for the current or given application version.
-
#release_time(version = Origen.app.version.prefixed) ⇒ Object
Returns the release time for the current or given application version.
-
#reload_target!(options = {}) ⇒ Object
Equivalent to load_target! except that any options that were passed to load_target! the last time it was called will be re-applied when (re)loading the target.
-
#require_environment! ⇒ Object
-
#revision_controller ⇒ Object
(also: #rc)
-
#root ⇒ Object
Returns a full path to the root directory of the given application.
-
#root=(val) ⇒ Object
-
#runner ⇒ Object
-
#server_data ⇒ Object
Returns the server data packet available for the given application, returns nil if none is found.
-
#session ⇒ Object
-
#set_dynamic_resource(name, value) ⇒ Object
-
#statistics ⇒ Object
(also: #stats)
-
#subscribers_dev ⇒ Object
Returns an array of users who have subscribed for development release notifications for the given application on the website.
-
#subscribers_prod ⇒ Object
Returns an array of users who have subscribed for production release notifications for the given application on the website.
-
#target ⇒ Object
-
#target_instantiated? ⇒ Boolean
-
#tester ⇒ Object
-
#tester=(obj) ⇒ Object
-
#top_level ⇒ Object
Returns the current top-level object (the DUT).
-
#toplevel_listeners ⇒ Object
-
#unload_target! ⇒ Object
private
Not a clean unload, but allows objects to be re-instantiated for testing.
-
#version(options = {}) ⇒ Object
-
#version_tracker ⇒ Object
-
#versions ⇒ Object
-
#with_doc_tester(options = {}) ⇒ Object
Any attempts to instantiate a test within the give block will be forced to instantiate an Origen::Tester::Doc instance.
-
#with_doc_tester? ⇒ Boolean
-
#with_html_doc_tester? ⇒ Boolean
-
#workspace_manager ⇒ Object
Methods included from Users
#admins, #app_users, #current_user
Instance Attribute Details
#current_job ⇒ Object
Returns the value of attribute current_job.
26
27
28
|
# File 'lib/origen/application.rb', line 26
def current_job
@current_job
end
|
Returns the name of the given application, this is the name that will be used to refer to the application when it is used as a plugin
403
404
405
|
# File 'lib/origen/application.rb', line 403
def name
@name
end
|
#namespace ⇒ Object
Returns the namespace used by the application as a string
158
159
160
|
# File 'lib/origen/application.rb', line 158
def namespace
@namespace
end
|
Class Method Details
.inherited(base) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/origen/application.rb', line 31
def inherited(base)
unless caller[0] =~ /version.rb.*/
root = Pathname.new(caller[0].sub(/(\\|\/)?config(\\|\/)application.rb.*/, '')).realpath
app = base.instance
app.root = root.to_s
Origen.register_application(app)
app.add_lib_to_load_path!
end
end
|
43
44
45
|
# File 'lib/origen/application.rb', line 43
def instance
@instance ||= new
end
|
.respond_to?(*args) ⇒ Boolean
47
48
49
|
# File 'lib/origen/application.rb', line 47
def respond_to?(*args)
super || instance.respond_to?(*args)
end
|
Instance Method Details
#add_callback_listener(obj) ⇒ Object
510
511
512
|
# File 'lib/origen/application.rb', line 510
def add_callback_listener(obj)
dynamic_resource(:callback_listeners, [], adding: true) << obj
end
|
#add_lib_to_load_path! ⇒ Object
This method is called just after an application inherits from Origen::Application, allowing the developer to load classes in lib and use them during application configuration.
class MyApplication < Origen::Application
require "my_backend" config.i18n.backend = MyBackend
end
740
741
742
743
744
|
# File 'lib/origen/application.rb', line 740
def add_lib_to_load_path! [root.join('lib'), root.join('vendor', 'lib')].each do |path|
$LOAD_PATH.unshift(path.to_s) if File.exist?(path) && !$LOAD_PATH.include?(path.to_s)
end
end
|
#add_persistant_callback_listener(obj) ⇒ Object
514
515
516
517
518
|
# File 'lib/origen/application.rb', line 514
def add_persistant_callback_listener(obj)
@persistant_callback_listeners ||= []
@persistant_callback_listeners << obj
@persistant_callback_listeners.uniq!
end
|
#add_pin_to_pin_map(id, pin) ⇒ Object
564
565
566
567
568
569
570
571
572
|
# File 'lib/origen/application.rb', line 564
def add_pin_to_pin_map(id, pin)
if @load_event
pin_map[id] = pin
else
@transient_resources[:pin_map][id] = pin
end
end
|
#add_pingroup_to_pingroup_map(id, pins) ⇒ Object
578
579
580
581
582
583
584
585
586
|
# File 'lib/origen/application.rb', line 578
def add_pingroup_to_pingroup_map(id, pins)
if @load_event
pingroup_map[id] = pins
else
@transient_resources[:pingroup_map][id] = pins
end
end
|
#add_toplevel_listener(obj) ⇒ Object
520
521
522
523
524
525
526
527
|
# File 'lib/origen/application.rb', line 520
def add_toplevel_listener(obj)
if Origen.top_level
puts "Attempt to set an instance of #{obj.class} as the top level when there is already an instance of #{Origen.top_level.class} defined as the top-level!"
fail 'Only one object that include the Origen::TopLevel module can be instantiated per target!'
end
$dut = obj
dynamic_resource(:toplevel_listeners, [], adding: true) << obj
end
|
#author(version = Origen.app.version.prefixed) ⇒ Object
Returns the author (committer) for the current or given application version
If the user can be found in the directory then a user object will be returned, otherwise the name will be returned as a String
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
|
# File 'lib/origen/application.rb', line 325
def author(version = Origen.app.version.prefixed)
version = VersionString.new(version)
version = version.prefixed if version.semantic?
capture = false
File.readlines("#{Origen.root}/doc/history").each do |line|
line = line.strip
if capture
if capture && line =~ /^#+ by (.*) on (.*(AM|PM))/
user = Origen.fsl.find_by_name(Regexp.last_match(1))
return user if user
return Regexp.last_match(1)
end
else
if line =~ /Tag:/
line = line.gsub('\\', '')
if line =~ /^#+ Tag: #{version}$/ ||
line =~ />Tag: #{version}</
capture = true
end
end
end
end
nil
end
|
#branch(version = Origen.app.version.prefixed) ⇒ Object
Also known as:
selector
Returns the branch for the current or given application version
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
|
# File 'lib/origen/application.rb', line 351
def branch(version = Origen.app.version.prefixed)
version = VersionString.new(version)
version = version.prefixed if version.semantic?
capture = false
File.readlines("#{Origen.root}/doc/history").each do |line|
line = line.strip
if capture
if capture && line =~ /^#+ .*(Selector|Branch): '(.*)'/
return Regexp.last_match(2).gsub('\\', '')
end
else
if line =~ /Tag:/
line = line.gsub('\\', '')
if line =~ /^#+ Tag: #{version}$/ ||
line =~ />Tag: #{version}</
capture = true
end
end
end
end
nil
end
|
#callback_listeners ⇒ Object
495
496
497
498
499
500
|
# File 'lib/origen/application.rb', line 495
def callback_listeners
current = Origen.current_plugin.instance
applications = [self]
applications << current if current
applications + instantiated_callback_listeners
end
|
#clear_dynamic_resources(type = :transient) ⇒ Object
714
715
716
717
718
719
720
|
# File 'lib/origen/application.rb', line 714
def clear_dynamic_resources(type = :transient)
if type == :transient
@transient_resources = nil
else
@static_resources = nil
end
end
|
397
398
399
|
# File 'lib/origen/application.rb', line 397
def config
@config ||= Configuration.new(self)
end
|
#configuration_manager ⇒ Object
Also known as:
cm
486
487
488
|
# File 'lib/origen/application.rb', line 486
def configuration_manager
@cm ||= ConfigurationManager.new
end
|
#contributors ⇒ Object
387
388
389
390
391
392
393
394
395
|
# File 'lib/origen/application.rb', line 387
def contributors
c = []
File.readlines("#{Origen.root}/doc/history").each do |line|
if line =~ /^#+ by (.*) on /
c << Regexp.last_match(1)
end
end
c.uniq
end
|
#current? ⇒ Boolean
Returns true if the given application instance is the current top level application
194
195
196
|
# File 'lib/origen/application.rb', line 194
def current?
Origen.app == self
end
|
#current_plugin? ⇒ Boolean
Returns true if the given application instance is the current plugin
200
201
202
203
204
205
206
|
# File 'lib/origen/application.rb', line 200
def current_plugin?
if Origen.current_plugin.name
Origen.current_plugin.instance == self
else
false
end
end
|
433
434
435
|
# File 'lib/origen/application.rb', line 433
def deployer
@deployer ||= Deployer.new
end
|
#dynamic_resource(name, default, options = {}) ⇒ Object
Enable for debugging to see what the currently tracked objects are def object_store
[@load_event, @static_resources, @transient_resources]
end
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
|
# File 'lib/origen/application.rb', line 687
def dynamic_resource(name, default, options = {})
@static_resources ||= {}
@transient_resources ||= {}
if @load_event == :static ||
(!@load_event && options[:adding])
if options[:set]
@static_resources[name] = default
else
@static_resources[name] ||= default
end
elsif @load_event == :transient
if options[:set]
@transient_resources[name] = default
else
@transient_resources[name] ||= default
end
else
static = @static_resources[name] ||= default
transient = @transient_resources[name] ||= default
if static.respond_to?('+')
static + transient
else
static.merge(transient)
end
end
end
|
#environment ⇒ Object
421
422
423
|
# File 'lib/origen/application.rb', line 421
def environment
@environment ||= Environment.new
end
|
407
408
409
|
# File 'lib/origen/application.rb', line 407
def gem_name
(Origen.app.config.gem_name || name).to_s.underscore.symbolize
end
|
137
138
139
|
# File 'lib/origen/application.rb', line 137
def inspect
"<Origen app (#{name}):#{object_id}>"
end
|
#instantiated_callback_listeners ⇒ Object
502
503
504
|
# File 'lib/origen/application.rb', line 502
def instantiated_callback_listeners
dynamic_resource(:callback_listeners, []) + (@persistant_callback_listeners || [])
end
|
#listeners_for(*args) ⇒ Object
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
# File 'lib/origen/application.rb', line 213
def listeners_for(*args)
callback = args.shift
max = args.first.is_a?(Numeric) ? args.shift : nil
options = args.shift || {}
options = {
top_level: :first
}.merge(options)
listeners = callback_listeners
if Origen.top_level
listeners -= [Origen.top_level]
if options[:top_level]
if options[:top_level] == :last
listeners = listeners + [Origen.top_level]
else
listeners = [Origen.top_level] + listeners
end
end
end
listeners = listeners.select { |l| l.respond_to?(callback) }
if max && listeners.size > max
fail "You can only define a #{callback} callback #{max > 1 ? (max.to_s + 'times') : 'once'}, however you have declared it #{listeners.size} times for instances of: #{listeners.map(&:class)}"
end
listeners
end
|
#load_console ⇒ Object
612
613
614
|
# File 'lib/origen/application.rb', line 612
def load_console
load_target!
end
|
#load_event(type) ⇒ Object
722
723
724
725
726
|
# File 'lib/origen/application.rb', line 722
def load_event(type)
@load_event = type
yield
@load_event = nil
end
|
#load_target!(options = {}) ⇒ Object
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
|
# File 'lib/origen/application.rb', line 616
def load_target!(options = {})
options = {
force_debug: false
}.merge(options)
if options[:reload]
@target_load_count = 0
else
@target_load_count ||= 0
@target_load_count += 1
end
listeners_for(:before_load_target).each(&:before_load_target)
@target_load_options = options.merge({})
clear_dynamic_resources
load_event(:transient) do
Origen.config.mode = :production begin
$_target_options = @target_load_options
Origen.target.set_signature(@target_load_options)
$dut = nil
load environment.file if environment.file
load target.file!
ensure
$_target_options = nil
end
@target_instantiated = true
Origen.config.mode = :debug if options[:force_debug]
listeners_for(:on_create).each(&:on_create)
listeners_for(:on_load_target).each(&:on_load_target)
end
listeners_for(:after_load_target).each(&:after_load_target)
Origen.import_manager.validate_production_status
end
|
#load_tasks ⇒ Object
Load all rake tasks defined in the application’s lib/task directory
425
426
427
|
# File 'lib/origen/application.rb', line 425
def lsf
@lsf ||= LSF.new
end
|
#lsf_manager ⇒ Object
437
438
439
|
# File 'lib/origen/application.rb', line 437
def lsf_manager
@lsf_manager ||= LSFManager.new
end
|
449
450
451
|
# File 'lib/origen/application.rb', line 449
def mailer
@mailer ||= Utility::Mailer.new
end
|
#on_loaded ⇒ Object
This callback handler will fire once the main app and all of its plugins have been loaded
128
129
130
|
# File 'lib/origen/application.rb', line 128
def on_loaded
config.log_deprecations
end
|
#origen_core? ⇒ Boolean
Convenience method to check if the given application instance is Origen core
133
134
135
|
# File 'lib/origen/application.rb', line 133
def origen_core?
name.to_s.symbolize == :origen_core
end
|
#pattern_iterators ⇒ Object
491
492
493
|
# File 'lib/origen/application.rb', line 491
def pattern_iterators
@pattern_iterators ||= []
end
|
#pdm_component ⇒ Object
461
462
463
464
465
466
467
468
469
470
|
# File 'lib/origen/application.rb', line 461
def pdm_component
return @pdm_component if @pdm_component
require "#{Origen.root}/config/pdm_component"
begin
@pdm_component = (eval "#{Origen.app.class}::PDMComponent").new
rescue
@pdm_component = ::Application::PDMComponent.new
end
end
|
560
561
562
|
# File 'lib/origen/application.rb', line 560
def pin_map
dynamic_resource(:pin_map, {})
end
|
#pin_names ⇒ Object
604
605
606
607
608
609
610
|
# File 'lib/origen/application.rb', line 604
def pin_names
if @load_event
dynamic_resource(:pin_names, {})
else
@transient_resources[:pin_names] ||= {}
end
end
|
#pin_pattern_exclude ⇒ Object
596
597
598
599
600
601
602
|
# File 'lib/origen/application.rb', line 596
def pin_pattern_exclude
if @load_event
dynamic_resource(:pin_pattern_exclude, [])
else
@transient_resources[:pin_pattern_exclude] ||= []
end
end
|
#pin_pattern_order ⇒ Object
588
589
590
591
592
593
594
|
# File 'lib/origen/application.rb', line 588
def pin_pattern_order
if @load_event
dynamic_resource(:pin_pattern_order, [])
else
@transient_resources[:pin_pattern_order] ||= []
end
end
|
#pingroup_map ⇒ Object
574
575
576
|
# File 'lib/origen/application.rb', line 574
def pingroup_map
dynamic_resource(:pingroup_map, {})
end
|
#plugins_manager ⇒ Object
Also known as:
plugin_manager, current_plugin
411
412
413
|
# File 'lib/origen/application.rb', line 411
def plugins_manager
@plugins_manager ||= PluginsManager.new
end
|
#previous_versions ⇒ Object
375
376
377
378
379
380
381
382
383
384
385
|
# File 'lib/origen/application.rb', line 375
def previous_versions
versions = []
File.readlines("#{Origen.root}/doc/history").each do |line|
line = line.strip
if line =~ /^#+ Tag: (.*)$/ ||
line =~ />Tag: ([^<]*)</
versions << Regexp.last_match(1).gsub('\\', '')
end
end
versions.uniq
end
|
#release(options) ⇒ Object
476
477
478
479
|
# File 'lib/origen/application.rb', line 476
def release(options)
@release ||= Release.new
@release.run(options)
end
|
#release_date(version = Origen.app.version.prefixed) ⇒ Object
Returns the release date for the current or given application version
292
293
294
295
|
# File 'lib/origen/application.rb', line 292
def release_date(version = Origen.app.version.prefixed)
time = release_time(version)
time ? time.to_date : nil
end
|
#release_note(version = Origen.app.version.prefixed) ⇒ Object
Returns the release note for the current or given application version
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
# File 'lib/origen/application.rb', line 255
def release_note(version = Origen.app.version.prefixed)
version = VersionString.new(version)
version = version.prefixed if version.semantic?
capture = false
note_started = false
note = []
File.readlines("#{Origen.root}/doc/history").each do |line|
line = line.strip
if capture
if note_started
if line =~ /^<a class="anchor release_tag/ || line =~ /^#+ Tag/
note.pop while note.last && note.last.empty?
return note
end
if line.empty? && note.empty?
else
note << line
end
elsif line =~ /^#+ by/
note_started = true
end
else
if line =~ /Tag:/
line = line.gsub('\\', '')
if line =~ /^#+ Tag: #{version}$/ ||
line =~ />Tag: #{version}</
capture = true
end
end
end
end
note.pop while note.last && note.last.empty?
note
end
|
#release_time(version = Origen.app.version.prefixed) ⇒ Object
Returns the release time for the current or given application version
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
# File 'lib/origen/application.rb', line 298
def release_time(version = Origen.app.version.prefixed)
version = VersionString.new(version)
version = version.prefixed if version.semantic?
capture = false
File.readlines("#{Origen.root}/doc/history").each do |line|
line = line.strip
if capture
if capture && line =~ /^#+ by .* on (.*(AM|PM))/
return Time.parse(Regexp.last_match(1))
end
else
if line =~ /Tag:/
line = line.gsub('\\', '')
if line =~ /^#+ Tag: #{version}$/ ||
line =~ />Tag: #{version}</
capture = true
end
end
end
end
nil
end
|
#reload_target!(options = {}) ⇒ Object
Equivalent to load_target! except that any options that were passed to load_target! the last time it was called will be re-applied when (re)loading the target.
668
669
670
671
672
673
674
675
676
|
# File 'lib/origen/application.rb', line 668
def reload_target!(options = {})
old_options = @target_load_options || {}
options = (@target_load_options || {}).merge(options)
if options[:skip_first_time] && @target_load_count == 1
@target_load_count += 1
else
load_target!(options.merge(reload: true))
end
end
|
#require_environment! ⇒ Object
145
146
147
|
# File 'lib/origen/application.rb', line 145
def require_environment!
Origen.deprecate 'Calling app.require_environment! is no longer required, the app environment is now automtically loaded when Origen.app is called'
end
|
#revision_controller ⇒ Object
Also known as:
rc
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# File 'lib/origen/application.rb', line 99
def revision_controller
if current?
if config.rc_url
if config.rc_url =~ /^sync:/
@revision_controller ||= RevisionControl::DesignSync.new(
local: root,
remote: config.rc_url
)
elsif config.rc_url =~ /git/
@revision_controller ||= RevisionControl::Git.new(
local: root,
remote: config.rc_url
)
else
fail "The revision control type could not be worked out from the value config.rc_url: #{config.rc_url}"
end
else
@revision_controller ||= RevisionControl::DesignSync.new(
local: root,
remote: config.vault
)
end
else
fail "Only the top-level application has a revision controller! #{name} is a plugin"
end
end
|
Returns a full path to the root directory of the given application
If the application instance is a plugin then this will point to where the application is installed within the imports directory
153
154
155
|
# File 'lib/origen/application.rb', line 153
def root
@root
end
|
#root=(val) ⇒ Object
141
142
143
|
# File 'lib/origen/application.rb', line 141
def root=(val)
@root = Pathname.new(val)
end
|
429
430
431
|
# File 'lib/origen/application.rb', line 429
def runner
@runner ||= Runner.new
end
|
#server_data ⇒ Object
Returns the server data packet available for the given application, returns nil if none is found
184
185
186
187
188
189
190
|
# File 'lib/origen/application.rb', line 184
def server_data
if name == :origen
@server_data ||= Origen.client.origen
else
@server_data ||= Origen.client.plugins.find { |p| p[:origen_name].downcase == name.to_s.downcase }
end
end
|
457
458
459
|
# File 'lib/origen/application.rb', line 457
def session
@session ||= Database::KeyValueStores.new(self, persist: false)
end
|
#set_dynamic_resource(name, value) ⇒ Object
678
679
680
|
# File 'lib/origen/application.rb', line 678
def set_dynamic_resource(name, value)
dynamic_resource(name, value, set: true)
end
|
#statistics ⇒ Object
Also known as:
stats
481
482
483
|
# File 'lib/origen/application.rb', line 481
def statistics
runner.statistics
end
|
#subscribers_dev ⇒ Object
Returns an array of users who have subscribed for development release notifications for the given application on the website
174
175
176
177
178
179
180
|
# File 'lib/origen/application.rb', line 174
def subscribers_dev
if server_data
@subscribers_dev ||= server_data[:subscribers_dev].map { |u| User.new(u[:core_id]) }
else
[]
end
end
|
#subscribers_prod ⇒ Object
Returns an array of users who have subscribed for production release notifications for the given application on the website
164
165
166
167
168
169
170
|
# File 'lib/origen/application.rb', line 164
def subscribers_prod
if server_data
@subscribers_prod ||= server_data[:subscribers_prod].map { |u| User.new(u[:core_id]) }
else
[]
end
end
|
417
418
419
|
# File 'lib/origen/application.rb', line 417
def target
@target ||= Target.new
end
|
#target_instantiated? ⇒ Boolean
728
729
730
|
# File 'lib/origen/application.rb', line 728
def target_instantiated?
@target_instantiated
end
|
549
550
551
|
# File 'lib/origen/application.rb', line 549
def tester
dynamic_resource(:tester, []).first
end
|
#tester=(obj) ⇒ Object
553
554
555
556
557
558
|
# File 'lib/origen/application.rb', line 553
def tester=(obj)
set_dynamic_resource(:tester, [obj])
end
|
#top_level ⇒ Object
Returns the current top-level object (the DUT)
209
210
211
|
# File 'lib/origen/application.rb', line 209
def top_level
toplevel_listeners.first
end
|
#toplevel_listeners ⇒ Object
506
507
508
|
# File 'lib/origen/application.rb', line 506
def toplevel_listeners
dynamic_resource(:toplevel_listeners, [])
end
|
#unload_target! ⇒ 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.
Not a clean unload, but allows objects to be re-instantiated for testing
657
658
659
660
661
662
663
|
# File 'lib/origen/application.rb', line 657
def unload_target!
listeners_for(:before_load_target).each(&:before_load_target)
clear_dynamic_resources
clear_dynamic_resources(:static)
Origen::Pins.clear_pin_aliases
$dut = nil
end
|
#version(options = {}) ⇒ Object
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
# File 'lib/origen/application.rb', line 238
def version(options = {})
@version = nil if options[:refresh]
return @version if @version
load File.join(root, 'config', 'version.rb')
if defined? eval(namespace)::VERSION
@version = Origen::VersionString.new(eval(namespace)::VERSION)
else
@version = Origen::VersionString.new(eval(self.class.to_s)::VERSION)
end
@version
end
|
#version_tracker ⇒ Object
441
442
443
|
# File 'lib/origen/application.rb', line 441
def version_tracker
@version_tracker ||= VersionTracker.new
end
|
472
473
474
|
# File 'lib/origen/application.rb', line 472
def versions
version_tracker.versions
end
|
#with_doc_tester(options = {}) ⇒ Object
Any attempts to instantiate a test within the give block will be forced to instantiate an Origen::Tester::Doc instance
531
532
533
534
535
536
537
538
539
|
# File 'lib/origen/application.rb', line 531
def with_doc_tester(options = {})
@with_doc_tester = true
if options[:html]
@with_html_doc_tester = true
end
yield
@with_doc_tester = false
@with_html_doc_tester = false
end
|
#with_doc_tester? ⇒ Boolean
541
542
543
|
# File 'lib/origen/application.rb', line 541
def with_doc_tester?
@with_doc_tester
end
|
#with_html_doc_tester? ⇒ Boolean
545
546
547
|
# File 'lib/origen/application.rb', line 545
def with_html_doc_tester?
@with_html_doc_tester
end
|
#workspace_manager ⇒ Object
445
446
447
|
# File 'lib/origen/application.rb', line 445
def workspace_manager
@workspace_manager ||= WorkspaceManager.new
end
|