origen 0.44.0 → 0.50.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/config/application.rb +2 -2
  3. data/config/boot.rb +0 -7
  4. data/config/commands.rb +3 -74
  5. data/config/rubocop/easy_disabled.yml +4 -0
  6. data/config/rubocop/easy_enabled.yml +0 -4
  7. data/config/rubocop/strict_disabled.yml +4 -0
  8. data/config/rubocop/strict_enabled.yml +0 -4
  9. data/config/version.rb +1 -2
  10. data/lib/origen/application/deployer.rb +3 -1
  11. data/lib/origen/application/release.rb +2 -2
  12. data/lib/origen/application/runner.rb +9 -2
  13. data/lib/origen/application.rb +91 -2
  14. data/lib/origen/boot/app.rb +0 -4
  15. data/lib/origen/boot.rb +2 -1
  16. data/lib/origen/code_generators/actions.rb +244 -34
  17. data/lib/origen/code_generators/base.rb +9 -2
  18. data/lib/origen/code_generators/block.rb +203 -0
  19. data/lib/origen/code_generators/block_common.rb +100 -0
  20. data/lib/origen/code_generators/dut.rb +62 -0
  21. data/lib/origen/code_generators/feature.rb +50 -0
  22. data/lib/origen/code_generators/klass.rb +41 -0
  23. data/lib/origen/code_generators/model.rb +60 -0
  24. data/lib/origen/code_generators/module.rb +92 -0
  25. data/lib/origen/code_generators.rb +30 -10
  26. data/lib/origen/commands/lint.rb +6 -1
  27. data/lib/origen/commands/new.rb +1 -1
  28. data/lib/origen/commands/new_resource.rb +41 -0
  29. data/lib/origen/commands/web.rb +11 -6
  30. data/lib/origen/commands.rb +18 -0
  31. data/lib/{option_parser → origen/core_ext/option_parser}/optparse.rb +0 -0
  32. data/lib/origen/dependencies.rb +0 -0
  33. data/lib/origen/file_handler.rb +8 -4
  34. data/lib/origen/generator/pattern_finder.rb +3 -3
  35. data/lib/origen/loader.rb +377 -0
  36. data/lib/origen/model.rb +22 -1
  37. data/lib/origen/model_initializer.rb +5 -1
  38. data/lib/origen/parameters/set.rb +2 -1
  39. data/lib/origen/parameters.rb +95 -3
  40. data/lib/origen/sub_blocks.rb +21 -7
  41. data/lib/origen/top_level.rb +11 -0
  42. data/lib/origen.rb +3 -1
  43. data/origen_app_generators/Gemfile +6 -2
  44. data/origen_app_generators/Gemfile.lock +83 -72
  45. data/origen_app_generators/bin/boot.rb +4 -2
  46. data/origen_app_generators/config/commands.rb +3 -3
  47. data/origen_app_generators/config/shared_commands.rb +11 -6
  48. data/origen_app_generators/lbin/bundle +105 -0
  49. data/origen_app_generators/lbin/byebug +29 -0
  50. data/origen_app_generators/lbin/coderay +29 -0
  51. data/origen_app_generators/lbin/htmldiff +29 -0
  52. data/origen_app_generators/lbin/httparty +29 -0
  53. data/origen_app_generators/lbin/httpclient +29 -0
  54. data/origen_app_generators/lbin/kramdown +29 -0
  55. data/origen_app_generators/lbin/ldiff +29 -0
  56. data/origen_app_generators/lbin/nanoc +29 -0
  57. data/origen_app_generators/lbin/nokogiri +29 -0
  58. data/origen_app_generators/lbin/origen +62 -0
  59. data/origen_app_generators/lbin/pry +29 -0
  60. data/origen_app_generators/lbin/rackup +29 -0
  61. data/origen_app_generators/lbin/rake +29 -0
  62. data/origen_app_generators/lbin/rspec +29 -0
  63. data/origen_app_generators/lbin/rubocop +29 -0
  64. data/origen_app_generators/lbin/ruby-parse +29 -0
  65. data/origen_app_generators/lbin/ruby-rewrite +29 -0
  66. data/origen_app_generators/lbin/thor +29 -0
  67. data/origen_app_generators/lbin/tilt +29 -0
  68. data/origen_app_generators/lbin/yard +29 -0
  69. data/origen_app_generators/lbin/yardoc +29 -0
  70. data/origen_app_generators/lbin/yri +29 -0
  71. data/origen_app_generators/lib/origen_app_generators/application.rb +12 -12
  72. data/origen_app_generators/lib/origen_app_generators/base.rb +34 -8
  73. data/origen_app_generators/lib/origen_app_generators/new.rb +17 -9
  74. data/origen_app_generators/lib/{tasks/new_app_tests.rake → origen_app_generators/new_app_tests.rb} +1 -5
  75. data/origen_app_generators/lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb +6 -8
  76. data/origen_app_generators/lib/origen_app_generators/plugin.rb +4 -7
  77. data/origen_app_generators/lib/origen_app_generators/test_engineering/common.rb +29 -0
  78. data/origen_app_generators/lib/origen_app_generators/test_engineering/stand_alone_application.rb +9 -181
  79. data/origen_app_generators/lib/origen_app_generators/test_engineering/test_block.rb +4 -105
  80. data/origen_app_generators/lib/origen_app_generators.rb +6 -4
  81. data/origen_app_generators/origen_app_generators.gemspec +7 -7
  82. data/origen_app_generators/templates/app_generators/application/Gemfile +14 -3
  83. data/origen_app_generators/templates/app_generators/application/{lib → app/blocks}/top_level.rb +1 -1
  84. data/origen_app_generators/templates/app_generators/application/app/lib/module.rb +6 -0
  85. data/origen_app_generators/templates/app_generators/application/{templates → app/templates}/web/index.md.erb +0 -0
  86. data/origen_app_generators/templates/app_generators/application/{templates → app/templates}/web/layouts/_basic.html.erb +0 -0
  87. data/origen_app_generators/templates/app_generators/application/{templates → app/templates}/web/partials/_navbar.html.erb +0 -0
  88. data/origen_app_generators/templates/app_generators/application/{templates → app/templates}/web/release_notes.md.erb +0 -0
  89. data/origen_app_generators/templates/app_generators/application/config/application.rb +51 -55
  90. data/origen_app_generators/templates/app_generators/application/{spec → test/spec}/spec_helper.rb +0 -0
  91. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/{lib → app/lib}/application.rb +0 -0
  92. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/{lib → app/lib}/base.rb +0 -0
  93. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/{lib → app/lib}/module.rb +0 -0
  94. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/{lib → app/lib}/plugin.rb +0 -0
  95. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/config/load_generators.rb +1 -1
  96. data/origen_app_generators/templates/app_generators/plugin/Gemfile +5 -2
  97. data/origen_app_generators/templates/app_generators/plugin/{templates → app/templates}/web/index.md.erb +0 -0
  98. data/origen_app_generators/templates/app_generators/plugin/{templates → app/templates}/web/partials/_navbar_external.html.erb +0 -0
  99. data/origen_app_generators/templates/app_generators/plugin/{templates → app/templates}/web/partials/_navbar_internal.html.erb +0 -0
  100. data/origen_app_generators/templates/app_generators/plugin/gemspec.rb +4 -3
  101. data/origen_app_generators/templates/app_generators/test_engineering/{stand_alone_application/environment → environment}/j750.rb +0 -0
  102. data/origen_app_generators/templates/app_generators/test_engineering/{stand_alone_application/environment → environment}/uflex.rb +0 -0
  103. data/origen_app_generators/templates/app_generators/test_engineering/{stand_alone_application/environment → environment}/v93k.rb +0 -0
  104. data/origen_site_config.yml +0 -7
  105. data/templates/code_generators/attributes.rb +20 -0
  106. data/templates/code_generators/class.rb +9 -0
  107. data/templates/code_generators/controller.rb +87 -0
  108. data/templates/code_generators/model.rb +21 -0
  109. data/templates/code_generators/module.rb +4 -0
  110. data/templates/code_generators/parameters.rb +19 -0
  111. data/templates/code_generators/pins.rb +28 -0
  112. data/templates/code_generators/registers.rb +20 -0
  113. data/templates/code_generators/sub_blocks.rb +24 -0
  114. data/templates/code_generators/timesets.rb +24 -0
  115. data/templates/code_generators/version.rb +0 -1
  116. metadata +66 -77
  117. data/lib/c99/ate_interface.rb +0 -77
  118. data/lib/c99/nvm.rb +0 -110
  119. data/lib/c99/target/mock2.rb +0 -1
  120. data/lib/c99/target/subdir/mock3.rb +0 -1
  121. data/lib/origen/code_generators/bundler.rb +0 -17
  122. data/lib/origen/code_generators/gem_setup.rb +0 -49
  123. data/lib/origen/code_generators/rake.rb +0 -13
  124. data/lib/origen/code_generators/rspec.rb +0 -12
  125. data/lib/origen/commands/add.rb +0 -12
  126. data/lib/tasks/private/build.rake +0 -8
  127. data/origen_app_generators/bin/fix_my_workspace +0 -100
  128. data/origen_app_generators/lib/origen_app_generators/sub_block_parser.rb +0 -81
  129. data/origen_app_generators/lib/tasks/app_generators.rake +0 -6
  130. data/origen_app_generators/spec/sub_block_spec.rb +0 -36
  131. data/origen_app_generators/templates/app_generators/application/lib/app.rake +0 -6
  132. data/origen_app_generators/templates/app_generators/application/lib/module.rb +0 -22
  133. data/origen_app_generators/templates/app_generators/plugin/lib/README +0 -4
  134. data/origen_app_generators/templates/app_generators/plugin/lib_dev/README +0 -5
  135. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/Gemfile +0 -23
  136. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/environment/jlink.rb +0 -1
  137. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/ip_block.rb +0 -23
  138. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/ip_block_controller.rb +0 -5
  139. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/top_level.rb +0 -33
  140. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/top_level_controller.rb +0 -21
  141. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/pattern/example.rb +0 -4
  142. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/target/top_level.rb +0 -4
  143. data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/j750.rb +0 -2
  144. data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/ultraflex.rb +0 -2
  145. data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/v93k.rb +0 -2
  146. data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/controller.rb +0 -12
  147. data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/interface.rb +0 -21
  148. data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/model.rb +0 -18
  149. data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib_dev/dut.rb +0 -27
  150. data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib_dev/dut_controller.rb +0 -26
  151. data/origen_app_generators/templates/app_generators/test_engineering/test_block/pattern/example.rb +0 -5
  152. data/origen_app_generators/templates/app_generators/test_engineering/test_block/program/prb1.rb +0 -11
  153. data/origen_app_generators/templates/app_generators/test_engineering/test_block/target/default.rb +0 -2
  154. data/templates/code_generators/gemfile_app.rb +0 -4
  155. data/templates/code_generators/gemfile_plugin.rb +0 -6
  156. data/templates/code_generators/gemspec.rb +0 -33
  157. data/templates/code_generators/rakefile.rb +0 -10
  158. data/templates/code_generators/spec_helper.rb +0 -49
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a8903e336caa8b0e7747f54f298178408b848f4203bfaccb4c7c2506c1df6c3
4
- data.tar.gz: f3e398328927876c9ad9d7d46b04594f8ca7f33915be9b0d7956f0d86343c743
3
+ metadata.gz: c9ad10ac5859dc7cfe9fdbb76fea98e5c429b8844b016b661b28a346dbd83b17
4
+ data.tar.gz: c0f4b0490390588849aadd3fb5b4aa04b7a7d10b16e13e28b8bdae410b816e05
5
5
  SHA512:
6
- metadata.gz: fc638f7063bc0fa0ae993532d19360ed6d3191710d41d4cda3f31c72f86a165ac90854b4305335d49e64f67b2941bad5a456ebbf00e740238c8e1c3b6ef635e4
7
- data.tar.gz: 8094048eb20dc9c3319fc5c5f629ba40a0c928915cf3c21ad3174119f2bad267fddcf9e4c2880d91abd1f3316bedaa963a60e6c2dec53a3c4bba3c52f681da8d
6
+ metadata.gz: f425e0db9c3374cf6c53ee2ce1fa66defa5e09ce5b0fd3bb7aa21473a843f13b117e0026ad1c43bd23bcce98c124baf7a00aae040063184610fc9747666cb63d
7
+ data.tar.gz: cd2391055c02ba08d3fd3a31717f8e0db8bfa60d83254820bb6931485854339be842abc1c8f9b74dc929c1d66e6c73e852860eca9f28e0d5ee1899cee78846e7
@@ -79,13 +79,13 @@ class OrigenCoreApplication < Origen::Application
79
79
  iterator.key = :by_block
80
80
 
81
81
  iterator.loop do |&pattern|
82
- $nvm.blocks.each do |block|
82
+ dut.nvm.blocks.each do |block|
83
83
  pattern.call(block)
84
84
  end
85
85
  end
86
86
 
87
87
  iterator.setup do |block|
88
- blk = $nvm.find_block_by_id(block.id)
88
+ blk = dut.nvm.find_block_by_id(block.id)
89
89
  blk.select
90
90
  blk
91
91
  end
data/config/boot.rb CHANGED
@@ -1,10 +1,3 @@
1
- # Interfaces must be required, can't autoload
2
- require "c99/ate_interface"
3
- # The majority of this class is defined in the support application,
4
- # this is to test that the importing application can override and
5
- # extend imported classes.
6
- require_relative "../lib/c99/nvm"
7
-
8
1
  require_relative "../helpers/guides"
9
2
 
10
3
  require "#{Origen.root(:origen_sim)}/config/boot"
data/config/commands.rb CHANGED
@@ -15,83 +15,12 @@ when "tags"
15
15
  exit 0
16
16
 
17
17
  when "specs"
18
+ Origen.app.session.origen_core[:mode] = 'debug'
18
19
  require "rspec"
19
-
20
- options = {}
21
- opt_parser = OptionParser.new do |opts|
22
- opts.banner = [
23
- 'Run the specs unit tests',
24
- 'Usage: origen specs [filename_substrings...] [options]',
25
- "Note: all files must reside in #{Origen.app.root}/specs for filename substrings",
26
- "E.g.: origen specs site_config #=> runs only specs in filenames matching 'site_config'"
27
- ].join("\n")
28
- opts.on('-h', '--help', 'Show this help message') do |h|
29
- puts opt_parser
30
- exit!
31
- end
32
- end
33
- opt_parser.parse! ARGV
34
-
35
- # Search for the filenames given.
36
- spec_files = ARGV.map do |file|
37
- f = Pathname.new(file)
38
- dir = Origen.app.root.join('spec')
39
-
40
- # Find any files that match the name. Include all these files.
41
- # Note that this will map a string to an array, so we'll flatten the array later.
42
- # Also, we'll only search for .rb files in spec. Append that to the glob if no file ext is provided.
43
- if f.exist? && f.extname == '.rb'
44
- # This is a hard-coded path. Don't glob this, just make sure its witin the spec directory.
45
- File.expand_path(f)
46
- elsif f.extname == '.rb'
47
- # Search includes the extension, so don't add it.
48
- # (limited to .rb files)
49
- Dir.glob(dir.join("**/*#{f}"))
50
- else
51
- # Search for matching ruby files.
52
- # (limited to .rb files)
53
- Dir.glob(dir.join("**/*#{f}*.rb"))
54
- end
55
- end
56
- spec_files.flatten!
57
-
58
- if ARGV.empty?
59
- # No filename substrings given. Run all *_spec files in spec/ directory
60
- spec_files = ['spec']
61
- elsif spec_files.empty? && !ARGV.empty?
62
- # The spec files to run is empty, but file substring were given.
63
- # Report that no files were found and exit.
64
- Origen.app!.fail!(message: "No matching spec files could be found at #{Origen.app.root}/spec for patterns: #{ARGV.join(', ')}")
65
- else
66
- # Filename substrings were given and matching files were found. List the files just for user awareness.
67
- Origen.log.info "Found matching specs files for patterns: #{ARGV.join(', ')}"
68
- spec_files.each { |f| Origen.log.info(f) }
69
- end
70
-
71
- current_mode = Origen.mode.instance_variable_get(:@current_mode)
72
- Origen.mode = :debug
73
- Origen.app.session.origen_core[:mode] = Origen.mode.to_s
74
- begin
75
- status = RSpec::Core::Runner.run(spec_files)
76
- rescue SystemExit => e
77
- Origen.log.error "Unexpected SystemExit reached. Reporting failure status..."
78
- status = 1
79
- end
80
- Origen.mode = current_mode
81
- Origen.app.session.origen_core[:mode] = Origen.mode.to_s
82
-
83
- # One kind of confusing thing is that Specs can still print the 'pass'/'success' verbiage even when it actually failed.
84
- # This is due to rspec itself catching the errors, so there's no exception to catch from outside Rspec.
85
- # Most likely the user will see red and see that nothing was actually run, but print a reassuring message from Origen saying that the specs actually failed,
86
- # despite what Rspec's verbiage says.
87
- if status == 1
88
- Origen.log.error "Some errors occurred outside of the examples: received exit status 1 (failure). Please review RSpec output for details."
89
- end
90
-
91
- exit(status)
20
+ exit RSpec::Core::Runner.run(['spec'])
92
21
 
93
22
  when "examples", "test"
94
- Origen.load_application
23
+ Origen.app.session.origen_core[:mode] = 'debug'
95
24
  status = 0
96
25
  Dir["#{Origen.root}/examples/*.rb"].each do |example|
97
26
  require example
@@ -269,3 +269,7 @@ Rails/ScopeArgs:
269
269
  Rails/Validation:
270
270
  Description: 'Use validates :attribute, hash of validations.'
271
271
  Enabled: false
272
+
273
+ Style/ClassAndModuleChildren:
274
+ Description: 'Checks style of children classes and modules.'
275
+ Enabled: false
@@ -78,10 +78,6 @@ Style/CharacterLiteral:
78
78
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
79
79
  Enabled: true
80
80
 
81
- Style/ClassAndModuleChildren:
82
- Description: 'Checks style of children classes and modules.'
83
- Enabled: true
84
-
85
81
  Style/ClassCheck:
86
82
  Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
87
83
  Enabled: true
@@ -245,3 +245,7 @@ Rails/ScopeArgs:
245
245
  Rails/Validation:
246
246
  Description: 'Use validates :attribute, hash of validations.'
247
247
  Enabled: false
248
+
249
+ Style/ClassAndModuleChildren:
250
+ Description: 'Checks style of children classes and modules.'
251
+ Enabled: false
@@ -88,10 +88,6 @@ Style/CharacterLiteral:
88
88
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
89
89
  Enabled: true
90
90
 
91
- Style/ClassAndModuleChildren:
92
- Description: 'Checks style of children classes and modules.'
93
- Enabled: true
94
-
95
91
  Style/ClassCheck:
96
92
  Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
97
93
  Enabled: true
data/config/version.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
- MINOR = 44
3
+ MINOR = 50
4
4
  BUGFIX = 0
5
5
  DEV = nil
6
-
7
6
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
8
7
  end
@@ -224,7 +224,9 @@ module Origen
224
224
  end
225
225
 
226
226
  def create_web_server_dir
227
- if File.exist?("#{Origen.root}/templates/web")
227
+ templates_web_dir = 'app/templates/web'
228
+ templates_web_dir = 'templates/web' unless File.exist?("#{Origen.root}/#{templates_web_dir}")
229
+ if File.exist?("#{Origen.root}/#{templates_web_dir}")
228
230
  dir = web_server_dir
229
231
  FileUtils.rm_rf dir if File.exist?(dir)
230
232
  FileUtils.mkdir_p dir
@@ -328,9 +328,9 @@ Your workspace has local modifications that are preventing the requested action
328
328
  # Sets the version number in the file store
329
329
  def write_version(version)
330
330
  if version.semantic?
331
- Origen::CodeGenerators.invoke 'semver', [], config: { change: version }
331
+ Origen::CodeGenerators.invoke_internal 'semver', [], config: { change: version }
332
332
  else
333
- Origen::CodeGenerators.invoke 'timever', [], config: { change: version }
333
+ Origen::CodeGenerators.invoke_internal 'timever', [], config: { change: version }
334
334
  end
335
335
  system 'origen -v' # Invoke Origen under the new version, this updates Gemfile.lock
336
336
  end
@@ -263,8 +263,15 @@ module Origen
263
263
  if Origen.mode.production? && Origen.app.rc
264
264
  unless Origen.app.rc.local_modifications.empty?
265
265
  puts <<-EOT
266
- Your workspace has local modifications that are preventing the requested action
267
- - run 'origen rc mods' to see them.
266
+ Your workspace is running in production mode and it has local modifications which are preventing
267
+ the requested action, run the following command to see what files have been modified:
268
+
269
+ origen rc mods
270
+
271
+ If you are currently developing this application and are not ready to check everything in yet,
272
+ then run the following command to switch your workspace to debug/development mode:
273
+
274
+ origen m debug
268
275
  EOT
269
276
  exit 1
270
277
  end
@@ -62,6 +62,33 @@ module Origen
62
62
  super || instance.respond_to?(*args)
63
63
  end
64
64
 
65
+ # Returns the application instance (i.e. main app or the plugin) that owns the given class/module
66
+ # (literal, string or symbol representation is accepted) or object instance.
67
+ # Returns nil if no matching Origen application can be found.
68
+ #
69
+ # Origen::Application.from_namespace(MyApp) # => <my_app instance>
70
+ # Origen::Application.from_namespace(MyApp::MyClass) # => <my_app instance>
71
+ # Origen::Application.from_namespace('MyApp::MyClass') # => <my_app instance>
72
+ # Origen::Application.from_namespace(<my_app::my_class instance>) # => <my_app instance>
73
+ def from_namespace(item)
74
+ unless item.is_a?(String)
75
+ if item.is_a?(Module) || item.is_a?(Class) || item.is_a?(Symbol)
76
+ item = item.to_s
77
+ else # Assume to be an object instance in this case
78
+ item = item.class.to_s
79
+ end
80
+ end
81
+ namespace = item.split('::').first
82
+ @apps_by_namespace ||= {}
83
+ @apps_by_namespace[namespace] ||= begin
84
+ return Origen.app if Origen.app.namespace == namespace
85
+ Origen.app.plugins.each do |plugin|
86
+ return plugin if plugin.namespace == namespace
87
+ end
88
+ nil
89
+ end
90
+ end
91
+
65
92
  protected
66
93
 
67
94
  def method_missing(*args, &block)
@@ -104,6 +131,63 @@ module Origen
104
131
  end
105
132
  end
106
133
 
134
+ # @api private
135
+ #
136
+ # Returns a lookup table for all block definitions (app/blocks) that the app contains
137
+ def blocks_files
138
+ # There seems to be some issue with this cache being corrupted when running the test suite
139
+ # in Travis, but don't believe that this is really an issue in practice and cannot replicate
140
+ # it locally. Therefore maintaining the cache of this potentially expensive operation except
141
+ # from when running in CI.
142
+ @blocks_files = nil if ENV['CONTINUOUS_INTEGRATION']
143
+ @blocks_files ||= begin
144
+ files = {}
145
+ block_dir = Pathname.new(File.join(root, 'app', 'blocks'))
146
+ if block_dir.exist?
147
+ block_dir.children.each do |item|
148
+ if item.directory?
149
+ _add_block_files(files, block_dir, item)
150
+ end
151
+ end
152
+ end
153
+ files
154
+ end
155
+ end
156
+
157
+ # @api private
158
+ def _add_block_files(files, block_dir, current_dir, sub_block = false)
159
+ fields = current_dir.relative_path_from(block_dir).to_s.split('/')
160
+ fields.delete('derivatives')
161
+ fields.delete('sub_blocks')
162
+ path = fields.join('/')
163
+ files[path] ||= {}
164
+ files[path][:_sub_block] = true if sub_block
165
+ Dir.glob(current_dir.join('*.rb')).each do |file|
166
+ file = Pathname.new(file)
167
+ type = file.basename('.rb').to_s.to_sym
168
+ unless type == :model || type == :controller
169
+ files[path][type] ||= []
170
+ files[path][type] << file
171
+ end
172
+ end
173
+ derivatives = current_dir.join('derivatives')
174
+ if derivatives.exist?
175
+ derivatives.children.each do |item|
176
+ if item.directory?
177
+ _add_block_files(files, block_dir, item)
178
+ end
179
+ end
180
+ end
181
+ sub_blocks = current_dir.join('sub_blocks')
182
+ if sub_blocks.exist?
183
+ sub_blocks.children.each do |item|
184
+ if item.directory?
185
+ _add_block_files(files, block_dir, item, true)
186
+ end
187
+ end
188
+ end
189
+ end
190
+
107
191
  def current_job
108
192
  current_jobs.last
109
193
  end
@@ -766,6 +850,7 @@ END
766
850
  force_debug: false
767
851
  }.merge(options)
768
852
  @on_create_called = false
853
+ @target_loading = true
769
854
  if options[:reload]
770
855
  @target_load_count = 0
771
856
  else
@@ -814,7 +899,7 @@ END
814
899
  end
815
900
  listeners_for(:after_load_target).each(&:after_load_target)
816
901
  Origen.app.plugins.validate_production_status
817
- # @target_instantiated = true
902
+ @target_loading = false
818
903
  end
819
904
 
820
905
  # Returns true if the on_create callback has already been called during a target load
@@ -900,6 +985,10 @@ END
900
985
  @target_instantiated
901
986
  end
902
987
 
988
+ def target_loading?
989
+ @target_loading || false
990
+ end
991
+
903
992
  # Prepends the application name to the fail message and throws a RuntimeError exception.
904
993
  # Very similar to the plain <code>fail</code> method with the addition of prepending the application name.
905
994
  # Prepended message: 'Fail in app.name: '
@@ -956,7 +1045,7 @@ END
956
1045
  # config.i18n.backend = MyBackend
957
1046
  # end
958
1047
  def add_lib_to_load_path! #:nodoc:
959
- [root.join('lib'), root.join('vendor', 'lib')].each do |path|
1048
+ [root.join('lib'), root.join('vendor', 'lib'), root.join('app', 'lib')].each do |path|
960
1049
  $LOAD_PATH.unshift(path.to_s) if File.exist?(path) && !$LOAD_PATH.include?(path.to_s)
961
1050
  end
962
1051
  end
@@ -193,10 +193,6 @@ end
193
193
  if BIN_DEPS.any? { |bin, gem| !File.exist?(File.join(lbin_dir, bin)) }
194
194
  system "bundle binstubs #{BIN_DEPS.map { |bin, gem| gem }.join(' ')} --path #{lbin_dir} --force"
195
195
  end
196
- if Origen.site_config.use_bootsnap && !Origen.os.windows?
197
- ENV['BOOTSNAP_CACHE_DIR'] ||= "#{origen_root}/tmp/cache"
198
- require 'bootsnap/setup'
199
- end
200
196
  end
201
197
  require 'origen'
202
198
  warnings
data/lib/origen/boot.rb CHANGED
@@ -54,8 +54,9 @@ else
54
54
  end
55
55
  end
56
56
 
57
- # Defer loading this until we have re-launched above to save time
57
+ # Defer loading these until we have re-launched above to save time
58
58
  load File.expand_path('../site_config.rb', __FILE__)
59
+ load File.expand_path('../loader.rb', __FILE__)
59
60
 
60
61
  warnings = nil
61
62