origen 0.34.3 → 0.52.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/origen +1 -231
- data/config/application.rb +12 -3
- data/config/boot.rb +2 -7
- data/config/commands.rb +3 -74
- data/config/rubocop/easy_disabled.yml +4 -0
- data/config/rubocop/easy_enabled.yml +0 -4
- data/config/rubocop/strict_disabled.yml +4 -0
- data/config/rubocop/strict_enabled.yml +0 -4
- data/config/version.rb +2 -3
- data/lib/origen.rb +27 -14
- data/lib/origen/application.rb +88 -2
- data/lib/origen/application/deployer.rb +3 -1
- data/lib/origen/application/release.rb +2 -2
- data/lib/origen/application/runner.rb +35 -20
- data/lib/origen/boot.rb +302 -0
- data/lib/origen/boot/api.rb +13 -0
- data/lib/origen/boot/app.rb +284 -0
- data/lib/origen/code_generators.rb +30 -10
- data/lib/origen/code_generators/actions.rb +244 -34
- data/lib/origen/code_generators/base.rb +9 -2
- data/lib/origen/code_generators/block.rb +203 -0
- data/lib/origen/code_generators/block_common.rb +100 -0
- data/lib/origen/code_generators/dut.rb +62 -0
- data/lib/origen/code_generators/feature.rb +50 -0
- data/lib/origen/code_generators/klass.rb +41 -0
- data/lib/origen/code_generators/model.rb +60 -0
- data/lib/origen/code_generators/module.rb +92 -0
- data/lib/origen/commands.rb +30 -13
- data/lib/origen/commands/archive.rb +175 -0
- data/lib/origen/commands/extract.rb +43 -0
- data/lib/origen/commands/generate.rb +1 -0
- data/lib/origen/commands/lint.rb +6 -1
- data/lib/origen/commands/new.rb +48 -24
- data/lib/origen/commands/new_resource.rb +41 -0
- data/lib/origen/commands/site.rb +52 -0
- data/lib/origen/commands/web.rb +11 -6
- data/lib/origen/commands_global.rb +9 -7
- data/lib/origen/core_ext/numeric.rb +20 -0
- data/lib/{option_parser → origen/core_ext/option_parser}/optparse.rb +0 -0
- data/lib/origen/dependencies.rb +0 -0
- data/lib/origen/file_handler.rb +18 -6
- data/lib/origen/generator.rb +19 -10
- data/lib/origen/generator/comparator.rb +2 -1
- data/lib/origen/generator/flow.rb +3 -1
- data/lib/origen/generator/job.rb +60 -16
- data/lib/origen/generator/pattern.rb +132 -72
- data/lib/origen/generator/pattern_finder.rb +3 -3
- data/lib/origen/generator/pattern_sequence.rb +201 -0
- data/lib/origen/generator/pattern_sequencer.rb +99 -0
- data/lib/origen/generator/pattern_thread.rb +175 -0
- data/lib/origen/loader.rb +381 -0
- data/lib/origen/log.rb +250 -108
- data/lib/origen/model.rb +22 -1
- data/lib/origen/model/exporter.rb +50 -10
- data/lib/origen/model_initializer.rb +5 -1
- data/lib/origen/operating_systems.rb +4 -0
- data/lib/origen/parameters.rb +96 -4
- data/lib/origen/parameters/set.rb +4 -3
- data/lib/origen/pins.rb +10 -8
- data/lib/origen/pins/pin.rb +61 -46
- data/lib/origen/ports/port.rb +5 -0
- data/lib/origen/registers.rb +5 -0
- data/lib/origen/registers/bit.rb +57 -53
- data/lib/origen/registers/bit_collection.rb +100 -43
- data/lib/origen/registers/msb0_delegator.rb +47 -0
- data/lib/origen/registers/reg.rb +114 -99
- data/lib/origen/revision_control.rb +1 -1
- data/lib/origen/revision_control/git.rb +23 -3
- data/lib/origen/site_config.rb +251 -60
- data/lib/origen/site_config/config.rb +217 -0
- data/lib/origen/sub_blocks.rb +106 -31
- data/lib/origen/top_level.rb +11 -0
- data/lib/origen/users/user.rb +3 -2
- data/lib/origen/utility/mailer.rb +42 -9
- data/lib/origen/value/bin_str_val.rb +1 -1
- data/lib/origen/value/hex_str_val.rb +1 -1
- data/lib/origen/version_string.rb +6 -1
- data/lib/tasks/gem.rake +6 -1
- data/origen_app_generators/Gemfile +19 -0
- data/origen_app_generators/Gemfile.lock +152 -0
- data/origen_app_generators/LICENSE +21 -0
- data/origen_app_generators/README.md +368 -0
- data/{templates/code_generators/rakefile.rb → origen_app_generators/Rakefile} +0 -0
- data/origen_app_generators/bin/boot.rb +39 -0
- data/origen_app_generators/config/application.rb +153 -0
- data/origen_app_generators/config/boot.rb +1 -0
- data/origen_app_generators/config/commands.rb +63 -0
- data/origen_app_generators/config/shared_commands.rb +177 -0
- data/origen_app_generators/config/version.rb +8 -0
- data/origen_app_generators/doc/history +223 -0
- data/origen_app_generators/lbin/bundle +105 -0
- data/origen_app_generators/lbin/byebug +29 -0
- data/origen_app_generators/lbin/coderay +29 -0
- data/origen_app_generators/lbin/htmldiff +29 -0
- data/origen_app_generators/lbin/httparty +29 -0
- data/origen_app_generators/lbin/httpclient +29 -0
- data/origen_app_generators/lbin/kramdown +29 -0
- data/origen_app_generators/lbin/ldiff +29 -0
- data/origen_app_generators/lbin/nanoc +29 -0
- data/origen_app_generators/lbin/nokogiri +29 -0
- data/origen_app_generators/lbin/origen +62 -0
- data/origen_app_generators/lbin/pry +29 -0
- data/origen_app_generators/lbin/rackup +29 -0
- data/origen_app_generators/lbin/rake +29 -0
- data/origen_app_generators/lbin/rspec +29 -0
- data/origen_app_generators/lbin/rubocop +29 -0
- data/origen_app_generators/lbin/ruby-parse +29 -0
- data/origen_app_generators/lbin/ruby-rewrite +29 -0
- data/origen_app_generators/lbin/thor +29 -0
- data/origen_app_generators/lbin/tilt +29 -0
- data/origen_app_generators/lbin/yard +29 -0
- data/origen_app_generators/lbin/yardoc +29 -0
- data/origen_app_generators/lbin/yri +29 -0
- data/origen_app_generators/lib/origen_app_generators.rb +125 -0
- data/origen_app_generators/lib/origen_app_generators/application.rb +62 -0
- data/origen_app_generators/lib/origen_app_generators/base.rb +257 -0
- data/origen_app_generators/lib/origen_app_generators/empty_application.rb +15 -0
- data/origen_app_generators/lib/origen_app_generators/empty_plugin.rb +15 -0
- data/origen_app_generators/lib/origen_app_generators/new.rb +170 -0
- data/origen_app_generators/lib/origen_app_generators/new_app_tests.rb +4 -0
- data/origen_app_generators/lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb +107 -0
- data/origen_app_generators/lib/origen_app_generators/plugin.rb +55 -0
- data/origen_app_generators/lib/origen_app_generators/test_engineering/common.rb +29 -0
- data/origen_app_generators/lib/origen_app_generators/test_engineering/stand_alone_application.rb +64 -0
- data/origen_app_generators/lib/origen_app_generators/test_engineering/test_block.rb +61 -0
- data/origen_app_generators/origen_app_generators.gemspec +33 -0
- data/{templates/code_generators → origen_app_generators/spec}/spec_helper.rb +0 -0
- data/origen_app_generators/target/debug.rb +8 -0
- data/origen_app_generators/target/default.rb +8 -0
- data/origen_app_generators/target/production.rb +0 -0
- data/origen_app_generators/templates/app_generators/application/.gitignore +37 -0
- data/origen_app_generators/templates/app_generators/application/.irbrc +9 -0
- data/origen_app_generators/templates/app_generators/application/.rspec +1 -0
- data/origen_app_generators/templates/app_generators/application/.travis.yml +11 -0
- data/origen_app_generators/templates/app_generators/application/Gemfile +34 -0
- data/origen_app_generators/templates/app_generators/application/Rakefile +7 -0
- data/origen_app_generators/templates/app_generators/application/app/blocks/top_level.rb +12 -0
- data/origen_app_generators/templates/app_generators/application/app/lib/module.rb +6 -0
- data/origen_app_generators/templates/app_generators/application/app/templates/web/index.md.erb +19 -0
- data/origen_app_generators/templates/app_generators/application/app/templates/web/layouts/_basic.html.erb +13 -0
- data/origen_app_generators/templates/app_generators/application/app/templates/web/partials/_navbar.html.erb +20 -0
- data/origen_app_generators/templates/app_generators/application/app/templates/web/release_notes.md.erb +5 -0
- data/origen_app_generators/templates/app_generators/application/config/application.rb +121 -0
- data/origen_app_generators/templates/app_generators/application/config/boot.rb +4 -0
- data/origen_app_generators/templates/app_generators/application/config/commands.rb +79 -0
- data/origen_app_generators/templates/app_generators/application/config/maillist_dev.txt +4 -0
- data/origen_app_generators/templates/app_generators/application/config/maillist_prod.txt +3 -0
- data/origen_app_generators/templates/app_generators/application/config/version.rb +8 -0
- data/origen_app_generators/templates/app_generators/application/doc/history +0 -0
- data/origen_app_generators/templates/app_generators/application/dot_keep +0 -0
- data/origen_app_generators/templates/app_generators/application/origen_core_session +2 -0
- data/origen_app_generators/templates/app_generators/application/spec/spec_helper.rb +44 -0
- data/origen_app_generators/templates/app_generators/application/target/debug.rb +8 -0
- data/origen_app_generators/templates/app_generators/application/target/default.rb +1 -0
- data/origen_app_generators/templates/app_generators/application/target/production.rb +4 -0
- data/origen_app_generators/templates/app_generators/new/generator.rb +102 -0
- data/origen_app_generators/templates/app_generators/new/info.md.erb +9 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/application.rb +54 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/base.rb +55 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/module.rb +28 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/plugin.rb +64 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/config/load_generators.rb +6 -0
- data/origen_app_generators/templates/app_generators/plugin/Gemfile +32 -0
- data/origen_app_generators/templates/app_generators/plugin/Rakefile +10 -0
- data/origen_app_generators/templates/app_generators/plugin/app/templates/web/index.md.erb +37 -0
- data/origen_app_generators/templates/app_generators/plugin/app/templates/web/partials/_navbar_external.html.erb +20 -0
- data/origen_app_generators/templates/app_generators/plugin/app/templates/web/partials/_navbar_internal.html.erb +20 -0
- data/origen_app_generators/templates/app_generators/plugin/config/boot.rb +24 -0
- data/origen_app_generators/templates/app_generators/plugin/gemspec.rb +43 -0
- data/origen_app_generators/templates/app_generators/test_engineering/environment/j750.rb +1 -0
- data/origen_app_generators/templates/app_generators/test_engineering/environment/uflex.rb +1 -0
- data/origen_app_generators/templates/app_generators/test_engineering/environment/v93k.rb +1 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/.keep +0 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/.keep +0 -0
- data/origen_site_config.yml +55 -5
- data/templates/code_generators/attributes.rb +20 -0
- data/templates/code_generators/class.rb +9 -0
- data/templates/code_generators/controller.rb +87 -0
- data/templates/code_generators/model.rb +21 -0
- data/templates/code_generators/module.rb +4 -0
- data/templates/code_generators/parameters.rb +19 -0
- data/templates/code_generators/pins.rb +28 -0
- data/templates/code_generators/registers.rb +20 -0
- data/templates/code_generators/sub_blocks.rb +24 -0
- data/templates/code_generators/timesets.rb +24 -0
- data/templates/code_generators/version.rb +0 -1
- data/templates/git/gitignore.erb +0 -1
- data/vendor/lib/models/origen/export1.rb +77 -0
- data/vendor/lib/models/origen/export1/block1.rb +13 -0
- data/vendor/lib/models/origen/export1/block1/x.rb +36 -0
- data/vendor/lib/models/origen/non_origen_meta_data.md +1 -0
- metadata +149 -68
- data/bin/fix_my_workspace +0 -100
- data/lib/c99/ate_interface.rb +0 -77
- data/lib/c99/nvm.rb +0 -110
- data/lib/c99/target/mock2.rb +0 -1
- data/lib/c99/target/subdir/mock3.rb +0 -1
- data/lib/origen/code_generators/bundler.rb +0 -17
- data/lib/origen/code_generators/gem_setup.rb +0 -49
- data/lib/origen/code_generators/rake.rb +0 -13
- data/lib/origen/code_generators/rspec.rb +0 -12
- data/lib/origen/commands/add.rb +0 -12
- data/lib/tasks/private/build.rake +0 -8
- data/templates/code_generators/gemfile_app.rb +0 -4
- data/templates/code_generators/gemfile_plugin.rb +0 -6
- data/templates/code_generators/gemspec.rb +0 -33
data/lib/origen/sub_blocks.rb
CHANGED
@@ -17,7 +17,7 @@ module Origen
|
|
17
17
|
# address API, but will accept any of these
|
18
18
|
@reg_base_address = options.delete(:reg_base_address) ||
|
19
19
|
options.delete(:base_address) || options.delete(:base) || 0
|
20
|
-
if options[:_instance]
|
20
|
+
if options[:_instance] # to be deprecated as part of multi-instance removal below
|
21
21
|
if @reg_base_address.is_a?(Array)
|
22
22
|
@reg_base_address = @reg_base_address[options[:_instance]]
|
23
23
|
elsif options[:base_address_step]
|
@@ -271,37 +271,47 @@ module Origen
|
|
271
271
|
tests.empty? ? false : true
|
272
272
|
end
|
273
273
|
|
274
|
-
def sub_block(name, options = {})
|
274
|
+
def sub_block(name = nil, options = {})
|
275
|
+
name, options = nil, name if name.is_a?(Hash)
|
276
|
+
return sub_blocks unless name
|
275
277
|
if i = options.delete(:instances)
|
276
|
-
a
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
278
|
+
# permit creating multiple instances of a particular sub_block class
|
279
|
+
# can pass array for base_address, which will be processed above
|
280
|
+
Origen.deprecate 'instances: option to sub_block is deprecated, use sub_block_groups instead'
|
281
|
+
group_name = name =~ /s$/ ? name : "#{name}s" # take care if name already with 's' is passed
|
282
|
+
unless respond_to?(group_name)
|
283
|
+
sub_block_groups group_name do
|
284
|
+
i.times do |j|
|
285
|
+
o = options.dup
|
286
|
+
o[:_instance] = j
|
287
|
+
sub_block("#{name}#{j}", o)
|
288
|
+
end
|
289
|
+
end
|
285
290
|
end
|
286
|
-
a
|
287
291
|
else
|
288
292
|
block = Placeholder.new(self, name, options)
|
289
|
-
if
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
else
|
300
|
-
sub_blocks[name] = block
|
293
|
+
# Allow additional attributes to be added to an existing sub-block if it hasn't
|
294
|
+
# been instantiated yet. This is not supported yet for instantiated sub-blocks since
|
295
|
+
# there are probably a lot more corner-cases to consider, and hopefully no one will
|
296
|
+
# really need this anyway.
|
297
|
+
if sub_blocks[name] && !sub_blocks[name].is_a?(Placeholder)
|
298
|
+
fail "You have already defined a sub-block named #{name} within class #{self.class}"
|
299
|
+
end
|
300
|
+
if respond_to?(name)
|
301
|
+
callers = Origen.split_caller_line caller[0]
|
302
|
+
Origen.log.warning "The sub_block defined at #{Pathname.new(callers[0]).relative_path_from(Pathname.pwd)}:#{callers[1]} is overriding an existing method called #{name}"
|
301
303
|
end
|
302
304
|
define_singleton_method name do
|
303
305
|
get_sub_block(name)
|
304
306
|
end
|
307
|
+
if sub_blocks[name] && sub_blocks[name].is_a?(Placeholder)
|
308
|
+
sub_blocks[name].add_attributes(options)
|
309
|
+
else
|
310
|
+
sub_blocks[name] = block
|
311
|
+
end
|
312
|
+
unless @current_group.nil? # a group is currently open, store sub_block id only
|
313
|
+
@current_group << name
|
314
|
+
end
|
305
315
|
if options.key?(:lazy)
|
306
316
|
lazy = options[:lazy]
|
307
317
|
else
|
@@ -311,6 +321,57 @@ module Origen
|
|
311
321
|
end
|
312
322
|
end
|
313
323
|
|
324
|
+
# Create a group of associated sub_blocks under a group name
|
325
|
+
# permits each sub_block to be of a different class
|
326
|
+
# e.g.
|
327
|
+
# sub_block_group :my_ip_group do
|
328
|
+
# sub_block :ip0, class_name: 'IP0', base_address: 0x000000
|
329
|
+
# sub_block :ip1, class_name: 'IP1', base_address: 0x000200
|
330
|
+
# sub_block :ip2, class_name: 'IP2', base_address: 0x000400
|
331
|
+
# sub_block :ip3, class_name: 'IP3', base_address: 0x000600
|
332
|
+
# end
|
333
|
+
#
|
334
|
+
# creates an array referenced by method called 'my_ip_group'
|
335
|
+
# which contains the sub_blocks 'ip0', 'ip1', 'ip2', 'ip3'.
|
336
|
+
#
|
337
|
+
# Can also indicate a custom class container to hold these.
|
338
|
+
# This custom class container MUST support a '<<' method in
|
339
|
+
# order to add new sub_blocks to the container instance.
|
340
|
+
#
|
341
|
+
# e.g.
|
342
|
+
# sub_block_group :my_ip_group, class_name: 'MYGRP' do
|
343
|
+
# sub_block :ip0, class_name: 'IP0', base_address: 0x000000
|
344
|
+
# sub_block :ip1, class_name: 'IP1', base_address: 0x000200
|
345
|
+
# sub_block :ip2, class_name: 'IP2', base_address: 0x000400
|
346
|
+
# sub_block :ip3, class_name: 'IP3', base_address: 0x000600
|
347
|
+
# end
|
348
|
+
#
|
349
|
+
#
|
350
|
+
def sub_block_group(id, options = {})
|
351
|
+
@current_group = [] # open group
|
352
|
+
yield # any sub_block calls within this block will have their ID added to @current_group
|
353
|
+
my_group = @current_group.dup
|
354
|
+
if respond_to?(id)
|
355
|
+
callers = Origen.split_caller_line caller[0]
|
356
|
+
Origen.log.warning "The sub_block_group defined at #{Pathname.new(callers[0]).relative_path_from(Pathname.pwd)}:#{callers[1]} is overriding an existing method called #{id}"
|
357
|
+
end
|
358
|
+
define_singleton_method "#{id}" do
|
359
|
+
if options[:class_name]
|
360
|
+
b = Object.const_get(options[:class_name]).new
|
361
|
+
else
|
362
|
+
b = []
|
363
|
+
end
|
364
|
+
my_group.each do |group_id|
|
365
|
+
b << send(group_id)
|
366
|
+
end
|
367
|
+
b # return array inside new singleton method
|
368
|
+
end
|
369
|
+
@current_group = nil # close group
|
370
|
+
end
|
371
|
+
alias_method :sub_block_groups, :sub_block_group
|
372
|
+
alias_method :sub_blocks_groups, :sub_block_group
|
373
|
+
alias_method :sub_blocks_group, :sub_block_group
|
374
|
+
|
314
375
|
def namespace
|
315
376
|
self.class.to_s.sub(/::[^:]*$/, '')
|
316
377
|
end
|
@@ -346,6 +407,11 @@ module Origen
|
|
346
407
|
|
347
408
|
# Make this appear like a sub-block to any application code
|
348
409
|
def is_a?(klass)
|
410
|
+
# Because sub_blocks are stored in a hash.with_indifferent_access, the value is tested
|
411
|
+
# against being a Hash or Array when it is added to the hash. This prevents the class being
|
412
|
+
# looking up and loaded by the autoload system straight away, especially if the sub-block
|
413
|
+
# has been specified to lazy load
|
414
|
+
return false if klass == Hash || klass == Array
|
349
415
|
klass == self.klass || klass == Placeholder
|
350
416
|
end
|
351
417
|
|
@@ -363,13 +429,16 @@ module Origen
|
|
363
429
|
end
|
364
430
|
|
365
431
|
def materialize
|
432
|
+
block = nil
|
366
433
|
file = attributes.delete(:file)
|
434
|
+
load_block = attributes.delete(:load_block)
|
367
435
|
dir = attributes.delete(:dir) || owner.send(:export_dir)
|
368
436
|
block = owner.send(:instantiate_sub_block, name, klass, attributes)
|
369
437
|
if file
|
370
438
|
require File.join(dir, file)
|
371
439
|
block.extend owner.send(:export_module_names_from_path, file).join('::').constantize
|
372
440
|
end
|
441
|
+
block.load_block(load_block) if load_block
|
373
442
|
block.owner = owner
|
374
443
|
block
|
375
444
|
end
|
@@ -403,17 +472,17 @@ module Origen
|
|
403
472
|
@klass ||= begin
|
404
473
|
class_name = attributes.delete(:class_name)
|
405
474
|
if class_name
|
406
|
-
|
475
|
+
begin
|
407
476
|
klass = eval("::#{owner.namespace}::#{class_name}")
|
408
|
-
|
409
|
-
|
477
|
+
rescue NameError
|
478
|
+
begin
|
410
479
|
klass = eval(class_name)
|
411
|
-
|
412
|
-
|
480
|
+
rescue NameError
|
481
|
+
begin
|
413
482
|
klass = eval("#{owner.class}::#{class_name}")
|
414
|
-
|
483
|
+
rescue NameError
|
415
484
|
puts "Could not find class: #{class_name}"
|
416
|
-
|
485
|
+
raise 'Unknown sub block class!'
|
417
486
|
end
|
418
487
|
end
|
419
488
|
end
|
@@ -441,6 +510,12 @@ module Origen
|
|
441
510
|
class SubBlock
|
442
511
|
include Origen::Model
|
443
512
|
|
513
|
+
# Since no application defined this sub-block class, consider its parent's app to be
|
514
|
+
# the owning application
|
515
|
+
def app
|
516
|
+
parent.app
|
517
|
+
end
|
518
|
+
|
444
519
|
# Used to create attribute accessors on the fly.
|
445
520
|
#
|
446
521
|
# On first call of a missing method a method is generated to avoid the missing lookup
|
data/lib/origen/top_level.rb
CHANGED
@@ -24,6 +24,17 @@ module Origen
|
|
24
24
|
include Origen::Model
|
25
25
|
end
|
26
26
|
|
27
|
+
# Unloads all modules class defined by the application and reloads the target, use
|
28
|
+
# this in the console to pick up changes made to files since you opened it.
|
29
|
+
# It will only work if your application uses Origen auto-loading from the app/dir,
|
30
|
+
# any files that you have manually required will not be re-loaded and may generally
|
31
|
+
# cause problems with the use of this method.
|
32
|
+
def reload!
|
33
|
+
Loader.unload
|
34
|
+
Origen.app.reload_target!
|
35
|
+
true
|
36
|
+
end
|
37
|
+
|
27
38
|
# Top-level timing manager/API, returns an instance of Origen::Pins::Timing
|
28
39
|
def timing
|
29
40
|
@timing ||= Pins::Timing.new
|
data/lib/origen/users/user.rb
CHANGED
@@ -44,10 +44,11 @@ module Origen
|
|
44
44
|
Origen.mailer.send_email(options)
|
45
45
|
end
|
46
46
|
|
47
|
-
def id
|
47
|
+
def id(options = {})
|
48
48
|
@id.to_s.downcase
|
49
49
|
end
|
50
50
|
alias_method :core_id, :id
|
51
|
+
alias_method :username, :id
|
51
52
|
|
52
53
|
# Returns true if the user is an admin for the current application
|
53
54
|
def admin?
|
@@ -73,7 +74,7 @@ module Origen
|
|
73
74
|
RevisionControl::Git.user_name
|
74
75
|
end
|
75
76
|
|
76
|
-
def email
|
77
|
+
def email(options = {})
|
77
78
|
if current?
|
78
79
|
@email ||= ENV['ORIGEN_EMAIL'] || email_from_rc || begin
|
79
80
|
if Origen.site_config.email_domain
|
@@ -7,13 +7,18 @@ module Origen
|
|
7
7
|
# Generic method to send an email, alternatively use one of the
|
8
8
|
# pre-defined mail types using the other methods.
|
9
9
|
def send_email(options = {})
|
10
|
-
options = { server:
|
11
|
-
port:
|
12
|
-
from:
|
13
|
-
from_alias:
|
14
|
-
subject:
|
15
|
-
body:
|
16
|
-
to:
|
10
|
+
options = { server: Origen.site_config.email_server,
|
11
|
+
port: Origen.site_config.email_port,
|
12
|
+
from: current_user.email,
|
13
|
+
from_alias: current_user.name,
|
14
|
+
subject: 'Hello',
|
15
|
+
body: 'Hello from Origen!',
|
16
|
+
to: current_user.email,
|
17
|
+
authentication: (Origen.site_config.email_authentication || :none).to_sym,
|
18
|
+
domain: (Origen.site_config.email_domain || ''),
|
19
|
+
|
20
|
+
auth_user: (Origen.site_config.email_auth_user || current_user.email),
|
21
|
+
auth_password: (Origen.site_config.email_auth_password || current_user.password)
|
17
22
|
}.merge(options)
|
18
23
|
|
19
24
|
# Force to an array
|
@@ -32,10 +37,38 @@ Subject: #{options[:subject]}
|
|
32
37
|
END_OF_MESSAGE
|
33
38
|
|
34
39
|
begin
|
40
|
+
Origen.log.debug('Origen::Utility::Mailer Setup:')
|
41
|
+
options.each { |k, v| Origen.log.debug(" #{k}: #{v}") }
|
42
|
+
|
43
|
+
# Net::SMTP.start(options[:server], options[:port]) do |smtp|
|
44
|
+
# smtp.send_message msg, options[:from], addr
|
45
|
+
# end
|
46
|
+
|
35
47
|
# Exceptions raised here will be caught by rescue clause
|
36
|
-
Net::SMTP.
|
37
|
-
|
48
|
+
smtp = Net::SMTP.new(options[:server], options[:port])
|
49
|
+
smtp.enable_starttls if options[:authentication] != :none
|
50
|
+
|
51
|
+
opts = begin
|
52
|
+
if options[:authentication] == :none
|
53
|
+
# Trying to add username and password if there's no authentication will actually be rejected by
|
54
|
+
# the server.
|
55
|
+
[options[:domain]]
|
56
|
+
else
|
57
|
+
[options[:domain], options[:auth_user], options[:auth_password], options[:authentication]]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
smtp.start(*opts) do |m|
|
62
|
+
m.send_message(msg, options[:from], addr)
|
38
63
|
end
|
64
|
+
|
65
|
+
# Exceptions raised here will be caught by rescue clause
|
66
|
+
# smtp = Net::SMTP.new(options[:server], options[:port])
|
67
|
+
# smtp.enable_starttls
|
68
|
+
|
69
|
+
# smtp.start (options[:domain], options[:auth_user], options[:auth_password], options[:authentication]) do |smtp|
|
70
|
+
# smtp.send_message(msg, options[:from], addr)
|
71
|
+
# end
|
39
72
|
rescue
|
40
73
|
warn "Email not able to be sent to address '#{addr}'"
|
41
74
|
end
|
@@ -64,7 +64,7 @@ module Origen
|
|
64
64
|
if val =~ /^[01_xXzZ]+$/
|
65
65
|
true
|
66
66
|
else
|
67
|
-
fail Origen::
|
67
|
+
fail Origen::BinStrValError, "Binary string values can only contain: 0, 1, _, x, X, z, Z, this is invalid: #{val}"
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -92,7 +92,7 @@ module Origen
|
|
92
92
|
if val =~ /^[0-9a-fA-F_xXzZ]+$/
|
93
93
|
true
|
94
94
|
else
|
95
|
-
fail Origen::
|
95
|
+
fail Origen::HexStrValError, "Hex string values can only contain: 0-9, a-f, A-F, _, x, X, z, Z, this is invalid: #{val}"
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
@@ -32,7 +32,12 @@ module Origen
|
|
32
32
|
alias_method :orig_equal?, :==
|
33
33
|
|
34
34
|
def equal?(version)
|
35
|
-
|
35
|
+
# If not a valid version string, compare using regular string comparison
|
36
|
+
if valid?
|
37
|
+
condition_met?("== #{version}")
|
38
|
+
else
|
39
|
+
orig_equal?(version)
|
40
|
+
end
|
36
41
|
end
|
37
42
|
alias_method :eq?, :equal?
|
38
43
|
alias_method :==, :equal?
|
data/lib/tasks/gem.rake
CHANGED
@@ -24,7 +24,12 @@ namespace 'gem' do
|
|
24
24
|
if Origen.app.config.release_externally
|
25
25
|
cmd = "gem push #{built_gem_path}"
|
26
26
|
else
|
27
|
-
|
27
|
+
url = Origen.site_config.gem_server_push || Origen.site_config.gem_server!
|
28
|
+
if Origen.site_config.gem_push_cmd
|
29
|
+
cmd = Origen.site_config.gem_push_cmd.gsub('+URL+', url).gsub('+GEM+', built_gem_path)
|
30
|
+
else
|
31
|
+
cmd = "gem push #{built_gem_path} --host #{url}"
|
32
|
+
end
|
28
33
|
end
|
29
34
|
sh(cmd) do |ok, _res|
|
30
35
|
if ok
|
@@ -0,0 +1,19 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in origen_app_generators.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
# DO NOT ADD ANY RUNTIME GEMS HERE, WHEN THESE GENERATORS ARE INVOKED TO
|
7
|
+
# GENERATE A NEW APPLICATION IT WILL NOT BE LAUNCHED FROM WITHIN A BUNDLED
|
8
|
+
# ENVIRONMENT.
|
9
|
+
#
|
10
|
+
# THEREFORE GENERATORS MUST NOT RELY ON ANY 3RD PARTY GEMS THAT ARE NOT
|
11
|
+
# PRESENT AS PART OF A STANDARD RGEN INSTALLATION - I.E. YOU CAN ONLY RELY
|
12
|
+
# ON THE GEMS THAT RGEN ITSELF DEPENDS ON.
|
13
|
+
|
14
|
+
gem 'byebug', '< 9.1.0'
|
15
|
+
#gem 'origen'
|
16
|
+
#gem 'origen', path: "~/Code/github/origen"
|
17
|
+
|
18
|
+
# Lock this version to enable testing on Ruby 2.2
|
19
|
+
gem 'nokogiri', '1.8.5'
|
@@ -0,0 +1,152 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
origen_app_generators (2.0.0)
|
5
|
+
origen (>= 0.40.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (4.2.11.1)
|
11
|
+
i18n (~> 0.7)
|
12
|
+
minitest (~> 5.1)
|
13
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
ast (2.4.0)
|
16
|
+
astrolabe (1.3.1)
|
17
|
+
parser (~> 2.2)
|
18
|
+
bootsnap (1.4.4)
|
19
|
+
msgpack (~> 1.0)
|
20
|
+
builder (3.2.3)
|
21
|
+
byebug (9.0.6)
|
22
|
+
coderay (1.1.2)
|
23
|
+
colored (1.2)
|
24
|
+
colorize (0.8.1)
|
25
|
+
concurrent-ruby (1.1.5)
|
26
|
+
cri (2.10.1)
|
27
|
+
colored (~> 1.2)
|
28
|
+
dentaku (2.0.11)
|
29
|
+
diff-lcs (1.3)
|
30
|
+
docile (1.3.1)
|
31
|
+
faraday (0.15.4)
|
32
|
+
multipart-post (>= 1.2, < 3)
|
33
|
+
geminabox (0.12.4)
|
34
|
+
builder
|
35
|
+
faraday
|
36
|
+
httpclient (>= 2.2.7)
|
37
|
+
nesty
|
38
|
+
sinatra (>= 1.2.7)
|
39
|
+
gems (0.8.3)
|
40
|
+
highline (1.7.10)
|
41
|
+
httparty (0.17.0)
|
42
|
+
mime-types (~> 3.0)
|
43
|
+
multi_xml (>= 0.5.2)
|
44
|
+
httpclient (2.8.3)
|
45
|
+
i18n (0.9.5)
|
46
|
+
concurrent-ruby (~> 1.0)
|
47
|
+
json (2.2.0)
|
48
|
+
kramdown (1.17.0)
|
49
|
+
method_source (0.9.2)
|
50
|
+
mime-types (3.2.2)
|
51
|
+
mime-types-data (~> 3.2015)
|
52
|
+
mime-types-data (3.2019.0331)
|
53
|
+
mini_portile2 (2.3.0)
|
54
|
+
minitest (5.11.3)
|
55
|
+
msgpack (1.2.10)
|
56
|
+
multi_xml (0.6.0)
|
57
|
+
multipart-post (2.1.1)
|
58
|
+
nanoc (3.7.5)
|
59
|
+
cri (~> 2.3)
|
60
|
+
nesty (1.0.2)
|
61
|
+
net-ldap (0.16.1)
|
62
|
+
nokogiri (1.8.5)
|
63
|
+
mini_portile2 (~> 2.3.0)
|
64
|
+
origen (0.44.0)
|
65
|
+
activesupport (~> 4.1)
|
66
|
+
bootsnap (>= 1.3.2)
|
67
|
+
bundler (~> 1.7)
|
68
|
+
coderay (~> 1.1)
|
69
|
+
colored (~> 1.2)
|
70
|
+
colorize (~> 0.8.1)
|
71
|
+
concurrent-ruby
|
72
|
+
cri (~> 2.10.0)
|
73
|
+
dentaku (~> 2)
|
74
|
+
geminabox (= 0.12.4)
|
75
|
+
gems (~> 0.8)
|
76
|
+
highline (~> 1.7)
|
77
|
+
httparty (~> 0.13)
|
78
|
+
kramdown (~> 1.5)
|
79
|
+
nanoc (~> 3.7.0)
|
80
|
+
net-ldap (~> 0.13)
|
81
|
+
nokogiri (>= 1.7.2)
|
82
|
+
pry (~> 0.10)
|
83
|
+
rake (~> 10)
|
84
|
+
rspec (~> 3)
|
85
|
+
rspec-legacy_formatters (~> 1)
|
86
|
+
rubocop (= 0.30)
|
87
|
+
scrub_rb (~> 1.0)
|
88
|
+
simplecov (~> 0.9)
|
89
|
+
sinatra (~> 1)
|
90
|
+
thor (~> 0.19)
|
91
|
+
yard (~> 0.8)
|
92
|
+
parser (2.6.3.0)
|
93
|
+
ast (~> 2.4.0)
|
94
|
+
powerpack (0.1.2)
|
95
|
+
pry (0.12.2)
|
96
|
+
coderay (~> 1.1.0)
|
97
|
+
method_source (~> 0.9.0)
|
98
|
+
rack (1.6.11)
|
99
|
+
rack-protection (1.5.5)
|
100
|
+
rack
|
101
|
+
rainbow (2.2.2)
|
102
|
+
rake
|
103
|
+
rake (10.5.0)
|
104
|
+
rspec (3.8.0)
|
105
|
+
rspec-core (~> 3.8.0)
|
106
|
+
rspec-expectations (~> 3.8.0)
|
107
|
+
rspec-mocks (~> 3.8.0)
|
108
|
+
rspec-core (3.8.0)
|
109
|
+
rspec-support (~> 3.8.0)
|
110
|
+
rspec-expectations (3.8.3)
|
111
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
112
|
+
rspec-support (~> 3.8.0)
|
113
|
+
rspec-legacy_formatters (1.0.1)
|
114
|
+
rspec (~> 3.0)
|
115
|
+
rspec-mocks (3.8.0)
|
116
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
117
|
+
rspec-support (~> 3.8.0)
|
118
|
+
rspec-support (3.8.0)
|
119
|
+
rubocop (0.30.0)
|
120
|
+
astrolabe (~> 1.3)
|
121
|
+
parser (>= 2.2.0.1, < 3.0)
|
122
|
+
powerpack (~> 0.1)
|
123
|
+
rainbow (>= 1.99.1, < 3.0)
|
124
|
+
ruby-progressbar (~> 1.4)
|
125
|
+
ruby-progressbar (1.10.0)
|
126
|
+
scrub_rb (1.0.1)
|
127
|
+
simplecov (0.16.1)
|
128
|
+
docile (~> 1.1)
|
129
|
+
json (>= 1.8, < 3)
|
130
|
+
simplecov-html (~> 0.10.0)
|
131
|
+
simplecov-html (0.10.2)
|
132
|
+
sinatra (1.4.8)
|
133
|
+
rack (~> 1.5)
|
134
|
+
rack-protection (~> 1.4)
|
135
|
+
tilt (>= 1.3, < 3)
|
136
|
+
thor (0.20.3)
|
137
|
+
thread_safe (0.3.6)
|
138
|
+
tilt (2.0.9)
|
139
|
+
tzinfo (1.2.5)
|
140
|
+
thread_safe (~> 0.1)
|
141
|
+
yard (0.9.19)
|
142
|
+
|
143
|
+
PLATFORMS
|
144
|
+
ruby
|
145
|
+
|
146
|
+
DEPENDENCIES
|
147
|
+
byebug (< 9.1.0)
|
148
|
+
nokogiri (= 1.8.5)
|
149
|
+
origen_app_generators!
|
150
|
+
|
151
|
+
BUNDLED WITH
|
152
|
+
1.17.1
|