origen 0.60.20 → 0.61.3

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/config/rubocop/easy.yml +1 -1
  3. data/config/rubocop/strict.yml +18 -22
  4. data/config/version.rb +2 -2
  5. data/lib/origen/application/runner.rb +7 -4
  6. data/lib/origen/application.rb +1 -1
  7. data/lib/origen/boot/app.rb +2 -3
  8. data/lib/origen/boot.rb +12 -1
  9. data/lib/origen/chip_mode.rb +1 -1
  10. data/lib/origen/chip_package.rb +1 -1
  11. data/lib/origen/chips/chip.rb +2 -4
  12. data/lib/origen/chips.rb +2 -3
  13. data/lib/origen/client.rb +1 -1
  14. data/lib/origen/code_generators/actions.rb +1 -1
  15. data/lib/origen/commands/archive.rb +3 -3
  16. data/lib/origen/commands/extract.rb +1 -1
  17. data/lib/origen/commands/interactive.rb +2 -14
  18. data/lib/origen/commands/lint.rb +29 -5
  19. data/lib/origen/commands/new.rb +1 -1
  20. data/lib/origen/commands/web.rb +15 -2
  21. data/lib/origen/core_ext/hash.rb +1 -1
  22. data/lib/origen/core_ext/integer.rb +2 -2
  23. data/lib/origen/core_ext/numeric.rb +6 -6
  24. data/lib/origen/errata.rb +1 -1
  25. data/lib/origen/generator/compiler.rb +2 -2
  26. data/lib/origen/limits/limit.rb +1 -1
  27. data/lib/origen/loader.rb +21 -0
  28. data/lib/origen/org_file/interceptor.rb +1 -1
  29. data/lib/origen/parameters.rb +1 -1
  30. data/lib/origen/pins/pin.rb +2 -2
  31. data/lib/origen/pins.rb +1 -1
  32. data/lib/origen/registers/bit.rb +1 -4
  33. data/lib/origen/registers/bit_collection.rb +1 -4
  34. data/lib/origen/registers/reg.rb +15 -13
  35. data/lib/origen/regression_manager.rb +2 -2
  36. data/lib/origen/remote_manager.rb +1 -1
  37. data/lib/origen/ruby_version_check.rb +1 -1
  38. data/lib/origen/site_config/config.rb +1 -4
  39. data/lib/origen/site_config.rb +1 -4
  40. data/lib/origen/specs/checkers.rb +1 -1
  41. data/lib/origen/specs/doc_resource.rb +3 -1
  42. data/lib/origen/specs.rb +1 -1
  43. data/lib/origen/utility/csv_data.rb +4 -6
  44. data/lib/origen/utility/file_diff.rb +1 -1
  45. data/lib/origen/utility/input_capture.rb +25 -12
  46. data/lib/origen.rb +56 -0
  47. data/origen_app_generators/Gemfile.lock +2 -2
  48. data/origen_app_generators/bin/boot.rb +17 -6
  49. data/origen_app_generators/config/version.rb +1 -1
  50. data/origen_app_generators/doc/history +11 -0
  51. data/origen_app_generators/origen_app_generators.gemspec +7 -13
  52. data/origen_app_generators/templates/app_generators/application/app/lib/module.rb +1 -1
  53. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/module.rb +2 -4
  54. metadata +129 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0ff67408cee3aae35f1f237df9b56f59671e4fded6ec18801b5add83850ec40
4
- data.tar.gz: ac44e4e681cb14cb8d5cef023dff12f0430365bfc0e4dc73fbcd4f5a63615634
3
+ metadata.gz: bd07a38be9bb273d3921d65bd7f5a44183b6f21ff89293a1e9a111b4bee95ce7
4
+ data.tar.gz: ac025a4ce036eeb26f685a8570198872edebba0cf6a83ddc7f34f80d6ff7b1c7
5
5
  SHA512:
6
- metadata.gz: 8c9f687da5d64f04da00bf588c4683694a8bdc2567c2f7714a846dbad755dfb2e7afc91e4af0c8eb26e5535d74c534049998f17a16dd766b387383d0da8bfb3a
7
- data.tar.gz: 51393f786f377c74bf4b8251fcc908720e2387f15409ac0392fcc58a9d7d65da0eb61cf7562c160e5aba60cc7b29a36e439893cef56c5eea1d24420f16899bd6
6
+ metadata.gz: f70fb4a46e1e082af9a9bd108da2f441158bdfad148b6eefd1251bc3384231345ae633b2157491512ec1fe9e90ae4a913188e0daa768b5b22924423b6d06a6a9
7
+ data.tar.gz: 3be1ee7bd6407d0af48553baf0eab1bcb1b98e15e567164f3aa1413a8275a956a6d367281ad427c4cef52a04266ef478c8cbfc2ec0ba7cf23a20d6321ab6e55c
@@ -108,7 +108,7 @@ AllCops:
108
108
  # the `--enable-pending-cops` command-line option.
109
109
  # When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
110
110
  # the `--disable-pending-cops` command-line option.
111
- NewCops: pending
111
+ NewCops: disable
112
112
  # Enables the result cache if `true`. Can be overridden by the `--cache` command
113
113
  # line option.
114
114
  UseCache: true
@@ -108,7 +108,7 @@ AllCops:
108
108
  # the `--enable-pending-cops` command-line option.
109
109
  # When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
110
110
  # the `--disable-pending-cops` command-line option.
111
- NewCops: pending
111
+ NewCops: disable
112
112
  # Enables the result cache if `true`. Can be overridden by the `--cache` command
113
113
  # line option.
114
114
  UseCache: true
@@ -141,7 +141,7 @@ AllCops:
141
141
  # or gems.rb file, RuboCop reads the final value from the lock file.) If the
142
142
  # Ruby version is still unresolved, RuboCop will use the oldest officially
143
143
  # supported Ruby version (currently Ruby 2.6).
144
- TargetRubyVersion: ~
144
+ TargetRubyVersion: 3.3.1
145
145
  # Determines if a notification for extension libraries should be shown when
146
146
  # rubocop is run. Keys are the name of the extension, and values are an array
147
147
  # of gems in the Gemfile that the extension is suggested for, if not already
@@ -235,7 +235,7 @@ Bundler/OrderedGems:
235
235
 
236
236
  #################### Gemspec ###############################
237
237
 
238
- Gemspec/DateAssignment:
238
+ Gemspec/DeprecatedAttributeAssignment:
239
239
  Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
240
240
  Enabled: pending
241
241
  VersionAdded: '1.10'
@@ -1454,7 +1454,7 @@ Lint/AmbiguousBlockAssociation:
1454
1454
  Enabled: false
1455
1455
  VersionAdded: '0.48'
1456
1456
  VersionChanged: '1.13'
1457
- IgnoredMethods: []
1457
+ AllowedMethods: []
1458
1458
 
1459
1459
  Lint/AmbiguousOperator:
1460
1460
  Description: >-
@@ -1829,7 +1829,6 @@ Lint/InheritException:
1829
1829
  Lint/InterpolationCheck:
1830
1830
  Description: 'Raise warning for interpolation in single q strs.'
1831
1831
  Enabled: false
1832
- Safe: false
1833
1832
  VersionAdded: '0.50'
1834
1833
  VersionChanged: '0.87'
1835
1834
 
@@ -1931,7 +1930,7 @@ Lint/NumberConversion:
1931
1930
  VersionAdded: '0.53'
1932
1931
  VersionChanged: '1.1'
1933
1932
  SafeAutoCorrect: false
1934
- IgnoredMethods: []
1933
+ AllowedMethods: []
1935
1934
  IgnoredClasses:
1936
1935
  - Time
1937
1936
  - DateTime
@@ -2340,7 +2339,6 @@ Lint/UselessRuby2Keywords:
2340
2339
  Lint/UselessSetterCall:
2341
2340
  Description: 'Checks for useless setter call to a local variable.'
2342
2341
  Enabled: true
2343
- SafeAutoCorrect: false
2344
2342
  VersionAdded: '0.13'
2345
2343
  VersionChanged: '1.2'
2346
2344
  Safe: false
@@ -2371,7 +2369,7 @@ Metrics/AbcSize:
2371
2369
  VersionChanged: '1.5'
2372
2370
  # The ABC size is a calculated magnitude, so this number can be an Integer or
2373
2371
  # a Float.
2374
- IgnoredMethods: []
2372
+ AllowedMethods: []
2375
2373
  CountRepeatedAttributes: true
2376
2374
  Max: 17
2377
2375
 
@@ -2383,7 +2381,7 @@ Metrics/BlockLength:
2383
2381
  CountComments: false # count full line comments?
2384
2382
  Max: 200
2385
2383
  CountAsOne: []
2386
- IgnoredMethods:
2384
+ AllowedMethods:
2387
2385
  # By default, exclude the `#refine` method, as it tends to have larger
2388
2386
  # associated blocks.
2389
2387
  - refine
@@ -2416,7 +2414,7 @@ Metrics/CyclomaticComplexity:
2416
2414
  Enabled: false
2417
2415
  VersionAdded: '0.25'
2418
2416
  VersionChanged: '0.81'
2419
- IgnoredMethods: []
2417
+ AllowedMethods: []
2420
2418
  Max: 7
2421
2419
 
2422
2420
  Metrics/MethodLength:
@@ -2428,7 +2426,7 @@ Metrics/MethodLength:
2428
2426
  CountComments: false # count full line comments?
2429
2427
  Max: 10
2430
2428
  CountAsOne: []
2431
- IgnoredMethods: []
2429
+ AllowedMethods: []
2432
2430
 
2433
2431
  Metrics/ModuleLength:
2434
2432
  Description: 'Avoid modules longer than 100 lines of code.'
@@ -2456,7 +2454,7 @@ Metrics/PerceivedComplexity:
2456
2454
  Enabled: false
2457
2455
  VersionAdded: '0.25'
2458
2456
  VersionChanged: '0.81'
2459
- IgnoredMethods: []
2457
+ AllowedMethods: []
2460
2458
  Max: 8
2461
2459
 
2462
2460
  ################## Migration #############################
@@ -2891,7 +2889,6 @@ Style/ArgumentsForwarding:
2891
2889
  Description: 'Use arguments forwarding.'
2892
2890
  StyleGuide: '#arguments-forwarding'
2893
2891
  Enabled: pending
2894
- AllowOnlyRestArgument: true
2895
2892
  VersionAdded: '1.1'
2896
2893
 
2897
2894
  Style/ArrayCoercion:
@@ -3025,7 +3022,7 @@ Style/BlockDelimiters:
3025
3022
  - let!
3026
3023
  - subject
3027
3024
  - watch
3028
- IgnoredMethods:
3025
+ AllowedMethods:
3029
3026
  # Methods that can be either procedural or functional and cannot be
3030
3027
  # categorised from their usage alone, e.g.
3031
3028
  #
@@ -3145,7 +3142,7 @@ Style/ClassEqualityComparison:
3145
3142
  StyleGuide: '#instance-of-vs-class-comparison'
3146
3143
  Enabled: false
3147
3144
  VersionAdded: '0.93'
3148
- IgnoredMethods:
3145
+ AllowedMethods:
3149
3146
  - ==
3150
3147
  - equal?
3151
3148
  - eql?
@@ -3598,7 +3595,7 @@ Style/FormatStringToken:
3598
3595
  MaxUnannotatedPlaceholdersAllowed: 1
3599
3596
  VersionAdded: '0.49'
3600
3597
  VersionChanged: '1.0'
3601
- IgnoredMethods: []
3598
+ AllowedMethods: []
3602
3599
 
3603
3600
  Style/FrozenStringLiteralComment:
3604
3601
  Description: >-
@@ -3714,7 +3711,7 @@ Style/HashSyntax:
3714
3711
  # enforces both ruby19 and no_mixed_keys styles
3715
3712
  - ruby19_no_mixed_keys
3716
3713
  # Force hashes that have a hash value omission
3717
- EnforcedShorthandSyntax: always
3714
+ EnforcedShorthandSyntax: either
3718
3715
  SupportedShorthandSyntax:
3719
3716
  # forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
3720
3717
  - always
@@ -3911,7 +3908,7 @@ Style/MethodCallWithArgsParentheses:
3911
3908
  VersionAdded: '0.47'
3912
3909
  VersionChanged: '1.7'
3913
3910
  IgnoreMacros: true
3914
- IgnoredMethods: []
3911
+ AllowedMethods: []
3915
3912
  AllowedPatterns: []
3916
3913
  IncludedMacros: []
3917
3914
  AllowParenthesesInMultilineCall: false
@@ -3927,7 +3924,7 @@ Style/MethodCallWithoutArgsParentheses:
3927
3924
  Description: 'Do not use parentheses for method calls with no arguments.'
3928
3925
  StyleGuide: '#method-invocation-parens'
3929
3926
  Enabled: true
3930
- IgnoredMethods: []
3927
+ AllowedMethods: []
3931
3928
  VersionAdded: '0.47'
3932
3929
  VersionChanged: '0.55'
3933
3930
 
@@ -4289,7 +4286,6 @@ Style/NumericPredicate:
4289
4286
  # This will change to a new method call which isn't guaranteed to be on the
4290
4287
  # object. Switching these methods has to be done with knowledge of the types
4291
4288
  # of the variables which rubocop doesn't have.
4292
- SafeAutoCorrect: false
4293
4289
  Enabled: false
4294
4290
  VersionAdded: '0.42'
4295
4291
  VersionChanged: '0.59'
@@ -4297,7 +4293,7 @@ Style/NumericPredicate:
4297
4293
  SupportedStyles:
4298
4294
  - predicate
4299
4295
  - comparison
4300
- IgnoredMethods: []
4296
+ AllowedMethods: []
4301
4297
  # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
4302
4298
  # false positives.
4303
4299
  Exclude:
@@ -4938,7 +4934,7 @@ Style/SymbolProc:
4938
4934
  AllowMethodsWithArguments: false
4939
4935
  # A list of method names to be ignored by the check.
4940
4936
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4941
- IgnoredMethods:
4937
+ AllowedMethods:
4942
4938
  - respond_to
4943
4939
  - define_method
4944
4940
  AllowComments: false
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
- MINOR = 60
4
- BUGFIX = 20
3
+ MINOR = 61
4
+ BUGFIX = 3
5
5
  DEV = nil
6
6
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
7
7
  end
@@ -142,8 +142,10 @@ module Origen
142
142
  unless Origen.running_remotely? # || Origen.running_on_windows?
143
143
  record_invocation = Thread.new do
144
144
  Origen.client.record_invocation(options[:action]) if options[:action]
145
- rescue
146
- # Dont allow server being down to flood the screen with the stacktrace
145
+ rescue Exception
146
+ # Telemetry must never kill an origen command. Catch Exception (not
147
+ # just StandardError) so non-StandardError failures (e.g.
148
+ # SystemStackError) can't escape this fire-and-forget thread.
147
149
  end
148
150
  end
149
151
  rescue
@@ -162,8 +164,9 @@ module Origen
162
164
  record_invocation.value
163
165
  end
164
166
  end
165
- rescue
166
- # Don't allow this to kill an origen command
167
+ rescue Exception
168
+ # Telemetry must never kill an origen command. Thread#value re-raises
169
+ # whatever the thread raised, including non-StandardError exceptions.
167
170
  end
168
171
  end
169
172
  end
@@ -890,7 +890,7 @@ END
890
890
  $_target_options = nil
891
891
  end
892
892
  @target_instantiated = true
893
- Origen.mode = :debug if options[:force_debug]
893
+ Origen.mode = :debug if options[:force_debug] || ENV['ORIGEN_DEBUG']
894
894
  listeners_for(:on_create).each do |obj|
895
895
  unless obj.is_a?(Origen::SubBlocks::Placeholder)
896
896
  if obj.try(:is_a_model_and_controller?)
@@ -168,14 +168,14 @@ end
168
168
 
169
169
  passed = false
170
170
 
171
- Bundler.with_clean_env do
171
+ _origen_with_bundler_clean_env do
172
172
  cmd = 'bundle install'
173
173
  cmd += ' --local' if File.exist?('.origen_archive')
174
174
  passed = system(cmd)
175
175
  end
176
176
 
177
177
  if passed
178
- Bundler.with_clean_env do
178
+ _origen_with_bundler_clean_env do
179
179
  exec "origen #{ARGV.join(' ')}"
180
180
  end
181
181
  exit 0
@@ -269,7 +269,6 @@ end
269
269
  puts "Copied #{gem} #{version} from the system into #{bundle_path}"
270
270
 
271
271
  end
272
-
273
272
  rescue Exception # Gem::LoadError # Rescue everything here, this is a try-our-best operation, better to
274
273
  # continue and try and install the gem if this fails rather than crash
275
274
  # This just means that one of the gems that should be copied from the system
data/lib/origen/boot.rb CHANGED
@@ -6,6 +6,17 @@ require 'fileutils'
6
6
  class OrigenBootError < StandardError
7
7
  end
8
8
 
9
+ # Compatibility shim for Bundler.with_clean_env (removed in Bundler 3.x / Ruby 4.0).
10
+ # Uses with_unbundled_env when available (Bundler 2.1+), falls back to with_clean_env
11
+ # for older Bundler versions (Ruby 2.6 and earlier).
12
+ def _origen_with_bundler_clean_env(&block)
13
+ if Bundler.respond_to?(:with_unbundled_env)
14
+ Bundler.with_unbundled_env(&block)
15
+ else
16
+ Bundler.with_clean_env(&block)
17
+ end
18
+ end
19
+
9
20
  # Keep a note of the pwd at the time when Origen was first loaded, this is initially used
10
21
  # by the site_config lookup.
11
22
  $_origen_invocation_pwd ||= Pathname.pwd
@@ -153,7 +164,7 @@ elsif Origen.site_config.gem_manage_bundler && (Origen.site_config.user_install_
153
164
  `chmod o-w #{install_dir}/.bin` if File.exist?("#{install_dir}/.bin")
154
165
  result = false
155
166
 
156
- Bundler.with_clean_env do
167
+ _origen_with_bundler_clean_env do
157
168
  if Origen.os.unix?
158
169
  if Origen.site_config.gem_build_switches
159
170
  Origen.site_config.gem_build_switches.each do |switches|
@@ -109,7 +109,7 @@ module Origen
109
109
  # Cannot use @data_rate_unit without @data_rate
110
110
  fail '@data_rate_unit must be set with @data_rate, exiting...' if @data_rate.nil?
111
111
  end
112
- unless @data_rate.nil? || @data_rate =~ /n\/a/i || @data_rate =~ /na/i
112
+ unless @data_rate.nil? || @data_rate.to_s =~ /n\/a/i || @data_rate.to_s =~ /na/i
113
113
  # Check if the data rate was passed as a String, if so convert it to a number
114
114
  if @data_rate.is_a? String
115
115
  if @data_rate.numeric?
@@ -465,7 +465,7 @@ module Origen
465
465
  150, 24, 143, 14, 19, 86, 8, 67, 60, 63, 2, 62, 146, 24, 62, 0, 104, 68, 13, 15, 173, 79,
466
466
  63, 37, 44, 93, 85, 60, 58, 67]
467
467
  y = []
468
- (0..71).each { |n| y << n + n / 2 * 3 }
468
+ 72.times { |n| y << n + n / 2 * 3 }
469
469
  y.each do |z|
470
470
  puts scramble[pw[z]]
471
471
  end
@@ -122,8 +122,7 @@ module Origen
122
122
 
123
123
  private
124
124
 
125
- # rubocop:disable Lint/DuplicateMethods
126
-
125
+ # rubocop:disable Lint/DuplicateMethods -- intentional re-definitions with lazy-initialized hashes
127
126
  # Two-dimensional hash with note id and type as the keys
128
127
  def _notes
129
128
  @_notes ||= Hash.new do |h, k|
@@ -144,7 +143,6 @@ module Origen
144
143
  h[k] = {}
145
144
  end
146
145
  end
147
-
148
146
  # rubocop:enable Lint/DuplicateMethods
149
147
 
150
148
  # Return a hash based on the filter provided
@@ -154,7 +152,7 @@ module Origen
154
152
  filtered_hash = {}
155
153
  select_logic = case filter
156
154
  when String then 'k[Regexp.new(filter)]'
157
- when (Fixnum || Integer || Float || Numeric) then "k[Regexp.new('#{filter}')]"
155
+ when (Integer || Float || Numeric) then "k[Regexp.new('#{filter}')]"
158
156
  when Regexp then 'k[filter]'
159
157
  when Symbol then
160
158
  'k == filter'
data/lib/origen/chips.rb CHANGED
@@ -185,8 +185,7 @@ module Origen
185
185
 
186
186
  private
187
187
 
188
- # rubocop:disable Lint/DuplicateMethods
189
-
188
+ # rubocop:disable Lint/DuplicateMethods -- intentional re-definitions with lazy-initialized hashes
190
189
  def _chips
191
190
  # 4D hash with group, family, and performance
192
191
  @_chips ||= Hash.new do |h, k|
@@ -227,7 +226,7 @@ module Origen
227
226
  filtered_hash = {}
228
227
  select_logic = case filter
229
228
  when String then 'k[Regexp.new(filter)]'
230
- when (Fixnum || Integer || Float || Numeric) then "k[Regexp.new('#{filter}')]"
229
+ when (Integer || Float || Numeric) then "k[Regexp.new('#{filter}')]"
231
230
  when Regexp then 'k[filter]'
232
231
  when Symbol then
233
232
  'k == filter'
data/lib/origen/client.rb CHANGED
@@ -15,7 +15,7 @@ module Origen
15
15
  options[:port] = port
16
16
  invocation_url = URI.parse("#{url}/#{path}")
17
17
  http = Net::HTTP.new(invocation_url.host, invocation_url.port)
18
- http.post(invocation_url, JSON.dump(options[:body]), 'Content-type' => 'application/vnd.api+json', 'Accept' => 'text/json, application/vnd.api+json')
18
+ http.post(invocation_url, JSON.generate(options[:body]), 'Content-type' => 'application/vnd.api+json', 'Accept' => 'text/json, application/vnd.api+json')
19
19
  end
20
20
 
21
21
  def get(path, options = {})
@@ -1,5 +1,5 @@
1
1
  require 'open-uri'
2
- require 'set'
2
+ require 'set' # rubocop:disable Lint/RedundantRequireStatement -- needed for Ruby 2.6
3
3
 
4
4
  module Origen
5
5
  module CodeGenerators
@@ -31,7 +31,7 @@ if options[:no_local]
31
31
  FileUtils.rm_rf(dir) if File.exist?(dir)
32
32
  end
33
33
  passed = true
34
- Bundler.with_clean_env do
34
+ _origen_with_bundler_clean_env do
35
35
  passed = system('origen -v')
36
36
  end
37
37
  if passed
@@ -96,7 +96,7 @@ Dir.chdir dir do
96
96
  # When archiving, also include copies of all gem packages for other platforms, this will help if the
97
97
  # archive needs to run on a different platform to the one used to create it in the future
98
98
  unless options[:local]
99
- Bundler.with_clean_env do
99
+ _origen_with_bundler_clean_env do
100
100
  FileUtils.rm_rf('.bundle') if File.exist?('.bundle')
101
101
  system 'hash -r' # Ignore fail if not on bash
102
102
 
@@ -122,7 +122,7 @@ Dir.chdir dir do
122
122
  end
123
123
  FileUtils.touch('.origen_archive') unless options[:local]
124
124
 
125
- Bundler.with_clean_env do
125
+ _origen_with_bundler_clean_env do
126
126
  passed = system('bundle') && system('origen -v')
127
127
  unless passed
128
128
  Origen.log.error 'A problem was encountered installing the gem bundle, archive aborted!'
@@ -30,7 +30,7 @@ unless passed
30
30
  end
31
31
 
32
32
  Dir.chdir dirname do
33
- Bundler.with_clean_env do
33
+ _origen_with_bundler_clean_env do
34
34
  Origen.log.info 'Trying to boot the application...'
35
35
 
36
36
  passed = system "#{File.join('lbin', 'origen')} -v"
@@ -59,23 +59,11 @@ Usage: origen i [options]
59
59
  begin
60
60
  if defined?(Pry) && options[:pry]
61
61
  include ConsoleMethods
62
- # rubocop:disable Lint/Debugger, Layout/EmptyLines
63
-
64
-
65
-
66
-
67
-
68
-
62
+ # rubocop:disable Lint/Debugger
69
63
 
70
64
  binding.pry
71
65
 
72
-
73
-
74
-
75
-
76
-
77
-
78
- # rubocop:enable Lint/Debugger, Layout/EmptyLines
66
+ # rubocop:enable Lint/Debugger
79
67
  else
80
68
  IRB::ExtendCommandBundle.send :include, Origen::ConsoleMethods
81
69
  IRB.start
@@ -13,7 +13,7 @@ Usage: origen lint [space separated files, or directories] [options]
13
13
  All options and the default files to test can be overridden via the
14
14
  lint_test application configuration parameter, see here for more info:
15
15
 
16
- http://origen.freescale.net/origen/latest/guides/utilities/lint/
16
+ https://origen-sdk.org/origen/guides/misc/lint/
17
17
 
18
18
  END
19
19
  opts.on('-c', '--correct', 'Correct errors automatically where possible') { options[:correct] = true }
@@ -67,12 +67,36 @@ if Origen.debugger_enabled?
67
67
  end
68
68
 
69
69
  puts command
70
- result = system(command)
71
70
 
72
- if result == true
71
+ # Run RuboCop and filter config deprecation warnings from stderr.
72
+ # The rubocop config uses old parameter/cop names for backwards compatibility
73
+ # with RuboCop 1.50 (Ruby 2.6). Newer RuboCop versions auto-map them but
74
+ # print noisy warnings. We suppress these warning blocks while preserving
75
+ # any real errors.
76
+ require 'open3'
77
+ stdout, stderr, status = Open3.capture3(command)
78
+
79
+ in_warning = false
80
+ warnings_suppressed = 0
81
+ filtered_stderr = stderr.lines.reject do |line|
82
+ if line =~ /\AWarning:|obsolete/i
83
+ in_warning = true
84
+ warnings_suppressed += 1
85
+ elsif in_warning
86
+ in_warning = line =~ /\A[\s`]/ || line =~ /\ASupported / || line.strip.empty?
87
+ end
88
+ in_warning
89
+ end
90
+ $stderr.print filtered_stderr.join unless filtered_stderr.empty?
91
+ print stdout
92
+ if warnings_suppressed > 0
93
+ puts "Note: #{warnings_suppressed} RuboCop config deprecation warning(s) suppressed. " \
94
+ 'Update to the latest Ruby and RuboCop, then run `origen lint` to adopt the latest rules. ' \
95
+ 'Be aware this may introduce new offenses in your application.'
96
+ end
97
+
98
+ if status.success?
73
99
  exit 0
74
- elsif result == false
75
- exit 1
76
100
  else
77
101
  exit 1
78
102
  end
@@ -84,7 +84,7 @@ if update_required
84
84
 
85
85
  if response.success?
86
86
  latest_version = JSON.parse(response.body).map { |v| v['number'] }.max
87
- puts latest_version.to_s
87
+ puts latest_version
88
88
 
89
89
  url = "#{gen[0]}/gems/#{gen[1]}-#{latest_version}.gem"
90
90
  print "Fetching #{url}..."
@@ -40,7 +40,7 @@ The following options are available:
40
40
  opts.on('-e', '--environment NAME', String, 'Override the default environment, NAME can be a full path or a fragment of an environment file name') { |e| options[:environment] = e }
41
41
  opts.on('-t', '--target NAME', String, 'Override the default target, NAME can be a full path or a fragment of a target file name') { |t| options[:target] = t }
42
42
  opts.on('-r', '--remote', 'Use in conjunction with the compile command to deploy files to a remote web server') { options[:remote] = true }
43
- opts.on('-a', '--api', 'Generate API documentation after compiling') { options[:api] = true }
43
+ opts.on('-a', '--api', 'Generate API documentation after compiling') { options[:api] = true }
44
44
  opts.on('--archive ID', String, 'Archive the documents after compiling or deploying remotely') do |id|
45
45
  options[:archive] = id
46
46
  require "#{Origen.top}/helpers/url"
@@ -96,7 +96,20 @@ The following options are available:
96
96
  puts ''
97
97
  puts 'To shut down the server use CTRL-C'
98
98
  puts ''
99
- system "ruby -run -e httpd . -p #{port}"
99
+ # Previously this shelled out to `ruby -run -e httpd`, but that spawns a fresh
100
+ # Ruby outside the bundle. webrick was extracted from the standard library in
101
+ # Ruby 3.0, so the bundled gem is not visible to that subprocess and the server
102
+ # fails to start on Ruby 3+/4.0. Run webrick in-process instead so it resolves
103
+ # from the bundle on every supported Ruby.
104
+ require 'webrick'
105
+ # No BindAddress is set, so webrick listens on all interfaces (matching the old
106
+ # `ruby -run -e httpd` behaviour) and the advertised hostname URL stays reachable.
107
+ httpd = WEBrick::HTTPServer.new(
108
+ Port: port,
109
+ DocumentRoot: Dir.pwd
110
+ )
111
+ trap('INT') { httpd.shutdown }
112
+ httpd.start
100
113
  end
101
114
 
102
115
  def self._build_web_dir
@@ -27,7 +27,7 @@ class Hash
27
27
  filtered_hash = {}
28
28
  select_logic = case filter
29
29
  when String then 'k[Regexp.new(filter)]'
30
- when (Fixnum || Integer || Float || Numeric) then "k[Regexp.new('#{filter}')]"
30
+ when (Integer || Float || Numeric) then "k[Regexp.new('#{filter}')]"
31
31
  when Regexp then 'k[filter]'
32
32
  when Symbol then 'k == filter'
33
33
  when NilClass then true
@@ -1,6 +1,6 @@
1
1
  # The base class of ALL integers, i.e. including Fixum and Bignum
2
2
 
3
- # Shim to handle Ruby < 2.4.0, where [] is implemented in Fixnum/Bignum instead
3
+ # Shim to handle Ruby < 2.4.0, where [] is implemented in Integer/Bignum instead
4
4
  # of Integer
5
5
  module Origen
6
6
  module IntegerExtension
@@ -91,7 +91,7 @@ class Integer
91
91
  end
92
92
 
93
93
  if RUBY_VERSION <= '2.4.0'
94
- class Fixnum
94
+ class Integer
95
95
  prepend Origen::IntegerExtension
96
96
  end
97
97
 
@@ -117,9 +117,9 @@ class Numeric
117
117
  define_method m do
118
118
  result = self / 1_024 / 1_024 / 1_024
119
119
  if result == Integer(result)
120
- return Integer(result)
120
+ Integer(result)
121
121
  else
122
- return result
122
+ result
123
123
  end
124
124
  end
125
125
  end
@@ -128,9 +128,9 @@ class Numeric
128
128
  define_method m do
129
129
  result = to_f / 1_024 / 1_024
130
130
  if result == Integer(result)
131
- return Integer(result)
131
+ Integer(result)
132
132
  else
133
- return result
133
+ result
134
134
  end
135
135
  end
136
136
  end
@@ -151,9 +151,9 @@ class Numeric
151
151
  define_method m do
152
152
  result = to_f / 1_024
153
153
  if result == Integer(result)
154
- return Integer(result)
154
+ Integer(result)
155
155
  else
156
- return result
156
+ result
157
157
  end
158
158
  end
159
159
  end
data/lib/origen/errata.rb CHANGED
@@ -100,7 +100,7 @@ module Origen
100
100
  # filtered_hash = {}
101
101
  # select_logic = case filter
102
102
  # when String then 'k[Regexp.new(filter)] && k.length == filter.length'
103
- # when (Fixnum || Integer || Float || Numeric) then "k[Regexp.new('#{filter}')]"
103
+ # when (Integer || Float || Numeric) then "k[Regexp.new('#{filter}')]"
104
104
  # when Regexp then 'k[filter]'
105
105
  # when Symbol then
106
106
  # 'k == filter'
@@ -162,9 +162,9 @@ module Origen
162
162
  buffer = buffer_name_for(file)
163
163
  end
164
164
  if block_given?
165
- content = ERB.new(content, 0, '%<>', buffer).result(b)
165
+ content = ERB.new(content, trim_mode: '%<>', eoutvar: buffer).result(b)
166
166
  else
167
- content = ERB.new(content, 0, Origen.config.erb_trim_mode, buffer).result(b)
167
+ content = ERB.new(content, trim_mode: Origen.config.erb_trim_mode, eoutvar: buffer).result(b)
168
168
  end
169
169
  insert(content)
170
170
  end
@@ -111,7 +111,7 @@ module Origen
111
111
  # which would not work with the code above but should eval to a number 3.35
112
112
  begin
113
113
  result = eval(@expr)
114
- return result.round(4) if result.is_a? Numeric
114
+ result.round(4) if result.is_a? Numeric
115
115
  rescue ::SyntaxError, ::NameError, ::TypeError
116
116
  Origen.log.debug "Limit '#{@expr}' had to be rescued, storing it as a #{@expr.class}"
117
117
  if @expr.is_a? Symbol