origen 0.38.0 → 0.40.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/origen +1 -236
- data/config/application.rb +10 -1
- data/config/version.rb +1 -1
- data/lib/origen/{boot_api.rb → boot/api.rb} +2 -2
- data/lib/origen/boot/app.rb +324 -0
- data/lib/origen/boot.rb +287 -0
- data/lib/origen/commands/archive.rb +175 -0
- data/lib/origen/commands/extract.rb +43 -0
- data/lib/origen/commands/new.rb +33 -23
- data/lib/origen/commands.rb +4 -1
- data/lib/origen/commands_global.rb +3 -2
- data/lib/origen/operating_systems.rb +4 -0
- data/lib/origen/revision_control.rb +1 -1
- data/lib/origen/site_config.rb +4 -1
- data/lib/origen.rb +3 -2
- data/origen_app_generators/Gemfile +16 -0
- data/origen_app_generators/Gemfile.lock +147 -0
- data/origen_app_generators/LICENSE +21 -0
- data/origen_app_generators/README.md +368 -0
- data/origen_app_generators/Rakefile +10 -0
- data/origen_app_generators/bin/boot.rb +37 -0
- data/{bin → origen_app_generators/bin}/fix_my_workspace +0 -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 +172 -0
- data/origen_app_generators/config/version.rb +8 -0
- data/origen_app_generators/doc/history +213 -0
- data/origen_app_generators/lib/origen_app_generators/application.rb +62 -0
- data/origen_app_generators/lib/origen_app_generators/base.rb +231 -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 +162 -0
- data/origen_app_generators/lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb +109 -0
- data/origen_app_generators/lib/origen_app_generators/plugin.rb +58 -0
- data/origen_app_generators/lib/origen_app_generators/sub_block_parser.rb +81 -0
- data/origen_app_generators/lib/origen_app_generators/test_engineering/stand_alone_application.rb +236 -0
- data/origen_app_generators/lib/origen_app_generators/test_engineering/test_block.rb +162 -0
- data/origen_app_generators/lib/origen_app_generators.rb +123 -0
- data/origen_app_generators/lib/tasks/app_generators.rake +6 -0
- data/origen_app_generators/lib/tasks/new_app_tests.rake +8 -0
- data/origen_app_generators/origen_app_generators.gemspec +33 -0
- data/origen_app_generators/spec/spec_helper.rb +49 -0
- data/origen_app_generators/spec/sub_block_spec.rb +36 -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/Gemfile +19 -0
- data/origen_app_generators/templates/app_generators/application/Rakefile +7 -0
- data/origen_app_generators/templates/app_generators/application/config/application.rb +125 -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/lib/app.rake +6 -0
- data/origen_app_generators/templates/app_generators/application/lib/module.rb +22 -0
- data/origen_app_generators/templates/app_generators/application/lib/top_level.rb +12 -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/application/templates/web/index.md.erb +19 -0
- data/origen_app_generators/templates/app_generators/application/templates/web/layouts/_basic.html.erb +13 -0
- data/origen_app_generators/templates/app_generators/application/templates/web/partials/_navbar.html.erb +20 -0
- data/origen_app_generators/templates/app_generators/application/templates/web/release_notes.md.erb +5 -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/config/load_generators.rb +6 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/application.rb +54 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/base.rb +55 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/module.rb +28 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/plugin.rb +64 -0
- data/origen_app_generators/templates/app_generators/plugin/Gemfile +26 -0
- data/origen_app_generators/templates/app_generators/plugin/Rakefile +10 -0
- data/origen_app_generators/templates/app_generators/plugin/config/boot.rb +24 -0
- data/origen_app_generators/templates/app_generators/plugin/gemspec.rb +42 -0
- data/origen_app_generators/templates/app_generators/plugin/lib/README +4 -0
- data/origen_app_generators/templates/app_generators/plugin/lib_dev/README +5 -0
- data/origen_app_generators/templates/app_generators/plugin/templates/web/index.md.erb +37 -0
- data/origen_app_generators/templates/app_generators/plugin/templates/web/partials/_navbar_external.html.erb +20 -0
- data/origen_app_generators/templates/app_generators/plugin/templates/web/partials/_navbar_internal.html.erb +20 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/Gemfile +23 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/environment/j750.rb +1 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/environment/jlink.rb +1 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/environment/uflex.rb +1 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/environment/v93k.rb +1 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/ip_block.rb +23 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/ip_block_controller.rb +5 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/top_level.rb +33 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/top_level_controller.rb +21 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/pattern/example.rb +4 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/target/top_level.rb +4 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/j750.rb +2 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/ultraflex.rb +2 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/v93k.rb +2 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/controller.rb +12 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/interface.rb +21 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/model.rb +18 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib_dev/dut.rb +27 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib_dev/dut_controller.rb +26 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/pattern/example.rb +5 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/program/prb1.rb +11 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/target/default.rb +2 -0
- data/origen_site_config.yml +13 -2
- data/templates/git/gitignore.erb +0 -1
- metadata +99 -4
@@ -0,0 +1,153 @@
|
|
1
|
+
require 'origen'
|
2
|
+
class OrigenAppGeneratorsApplication < Origen::Application
|
3
|
+
# This information is used in headers and email templates, set it specific
|
4
|
+
# to your application
|
5
|
+
config.name = "Origen App Generators"
|
6
|
+
config.initials = "Origen_App_Generators"
|
7
|
+
config.rc_url = "ssh://git@github.com:Origen-SDK/origen_app_generators.git"
|
8
|
+
config.release_externally = true
|
9
|
+
|
10
|
+
# To enable deployment of your documentation to a web server (via the 'origen web'
|
11
|
+
# command) fill in these attributes. The example here is configured to deploy to
|
12
|
+
# the origen.freescale.net domain, which is an easy option if you don't have another
|
13
|
+
# server already in mind. To do this you will need an account on CDE and to be a member
|
14
|
+
# of the 'origen' group.
|
15
|
+
config.web_directory = "/proj/.web_origen/html/origen_app_generators"
|
16
|
+
config.web_domain = "http://origen-sdk.org/origen_app_generators"
|
17
|
+
|
18
|
+
# When false Origen will be less strict about checking for some common coding errors,
|
19
|
+
# it is recommended that you leave this to true for better feedback and easier debug.
|
20
|
+
# This will be the default setting in Origen v3.
|
21
|
+
config.strict_errors = true
|
22
|
+
|
23
|
+
# See: http://origen.freescale.net/origen/latest/guides/utilities/lint/
|
24
|
+
config.lint_test = {
|
25
|
+
# Require the lint tests to pass before allowing a release to proceed
|
26
|
+
run_on_tag: true,
|
27
|
+
# Auto correct violations where possible whenever 'origen lint' is run
|
28
|
+
auto_correct: true,
|
29
|
+
# Limit the testing for large legacy applications
|
30
|
+
#level: :easy,
|
31
|
+
# Run on these directories/files by default
|
32
|
+
#files: ["lib", "config/application.rb"],
|
33
|
+
}
|
34
|
+
|
35
|
+
# Versioning is based on a timestamp by default, if you would rather use semantic
|
36
|
+
# versioning, i.e. v1.0.0 format, then set this to true.
|
37
|
+
# In parallel go and edit config/version.rb to enable the semantic version code.
|
38
|
+
config.semantically_version = true
|
39
|
+
|
40
|
+
config.shared = {
|
41
|
+
#patterns: "pattern",
|
42
|
+
#templates: "templates",
|
43
|
+
#programs: "program",
|
44
|
+
command_launcher: "config/shared_commands.rb"
|
45
|
+
}
|
46
|
+
|
47
|
+
# An example of how to set application specific LSF parameters
|
48
|
+
#config.lsf.project = "msg.te"
|
49
|
+
|
50
|
+
# An example of how to specify a prefix to add to all generated patterns
|
51
|
+
#config.pattern_prefix = "nvm"
|
52
|
+
|
53
|
+
# An example of how to add header comments to all generated patterns
|
54
|
+
#config.pattern_header do
|
55
|
+
# cc "This is a pattern created by the example origen application"
|
56
|
+
#end
|
57
|
+
|
58
|
+
# By default all generated output will end up in ./output.
|
59
|
+
# Here you can specify an alternative directory entirely, or make it dynamic such that
|
60
|
+
# the output ends up in a setup specific directory.
|
61
|
+
#config.output_directory do
|
62
|
+
# "#{Origen.root}/output/#{$dut.class}"
|
63
|
+
#end
|
64
|
+
|
65
|
+
# Similary for the reference files, generally you want to setup the reference directory
|
66
|
+
# structure to mirror that of your output directory structure.
|
67
|
+
#config.reference_directory do
|
68
|
+
# "#{Origen.root}/.ref/#{$dut.class}"
|
69
|
+
#end
|
70
|
+
|
71
|
+
# This will automatically deploy your documentation after every tag
|
72
|
+
#def after_release_email(tag, note, type, selector, options)
|
73
|
+
# deployer = Origen.app.deployer
|
74
|
+
# if deployer.running_on_cde? && deployer.user_belongs_to_origen?
|
75
|
+
# command = "origen web compile --remote --api"
|
76
|
+
# if Origen.app.version.production?
|
77
|
+
# command += " --archive #{Origen.app.version}"
|
78
|
+
# end
|
79
|
+
# Dir.chdir Origen.root do
|
80
|
+
# system command
|
81
|
+
# end
|
82
|
+
# end
|
83
|
+
#end
|
84
|
+
|
85
|
+
# Ensure that all tests pass before allowing a release to continue
|
86
|
+
#def validate_release
|
87
|
+
# if !system("origen specs") || !system("origen examples")
|
88
|
+
# puts "Sorry but you can't release with failing tests, please fix them and try again."
|
89
|
+
# exit 1
|
90
|
+
# else
|
91
|
+
# puts "All tests passing, proceeding with release process!"
|
92
|
+
# end
|
93
|
+
#end
|
94
|
+
|
95
|
+
# To enabled source-less pattern generation create a class (for example PatternDispatcher)
|
96
|
+
# to generate the pattern. This should return false if the requested pattern has been
|
97
|
+
# dispatched, otherwise Origen will proceed with looking up a pattern source as normal.
|
98
|
+
#def before_pattern_lookup(requested_pattern)
|
99
|
+
# PatternDispatcher.new.dispatch_or_return(requested_pattern)
|
100
|
+
#end
|
101
|
+
|
102
|
+
# If you use pattern iterators you may come accross the case where you request a pattern
|
103
|
+
# like this:
|
104
|
+
# origen g example_pat_b0.atp
|
105
|
+
#
|
106
|
+
# However it cannot be found by Origen since the pattern name is actually example_pat_bx.atp
|
107
|
+
# In the case where the pattern cannot be found Origen will pass the name to this translator
|
108
|
+
# if it exists, and here you can make any substitutions to help Origen find the file you
|
109
|
+
# want. In this example any instances of _b\d, where \d means a number, are replaced by
|
110
|
+
# _bx.
|
111
|
+
#config.pattern_name_translator do |name|
|
112
|
+
# name.gsub(/_b\d/, "_bx")
|
113
|
+
#end
|
114
|
+
|
115
|
+
# If you want to use pattern iterators, that is the ability to generate multiple pattern
|
116
|
+
# variants from a single source file, then you can define the required behavior here.
|
117
|
+
# The examples below implement some of the iterators that were available in Origen 1,
|
118
|
+
# you can remove them if you don't want to use them, or of course modify or add new
|
119
|
+
# iterators specific to your application logic.
|
120
|
+
|
121
|
+
# By setting iterator
|
122
|
+
config.pattern_iterator do |iterator|
|
123
|
+
# Define a key that you will use to enable this in a pattern, here the iterator
|
124
|
+
# can be enabled like this: Pattern.create(by_setting: [1,2,3]) do
|
125
|
+
iterator.key = :by_setting
|
126
|
+
|
127
|
+
# The value passed from the pattern via the key comes in here as the first
|
128
|
+
# argument, the name applied here can be anything, but settings seem reasonable since
|
129
|
+
# an array of setting values is expected.
|
130
|
+
# The last argument &pattern is mandatory and represents the pattern block (the bit contained
|
131
|
+
# within Pattern.create do ... end)
|
132
|
+
iterator.loop do |settings, &pattern|
|
133
|
+
# Implement the loop however you like, here we loop for each value in the array
|
134
|
+
settings.each do |setting|
|
135
|
+
# Now call the pattern passing in the setting argument, this would be captured
|
136
|
+
# in the pattern like this:
|
137
|
+
# Pattern.create do |setting|
|
138
|
+
pattern.call(setting)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# Each pattern iteration needs a unique name, otherwise Origen will simply overwrite
|
143
|
+
# the same output file each time.
|
144
|
+
# The base pattern name and the pattern argument, in this case the setting, will be
|
145
|
+
# passed in here and whatever is returned is what will be used as the name.
|
146
|
+
iterator.pattern_name do |name, setting|
|
147
|
+
# Substiture _x in the name with the setting, _1, _2, etc.
|
148
|
+
name.gsub("_x", "_#{setting}")
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "origen_app_generators"
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# This file should be used to extend the origen command line tool with tasks
|
2
|
+
# specific to your application.
|
3
|
+
# The comments below should help to get started and you can also refer to
|
4
|
+
# lib/origen/commands.rb in your Origen core workspace for more examples and
|
5
|
+
# inspiration.
|
6
|
+
#
|
7
|
+
# Also see the official docs on adding commands:
|
8
|
+
# http://origen.freescale.net/origen/latest/guides/custom/commands/
|
9
|
+
|
10
|
+
# Map any command aliases here, for example to allow origen -x to refer to a
|
11
|
+
# command called execute you would add a reference as shown below:
|
12
|
+
aliases ={
|
13
|
+
# "-x" => "execute",
|
14
|
+
}
|
15
|
+
|
16
|
+
# The requested command is passed in here as @command, this checks it against
|
17
|
+
# the above alias table and should not be removed.
|
18
|
+
@command = aliases[@command] || @command
|
19
|
+
|
20
|
+
## Now branch to the specific task code
|
21
|
+
case @command
|
22
|
+
|
23
|
+
# Run the unit tests
|
24
|
+
when "specs"
|
25
|
+
require "rspec"
|
26
|
+
exit RSpec::Core::Runner.run(['spec'])
|
27
|
+
|
28
|
+
## Run the example-based (diff) tests
|
29
|
+
#when "examples"
|
30
|
+
# Origen.load_application
|
31
|
+
# status = 0
|
32
|
+
#
|
33
|
+
# # Compiler tests
|
34
|
+
# ARGV = %w(templates/example.txt.erb -t debug -r approved)
|
35
|
+
# load "origen/commands/compile.rb"
|
36
|
+
# # Pattern generator tests
|
37
|
+
# #ARGV = %w(some_pattern -t debug -r approved)
|
38
|
+
# #load "#{Origen.top}/lib/origen/commands/generate.rb"
|
39
|
+
#
|
40
|
+
# if Origen.app.stats.changed_files == 0 &&
|
41
|
+
# Origen.app.stats.new_files == 0 &&
|
42
|
+
# Origen.app.stats.changed_patterns == 0 &&
|
43
|
+
# Origen.app.stats.new_patterns == 0
|
44
|
+
#
|
45
|
+
# Origen.app.stats.report_pass
|
46
|
+
# else
|
47
|
+
# Origen.app.stats.report_fail
|
48
|
+
# status = 1
|
49
|
+
# end
|
50
|
+
# puts
|
51
|
+
# exit status # Exit with a 1 on the event of a failure per std unix result codes
|
52
|
+
#
|
53
|
+
## Always leave an else clause to allow control to fall back through to the
|
54
|
+
## Origen command handler.
|
55
|
+
## You probably want to also add the command details to the help shown via
|
56
|
+
## origen -h, you can do this be assigning the required text to @application_commands
|
57
|
+
## before handing control back to Origen. Un-comment the example below to get started.
|
58
|
+
else
|
59
|
+
@application_commands = <<-EOT
|
60
|
+
specs Run the specs (tests), -c will enable coverage
|
61
|
+
EOT
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
# The requested command is passed in here as @command
|
2
|
+
case @command
|
3
|
+
|
4
|
+
when "app_gen:test"
|
5
|
+
options = {}
|
6
|
+
|
7
|
+
opt_parser = OptionParser.new do |opts|
|
8
|
+
opts.banner = <<-END
|
9
|
+
Test the generators by emulating the 'origen new' command execution and building the new
|
10
|
+
application into the tmp directory.
|
11
|
+
|
12
|
+
Usage: origen app_gen:test [options]
|
13
|
+
END
|
14
|
+
opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
|
15
|
+
opts.on('-i', '--inputs INDEX', Integer, "Apply the set of test inputs defined in #{Origen.app.namespace}::TEST_INPUTS[INDEX]") { |f| options[:inputs] = f }
|
16
|
+
opts.on('-r', '--regression', "Run all sets of test inputs defined in #{Origen.app.namespace}::TEST_INPUTS[INDEX]") { options[:regression] = true }
|
17
|
+
opts.on('-a', '--all_generators', "Include the generators from Origen core") { options[:all_generators] = true }
|
18
|
+
opts.separator ''
|
19
|
+
opts.on('-h', '--help', 'Show this message') { puts opts; exit }
|
20
|
+
end
|
21
|
+
|
22
|
+
opt_parser.orig_parse! ARGV
|
23
|
+
|
24
|
+
FileUtils.rm_rf "#{Origen.root}/tmp" if File.exist?("#{Origen.root}/tmp")
|
25
|
+
|
26
|
+
if options[:inputs] || options[:regression]
|
27
|
+
if options[:regression]
|
28
|
+
inputs = Origen.app.namespace.constantize::TEST_INPUTS
|
29
|
+
else
|
30
|
+
inputs = [Origen.app.namespace.constantize::TEST_INPUTS[options[:inputs].to_i]]
|
31
|
+
end
|
32
|
+
|
33
|
+
prefix = 'bundle exec ' unless Origen.site_config.gem_manage_bundler
|
34
|
+
|
35
|
+
overall_fail = false
|
36
|
+
|
37
|
+
inputs.each do |vals|
|
38
|
+
test_failed = false
|
39
|
+
post_build_operations = Array(vals.pop)
|
40
|
+
target_load_test_required = false
|
41
|
+
post_build_operations = post_build_operations.map do |op|
|
42
|
+
if op.to_s == 'default'
|
43
|
+
target_load_test_required = true
|
44
|
+
cmds = ['origen -v']
|
45
|
+
# For some reason this command doesn't work in Travis CI, don't know why and
|
46
|
+
# couldn't work out how to fix (looks like a Bundler-related issue)
|
47
|
+
cmds << 'origen lint --no-correct' unless ENV['TRAVIS']
|
48
|
+
cmds << 'bundle exec rake new_app_tests:load_target'
|
49
|
+
cmds << 'origen web compile --no-serve'
|
50
|
+
cmds
|
51
|
+
elsif op.to_s == 'load_target'
|
52
|
+
target_load_test_required = true
|
53
|
+
'rake new_app_tests:load_target'
|
54
|
+
else
|
55
|
+
op
|
56
|
+
end
|
57
|
+
end.flatten
|
58
|
+
|
59
|
+
str = vals.map { |i| i == :default ? "\n" : "#{i}\n" }.join('')
|
60
|
+
cmd = "#{prefix} origen app_gen:test"
|
61
|
+
cmd += ' --debugger' if options[:debugger]
|
62
|
+
cmd += ' --all_generators' if options[:all_generators]
|
63
|
+
passed = false
|
64
|
+
Bundler.with_clean_env do
|
65
|
+
passed = system "echo '#{str}' | #{cmd}"
|
66
|
+
end
|
67
|
+
|
68
|
+
if passed
|
69
|
+
# The app is successfully built, now see if it works...
|
70
|
+
unless post_build_operations.empty?
|
71
|
+
if target_load_test_required
|
72
|
+
FileUtils.cp "#{Origen.root!}/lib/tasks/new_app_tests.rake", 'tmp/lib/tasks'
|
73
|
+
end
|
74
|
+
|
75
|
+
operation_failed = false
|
76
|
+
Bundler.with_clean_env do
|
77
|
+
Dir.chdir "#{Origen.root}/tmp" do
|
78
|
+
post_build_operations.each_with_index do |op, i|
|
79
|
+
if i == 0 && !Origen.site_config.gem_manage_bundler
|
80
|
+
system('bundle')
|
81
|
+
end
|
82
|
+
Origen.log.info "Running command: #{op}"
|
83
|
+
if system("#{prefix}#{op}")
|
84
|
+
Origen.log.success "Command passed: #{op}"
|
85
|
+
else
|
86
|
+
Origen.log.error "Command failed: #{op}"
|
87
|
+
operation_failed = true
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
if operation_failed
|
94
|
+
if options[:regression]
|
95
|
+
overall_fail = true
|
96
|
+
else
|
97
|
+
Origen.app.stats.report_fail
|
98
|
+
exit 1
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
else
|
103
|
+
Origen.log.error "The generator failed to build!"
|
104
|
+
if options[:regression]
|
105
|
+
overall_fail = true
|
106
|
+
else
|
107
|
+
Origen.app.stats.report_fail
|
108
|
+
exit 1
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
if options[:regression] && overall_fail
|
114
|
+
Origen.app.stats.report_fail
|
115
|
+
exit 1
|
116
|
+
else
|
117
|
+
Origen.app.stats.report_pass
|
118
|
+
exit 0
|
119
|
+
end
|
120
|
+
|
121
|
+
else
|
122
|
+
|
123
|
+
# Launch the generator in a standalone shell,
|
124
|
+
# this is to emulate how it will run in real life and cause it to fail if there are
|
125
|
+
# any dependencies on running within an Origen app environment
|
126
|
+
boot = "#{Origen.root!}/bin/boot.rb"
|
127
|
+
origen_lib = "#{Origen.top}/lib"
|
128
|
+
app_gen_lib = "#{Origen.root!}/lib"
|
129
|
+
app_lib = "#{Origen.root}/lib"
|
130
|
+
load_generators = "#{Origen.root}/config/load_generators.rb"
|
131
|
+
cmd = "#{boot} #{origen_lib} #{app_gen_lib} #{app_lib} #{load_generators}"
|
132
|
+
cmd = "#{cmd} true" if options[:all_generators] || Origen.app.name == :origen_app_generators
|
133
|
+
cmd = "ruby #{cmd}" if Origen.os.windows?
|
134
|
+
cmd = "bundle exec #{cmd}" unless Origen.site_config.gem_manage_bundler
|
135
|
+
# puts cmd
|
136
|
+
passed = false
|
137
|
+
Bundler.with_clean_env do
|
138
|
+
passed = system cmd
|
139
|
+
end
|
140
|
+
exit passed ? 0 : 1
|
141
|
+
end
|
142
|
+
|
143
|
+
when "app_gen:new"
|
144
|
+
options = {}
|
145
|
+
|
146
|
+
opt_parser = OptionParser.new do |opts|
|
147
|
+
opts.banner = <<-END
|
148
|
+
Create a new application generator.
|
149
|
+
|
150
|
+
Usage: origen app_gen:new [options]
|
151
|
+
END
|
152
|
+
opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
|
153
|
+
opts.separator ''
|
154
|
+
opts.on('-h', '--help', 'Show this message') { puts opts; exit }
|
155
|
+
end
|
156
|
+
|
157
|
+
opt_parser.orig_parse! ARGV
|
158
|
+
|
159
|
+
OrigenAppGenerators::New.start []
|
160
|
+
exit 0
|
161
|
+
|
162
|
+
# Always leave an else clause to allow control to fall back through to the Origen command handler.
|
163
|
+
# You probably want to also add the command details to the help shown via 'origen -h',
|
164
|
+
# you can do this bb adding the required text to @plugin_commands before handing control back to
|
165
|
+
# Origen.
|
166
|
+
else
|
167
|
+
@plugin_commands << <<-EOT
|
168
|
+
app_gen:test Test run the 'origen new' command operation using your latest generators
|
169
|
+
app_gen:new Create a new application or plugin generator
|
170
|
+
EOT
|
171
|
+
|
172
|
+
end
|
@@ -0,0 +1,213 @@
|
|
1
|
+
<a class="anchor release_tag" name="v1_2_0"></a>
|
2
|
+
<h1><a href="#v1_2_0">Tag: v1.2.0</a></h1>
|
3
|
+
|
4
|
+
##### Branch: 'master'
|
5
|
+
|
6
|
+
##### by Stephen McGinty on 20-Jul-2018 10:27AM
|
7
|
+
|
8
|
+
|
9
|
+
* Added a fall back way of working out the latest Origen version if the default way
|
10
|
+
of fetching it from rubygems.org fails (e.g. due to https connection issues in
|
11
|
+
runtime environment).
|
12
|
+
|
13
|
+
* Removed 'https://rubygems.org' as a Gemfile source when the app/plugin type is internal
|
14
|
+
and Origen.site\_config.gem\_server has been configured. Origen.site\_config.gem\_server can
|
15
|
+
be set to an array of sources, so site configurations can put it back in again if they want it.
|
16
|
+
|
17
|
+
* Disabled lint checks in the regression command, couldn't work out why it is failing in
|
18
|
+
CI/Travis, though it still works and is enabled when the regression command
|
19
|
+
(origen app\_gen:test -r) is run locally.
|
20
|
+
|
21
|
+
<a class="anchor release_tag" name="v1_1_4"></a>
|
22
|
+
<h1><a href="#v1_1_4">Tag: v1.1.4</a></h1>
|
23
|
+
|
24
|
+
##### Branch: 'master'
|
25
|
+
|
26
|
+
##### by David Welguisz on 07-Dec-2017 10:23AM
|
27
|
+
|
28
|
+
|
29
|
+
#### Bug Fix
|
30
|
+
* Gemfile.lock was bad. Had windows specific gems. This one is clean.
|
31
|
+
|
32
|
+
<a class="anchor release_tag" name="v1_1_3"></a>
|
33
|
+
<h1><a href="#v1_1_3">Tag: v1.1.3</a></h1>
|
34
|
+
|
35
|
+
##### Branch: 'master'
|
36
|
+
|
37
|
+
##### by David Welguisz on 17-Oct-2017 11:33AM
|
38
|
+
|
39
|
+
|
40
|
+
#### Bug Fix
|
41
|
+
* Previous release had it that copying directories could only happen if they had the same destination and source name. Now source and destination directory can be different.
|
42
|
+
|
43
|
+
<a class="anchor release_tag" name="v1_1_2"></a>
|
44
|
+
<h1><a href="#v1_1_2">Tag: v1.1.2</a></h1>
|
45
|
+
|
46
|
+
##### Branch: 'master'
|
47
|
+
|
48
|
+
##### by David Welguisz on 16-Oct-2017 12:57PM
|
49
|
+
|
50
|
+
|
51
|
+
#### Updates
|
52
|
+
* Added the ability to recursively copy a directory in the app generator
|
53
|
+
* Added examples in the comment section of build\_filelist
|
54
|
+
|
55
|
+
<a class="anchor release_tag" name="v1_1_1"></a>
|
56
|
+
<h1><a href="#v1_1_1">Tag: v1.1.1</a></h1>
|
57
|
+
|
58
|
+
##### Branch: 'master'
|
59
|
+
|
60
|
+
##### by David Welguisz on 06-Oct-2017 13:05PM
|
61
|
+
|
62
|
+
|
63
|
+
#### Updates
|
64
|
+
* Added the ability to recursively copy a directory in the app generator
|
65
|
+
* Added examples in the comment section of build\_filelist
|
66
|
+
|
67
|
+
<a class="anchor release_tag" name="v1_1_0"></a>
|
68
|
+
<h1><a href="#v1_1_0">Tag: v1.1.0</a></h1>
|
69
|
+
|
70
|
+
##### Branch: 'master'
|
71
|
+
|
72
|
+
##### by Stephen McGinty on 29-Aug-2017 05:48AM
|
73
|
+
|
74
|
+
|
75
|
+
* Improvements to the custom app generators application template
|
76
|
+
* Improved the source path lookup for custom app generators, now includes
|
77
|
+
a base dir and should now add dirs for any additional sub-classing that
|
78
|
+
is added
|
79
|
+
* All directories will now include .keep files by default, though this can
|
80
|
+
be inhibited by setting nokeep: true within the directory definition in
|
81
|
+
the filelist
|
82
|
+
|
83
|
+
<a class="anchor release_tag" name="v1_0_1"></a>
|
84
|
+
<h1><a href="#v1_0_1">Tag: v1.0.1</a></h1>
|
85
|
+
|
86
|
+
##### Branch: 'master'
|
87
|
+
|
88
|
+
##### by Stephen McGinty on 18-Aug-2017 18:46PM
|
89
|
+
|
90
|
+
|
91
|
+
Some bug fixes after first trial in the wild, no changes to documented behavior
|
92
|
+
|
93
|
+
<a class="anchor release_tag" name="v1_0_0"></a>
|
94
|
+
<h1><a href="#v1_0_0">Tag: v1.0.0</a></h1>
|
95
|
+
|
96
|
+
##### Branch: 'master'
|
97
|
+
|
98
|
+
##### by Stephen McGinty on 17-Aug-2017 13:47PM
|
99
|
+
|
100
|
+
|
101
|
+
Added support for company customized application generators
|
102
|
+
|
103
|
+
<a class="anchor release_tag" name="v0_4_0"></a>
|
104
|
+
<h1><a href="#v0_4_0">Tag: v0.4.0</a></h1>
|
105
|
+
|
106
|
+
##### Branch: 'master'
|
107
|
+
|
108
|
+
##### by Stephen McGinty on 24-May-2017 17:31PM
|
109
|
+
|
110
|
+
|
111
|
+
Added origen\_updater to all new apps and fixed some bugs
|
112
|
+
|
113
|
+
<a class="anchor release_tag" name="v0_3_2"></a>
|
114
|
+
<h1><a href="#v0_3_2">Tag: v0.3.2</a></h1>
|
115
|
+
|
116
|
+
##### Branch: 'master'
|
117
|
+
|
118
|
+
##### by Stephen McGinty on 06-Jun-2016 21:32PM
|
119
|
+
|
120
|
+
|
121
|
+
Fix for \#1
|
122
|
+
|
123
|
+
<a class="anchor release_tag" name="v0_3_1"></a>
|
124
|
+
<h1><a href="#v0_3_1">Tag: v0.3.1</a></h1>
|
125
|
+
|
126
|
+
##### Branch: 'master'
|
127
|
+
|
128
|
+
##### by Stephen McGinty on 26-May-2016 05:48AM
|
129
|
+
|
130
|
+
|
131
|
+
Added .byebug\_history to generated .gitignore
|
132
|
+
|
133
|
+
<a class="anchor release_tag" name="v0_3_0"></a>
|
134
|
+
<h1><a href="#v0_3_0">Tag: v0.3.0</a></h1>
|
135
|
+
|
136
|
+
##### Branch: 'master'
|
137
|
+
|
138
|
+
##### by Stephen McGinty on 13-May-2016 00:15AM
|
139
|
+
|
140
|
+
|
141
|
+
Added an initial test module template
|
142
|
+
|
143
|
+
<a class="anchor release_tag" name="v0_2_3"></a>
|
144
|
+
<h1><a href="#v0_2_3">Tag: v0.2.3</a></h1>
|
145
|
+
|
146
|
+
##### Branch: 'master'
|
147
|
+
|
148
|
+
##### by Stephen McGinty on 25-Feb-2016 09:15AM
|
149
|
+
|
150
|
+
|
151
|
+
Added maillists
|
152
|
+
|
153
|
+
<a class="anchor release_tag" name="v0_2_2"></a>
|
154
|
+
<h1><a href="#v0_2_2">Tag: v0.2.2</a></h1>
|
155
|
+
|
156
|
+
##### Branch: 'master'
|
157
|
+
|
158
|
+
##### by Stephen McGinty on 22-Sep-2015 09:46AM
|
159
|
+
|
160
|
+
|
161
|
+
Added basic web pages templates to generated apps/plugins
|
162
|
+
|
163
|
+
<a class="anchor release_tag" name="v0_2_1"></a>
|
164
|
+
<h1><a href="#v0_2_1">Tag: v0.2.1</a></h1>
|
165
|
+
|
166
|
+
##### Branch: 'master'
|
167
|
+
|
168
|
+
##### by Stephen McGinty on 21-Sep-2015 10:34AM
|
169
|
+
|
170
|
+
|
171
|
+
Include template .files in the gem build
|
172
|
+
|
173
|
+
<a class="anchor release_tag" name="v0_2_0"></a>
|
174
|
+
<h1><a href="#v0_2_0">Tag: v0.2.0</a></h1>
|
175
|
+
|
176
|
+
##### Branch: 'master'
|
177
|
+
|
178
|
+
##### by Stephen McGinty on 21-Sep-2015 08:18AM
|
179
|
+
|
180
|
+
|
181
|
+
Initial release of stand alone test engineering app template
|
182
|
+
|
183
|
+
<a class="anchor release_tag" name="v0_1_0"></a>
|
184
|
+
<h1><a href="#v0_1_0">Tag: v0.1.0</a></h1>
|
185
|
+
|
186
|
+
##### Branch: 'master'
|
187
|
+
|
188
|
+
##### by Stephen McGinty on 10-Sep-2015 07:47AM
|
189
|
+
|
190
|
+
|
191
|
+
Initial working version of stand alone test engineering app generator
|
192
|
+
|
193
|
+
<a class="anchor release_tag" name="v0_0_3"></a>
|
194
|
+
<h1><a href="#v0_0_3">Tag: v0.0.3</a></h1>
|
195
|
+
|
196
|
+
##### Branch: 'master'
|
197
|
+
|
198
|
+
##### by r49409 on 24-Jun-2015 10:41AM
|
199
|
+
|
200
|
+
|
201
|
+
The generic application and plugin generators now build an app that can boot
|
202
|
+
|
203
|
+
<a class="anchor release_tag" name="v0_0_2"></a>
|
204
|
+
<h1><a href="#v0_0_2">Tag: v0.0.2</a></h1>
|
205
|
+
|
206
|
+
##### Branch: 'master'
|
207
|
+
|
208
|
+
##### by r49409 on 24-Jun-2015 08:06AM
|
209
|
+
|
210
|
+
|
211
|
+
Initial version that can run, the generated new app could have bugs however
|
212
|
+
|
213
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module OrigenAppGenerators
|
2
|
+
# The base generator class that should be used by all application generators
|
3
|
+
class Application < Base
|
4
|
+
# Any methods that are not protected will get invoked in the order they are
|
5
|
+
# defined when the generator is run
|
6
|
+
|
7
|
+
protected
|
8
|
+
|
9
|
+
def type
|
10
|
+
:application
|
11
|
+
end
|
12
|
+
|
13
|
+
# This is the default list of files that will get generated for a new application
|
14
|
+
# when you call the compile_filelist method.
|
15
|
+
# To customize this for a domain specific application generator you can either
|
16
|
+
# delete an entry:
|
17
|
+
#
|
18
|
+
# filelist.delete(:config_application)
|
19
|
+
# compile_filelist
|
20
|
+
#
|
21
|
+
# Or point it to a different template, the supplied path is relative to templates/app_generators
|
22
|
+
#
|
23
|
+
# filelist[:config_application][:source] = "dng_test_app/config/application.rb"
|
24
|
+
# compile_filelist
|
25
|
+
def filelist
|
26
|
+
fail '@name must be defined before calling filelist for the first time' unless @name
|
27
|
+
@filelist ||= {
|
28
|
+
config_application: { source: 'config/application.rb' },
|
29
|
+
config_version: { source: 'config/version.rb' },
|
30
|
+
config_boot: { source: 'config/boot.rb' },
|
31
|
+
config_commands: { source: 'config/commands.rb' },
|
32
|
+
config_dev: { source: 'config/maillist_dev.txt' },
|
33
|
+
config_prod: { source: 'config/maillist_prod.txt' },
|
34
|
+
doc_history: { source: 'doc/history' },
|
35
|
+
target_default: { source: 'target/default.rb' },
|
36
|
+
# target_default: { source: 'debug.rb', # Relative to the file being linked to
|
37
|
+
# dest: 'target/default.rb', # Relative to destination_root
|
38
|
+
# type: :symlink },
|
39
|
+
environment_dir: { dest: 'environment', type: :directory },
|
40
|
+
lib_module: { source: 'lib/module.rb',
|
41
|
+
dest: "lib/#{@name}.rb" },
|
42
|
+
lib_tasks: { source: 'lib/app.rake',
|
43
|
+
dest: "lib/tasks/#{@name}.rake" },
|
44
|
+
spec_helper: { source: 'spec/spec_helper.rb' },
|
45
|
+
web_index: { source: 'templates/web/index.md.erb' },
|
46
|
+
web_basic_layout: { source: 'templates/web/layouts/_basic.html.erb' },
|
47
|
+
web_navbar: { source: 'templates/web/partials/_navbar.html.erb' },
|
48
|
+
web_release_notes: { source: 'templates/web/release_notes.md.erb' },
|
49
|
+
rakefile: { source: 'Rakefile' },
|
50
|
+
gemfile: { source: 'Gemfile' },
|
51
|
+
gitignore: { source: '.gitignore' },
|
52
|
+
irbrc: { source: '.irbrc' },
|
53
|
+
rspec: { source: '.rspec' },
|
54
|
+
# This sets the initial mode of the new workspace to 'debug'
|
55
|
+
session: { source: 'origen_core_session',
|
56
|
+
dest: '.session/origen_core',
|
57
|
+
copy: true
|
58
|
+
}
|
59
|
+
}
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|