origen 0.3.0 → 0.4.0

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: 2cf3140f29f89f5990d3fd1d9280f7ee8d3f807a
4
- data.tar.gz: 53d58d539aa2f2469f90f93a9964a01f77564ec4
3
+ metadata.gz: cdf7248a1c3000a7ea31e2721bf61b28693c9222
4
+ data.tar.gz: b264bd5d9bd97000e7a8d33d5231c90b858caad9
5
5
  SHA512:
6
- metadata.gz: 2e6de38d9c7d045398861ca6cc6ce313ed97808677ce92d49657f1eee7ffdf8e563dcc9a97ce17f9c4c7327dc0476c734f5b195e4692629ab2ff2af438d8e505
7
- data.tar.gz: 8a1e4ea8472fbc7bd32fe9b3b92c6baf0b1e1800101cb775955e40953fc8062abe7580eaf128c9be1f8fc9598a1a55d57b2e50c96791d59ad0941af6660784e2
6
+ metadata.gz: 38b82c90dbba93819b9ea1aa8a02b383101e81a1e620fb54f388fdb64b26e8fc3674a00e73f6d57ae0a774aa133aa38fec2b80917ad7af80a7756214ee8c4a36
7
+ data.tar.gz: 3aaedb9dcfb7f5c9dea81c494955bf5ed0c192c1eaa10d3d5212c3d3cab7791e6c6bed88c7ca6769a1bb91dea5f4c58504ce950bac38e440651ba39371f1db43
data/config/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
- MINOR = 3
3
+ MINOR = 4
4
4
  BUGFIX = 0
5
5
  DEV = nil
6
6
 
data/lib/origen.rb CHANGED
@@ -1,632 +1,636 @@
1
- require 'English'
2
- require 'pathname'
3
- # Keep a note of the pwd at the time when Origen was first loaded, this is initially used
4
- # by the site_config lookup.
5
- $_origen_invocation_pwd ||= Pathname.pwd
6
- require 'fileutils'
7
- require 'origen/site_config'
8
- require 'origen/operating_systems'
9
- require 'origen/core_ext'
10
- require 'origen/acronyms'
11
- require 'origen/callbacks'
12
- require 'origen/top_level'
13
- require 'origen/model'
14
- require 'origen/ruby_version_check'
15
- require 'origen/application'
16
- require 'origen/remote_manager'
17
- require 'origen/utility'
18
- require 'origen/logger_methods'
19
- require 'option_parser/optparse'
20
- require 'bundler'
21
-
22
- module Origen
23
- autoload :Features, 'origen/features'
24
- autoload :Bugs, 'origen/bugs'
25
- autoload :Generator, 'origen/generator'
26
- autoload :Pins, 'origen/pins'
27
- autoload :Registers, 'origen/registers'
28
- autoload :Users, 'origen/users'
29
- autoload :FileHandler, 'origen/file_handler'
30
- autoload :RegressionManager, 'origen/regression_manager'
31
- autoload :Location, 'origen/location'
32
- autoload :VersionString, 'origen/version_string'
33
- autoload :Mode, 'origen/mode'
34
- autoload :ChipMode, 'origen/chip_mode'
35
- autoload :ChipPackage, 'origen/chip_package'
36
- autoload :Client, 'origen/client'
37
- autoload :SubBlocks, 'origen/sub_blocks'
38
- autoload :SubBlock, 'origen/sub_blocks'
39
- autoload :ModelInitializer, 'origen/model_initializer'
40
- autoload :Controller, 'origen/controller'
41
- autoload :Database, 'origen/database'
42
- autoload :Parameters, 'origen/parameters'
43
- autoload :RevisionControl, 'origen/revision_control'
44
- autoload :Specs, 'origen/specs'
45
- autoload :CodeGenerators, 'origen/code_generators'
46
- autoload :Encodings, 'origen/encodings'
47
- autoload :Log, 'origen/log'
48
- autoload :Chips, 'origen/chips'
49
-
50
- APP_CONFIG = File.join('config', 'application.rb')
51
-
52
- class OrigenError < StandardError
53
- def self.status_code(code)
54
- define_method(:status_code) { code }
1
+ # This guard is temporary to help Freescale transition to Origen from
2
+ # our original internal version (RGen)
3
+ unless defined? RGen::ORIGENTRANSITION
4
+ require 'English'
5
+ require 'pathname'
6
+ # Keep a note of the pwd at the time when Origen was first loaded, this is initially used
7
+ # by the site_config lookup.
8
+ $_origen_invocation_pwd ||= Pathname.pwd
9
+ require 'fileutils'
10
+ require 'origen/site_config'
11
+ require 'origen/operating_systems'
12
+ require 'origen/core_ext'
13
+ require 'origen/acronyms'
14
+ require 'origen/callbacks'
15
+ require 'origen/top_level'
16
+ require 'origen/model'
17
+ require 'origen/ruby_version_check'
18
+ require 'origen/application'
19
+ require 'origen/remote_manager'
20
+ require 'origen/utility'
21
+ require 'origen/logger_methods'
22
+ require 'option_parser/optparse'
23
+ require 'bundler'
24
+
25
+ module Origen
26
+ autoload :Features, 'origen/features'
27
+ autoload :Bugs, 'origen/bugs'
28
+ autoload :Generator, 'origen/generator'
29
+ autoload :Pins, 'origen/pins'
30
+ autoload :Registers, 'origen/registers'
31
+ autoload :Users, 'origen/users'
32
+ autoload :FileHandler, 'origen/file_handler'
33
+ autoload :RegressionManager, 'origen/regression_manager'
34
+ autoload :Location, 'origen/location'
35
+ autoload :VersionString, 'origen/version_string'
36
+ autoload :Mode, 'origen/mode'
37
+ autoload :ChipMode, 'origen/chip_mode'
38
+ autoload :ChipPackage, 'origen/chip_package'
39
+ autoload :Client, 'origen/client'
40
+ autoload :SubBlocks, 'origen/sub_blocks'
41
+ autoload :SubBlock, 'origen/sub_blocks'
42
+ autoload :ModelInitializer, 'origen/model_initializer'
43
+ autoload :Controller, 'origen/controller'
44
+ autoload :Database, 'origen/database'
45
+ autoload :Parameters, 'origen/parameters'
46
+ autoload :RevisionControl, 'origen/revision_control'
47
+ autoload :Specs, 'origen/specs'
48
+ autoload :CodeGenerators, 'origen/code_generators'
49
+ autoload :Encodings, 'origen/encodings'
50
+ autoload :Log, 'origen/log'
51
+ autoload :Chips, 'origen/chips'
52
+
53
+ APP_CONFIG = File.join('config', 'application.rb')
54
+
55
+ class OrigenError < StandardError
56
+ def self.status_code(code)
57
+ define_method(:status_code) { code }
58
+ end
55
59
  end
56
- end
57
60
 
58
- class GitError < OrigenError; status_code(11); end
59
- class DesignSyncError < OrigenError; status_code(12); end
61
+ class GitError < OrigenError; status_code(11); end
62
+ class DesignSyncError < OrigenError; status_code(12); end
60
63
 
61
- class << self
62
- include Origen::Utility::TimeAndDate
64
+ class << self
65
+ include Origen::Utility::TimeAndDate
63
66
 
64
- def enable_profiling
65
- @profiling = true
66
- end
67
+ def enable_profiling
68
+ @profiling = true
69
+ end
67
70
 
68
- def disable_profiling
69
- @profiling = false
70
- end
71
+ def disable_profiling
72
+ @profiling = false
73
+ end
71
74
 
72
- def profile(message)
73
- if @profiling
74
- caller[0] =~ /.*\/(\w+\.rb):(\d+).*/
75
- if block_given?
76
- start = Time.now
77
- yield
78
- duration_in_ms = ((Time.now - start) * 1000).round
79
- puts "#{duration_in_ms}ms".ljust(10) + "#{Regexp.last_match[1]}:#{Regexp.last_match[2]} '#{message}'"
75
+ def profile(message)
76
+ if @profiling
77
+ caller[0] =~ /.*\/(\w+\.rb):(\d+).*/
78
+ if block_given?
79
+ start = Time.now
80
+ yield
81
+ duration_in_ms = ((Time.now - start) * 1000).round
82
+ puts "#{duration_in_ms}ms".ljust(10) + "#{Regexp.last_match[1]}:#{Regexp.last_match[2]} '#{message}'"
83
+ else
84
+ puts "#{Time.now} - #{Regexp.last_match[1]}:#{Regexp.last_match[2]} #{message}"
85
+ end
80
86
  else
81
- puts "#{Time.now} - #{Regexp.last_match[1]}:#{Regexp.last_match[2]} #{message}"
87
+ yield if block_given?
82
88
  end
83
- else
84
- yield if block_given?
85
89
  end
86
- end
87
90
 
88
- def register_application(app)
89
- _applications_lookup[:name][app.name] = app
90
- _applications_lookup[:root][app.root.to_s] = app
91
- @plugins = nil
92
- end
91
+ def register_application(app)
92
+ _applications_lookup[:name][app.name] = app
93
+ _applications_lookup[:root][app.root.to_s] = app
94
+ @plugins = nil
95
+ end
93
96
 
94
- def plugins
95
- Origen.deprecate 'Origen.plugins is deprecated, use Origen.app.plugins instead'
96
- Origen.app.plugins
97
- end
97
+ def plugins
98
+ Origen.deprecate 'Origen.plugins is deprecated, use Origen.app.plugins instead'
99
+ Origen.app.plugins
100
+ end
98
101
 
99
- def app_loaded?
100
- @application_loaded
101
- end
102
+ def app_loaded?
103
+ @application_loaded
104
+ end
102
105
 
103
- # Returns the current (top-level) application instance
104
- def app(plugin = nil, _options = {})
105
- plugin, options = nil, plugin if plugin.is_a?(Hash)
106
- if plugin
107
- load_application
108
- app = _applications_lookup[:name][plugin.to_sym]
109
- if app
110
- app
106
+ # Returns the current (top-level) application instance
107
+ def app(plugin = nil, _options = {})
108
+ plugin, options = nil, plugin if plugin.is_a?(Hash)
109
+ if plugin
110
+ load_application
111
+ app = _applications_lookup[:name][plugin.to_sym]
112
+ if app
113
+ app
114
+ else
115
+ puts "Couldn't find application instance called #{plugin}, known names are:"
116
+ puts " #{_applications_lookup[:name].keys.join(', ')}"
117
+ puts
118
+ fail 'Origen.root lookup error!'
119
+ end
111
120
  else
112
- puts "Couldn't find application instance called #{plugin}, known names are:"
113
- puts " #{_applications_lookup[:name].keys.join(', ')}"
114
- puts
115
- fail 'Origen.root lookup error!'
121
+ load_application
116
122
  end
117
- else
118
- load_application
119
123
  end
120
- end
121
- alias_method :application, :app
122
-
123
- # Equivalent to application except that if called from code in a plugin this
124
- # will return that plugin's application instance
125
- def app!
126
- file = caller[0]
127
- path = @current_source_dir || Pathname.new(file).dirname
128
- until File.exist?(File.join(path, APP_CONFIG)) || path.root?
129
- path = path.parent
130
- end
131
- if path.root?
132
- fail "Something went wrong resoving Origen.app! from: #{caller[0]}"
124
+ alias_method :application, :app
125
+
126
+ # Equivalent to application except that if called from code in a plugin this
127
+ # will return that plugin's application instance
128
+ def app!
129
+ file = caller[0]
130
+ path = @current_source_dir || Pathname.new(file).dirname
131
+ until File.exist?(File.join(path, APP_CONFIG)) || path.root?
132
+ path = path.parent
133
+ end
134
+ if path.root?
135
+ fail "Something went wrong resoving Origen.app! from: #{caller[0]}"
136
+ end
137
+ find_app_by_root(path)
133
138
  end
134
- find_app_by_root(path)
135
- end
136
- alias_method :application!, :app!
139
+ alias_method :application!, :app!
137
140
 
138
- # @api private
139
- def with_source_file(file)
140
- @current_source_dir = Pathname.new(file).dirname
141
- yield
142
- @current_source_dir = nil
143
- end
141
+ # @api private
142
+ def with_source_file(file)
143
+ @current_source_dir = Pathname.new(file).dirname
144
+ yield
145
+ @current_source_dir = nil
146
+ end
144
147
 
145
- # Validates that when the current app is OrigenCore then the
146
- # origen executable is coming from the same workspace
147
- #
148
- # @api private
149
- def validate_origen_dev_configuration!
150
- if Origen.app.name == :origen_core
151
- if Origen.root != Origen.top
152
- puts 'It looks like you are trying to develop Origen core, but you are running an Origen'
153
- puts 'executable from another workspace!'
154
- if Origen.running_on_windows?
155
- puts 'To resolve this error you must add the following directory to your Windows PATH:'
156
- puts " #{Origen.root}\\bin"
157
- else
158
- puts 'To resolve this error run:'
159
- puts " cd #{Origen.root}"
160
- puts ' source source_setup'
148
+ # Validates that when the current app is OrigenCore then the
149
+ # origen executable is coming from the same workspace
150
+ #
151
+ # @api private
152
+ def validate_origen_dev_configuration!
153
+ if Origen.app.name == :origen_core
154
+ if Origen.root != Origen.top
155
+ puts 'It looks like you are trying to develop Origen core, but you are running an Origen'
156
+ puts 'executable from another workspace!'
157
+ if Origen.running_on_windows?
158
+ puts 'To resolve this error you must add the following directory to your Windows PATH:'
159
+ puts " #{Origen.root}\\bin"
160
+ else
161
+ puts 'To resolve this error run:'
162
+ puts " cd #{Origen.root}"
163
+ puts ' source source_setup'
164
+ end
165
+ exit 1
161
166
  end
162
- exit 1
163
167
  end
164
168
  end
165
- end
166
169
 
167
- # @api private
168
- def _applications_lookup
169
- @_applications_lookup ||= { name: {}, root: {} }
170
- end
170
+ # @api private
171
+ def _applications_lookup
172
+ @_applications_lookup ||= { name: {}, root: {} }
173
+ end
171
174
 
172
- # Returns an instance of Origen::Users::LDAP which provides
173
- # methods to query and authorize users against a company's LDAP-based employee directory
174
- def ldap
175
- @ldap ||= Origen::Users::LDAP.new
176
- end
175
+ # Returns an instance of Origen::Users::LDAP which provides
176
+ # methods to query and authorize users against a company's LDAP-based employee directory
177
+ def ldap
178
+ @ldap ||= Origen::Users::LDAP.new
179
+ end
177
180
 
178
- # Return the application instance from the given path
179
- # to an Origen application workspace, i.e. Origen.app conventionally
180
- # returns the current application instance, this method returns the
181
- # same thing that would be returned from the given remote workspace.
182
- #
183
- # @api private
184
- def find_app_by_root(path_to_origen_root, options = {})
185
- app = _applications_lookup[:root][Pathname.new(path_to_origen_root).realpath.to_s]
186
- if !app || options[:reload]
187
- # If the application is already defined then un-define it, this is to allow it to
188
- # be reloaded.
189
- # This option feels like it doesn't belong here, but is part of the legacy import
190
- # require system. When that has been removed in future so can this reload system, under
191
- # bundler app versions will be resolved before loading them so there will be no need
192
- # for this
193
- if app
194
- begin
195
- Object.send(:remove_const, app.class.to_s)
196
- rescue
197
- # Nothing to do here
181
+ # Return the application instance from the given path
182
+ # to an Origen application workspace, i.e. Origen.app conventionally
183
+ # returns the current application instance, this method returns the
184
+ # same thing that would be returned from the given remote workspace.
185
+ #
186
+ # @api private
187
+ def find_app_by_root(path_to_origen_root, options = {})
188
+ app = _applications_lookup[:root][Pathname.new(path_to_origen_root).realpath.to_s]
189
+ if !app || options[:reload]
190
+ # If the application is already defined then un-define it, this is to allow it to
191
+ # be reloaded.
192
+ # This option feels like it doesn't belong here, but is part of the legacy import
193
+ # require system. When that has been removed in future so can this reload system, under
194
+ # bundler app versions will be resolved before loading them so there will be no need
195
+ # for this
196
+ if app
197
+ begin
198
+ Object.send(:remove_const, app.class.to_s)
199
+ rescue
200
+ # Nothing to do here
201
+ end
198
202
  end
203
+ require File.join(path_to_origen_root, APP_CONFIG)
204
+ app = _applications_lookup[:root][Pathname.new(path_to_origen_root).realpath.to_s]
199
205
  end
200
- require File.join(path_to_origen_root, APP_CONFIG)
201
- app = _applications_lookup[:root][Pathname.new(path_to_origen_root).realpath.to_s]
202
- end
203
- return app if app
204
- puts "Couldn't find application instance with root #{path_to_origen_root}, known roots are:"
205
- _applications_lookup[:root].keys.each do |key|
206
- puts " #{key}"
206
+ return app if app
207
+ puts "Couldn't find application instance with root #{path_to_origen_root}, known roots are:"
208
+ _applications_lookup[:root].keys.each do |key|
209
+ puts " #{key}"
210
+ end
211
+ puts
212
+ fail 'Application lookup error!'
207
213
  end
208
- puts
209
- fail 'Application lookup error!'
210
- end
211
- alias_method :application_instance, :find_app_by_root
212
- alias_method :app_instance, :find_app_by_root
214
+ alias_method :application_instance, :find_app_by_root
215
+ alias_method :app_instance, :find_app_by_root
213
216
 
214
- def command_dispatcher
215
- @command_dispatcher ||= Application::CommandDispatcher.new
216
- end
217
+ def command_dispatcher
218
+ @command_dispatcher ||= Application::CommandDispatcher.new
219
+ end
217
220
 
218
- def configuration
219
- app.config
220
- end
221
- alias_method :config, :configuration
221
+ def configuration
222
+ app.config
223
+ end
224
+ alias_method :config, :configuration
222
225
 
223
- def mailer
224
- application.mailer
225
- end
226
+ def mailer
227
+ application.mailer
228
+ end
226
229
 
227
- def target
228
- application.target
229
- end
230
+ def target
231
+ application.target
232
+ end
230
233
 
231
- def load_target(t, options = {})
232
- target.temporary = t
233
- application.load_target!(options)
234
- application.runner.prepare_and_validate_workspace
235
- end
234
+ def load_target(t, options = {})
235
+ target.temporary = t
236
+ application.load_target!(options)
237
+ application.runner.prepare_and_validate_workspace
238
+ end
236
239
 
237
- def environment
238
- application.environment
239
- end
240
+ def environment
241
+ application.environment
242
+ end
240
243
 
241
- # Returns true if Origen is running in an application workspace
242
- def in_app_workspace?
243
- path = Pathname.new(Dir.pwd)
244
- until path.root? || File.exist?(File.join(path, APP_CONFIG))
245
- path = path.parent
244
+ # Returns true if Origen is running in an application workspace
245
+ def in_app_workspace?
246
+ path = Pathname.new(Dir.pwd)
247
+ until path.root? || File.exist?(File.join(path, APP_CONFIG))
248
+ path = path.parent
249
+ end
250
+ !path.root?
246
251
  end
247
- !path.root?
248
- end
249
252
 
250
- def root(plugin = nil)
251
- if plugin
252
- app(plugin).root
253
- else
254
- if @root_fudge_active
255
- app.root
253
+ def root(plugin = nil)
254
+ if plugin
255
+ app(plugin).root
256
256
  else
257
- @root ||= begin
258
- path = Pathname.new(Dir.pwd)
259
- until path.root? || File.exist?(File.join(path, APP_CONFIG))
260
- path = path.parent
261
- end
262
- if path.root?
263
- fail 'Something went wrong resolving the application root!'
257
+ if @root_fudge_active
258
+ app.root
259
+ else
260
+ @root ||= begin
261
+ path = Pathname.new(Dir.pwd)
262
+ until path.root? || File.exist?(File.join(path, APP_CONFIG))
263
+ path = path.parent
264
+ end
265
+ if path.root?
266
+ fail 'Something went wrong resolving the application root!'
267
+ end
268
+ path
264
269
  end
265
- path
266
270
  end
267
271
  end
268
272
  end
269
- end
270
- alias_method :app_root, :root
271
-
272
- # Like Origen.root but this will return the plugin root if called by plugin code
273
- def root!
274
- file = caller[0]
275
- path = Pathname.new(file).dirname
276
- until path.root? || File.exist?(File.join(path, APP_CONFIG))
277
- path = path.parent
278
- end
279
- if path.root?
280
- fail "Something went wrong resolving Origen.root! from: #{caller[0]}"
273
+ alias_method :app_root, :root
274
+
275
+ # Like Origen.root but this will return the plugin root if called by plugin code
276
+ def root!
277
+ file = caller[0]
278
+ path = Pathname.new(file).dirname
279
+ until path.root? || File.exist?(File.join(path, APP_CONFIG))
280
+ path = path.parent
281
+ end
282
+ if path.root?
283
+ fail "Something went wrong resolving Origen.root! from: #{caller[0]}"
284
+ end
285
+ path.realpath
281
286
  end
282
- path.realpath
283
- end
284
287
 
285
- # Ugly hack to force Origen.root references to the plugin's top-level when loading
286
- # the environment.rb of the plugin
287
- #
288
- # References to Origen.root in a plugin environment.rb is deprecated and this will be
289
- # removed in future once all plugins load through bundler
290
- #
291
- # @api private
292
- def with_origen_root(path)
293
- orig = app.root
294
- @root_fudge_active = true
295
- app.root = Pathname.new(path)
296
- yield
297
- app.root = orig
298
- @root_fudge_active = false
299
- end
300
-
301
- # Turns off bundler and all plugins if the app is loaded within this block
302
- # @api private
303
- def with_boot_environment
304
- @with_boot_environment = true
305
- yield
306
- @with_boot_environment = false
307
- end
288
+ # Ugly hack to force Origen.root references to the plugin's top-level when loading
289
+ # the environment.rb of the plugin
290
+ #
291
+ # References to Origen.root in a plugin environment.rb is deprecated and this will be
292
+ # removed in future once all plugins load through bundler
293
+ #
294
+ # @api private
295
+ def with_origen_root(path)
296
+ orig = app.root
297
+ @root_fudge_active = true
298
+ app.root = Pathname.new(path)
299
+ yield
300
+ app.root = orig
301
+ @root_fudge_active = false
302
+ end
308
303
 
309
- # This is the application-facing API for implementing custom callbacks,
310
- # the top-level application, all plugin application instances, and any
311
- # application objects that include the Origen::Callbacks module will be
312
- # returned
313
- #
314
- # Origen system callbacks should use Origen.app.listeners_for instead, that
315
- # version will return only the current plugin instance instead of them all
316
- # (yes we need to make the API more obvious).
317
- def listeners_for(*args)
318
- callback = args.shift
319
- max = args.first.is_a?(Numeric) ? args.shift : nil
320
- listeners = [Origen.app] + Origen.plugins +
321
- Origen.app.instantiated_callback_listeners
322
- listeners = listeners.select { |l| l.respond_to?(callback) }
323
- if max && listeners.size > max
324
- 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)}"
325
- end
326
- listeners
327
- end
304
+ # Turns off bundler and all plugins if the app is loaded within this block
305
+ # @api private
306
+ def with_boot_environment
307
+ @with_boot_environment = true
308
+ yield
309
+ @with_boot_environment = false
310
+ end
328
311
 
329
- def generator
330
- @generator ||= Generator.new
331
- end
312
+ # This is the application-facing API for implementing custom callbacks,
313
+ # the top-level application, all plugin application instances, and any
314
+ # application objects that include the Origen::Callbacks module will be
315
+ # returned
316
+ #
317
+ # Origen system callbacks should use Origen.app.listeners_for instead, that
318
+ # version will return only the current plugin instance instead of them all
319
+ # (yes we need to make the API more obvious).
320
+ def listeners_for(*args)
321
+ callback = args.shift
322
+ max = args.first.is_a?(Numeric) ? args.shift : nil
323
+ listeners = [Origen.app] + Origen.app.plugins +
324
+ Origen.app.instantiated_callback_listeners
325
+ listeners = listeners.select { |l| l.respond_to?(callback) }
326
+ if max && listeners.size > max
327
+ 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)}"
328
+ end
329
+ listeners
330
+ end
332
331
 
333
- def client
334
- @client ||= Client.new
335
- end
332
+ def generator
333
+ @generator ||= Generator.new
334
+ end
336
335
 
337
- def tester
338
- application && application.tester
339
- end
336
+ def client
337
+ @client ||= Client.new
338
+ end
340
339
 
341
- def pin_bank
342
- @pin_bank ||= Pins::PinBank.new
343
- end
340
+ def tester
341
+ application && application.tester
342
+ end
344
343
 
345
- def file_handler
346
- @file_handler ||= FileHandler.new
347
- end
344
+ def pin_bank
345
+ @pin_bank ||= Pins::PinBank.new
346
+ end
348
347
 
349
- def regression_manager
350
- @regression_manager ||= RegressionManager.new
351
- end
348
+ def file_handler
349
+ @file_handler ||= FileHandler.new
350
+ end
352
351
 
353
- def import_manager
354
- Origen.deprecated 'Origen.import_manager is deprecated, use Origen.app.plugins instead'
355
- app.plugins
356
- end
357
- alias_method :imports_manager, :import_manager
352
+ def regression_manager
353
+ @regression_manager ||= RegressionManager.new
354
+ end
358
355
 
359
- def plugins_manager
360
- Origen.deprecated 'Origen.plugins_manager and Origen.current_plugin are deprecated, use Origen.app.plugins instead'
361
- app.plugins
362
- end
363
- alias_method :plugin_manager, :plugins_manager
364
- alias_method :current_plugin, :plugins_manager
356
+ def import_manager
357
+ Origen.deprecated 'Origen.import_manager is deprecated, use Origen.app.plugins instead'
358
+ app.plugins
359
+ end
360
+ alias_method :imports_manager, :import_manager
365
361
 
366
- def remote_manager
367
- @remote_manager ||= RemoteManager.new
368
- end
369
- alias_method :remotes_manager, :remote_manager
362
+ def plugins_manager
363
+ Origen.deprecated 'Origen.plugins_manager and Origen.current_plugin are deprecated, use Origen.app.plugins instead'
364
+ app.plugins
365
+ end
366
+ alias_method :plugin_manager, :plugins_manager
367
+ alias_method :current_plugin, :plugins_manager
370
368
 
371
- def pattern
372
- generator.pattern
373
- end
369
+ def remote_manager
370
+ @remote_manager ||= RemoteManager.new
371
+ end
372
+ alias_method :remotes_manager, :remote_manager
374
373
 
375
- def flow
376
- generator.flow
377
- end
374
+ def pattern
375
+ generator.pattern
376
+ end
378
377
 
379
- def resources
380
- generator.resources
381
- end
378
+ def flow
379
+ generator.flow
380
+ end
382
381
 
383
- def time
384
- @time ||= Origen::Tester::Time.new
385
- end
382
+ def resources
383
+ generator.resources
384
+ end
386
385
 
387
- def controllers
388
- @controllers ||= []
389
- end
386
+ def time
387
+ @time ||= Origen::Tester::Time.new
388
+ end
390
389
 
391
- def version(options = {})
392
- @version = nil if options[:refresh]
393
- return @version if @version && !options[:refresh]
394
- if options[:refresh] || !defined?(Origen::VERSION)
395
- load File.join(Pathname.new(File.dirname(__FILE__)).parent, 'config', 'version.rb')
390
+ def controllers
391
+ @controllers ||= []
396
392
  end
397
- @version = Origen::VersionString.new(Origen::VERSION)
398
- end
399
393
 
400
- # Loads the top-level application and all of its plugins, but not the target
401
- #
402
- # In most cases this should never need to be called directly and will be called
403
- # automatically the first time the application is referenced via Origen.app
404
- def load_application(options = {})
405
- @application ||= begin
406
- # This flag is set so that when a thread starts with no app it remains with no app. This
407
- # was an issue when building a new app with the fetch command and when the thread did a
408
- # chdir to the new app directory (to fetch it) Origen.log would try to load the partial app.
409
- @running_outside_an_app = true unless in_app_workspace?
410
- return nil if @running_outside_an_app
411
- require File.join(root, APP_CONFIG)
412
- @application = _applications_lookup[:root][root.to_s]
413
- if File.exist?(File.join(root, 'Gemfile')) && !@with_boot_environment
414
- # Don't understand the rules here, belt and braces approach for now to make
415
- # sure that all Origen plugins are auto-required (otherwise Origen won't know
416
- # about them to plug them into the application)
417
- Bundler.require
418
- Bundler.require(:development)
419
- Bundler.require(:runtime)
420
- Bundler.require(:default)
394
+ def version(options = {})
395
+ @version = nil if options[:refresh]
396
+ return @version if @version && !options[:refresh]
397
+ if options[:refresh] || !defined?(Origen::VERSION)
398
+ load File.join(Pathname.new(File.dirname(__FILE__)).parent, 'config', 'version.rb')
421
399
  end
422
- if @with_boot_environment
423
- @application.plugins.disable_current
424
- else
425
- Origen.remote_manager.require!
400
+ @version = Origen::VersionString.new(Origen::VERSION)
401
+ end
402
+
403
+ # Loads the top-level application and all of its plugins, but not the target
404
+ #
405
+ # In most cases this should never need to be called directly and will be called
406
+ # automatically the first time the application is referenced via Origen.app
407
+ def load_application(options = {})
408
+ @application ||= begin
409
+ # This flag is set so that when a thread starts with no app it remains with no app. This
410
+ # was an issue when building a new app with the fetch command and when the thread did a
411
+ # chdir to the new app directory (to fetch it) Origen.log would try to load the partial app.
412
+ @running_outside_an_app = true unless in_app_workspace?
413
+ return nil if @running_outside_an_app
414
+ require File.join(root, APP_CONFIG)
415
+ @application = _applications_lookup[:root][root.to_s]
416
+ if File.exist?(File.join(root, 'Gemfile')) && !@with_boot_environment
417
+ # Don't understand the rules here, belt and braces approach for now to make
418
+ # sure that all Origen plugins are auto-required (otherwise Origen won't know
419
+ # about them to plug them into the application)
420
+ Bundler.require
421
+ Bundler.require(:development)
422
+ Bundler.require(:runtime)
423
+ Bundler.require(:default)
424
+ end
425
+ if @with_boot_environment
426
+ @application.plugins.disable_current
427
+ else
428
+ Origen.remote_manager.require!
429
+ end
430
+ boot = File.join(root, 'config', 'boot.rb')
431
+ require boot if File.exist?(boot)
432
+ env = File.join(root, 'config', 'environment.rb')
433
+ require env if File.exist?(env)
434
+ dev = File.join(root, 'config', 'development.rb')
435
+ require dev if File.exist?(dev)
436
+ validate_origen_dev_configuration!
437
+ ([@application] + Origen.app.plugins).each(&:on_loaded)
438
+ @application_loaded = true
439
+ @application
426
440
  end
427
- boot = File.join(root, 'config', 'boot.rb')
428
- require boot if File.exist?(boot)
429
- env = File.join(root, 'config', 'environment.rb')
430
- require env if File.exist?(env)
431
- dev = File.join(root, 'config', 'development.rb')
432
- require dev if File.exist?(dev)
433
- validate_origen_dev_configuration!
434
- ([@application] + Origen.app.plugins).each(&:on_loaded)
435
- @application_loaded = true
436
- @application
437
441
  end
438
- end
439
442
 
440
- def launch_time
441
- @launch_time ||= time_now
442
- end
443
+ def launch_time
444
+ @launch_time ||= time_now
445
+ end
443
446
 
444
- # Returns the full path to the Origen core top-level directory
445
- def top
446
- @origen_top ||= Pathname.new(File.dirname(__FILE__)).parent
447
- end
447
+ # Returns the full path to the Origen core top-level directory
448
+ def top
449
+ @origen_top ||= Pathname.new(File.dirname(__FILE__)).parent
450
+ end
448
451
 
449
- # Compile the given file and return the result as a string
450
- def compile(file, options = {})
451
- Origen::Generator::Compiler.new.compile_inline(file, options)
452
- end
452
+ # Compile the given file and return the result as a string
453
+ def compile(file, options = {})
454
+ Origen::Generator::Compiler.new.compile_inline(file, options)
455
+ end
453
456
 
454
- def interfaces
455
- @interfaces ||= []
456
- end
457
+ def interfaces
458
+ @interfaces ||= []
459
+ end
457
460
 
458
- def add_interface(interface_class)
459
- interfaces << interface_class
460
- end
461
+ def add_interface(interface_class)
462
+ interfaces << interface_class
463
+ end
461
464
 
462
- # Resets the tester interface (instantiates a new one). Any supplied options
463
- # are passed to the interface initialization.
464
- def reset_interface(options = {})
465
- # The doc interface should in future be phased out, but for now assume that an explicitly
466
- # declared interface is for the non-doc case
467
- if options[:interface] && !Origen.tester.doc?
468
- @interface = eval(options[:interface]).new(options)
469
- else
470
- int = interfaces.find { |i| i.supports?(Origen.tester) }
471
- if int
472
- @interface = int.new(options)
465
+ # Resets the tester interface (instantiates a new one). Any supplied options
466
+ # are passed to the interface initialization.
467
+ def reset_interface(options = {})
468
+ # The doc interface should in future be phased out, but for now assume that an explicitly
469
+ # declared interface is for the non-doc case
470
+ if options[:interface] && !Origen.tester.doc?
471
+ @interface = eval(options[:interface]).new(options)
473
472
  else
474
- unless options.delete(:silence_no_interface_error)
475
- fail "No interface has been defined for tester: #{Origen.tester.class}"
473
+ int = interfaces.find { |i| i.supports?(Origen.tester) }
474
+ if int
475
+ @interface = int.new(options)
476
+ else
477
+ unless options.delete(:silence_no_interface_error)
478
+ fail "No interface has been defined for tester: #{Origen.tester.class}"
479
+ end
476
480
  end
477
481
  end
482
+ @interface._load_generator if @interface.respond_to?(:_load_generator)
483
+ if @interface.respond_to?(:at_flow_start)
484
+ @interface.at_flow_start
485
+ else
486
+ @interface.reset_globals if @interface.respond_to?(:reset_globals)
487
+ end
488
+ @interface
478
489
  end
479
- @interface._load_generator if @interface.respond_to?(:_load_generator)
480
- if @interface.respond_to?(:at_flow_start)
481
- @interface.at_flow_start
482
- else
483
- @interface.reset_globals if @interface.respond_to?(:reset_globals)
484
- end
485
- @interface
486
- end
487
490
 
488
- def interface_loaded?
489
- !!@interface
490
- end
491
+ def interface_loaded?
492
+ !!@interface
493
+ end
491
494
 
492
- # Returns the (application defined) test program interface for the given tester
493
- # if one has been defined, otherwise returns nil
494
- def interface(options = {})
495
- @interface || reset_interface(options)
496
- end
495
+ # Returns the (application defined) test program interface for the given tester
496
+ # if one has been defined, otherwise returns nil
497
+ def interface(options = {})
498
+ @interface || reset_interface(options)
499
+ end
497
500
 
498
- # Returns true if an interface is defined for the current tester
499
- def interface_present?
500
- !!interface(silence_no_interface_error: true)
501
- end
501
+ # Returns true if an interface is defined for the current tester
502
+ def interface_present?
503
+ !!interface(silence_no_interface_error: true)
504
+ end
502
505
 
503
- # Use User.current to retrieve the current user, this is an internal API that will
504
- # be cleaned up (removed) in future
505
- # @api private
506
- def current_user
507
- if app_loaded? || in_app_workspace?
508
- application.current_user
509
- else
510
- User.new(User.current_user_id)
506
+ # Use User.current to retrieve the current user, this is an internal API that will
507
+ # be cleaned up (removed) in future
508
+ # @api private
509
+ def current_user
510
+ if app_loaded? || in_app_workspace?
511
+ application.current_user
512
+ else
513
+ User.new(User.current_user_id)
514
+ end
511
515
  end
512
- end
513
516
 
514
- def lsf
515
- application.lsf_manager
516
- end
517
+ def lsf
518
+ application.lsf_manager
519
+ end
517
520
 
518
- def running_on_windows?
519
- Origen.os.windows?
520
- end
521
+ def running_on_windows?
522
+ Origen.os.windows?
523
+ end
521
524
 
522
- def running_on_linux?
523
- !running_on_windows?
524
- end
525
+ def running_on_linux?
526
+ !running_on_windows?
527
+ end
525
528
 
526
- def running_remotely?
527
- @running_remotely
528
- end
529
- alias_method :running_remotely, :running_remotely?
529
+ def running_remotely?
530
+ @running_remotely
531
+ end
532
+ alias_method :running_remotely, :running_remotely?
530
533
 
531
- def running_locally?
532
- !running_remotely?
533
- end
534
+ def running_locally?
535
+ !running_remotely?
536
+ end
534
537
 
535
- def running_remotely=(val)
536
- @running_remotely = val
537
- end
538
+ def running_remotely=(val)
539
+ @running_remotely = val
540
+ end
538
541
 
539
- # Returns true if Origen is running with the -d or --debug switches enabled
540
- def debug?
541
- @debug || false
542
- end
543
- alias_method :debugger?, :debug?
542
+ # Returns true if Origen is running with the -d or --debug switches enabled
543
+ def debug?
544
+ @debug || false
545
+ end
546
+ alias_method :debugger?, :debug?
544
547
 
545
- def enable_debugger
546
- @debug = true
547
- end
548
+ def enable_debugger
549
+ @debug = true
550
+ end
548
551
 
549
- def debugger_enabled?
550
- @debug
551
- end
552
+ def debugger_enabled?
553
+ @debug
554
+ end
552
555
 
553
- def development?
554
- # This should be integrated with Origen.config.mode in the future
555
- @development
556
- end
556
+ def development?
557
+ # This should be integrated with Origen.config.mode in the future
558
+ @development
559
+ end
557
560
 
558
- def set_development_mode
559
- @development = true
560
- end
561
+ def set_development_mode
562
+ @development = true
563
+ end
561
564
 
562
- # Returns an object tracking the Origen execution mode/configuration, an
563
- # instance of Origen::Mode
564
- def mode
565
- application.config.mode
566
- end
565
+ # Returns an object tracking the Origen execution mode/configuration, an
566
+ # instance of Origen::Mode
567
+ def mode
568
+ application.config.mode
569
+ end
567
570
 
568
- def mode=(val)
569
- application.config.mode = val
570
- end
571
+ def mode=(val)
572
+ application.config.mode = val
573
+ end
571
574
 
572
- # Returns the current top-level (DUT) object if one has been defined (by
573
- # instantiating an object that includes Origen::TopLevel).
574
- def top_level
575
- application.top_level
576
- end
575
+ # Returns the current top-level (DUT) object if one has been defined (by
576
+ # instantiating an object that includes Origen::TopLevel).
577
+ def top_level
578
+ application.top_level
579
+ end
577
580
 
578
- def deprecate(*msgs)
579
- _deprecate(*msgs)
580
- if Origen.app
581
- # If an app deprecation return the caller who called the deprecated method
582
- if caller[0] =~ /#{Origen.root}/
583
- c = caller[1]
584
- # If an Origen deprecation then return the first caller from the current app
581
+ def deprecate(*msgs)
582
+ _deprecate(*msgs)
583
+ if Origen.app
584
+ # If an app deprecation return the caller who called the deprecated method
585
+ if caller[0] =~ /#{Origen.root}/
586
+ c = caller[1]
587
+ # If an Origen deprecation then return the first caller from the current app
588
+ else
589
+ c = caller.find { |line| line =~ /#{Origen.root}/ }
590
+ end
585
591
  else
586
- c = caller.find { |line| line =~ /#{Origen.root}/ }
592
+ c = caller[1]
593
+ end
594
+ c =~ /(.*):(\d+):.*/
595
+ begin
596
+ _deprecate "Called by #{Regexp.last_match[1]}:#{Regexp.last_match[2]}", options
597
+ rescue
598
+ # For this to fail it means the deprecated method was called by IRB or similar
599
+ # and in that case there is no point advising who called anyway
587
600
  end
588
- else
589
- c = caller[1]
590
- end
591
- c =~ /(.*):(\d+):.*/
592
- begin
593
- _deprecate "Called by #{Regexp.last_match[1]}:#{Regexp.last_match[2]}", options
594
- rescue
595
- # For this to fail it means the deprecated method was called by IRB or similar
596
- # and in that case there is no point advising who called anyway
597
601
  end
598
- end
599
- alias_method :deprecated, :deprecate
602
+ alias_method :deprecated, :deprecate
600
603
 
601
- def log
602
- @log ||= Log.new
603
- end
604
+ def log
605
+ @log ||= Log.new
606
+ end
604
607
 
605
- # Returns the name of the currently executing Origen command (a String),
606
- # e.g. 'generate', 'program', 'compile', etc.
607
- def current_command
608
- @current_command
609
- end
608
+ # Returns the name of the currently executing Origen command (a String),
609
+ # e.g. 'generate', 'program', 'compile', etc.
610
+ def current_command
611
+ @current_command
612
+ end
610
613
 
611
- private
614
+ private
612
615
 
613
- def current_command=(val)
614
- @current_command = val
615
- end
616
+ def current_command=(val)
617
+ @current_command = val
618
+ end
616
619
 
617
- def _deprecate(*lines)
618
- options = lines.last.is_a?(Hash) ? lines.pop : {}
619
- lines.flatten.each do |line|
620
- line.split(/\n/).each do |line|
621
- log.deprecate line
620
+ def _deprecate(*lines)
621
+ options = lines.last.is_a?(Hash) ? lines.pop : {}
622
+ lines.flatten.each do |line|
623
+ line.split(/\n/).each do |line|
624
+ log.deprecate line
625
+ end
622
626
  end
623
627
  end
624
628
  end
625
629
  end
626
- end
627
630
 
628
- # This is already required by commands.rb, but also necessary here so
629
- # that is included whenever rspec (or another 3rd party) loads Origen
630
- # outside the scope of an Origen command
631
- require 'origen/global_methods'
632
- include Origen::GlobalMethods
631
+ # This is already required by commands.rb, but also necessary here so
632
+ # that is included whenever rspec (or another 3rd party) loads Origen
633
+ # outside the scope of an Origen command
634
+ require 'origen/global_methods'
635
+ include Origen::GlobalMethods
636
+ end
@@ -81,7 +81,7 @@ module Origen
81
81
  end
82
82
  end
83
83
  # Finally those that the plugin's have given us
84
- ([Origen.app] + Origen.plugins).each do |plugin|
84
+ ([Origen.app] + Origen.app.plugins).each do |plugin|
85
85
  namespace plugin.name do
86
86
  Dir.glob("#{plugin.root}/lib/tasks/shared/*.rake").sort.each do |file|
87
87
  load file
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty