origen 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ctags +0 -0
- data/bin/origen +165 -1
- data/bin/rgen +2 -0
- data/config/application.rb +141 -0
- data/config/commands.rb +72 -0
- data/config/development.rb +7 -0
- data/config/environment.rb +0 -0
- data/config/rgen.policy +7 -0
- data/config/rubocop/easy.yml +620 -0
- data/config/rubocop/easy_disabled.yml +271 -0
- data/config/rubocop/easy_enabled.yml +731 -0
- data/config/rubocop/strict.yml +620 -0
- data/config/rubocop/strict_disabled.yml +247 -0
- data/config/rubocop/strict_enabled.yml +755 -0
- data/config/users.rb +20 -0
- data/config/version.rb +1 -1
- data/helpers/url.rb +68 -0
- data/lib/c99/doc_interface.rb +56 -0
- data/lib/c99/j750_interface.rb +85 -0
- data/lib/c99/nvm.rb +89 -0
- data/lib/c99/target/mock2.rb +1 -0
- data/lib/c99/target/subdir/mock3.rb +1 -0
- data/lib/option_parser/optparse.rb +12 -0
- data/lib/origen/acronyms.rb +60 -0
- data/lib/origen/application/command_dispatcher.rb +12 -0
- data/lib/origen/application/configuration.rb +206 -0
- data/lib/origen/application/configuration_manager.rb +78 -0
- data/lib/origen/application/deployer.rb +367 -0
- data/lib/origen/application/environment.rb +186 -0
- data/lib/origen/application/lsf.rb +145 -0
- data/lib/origen/application/lsf_manager.rb +657 -0
- data/lib/origen/application/plugins_manager.rb +280 -0
- data/lib/origen/application/release.rb +359 -0
- data/lib/origen/application/runner.rb +246 -0
- data/lib/origen/application/statistics.rb +191 -0
- data/lib/origen/application/target.rb +374 -0
- data/lib/origen/application/version_tracker.rb +59 -0
- data/lib/origen/application/workspace_manager.rb +151 -0
- data/lib/origen/application.rb +746 -0
- data/lib/origen/bugs/bug.rb +36 -0
- data/lib/origen/bugs.rb +45 -0
- data/lib/origen/callbacks.rb +35 -0
- data/lib/origen/chip_mode.rb +118 -0
- data/lib/origen/chip_package.rb +461 -0
- data/lib/origen/client.rb +87 -0
- data/lib/origen/code_generators/actions.rb +258 -0
- data/lib/origen/code_generators/base.rb +57 -0
- data/lib/origen/code_generators/bundler.rb +17 -0
- data/lib/origen/code_generators/gem_setup.rb +49 -0
- data/lib/origen/code_generators/rake.rb +13 -0
- data/lib/origen/code_generators/rspec.rb +12 -0
- data/lib/origen/code_generators/semver.rb +39 -0
- data/lib/origen/code_generators/timever.rb +37 -0
- data/lib/origen/code_generators.rb +111 -0
- data/lib/origen/commands/add.rb +12 -0
- data/lib/origen/commands/compile.rb +62 -0
- data/lib/origen/commands/ctags.rb +9 -0
- data/lib/origen/commands/dispatch.rb +22 -0
- data/lib/origen/commands/environment.rb +11 -0
- data/lib/origen/commands/fetch.rb +63 -0
- data/lib/origen/commands/generate.rb +130 -0
- data/lib/origen/commands/interactive.rb +73 -0
- data/lib/origen/commands/lint.rb +82 -0
- data/lib/origen/commands/lsf.rb +93 -0
- data/lib/origen/commands/merge.rb +55 -0
- data/lib/origen/commands/modifications.rb +12 -0
- data/lib/origen/commands/new.rb +113 -0
- data/lib/origen/commands/plugin.rb +105 -0
- data/lib/origen/commands/program.rb +70 -0
- data/lib/origen/commands/rc.rb +442 -0
- data/lib/origen/commands/save.rb +56 -0
- data/lib/origen/commands/target.rb +27 -0
- data/lib/origen/commands/time.rb +127 -0
- data/lib/origen/commands/version.rb +17 -0
- data/lib/origen/commands/web.rb +221 -0
- data/lib/origen/commands.rb +272 -0
- data/lib/origen/commands_global.rb +76 -0
- data/lib/origen/controller.rb +94 -0
- data/lib/origen/core_ext/array.rb +23 -0
- data/lib/origen/core_ext/bignum.rb +36 -0
- data/lib/origen/core_ext/enumerable.rb +76 -0
- data/lib/origen/core_ext/fixnum.rb +46 -0
- data/lib/origen/core_ext/hash.rb +52 -0
- data/lib/origen/core_ext/module.rb +14 -0
- data/lib/origen/core_ext/numeric.rb +126 -0
- data/lib/origen/core_ext/object.rb +13 -0
- data/lib/origen/core_ext/range.rb +7 -0
- data/lib/origen/core_ext/string.rb +124 -0
- data/lib/origen/core_ext.rb +10 -0
- data/lib/origen/database/key_value_store.rb +111 -0
- data/lib/origen/database/key_value_stores.rb +108 -0
- data/lib/origen/database.rb +6 -0
- data/lib/origen/encodings.rb +102 -0
- data/lib/origen/features/feature.rb +22 -0
- data/lib/origen/features.rb +104 -0
- data/lib/origen/file_handler.rb +429 -0
- data/lib/origen/generator/comparator.rb +56 -0
- data/lib/origen/generator/compiler.rb +277 -0
- data/lib/origen/generator/flow.rb +49 -0
- data/lib/origen/generator/job.rb +131 -0
- data/lib/origen/generator/pattern.rb +356 -0
- data/lib/origen/generator/pattern_finder.rb +155 -0
- data/lib/origen/generator/pattern_iterator.rb +55 -0
- data/lib/origen/generator/renderer.rb +113 -0
- data/lib/origen/generator/resources.rb +40 -0
- data/lib/origen/generator/stage.rb +89 -0
- data/lib/origen/generator.rb +85 -0
- data/lib/origen/global_methods.rb +205 -0
- data/lib/origen/import_manager.rb +596 -0
- data/lib/origen/location/base.rb +116 -0
- data/lib/origen/location/map.rb +83 -0
- data/lib/origen/location.rb +6 -0
- data/lib/origen/log.rb +217 -0
- data/lib/origen/logger_methods.rb +56 -0
- data/lib/origen/mode.rb +61 -0
- data/lib/origen/model.rb +267 -0
- data/lib/origen/model_initializer.rb +45 -0
- data/lib/origen/nvm/block_array.rb +72 -0
- data/lib/origen/nvm.rb +6 -0
- data/lib/origen/parameters/live.rb +22 -0
- data/lib/origen/parameters/missing.rb +28 -0
- data/lib/origen/parameters/set.rb +144 -0
- data/lib/origen/parameters.rb +107 -0
- data/lib/origen/pdm.rb +218 -0
- data/lib/origen/pins/function_proxy.rb +36 -0
- data/lib/origen/pins/ground_pin.rb +6 -0
- data/lib/origen/pins/pin.rb +860 -0
- data/lib/origen/pins/pin_bank.rb +349 -0
- data/lib/origen/pins/pin_clock.rb +124 -0
- data/lib/origen/pins/pin_collection.rb +492 -0
- data/lib/origen/pins/pin_common.rb +206 -0
- data/lib/origen/pins/port.rb +268 -0
- data/lib/origen/pins/power_pin.rb +30 -0
- data/lib/origen/pins.rb +696 -0
- data/lib/origen/registers/bit.rb +562 -0
- data/lib/origen/registers/bit_collection.rb +787 -0
- data/lib/origen/registers/container.rb +288 -0
- data/lib/origen/registers/domain.rb +16 -0
- data/lib/origen/registers/reg.rb +1406 -0
- data/lib/origen/registers/reg_collection.rb +24 -0
- data/lib/origen/registers.rb +652 -0
- data/lib/origen/regression_manager.rb +251 -0
- data/lib/origen/remote_manager.rb +340 -0
- data/lib/origen/revision_control/base.rb +257 -0
- data/lib/origen/revision_control/design_sync.rb +276 -0
- data/lib/origen/revision_control/git.rb +243 -0
- data/lib/origen/revision_control/subversion.rb +6 -0
- data/lib/origen/revision_control.rb +44 -0
- data/lib/origen/ruby_version_check.rb +131 -0
- data/lib/origen/site_config.rb +61 -0
- data/lib/origen/specs/checkers.rb +103 -0
- data/lib/origen/specs/creation_info.rb +17 -0
- data/lib/origen/specs/doc_resource.rb +91 -0
- data/lib/origen/specs/exhibit.rb +17 -0
- data/lib/origen/specs/mode_select.rb +16 -0
- data/lib/origen/specs/note.rb +17 -0
- data/lib/origen/specs/override.rb +21 -0
- data/lib/origen/specs/power_supply.rb +13 -0
- data/lib/origen/specs/spec.rb +226 -0
- data/lib/origen/specs/version_history.rb +14 -0
- data/lib/origen/specs.rb +552 -0
- data/lib/origen/sub_blocks.rb +298 -0
- data/lib/origen/tester/api.rb +277 -0
- data/lib/origen/tester/bdm/bdm.rb +25 -0
- data/lib/origen/tester/command_based_tester.rb +46 -0
- data/lib/origen/tester/doc/doc.rb +226 -0
- data/lib/origen/tester/doc/generator/flow.rb +71 -0
- data/lib/origen/tester/doc/generator/flow_line.rb +203 -0
- data/lib/origen/tester/doc/generator/test.rb +68 -0
- data/lib/origen/tester/doc/generator/test_group.rb +66 -0
- data/lib/origen/tester/doc/generator/tests.rb +47 -0
- data/lib/origen/tester/doc/generator.rb +126 -0
- data/lib/origen/tester/doc/model.rb +162 -0
- data/lib/origen/tester/generator/flow_control_api.rb +606 -0
- data/lib/origen/tester/generator/identity_map.rb +25 -0
- data/lib/origen/tester/generator/placeholder.rb +13 -0
- data/lib/origen/tester/generator/test_numberer.rb +25 -0
- data/lib/origen/tester/generator.rb +271 -0
- data/lib/origen/tester/interface.rb +154 -0
- data/lib/origen/tester/j750/files.rb +45 -0
- data/lib/origen/tester/j750/generator/flow.rb +123 -0
- data/lib/origen/tester/j750/generator/flow_line.rb +288 -0
- data/lib/origen/tester/j750/generator/patgroup.rb +111 -0
- data/lib/origen/tester/j750/generator/patgroups.rb +41 -0
- data/lib/origen/tester/j750/generator/patset.rb +111 -0
- data/lib/origen/tester/j750/generator/patsets.rb +41 -0
- data/lib/origen/tester/j750/generator/templates/flow.txt.erb +9 -0
- data/lib/origen/tester/j750/generator/templates/instances.txt.erb +16 -0
- data/lib/origen/tester/j750/generator/templates/patgroups.txt.erb +8 -0
- data/lib/origen/tester/j750/generator/templates/patsets.txt.erb +10 -0
- data/lib/origen/tester/j750/generator/test_instance.rb +846 -0
- data/lib/origen/tester/j750/generator/test_instance_group.rb +60 -0
- data/lib/origen/tester/j750/generator/test_instances.rb +182 -0
- data/lib/origen/tester/j750/generator.rb +203 -0
- data/lib/origen/tester/j750/j750.rb +845 -0
- data/lib/origen/tester/j750/j750_hpt.rb +35 -0
- data/lib/origen/tester/j750/parser/ac_spec.rb +11 -0
- data/lib/origen/tester/j750/parser/ac_specs.rb +0 -0
- data/lib/origen/tester/j750/parser/dc_spec.rb +36 -0
- data/lib/origen/tester/j750/parser/dc_specs.rb +50 -0
- data/lib/origen/tester/j750/parser/descriptions.rb +340 -0
- data/lib/origen/tester/j750/parser/flow.rb +111 -0
- data/lib/origen/tester/j750/parser/flow_line.rb +207 -0
- data/lib/origen/tester/j750/parser/flows.rb +23 -0
- data/lib/origen/tester/j750/parser/pattern_set.rb +94 -0
- data/lib/origen/tester/j750/parser/pattern_sets.rb +33 -0
- data/lib/origen/tester/j750/parser/test_instance.rb +322 -0
- data/lib/origen/tester/j750/parser/test_instances.rb +26 -0
- data/lib/origen/tester/j750/parser/timeset.rb +15 -0
- data/lib/origen/tester/j750/parser/timesets.rb +0 -0
- data/lib/origen/tester/j750/parser.rb +104 -0
- data/lib/origen/tester/jlink/jlink.rb +33 -0
- data/lib/origen/tester/parser/description_lookup.rb +64 -0
- data/lib/origen/tester/parser/searchable_array.rb +32 -0
- data/lib/origen/tester/parser/searchable_hash.rb +32 -0
- data/lib/origen/tester/parser.rb +24 -0
- data/lib/origen/tester/time.rb +338 -0
- data/lib/origen/tester/timing.rb +253 -0
- data/lib/origen/tester/ultraflex/files.rb +45 -0
- data/lib/origen/tester/ultraflex/generator/flow.rb +119 -0
- data/lib/origen/tester/ultraflex/generator/flow_line.rb +269 -0
- data/lib/origen/tester/ultraflex/generator/patgroup.rb +111 -0
- data/lib/origen/tester/ultraflex/generator/patgroups.rb +41 -0
- data/lib/origen/tester/ultraflex/generator/patset.rb +111 -0
- data/lib/origen/tester/ultraflex/generator/patsets.rb +41 -0
- data/lib/origen/tester/ultraflex/generator/templates/flow.txt.erb +9 -0
- data/lib/origen/tester/ultraflex/generator/templates/instances.txt.erb +16 -0
- data/lib/origen/tester/ultraflex/generator/templates/patgroups.txt.erb +8 -0
- data/lib/origen/tester/ultraflex/generator/templates/patsets.txt.erb +10 -0
- data/lib/origen/tester/ultraflex/generator/test_instance.rb +622 -0
- data/lib/origen/tester/ultraflex/generator/test_instance_group.rb +60 -0
- data/lib/origen/tester/ultraflex/generator/test_instances.rb +174 -0
- data/lib/origen/tester/ultraflex/generator.rb +200 -0
- data/lib/origen/tester/ultraflex/parser/ac_spec.rb +11 -0
- data/lib/origen/tester/ultraflex/parser/ac_specs.rb +0 -0
- data/lib/origen/tester/ultraflex/parser/dc_spec.rb +36 -0
- data/lib/origen/tester/ultraflex/parser/dc_specs.rb +50 -0
- data/lib/origen/tester/ultraflex/parser/descriptions.rb +342 -0
- data/lib/origen/tester/ultraflex/parser/flow.rb +111 -0
- data/lib/origen/tester/ultraflex/parser/flow_line.rb +207 -0
- data/lib/origen/tester/ultraflex/parser/flows.rb +23 -0
- data/lib/origen/tester/ultraflex/parser/pattern_set.rb +94 -0
- data/lib/origen/tester/ultraflex/parser/pattern_sets.rb +33 -0
- data/lib/origen/tester/ultraflex/parser/test_instance.rb +262 -0
- data/lib/origen/tester/ultraflex/parser/test_instances.rb +26 -0
- data/lib/origen/tester/ultraflex/parser/timeset.rb +15 -0
- data/lib/origen/tester/ultraflex/parser/timesets.rb +0 -0
- data/lib/origen/tester/ultraflex/parser.rb +104 -0
- data/lib/origen/tester/ultraflex/ultraflex.rb +759 -0
- data/lib/origen/tester/v93k/generator/flow.rb +63 -0
- data/lib/origen/tester/v93k/generator/flow_node/print.rb +10 -0
- data/lib/origen/tester/v93k/generator/flow_node.rb +17 -0
- data/lib/origen/tester/v93k/generator/pattern.rb +16 -0
- data/lib/origen/tester/v93k/generator/pattern_master.rb +54 -0
- data/lib/origen/tester/v93k/generator/templates/_test_method.txt.erb +6 -0
- data/lib/origen/tester/v93k/generator/templates/_test_suite.txt.erb +11 -0
- data/lib/origen/tester/v93k/generator/templates/template.flow.erb +121 -0
- data/lib/origen/tester/v93k/generator/templates/template.pmfl.erb +9 -0
- data/lib/origen/tester/v93k/generator/test_function.rb +103 -0
- data/lib/origen/tester/v93k/generator/test_functions.rb +79 -0
- data/lib/origen/tester/v93k/generator/test_method.rb +46 -0
- data/lib/origen/tester/v93k/generator/test_methods.rb +75 -0
- data/lib/origen/tester/v93k/generator/test_suite.rb +54 -0
- data/lib/origen/tester/v93k/generator/test_suites.rb +65 -0
- data/lib/origen/tester/v93k/generator.rb +80 -0
- data/lib/origen/tester/v93k/v93k.rb +420 -0
- data/lib/origen/tester/vector.rb +86 -0
- data/lib/origen/tester/vector_generator.rb +633 -0
- data/lib/origen/tester/vector_pipeline.rb +150 -0
- data/lib/origen/tester.rb +56 -0
- data/lib/origen/top_level.rb +134 -0
- data/lib/origen/users/ldap.rb +65 -0
- data/lib/origen/users/user.rb +149 -0
- data/lib/origen/users.rb +30 -0
- data/lib/origen/utility/block_args.rb +93 -0
- data/lib/origen/utility/csv_data.rb +110 -0
- data/lib/origen/utility/design_sync.rb +494 -0
- data/lib/origen/utility/diff.rb +158 -0
- data/lib/origen/utility/input_capture.rb +121 -0
- data/lib/origen/utility/mailer.rb +143 -0
- data/lib/origen/utility/s_record.rb +205 -0
- data/lib/origen/utility/time_and_date.rb +30 -0
- data/lib/origen/utility.rb +12 -0
- data/lib/origen/version_checker.rb +117 -0
- data/lib/origen/version_string.rb +356 -0
- data/lib/origen.rb +648 -0
- data/lib/tasks/gem.rake +27 -22
- data/origen_site_config.yml +36 -0
- data/source_setup +17 -0
- data/spec/format/rgen_formatter.rb +14 -0
- data/templates/api_doc/README.txt.erb +24 -0
- data/templates/code_generators/gemfile_app.rb +4 -0
- data/templates/code_generators/gemfile_plugin.rb +6 -0
- data/templates/code_generators/gemspec.rb +33 -0
- data/templates/code_generators/rakefile.rb +10 -0
- data/templates/code_generators/spec_helper.rb +49 -0
- data/templates/code_generators/version.rb +8 -0
- data/templates/code_generators/version_time.rb +3 -0
- data/templates/git/gitignore.erb +33 -0
- data/templates/j750/_vt_flow.txt.erb +8 -0
- data/templates/j750/_vt_instances.txt.erb +4 -0
- data/templates/j750/program_sheet.txt.erb +9 -0
- data/templates/nanoc/Rules +74 -0
- data/templates/nanoc/config.yaml +77 -0
- data/templates/nanoc/content/favicon.ico +0 -0
- data/templates/nanoc/layouts/bootstrap.html.erb +63 -0
- data/templates/nanoc/layouts/bootstrap3.html.erb +71 -0
- data/templates/nanoc/layouts/freescale.html.erb +79 -0
- data/templates/nanoc/lib/bootstrap_filter.rb +49 -0
- data/templates/nanoc/lib/codeblocks_filter.rb +41 -0
- data/templates/nanoc/lib/default.rb +2 -0
- data/templates/nanoc/lib/gzip_filter.rb +16 -0
- data/templates/nanoc/lib/haml_code_filter.rb +41 -0
- data/templates/nanoc/lib/helpers.rb +1 -0
- data/templates/nanoc/lib/search_filter.rb +62 -0
- data/templates/nanoc_dynamic/content/search.js.erb +92 -0
- data/templates/shared/web/_logo.html +10 -0
- data/templates/test/_inline_sub.txt.erb +2 -0
- data/templates/test/environment.txt.erb +1 -0
- data/templates/test/inline.txt.erb +11 -0
- data/templates/test/inspections.txt.erb +19 -0
- data/templates/test/set1/_sub1.txt.erb +12 -0
- data/templates/test/set1/_sub4.txt.erb +1 -0
- data/templates/test/set1/_sub5.txt.erb +1 -0
- data/templates/test/set1/main.txt.erb +53 -0
- data/templates/test/set1/sub_dir/_sub2.txt.erb +20 -0
- data/templates/test/set1/sub_dir/_sub3.txt.erb +12 -0
- data/templates/test/set1/sub_dir/main2.txt.erb +4 -0
- data/templates/test/set2/template_with_no_erb_1.txt +9 -0
- data/templates/test/set2/template_with_no_erb_2.txt +9 -0
- data/templates/test/set3/_layout.html.erb +4 -0
- data/templates/test/set3/content.html.erb +6 -0
- data/templates/time/filter.rb.erb +15 -0
- data/templates/time/rules.rb.erb +45 -0
- metadata +639 -5
@@ -0,0 +1,27 @@
|
|
1
|
+
module Origen
|
2
|
+
# === Task: $ origen -t [target]
|
3
|
+
# Sets or displays the default target.<br>
|
4
|
+
# The default target is the one that will be
|
5
|
+
# be used anytime you run an origen task without supplying a target via the -t option.
|
6
|
+
# ==== Supplying a target name
|
7
|
+
# The target argument can be any of the following:
|
8
|
+
# * A path to a file in the target directory, e.g. origen -t target/p2_production.rb
|
9
|
+
# * The name of a target, e.g. origen -t p2_production.rb
|
10
|
+
# * A fragment of a name. If this is enough to uniquely identify a target in from the
|
11
|
+
# the target directory then this will be used, otherwise the list of possible matches
|
12
|
+
# will be displayed. e.g. origen -t p2
|
13
|
+
# * A MOO number. The mapping of the MOO number to a target must be defined in
|
14
|
+
# the production_targets attribute of Project. e.g. origen -t 1m79x
|
15
|
+
#
|
16
|
+
Origen.load_application
|
17
|
+
|
18
|
+
target = ARGV.shift
|
19
|
+
if target
|
20
|
+
Origen.app.target.default = target
|
21
|
+
puts "Target now set to: #{Origen.app.target.file.basename}"
|
22
|
+
else
|
23
|
+
Origen.app.target.describe
|
24
|
+
end
|
25
|
+
|
26
|
+
exit 0
|
27
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
options = {}
|
5
|
+
|
6
|
+
ARGV << '-h' if ARGV.empty?
|
7
|
+
|
8
|
+
# App options are options that the application can supply to extend this command
|
9
|
+
app_options = @application_options || []
|
10
|
+
opt_parser = OptionParser.new do |opts|
|
11
|
+
opts.banner = <<-STOP
|
12
|
+
Origen test time profiling and forecasting tools.
|
13
|
+
|
14
|
+
Usage: origen time CMD [args] [options]
|
15
|
+
CMD - The command to run, the following commands exist:
|
16
|
+
|
17
|
+
import FILE - Import a reference test time from the given detailed execution time file
|
18
|
+
|
19
|
+
forecast - Forecast the test time for the current target for the given flow and library
|
20
|
+
|
21
|
+
new rules - Create a new rules file (use this to specify how tests should scale between targets)
|
22
|
+
new filter - Create a new filter (use this to filter imports, by default all tests are imported)
|
23
|
+
|
24
|
+
STOP
|
25
|
+
opts.on('-n', '--name FILE', String, 'Use the given named reference instead of the default') { |o| options[:ref_name] = o }
|
26
|
+
opts.on('-s', '--summary', 'Output flow summary results only (instead of details for each test)') { options[:summary] = true }
|
27
|
+
opts.on('-t', '--target NAME1,NAME2,NAME3', Array, 'Override the default target, NAME can be a full path or a fragment of a target file name') { |t| options[:target] = t }
|
28
|
+
opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
|
29
|
+
opts.on('-m', '--mode MODE', Origen::Mode::MODES, 'Force the Origen operating mode:', ' ' + Origen::Mode::MODES.join(', ')) { |_m| }
|
30
|
+
opts.on('-f', '--file FILE', String, 'Override the default log file') { |o| options[:log_file] = o }
|
31
|
+
app_options.each do |app_option|
|
32
|
+
opts.on(*app_option) {}
|
33
|
+
end
|
34
|
+
opts.separator ''
|
35
|
+
opts.on('-h', '--help', 'Show this message') { puts opts; exit }
|
36
|
+
end
|
37
|
+
opt_parser.parse! ARGV
|
38
|
+
|
39
|
+
cmd = ARGV[0] || 'missing'
|
40
|
+
case cmd.downcase
|
41
|
+
when 'forecast'
|
42
|
+
Origen.target.loop(options) do |options|
|
43
|
+
Origen.app.runner.launch(action: :forecast_test_time,
|
44
|
+
summary: options[:summary],
|
45
|
+
ref_name: options[:ref_name])
|
46
|
+
end
|
47
|
+
|
48
|
+
when 'import'
|
49
|
+
if !ARGV[1] || !File.exist?(ARGV[1])
|
50
|
+
puts 'A valid file to import must be supplied, e.g.'
|
51
|
+
puts ' origen time import exec_times/p2_sort1.txt'
|
52
|
+
exit 1
|
53
|
+
end
|
54
|
+
if options[:target] && [options[:target]].flatten.size > 1
|
55
|
+
puts "When importing it doesn't make sense to select multiple targets,"
|
56
|
+
puts 'select only the single target that matches the setup from which'
|
57
|
+
puts 'the detailed execution time has been generated!'
|
58
|
+
exit 1
|
59
|
+
end
|
60
|
+
Origen.target.loop(options) do |options|
|
61
|
+
# This step seems redundant, the flow should be imported at the
|
62
|
+
# same time as extracting the test times
|
63
|
+
Origen.app.runner.launch(action: :import_test_flow,
|
64
|
+
file: ARGV[1],
|
65
|
+
ref_name: options[:ref_name])
|
66
|
+
|
67
|
+
Origen.app.runner.launch(action: :import_test_time,
|
68
|
+
file: ARGV[1],
|
69
|
+
ref_name: options[:ref_name])
|
70
|
+
end
|
71
|
+
|
72
|
+
when 'new'
|
73
|
+
if ARGV[1] == 'rules'
|
74
|
+
Origen.app.runner.launch(action: :compile,
|
75
|
+
file: "#{Origen.top}/templates/time/rules.rb.erb",
|
76
|
+
output: "#{Origen.root}/config/test_time",
|
77
|
+
quiet: true,
|
78
|
+
check_for_changes: false
|
79
|
+
)
|
80
|
+
# Add this to the environment if not already present...
|
81
|
+
env = "#{Origen.root}/config/environment.rb"
|
82
|
+
unless File.readlines(env).any? { |l| l =~ /config\/test_time\/rules/ }
|
83
|
+
# The 'b' here invokes binary format and stops Ruby from substituting the \n for a
|
84
|
+
# windows carriage return when running on windows
|
85
|
+
File.open(env, 'ab') { |f| f.print "require \"\#{Origen.root}/config/test_time/rules\"\n" }
|
86
|
+
env = false
|
87
|
+
end
|
88
|
+
puts ''
|
89
|
+
puts 'New rules created at: config/test_time/rules.rb'
|
90
|
+
puts ''
|
91
|
+
unless env
|
92
|
+
puts 'This file has been added to your environment.rb'
|
93
|
+
puts ''
|
94
|
+
end
|
95
|
+
puts 'To check this in run:'
|
96
|
+
puts " dssc ci -new -keep -com \"Initial\" #{Origen.root}/config/test_time/rules.rb"
|
97
|
+
elsif ARGV[1] == 'filter'
|
98
|
+
Origen.app.runner.launch(action: :compile,
|
99
|
+
file: "#{Origen.top}/templates/time/filter.rb.erb",
|
100
|
+
output: "#{Origen.root}/config/test_time",
|
101
|
+
quiet: true,
|
102
|
+
check_for_changes: false
|
103
|
+
)
|
104
|
+
# Add this to the environment if not already present...
|
105
|
+
env = "#{Origen.root}/config/environment.rb"
|
106
|
+
unless File.readlines(env).any? { |l| l =~ /config\/test_time\/filter/ }
|
107
|
+
File.open(env, 'ab') { |f| f.print "require \"\#{Origen.root}/config/test_time/filter\"\n" }
|
108
|
+
env = false
|
109
|
+
end
|
110
|
+
puts ''
|
111
|
+
puts 'New filter created at: config/test_time/filter.rb'
|
112
|
+
puts ''
|
113
|
+
unless env
|
114
|
+
puts 'This file has been added to your environment.rb'
|
115
|
+
puts ''
|
116
|
+
end
|
117
|
+
puts 'To check this in run:'
|
118
|
+
puts " dssc ci -new -keep -com \"Initial\" #{Origen.root}/config/test_time/filter.rb"
|
119
|
+
|
120
|
+
else
|
121
|
+
puts 'A valid identifier for the kind of file to create must be supplied, e.g.'
|
122
|
+
puts ' origen time new rules'
|
123
|
+
exit 1
|
124
|
+
end
|
125
|
+
else
|
126
|
+
puts "Unknown command, see 'origen time -h' for a list of commands"
|
127
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
if Origen.app_loaded?
|
2
|
+
puts "Application: #{Origen.app.version}"
|
3
|
+
if Origen.config.required_origen_version && (Origen.config.required_origen_version != Origen.version)
|
4
|
+
puts " Origen: #{Origen.version} (App requires #{Origen.config.required_origen_version})"
|
5
|
+
elsif Origen.config.min_required_origen_version &&
|
6
|
+
Origen.version.less_than?(Origen.config.min_required_origen_version)
|
7
|
+
puts " Origen: #{Origen.version} (App requires >= #{Origen.config.min_required_origen_version})"
|
8
|
+
elsif Origen.config.max_required_origen_version &&
|
9
|
+
Origen.version.greater_than?(Origen.config.max_required_origen_version)
|
10
|
+
puts " Origen: #{Origen.version} (App requires <= #{Origen.config.max_required_origen_version})"
|
11
|
+
else
|
12
|
+
puts " Origen: #{Origen.version}"
|
13
|
+
end
|
14
|
+
else
|
15
|
+
puts " Origen: #{Origen.version}"
|
16
|
+
end
|
17
|
+
exit 0
|
@@ -0,0 +1,221 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
module Origen
|
5
|
+
options = {}
|
6
|
+
|
7
|
+
# App options are options that the application can supply to extend this command
|
8
|
+
app_options = @application_options || []
|
9
|
+
opt_parser = OptionParser.new do |opts|
|
10
|
+
opts.banner = <<-END
|
11
|
+
Usage: origen web CMD [options]
|
12
|
+
|
13
|
+
The following commands are available:
|
14
|
+
new Create a fresh web directory (this will delete any existing compiled files!).
|
15
|
+
A new directory will automatically be created if you don't have one when you run the compile
|
16
|
+
command, however if for some reason you want to start fresh you can run this command to do so.
|
17
|
+
|
18
|
+
serve Start a webserver from the current directory
|
19
|
+
|
20
|
+
compile [FILE] Compile all web templates and start a server to view them, optionally supply a
|
21
|
+
file argument to only update a single page e.g. 'origen web compile templates/web/index.md.erb'
|
22
|
+
Use the --remote option to copy the compiled files to a remote web server directory (the
|
23
|
+
location of which should be specified via Origen.config.web_directory). In this case when no
|
24
|
+
FILE argument is specified the entire site will be copied over to a fresh web server
|
25
|
+
directory and the live site will be switched over when complete.
|
26
|
+
When a FILE argument is present the specified file(s) will be compiled directly to the live
|
27
|
+
production site.
|
28
|
+
|
29
|
+
deploy [FILE] Same as compile with --remote except that the actual compilation step will be skipped - i.e.
|
30
|
+
use this in cases where you already have long-running templates pre-compiled.
|
31
|
+
The api generation step will also be skipped if the --api option is supplied.
|
32
|
+
|
33
|
+
archive ID Archive the current contents of your live website under the given ID. This is normally used
|
34
|
+
to archive the documents for a specific production release, so "origen web archive Rel20120112"
|
35
|
+
would be viewable at <your_domain>/Rel20120112.
|
36
|
+
|
37
|
+
The following options are available:
|
38
|
+
END
|
39
|
+
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 }
|
40
|
+
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 }
|
41
|
+
opts.on('-r', '--remote', 'Use in conjunction with the compile command to deploy files to a remote web server') { options[:remote] = true }
|
42
|
+
opts.on('-a', '--api', 'Generate API documentation after compiling') { options[:api] = true }
|
43
|
+
opts.on('--archive ID', String, 'Archive the documents after compiling or deploying remotely') { |id| options[:archive] = id }
|
44
|
+
opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
|
45
|
+
opts.on('-m', '--mode MODE', Origen::Mode::MODES, 'Force the Origen operating mode:', ' ' + Origen::Mode::MODES.join(', ')) { |_m| }
|
46
|
+
app_options.each do |app_option|
|
47
|
+
opts.on(*app_option) {}
|
48
|
+
end
|
49
|
+
opts.separator ''
|
50
|
+
opts.on('-h', '--help', 'Show this message') { puts opts; exit }
|
51
|
+
end
|
52
|
+
opt_parser.parse! ARGV
|
53
|
+
|
54
|
+
Origen.load_application
|
55
|
+
Origen.environment.temporary = options[:environment] if options[:environment]
|
56
|
+
Origen.target.temporary = options[:target] if options[:target]
|
57
|
+
|
58
|
+
def self._require_web_directory
|
59
|
+
unless Origen.config.web_directory
|
60
|
+
puts 'To run that command you must specify the location of your webserver, for example:'
|
61
|
+
puts ''
|
62
|
+
puts '# config/application.rb'
|
63
|
+
puts 'config.web_directory = "/proj/.web_origen/html/origen"'
|
64
|
+
exit 1
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def self._start_server
|
69
|
+
# Get the current host
|
70
|
+
host = `hostname`.strip.downcase
|
71
|
+
if Origen.running_on_windows?
|
72
|
+
domain = 'fsl.freescale.net'
|
73
|
+
else
|
74
|
+
domain = `dnsdomainname`.strip
|
75
|
+
end
|
76
|
+
# Get a free port
|
77
|
+
require 'socket'
|
78
|
+
port = 8000 # preferred port
|
79
|
+
begin
|
80
|
+
server = TCPServer.new('127.0.0.1', port)
|
81
|
+
rescue Errno::EADDRINUSE
|
82
|
+
# port = rand(65000 - 1024) + 1024
|
83
|
+
port += 1
|
84
|
+
retry
|
85
|
+
end
|
86
|
+
server.close
|
87
|
+
# Start the server
|
88
|
+
puts ''
|
89
|
+
puts "Point your browser to this address: http://#{host}#{domain.empty? ? '' : '.' + domain}:#{port}"
|
90
|
+
puts ''
|
91
|
+
puts 'To shut down the server use CTRL-C'
|
92
|
+
puts ''
|
93
|
+
system "ruby -run -e httpd . -p #{port}"
|
94
|
+
end
|
95
|
+
|
96
|
+
def self._build_web_dir
|
97
|
+
_deployer.create_web_server_dir
|
98
|
+
|
99
|
+
dir = Pathname.new(_deployer.web_server_dir).relative_path_from(Pathname.pwd)
|
100
|
+
|
101
|
+
puts "Web server directory created at: #{dir}"
|
102
|
+
puts ''
|
103
|
+
puts "Compile any files you want to test into the #{dir}/content directory, e.g.:"
|
104
|
+
puts " origen c templates/file.md.erb -o #{dir}/content"
|
105
|
+
puts ''
|
106
|
+
puts 'To turn them into web pages:'
|
107
|
+
puts " cd #{dir}"
|
108
|
+
if Origen.running_on_windows?
|
109
|
+
puts ' nanoc'
|
110
|
+
else
|
111
|
+
puts ' env LANG=en_US.UTF-8 nanoc'
|
112
|
+
end
|
113
|
+
puts ''
|
114
|
+
puts 'To start a web server for remote viewing:'
|
115
|
+
puts " cd #{dir}/output"
|
116
|
+
puts ' origen web serve'
|
117
|
+
end
|
118
|
+
|
119
|
+
def self._deployer
|
120
|
+
@_deployer ||= Origen.app.deployer
|
121
|
+
@_deployer.test = true
|
122
|
+
@_deployer
|
123
|
+
end
|
124
|
+
|
125
|
+
if ARGV[0]
|
126
|
+
case ARGV.shift
|
127
|
+
when 'serve'
|
128
|
+
_start_server
|
129
|
+
when 'new'
|
130
|
+
_build_web_dir
|
131
|
+
when 'compile'
|
132
|
+
Origen.app.load_target!
|
133
|
+
if options[:remote]
|
134
|
+
_require_web_directory
|
135
|
+
_deployer.require_remote_directories
|
136
|
+
# If the whole site has been requested that start from a clean slate
|
137
|
+
_build_web_dir if ARGV.empty?
|
138
|
+
else
|
139
|
+
Origen.set_development_mode
|
140
|
+
end
|
141
|
+
if ARGV.empty?
|
142
|
+
_build_web_dir
|
143
|
+
Dir.chdir Origen.root do
|
144
|
+
Origen.app.listeners_for(:before_web_compile).each do |listener|
|
145
|
+
listener.before_web_compile(options)
|
146
|
+
end
|
147
|
+
Origen.app.runner.launch action: :compile,
|
148
|
+
files: 'templates/web',
|
149
|
+
output: 'web/content'
|
150
|
+
Origen.app.listeners_for(:after_web_compile).each do |listener|
|
151
|
+
listener.after_web_compile(options)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
else
|
156
|
+
_build_web_dir unless File.exist?("#{Origen.root}/web")
|
157
|
+
Origen.app.listeners_for(:before_web_compile).each do |listener|
|
158
|
+
listener.before_web_compile(options)
|
159
|
+
end
|
160
|
+
ARGV.each do |file|
|
161
|
+
output = Origen.file_handler.sub_dir_of(Origen.file_handler.clean_path_to(file), "#{Origen.root}/templates/web")
|
162
|
+
Origen.app.runner.launch action: :compile,
|
163
|
+
files: file,
|
164
|
+
output: "#{Origen.root}/web/content/#{output}"
|
165
|
+
end
|
166
|
+
Origen.app.listeners_for(:after_web_compile).each do |listener|
|
167
|
+
listener.after_web_compile(options)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
Dir.chdir "#{Origen.root}/web" do
|
171
|
+
system "#{Origen.root}/lbin/nanoc"
|
172
|
+
end
|
173
|
+
if options[:api]
|
174
|
+
_deployer.generate_api
|
175
|
+
end
|
176
|
+
if options[:remote]
|
177
|
+
if ARGV.empty?
|
178
|
+
_deployer.deploy_site
|
179
|
+
else
|
180
|
+
ARGV.each do |files|
|
181
|
+
Origen.file_handler.resolve_files(files) do |file|
|
182
|
+
_deployer.deploy_file(file)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
_deployer.deploy_archive(options[:archive]) if options[:archive]
|
187
|
+
else
|
188
|
+
Dir.chdir "#{Origen.root}/web/output" do
|
189
|
+
_start_server
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
when 'deploy'
|
194
|
+
Origen.app.load_target!
|
195
|
+
_require_web_directory
|
196
|
+
if ARGV.empty?
|
197
|
+
_deployer.deploy_site
|
198
|
+
else
|
199
|
+
ARGV.each do |files|
|
200
|
+
Origen.file_handler.resolve_files(files) do |file|
|
201
|
+
_deployer.deploy_file(file)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
_deployer.deploy_archive(options[:archive]) if options[:archive]
|
206
|
+
|
207
|
+
when 'archive'
|
208
|
+
Origen.app.load_target!
|
209
|
+
_require_web_directory
|
210
|
+
unless ARGV[0]
|
211
|
+
puts 'You must supply an ID argument to create an archive'
|
212
|
+
end
|
213
|
+
_deployer.deploy_archive(ARGV[0])
|
214
|
+
|
215
|
+
else
|
216
|
+
puts "Unknown command, see 'origen web -h' for a list of commands"
|
217
|
+
end
|
218
|
+
else
|
219
|
+
puts "You must supply a command, see 'origen web -h' for a list of commands"
|
220
|
+
end
|
221
|
+
end
|
@@ -0,0 +1,272 @@
|
|
1
|
+
# Main entry point for all Origen commands, some global option handling
|
2
|
+
# is done here (i.e. options that apply to all commands) before handing
|
3
|
+
# over to the specific command handlers
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
ARGV << '--help' if ARGV.empty?
|
7
|
+
|
8
|
+
ORIGEN_COMMAND_ALIASES = {
|
9
|
+
'g' => 'generate',
|
10
|
+
'p' => 'program',
|
11
|
+
't' => 'target',
|
12
|
+
'-t' => 'target', # For legacy reasons
|
13
|
+
'e' => 'environment',
|
14
|
+
'-e' => 'environment',
|
15
|
+
'mods' => 'modifications',
|
16
|
+
'-o' => 'modifications', # Legacy
|
17
|
+
'l' => 'lsf',
|
18
|
+
'i' => 'interactive',
|
19
|
+
'c' => 'compile',
|
20
|
+
'pl' => 'plugin',
|
21
|
+
'-v' => 'version',
|
22
|
+
'--version' => 'version'
|
23
|
+
}
|
24
|
+
|
25
|
+
@command = ARGV.shift
|
26
|
+
@command = ORIGEN_COMMAND_ALIASES[@command] || @command
|
27
|
+
|
28
|
+
# Don't log to file during the save command since we need to preserve the last log,
|
29
|
+
# this is done as early in the process as possible so any deprecation warnings during
|
30
|
+
# load don't trigger a new log
|
31
|
+
Origen::Log.console_only = (%w(save target environment version).include?(@command) || ARGV.include?('--exec_remote'))
|
32
|
+
|
33
|
+
if ARGV.delete('--coverage') ||
|
34
|
+
((@command == 'specs' || @command == 'examples') && (ARGV.delete('-c') || ARGV.delete('--coverage')))
|
35
|
+
require 'simplecov'
|
36
|
+
SimpleCov.start
|
37
|
+
Origen.log.info 'Started code coverage'
|
38
|
+
SimpleCov.configure do
|
39
|
+
filters.clear # This will remove the :root_filter that comes via simplecov's defaults
|
40
|
+
add_filter do |src|
|
41
|
+
!(src.filename =~ /^#{Origen.root}\/lib/)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Results from commands run in succession will be merged by default
|
45
|
+
use_merging(!ARGV.delete('--no_merge'))
|
46
|
+
|
47
|
+
# Try and make a guess about which directory contains the bulk of the application's code
|
48
|
+
# and create groups to match the main folders
|
49
|
+
d1 = "#{Origen.root}/lib/#{Origen.app.name.to_s.underscore}"
|
50
|
+
d2 = "#{Origen.root}/lib/#{Origen.app.namespace.to_s.underscore}"
|
51
|
+
d3 = "#{Origen.root}/lib"
|
52
|
+
if File.exist?(d1) && File.directory?(d1)
|
53
|
+
dir = d1
|
54
|
+
elsif File.exist?(d2) && File.directory?(d2)
|
55
|
+
dir = d2
|
56
|
+
else
|
57
|
+
dir = d3
|
58
|
+
end
|
59
|
+
|
60
|
+
Dir.glob("#{dir}/*").each do |d|
|
61
|
+
d = Pathname.new(d)
|
62
|
+
if d.directory?
|
63
|
+
add_group d.basename.to_s.camelcase, d.to_s
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
command_name @command
|
68
|
+
|
69
|
+
path_to_coverage_report = Pathname.new("#{Origen.root}/coverage/index.html").relative_path_from(Pathname.pwd)
|
70
|
+
|
71
|
+
at_exit do
|
72
|
+
SimpleCov.result.format!
|
73
|
+
puts ''
|
74
|
+
puts 'To view coverage report:'
|
75
|
+
puts " firefox #{path_to_coverage_report} &"
|
76
|
+
puts ''
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
require 'origen/global_methods'
|
82
|
+
include Origen::GlobalMethods
|
83
|
+
|
84
|
+
Origen.lsf.current_command = @command
|
85
|
+
Origen.send :current_command=, @command
|
86
|
+
|
87
|
+
if ARGV.delete('-d') || ARGV.delete('--debug')
|
88
|
+
begin
|
89
|
+
if RUBY_VERSION >= '2.0.0'
|
90
|
+
require 'byebug'
|
91
|
+
else
|
92
|
+
require 'rubygems'
|
93
|
+
require 'ruby-debug'
|
94
|
+
end
|
95
|
+
rescue LoadError
|
96
|
+
def debugger
|
97
|
+
caller[0] =~ /.*\/(\w+\.rb):(\d+).*/
|
98
|
+
puts 'The debugger gem is not installed, add the following to your Gemfile:'
|
99
|
+
puts
|
100
|
+
puts "if RUBY_VERSION >= '2.0.0'"
|
101
|
+
puts " gem 'byebug', '~>3.5'"
|
102
|
+
puts 'else'
|
103
|
+
puts " gem 'debugger', '~>1.6'"
|
104
|
+
puts 'end'
|
105
|
+
puts
|
106
|
+
end
|
107
|
+
end
|
108
|
+
Origen.enable_debugger
|
109
|
+
else
|
110
|
+
def debugger
|
111
|
+
caller[0] =~ /.*\/(\w+\.rb):(\d+).*/
|
112
|
+
puts "#{Regexp.last_match[1]}:#{Regexp.last_match[2]} - debugger statement ignored, run again with '-d' to enable it"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
if ARGV.include?('-verbose') || ARGV.include?('--verbose')
|
117
|
+
options ||= {}
|
118
|
+
Origen.log.level = :verbose
|
119
|
+
ARGV.delete('-verbose')
|
120
|
+
ARGV.delete('--verbose')
|
121
|
+
end
|
122
|
+
|
123
|
+
if ARGV.include?('-silent') || ARGV.include?('--silent')
|
124
|
+
options ||= {}
|
125
|
+
Origen.log.level = :silent
|
126
|
+
ARGV.delete('-silent')
|
127
|
+
ARGV.delete('--silent')
|
128
|
+
end
|
129
|
+
|
130
|
+
# If the current command is an LSF execution request (that is a request to
|
131
|
+
# execute a non-Origen command remotely)
|
132
|
+
if (@command == 'lsf' || @command == 'l') && (ARGV.include?('-e') || ARGV.include?('--execute'))
|
133
|
+
# Don't apply these global options yet, pass them through to the underlying command
|
134
|
+
else
|
135
|
+
if ARGV.delete('--profile')
|
136
|
+
# This means that as well as applying to the current thread, this option will also
|
137
|
+
# be applied to any remote jobs triggered by this thread
|
138
|
+
Origen.app.lsf_manager.add_command_option('--profile')
|
139
|
+
Origen.enable_profiling
|
140
|
+
end
|
141
|
+
if ARGV.delete('--exec_remote') && @command != 'lsf' && @command != 'l'
|
142
|
+
Origen.running_remotely = true
|
143
|
+
end
|
144
|
+
# Set the Origen operating mode if supplied
|
145
|
+
ix = ARGV.index('-m') || ARGV.index('--mode')
|
146
|
+
if ix
|
147
|
+
ARGV.delete_at(ix)
|
148
|
+
mode = ARGV[ix]
|
149
|
+
ARGV.delete_at(ix)
|
150
|
+
Origen.app.lsf_manager.add_command_option('--mode', mode)
|
151
|
+
Origen.mode = mode
|
152
|
+
# Make sure this sticks for the remainder of this thread
|
153
|
+
Origen.mode.freeze
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
# Give application commands the first shot at executing the given command,
|
158
|
+
# the application file must exit upon servicing the command if it wants to
|
159
|
+
# prevent Origen from then having a go.
|
160
|
+
# This order is preferable to allowing Origen to go first since it allows
|
161
|
+
# overloading of Origen commands by the application.
|
162
|
+
if File.exist? "#{Origen.root}/config/commands.rb"
|
163
|
+
require "#{Origen.root}/config/commands"
|
164
|
+
end
|
165
|
+
|
166
|
+
shared_commands = Origen.import_manager.command_launcher
|
167
|
+
@plugin_commands ||= []
|
168
|
+
if shared_commands && shared_commands.size != 0
|
169
|
+
shared_commands.each do |file|
|
170
|
+
require file
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
case @command
|
175
|
+
when 'generate', 'program', 'compile', 'merge', 'interactive', 'target', 'environment',
|
176
|
+
'ctags', 'save', 'lsf', 'web', 'time', 'dispatch', 'rc', 'lint', 'plugin' # , 'add'
|
177
|
+
|
178
|
+
require "origen/commands/#{@command}"
|
179
|
+
exit 0 unless @command == 'interactive'
|
180
|
+
|
181
|
+
when 'upgrade_app'
|
182
|
+
Origen::CodeGenerators.invoke 'bundler', [], config: { type: :application }
|
183
|
+
Origen::CodeGenerators.invoke 'rake', []
|
184
|
+
Origen::CodeGenerators.invoke 'r_spec', ['-f']
|
185
|
+
exit 0
|
186
|
+
|
187
|
+
when 'upgrade_plugin'
|
188
|
+
unless Origen.app.version.semantic?
|
189
|
+
puts 'To upgrade to a gem your plugin must switch to semantic (1.2.3) style versioning.'
|
190
|
+
puts
|
191
|
+
end
|
192
|
+
Origen::CodeGenerators.invoke 'semver', []
|
193
|
+
Origen::CodeGenerators.invoke 'gem_setup', []
|
194
|
+
Origen::CodeGenerators.invoke 'bundler', []
|
195
|
+
Origen::CodeGenerators.invoke 'rake', []
|
196
|
+
Origen::CodeGenerators.invoke 'r_spec', ['-f']
|
197
|
+
exit 0
|
198
|
+
|
199
|
+
when 'version'
|
200
|
+
Origen.disable_origen_version_check do
|
201
|
+
Origen.load_application(false)
|
202
|
+
require 'origen/commands/version'
|
203
|
+
end
|
204
|
+
|
205
|
+
when 'serve'
|
206
|
+
puts '***************************************************************'
|
207
|
+
puts "'origen serve' is deprecated, please use 'origen web serve' instead"
|
208
|
+
puts '***************************************************************'
|
209
|
+
ARGV.unshift 'serve'
|
210
|
+
load 'origen/commands/web.rb'
|
211
|
+
|
212
|
+
when 'tag'
|
213
|
+
puts '***************************************************************'
|
214
|
+
puts "'origen tag' is deprecated, please use 'origen rc tag' instead"
|
215
|
+
puts '***************************************************************'
|
216
|
+
ARGV.unshift 'tag'
|
217
|
+
load 'origen/commands/rc.rb'
|
218
|
+
|
219
|
+
when 'modifications'
|
220
|
+
puts '***************************************************************'
|
221
|
+
puts "'origen mods' is deprecated, please use 'origen rc mods' instead"
|
222
|
+
puts '***************************************************************'
|
223
|
+
ARGV.unshift 'modifications'
|
224
|
+
load 'origen/commands/rc.rb'
|
225
|
+
|
226
|
+
else
|
227
|
+
puts "Error: Command not recognized: #{@command}" unless ['-h', '--help'].include?(@command)
|
228
|
+
puts <<-EOT
|
229
|
+
Usage: origen COMMAND [ARGS]
|
230
|
+
|
231
|
+
The core origen commands are:
|
232
|
+
environment Display or set the default environment (short-cut alias: "e")
|
233
|
+
target Display or set the default target (short-cut alias: "t")
|
234
|
+
generate Generate a test pattern (short-cut alias: "g")
|
235
|
+
program Generate a test program (short-cut alias: "p")
|
236
|
+
interactive Start an interactive Origen console (short-cut alias: "i")
|
237
|
+
compile Compile a template file or directory (short-cut alias: "c")
|
238
|
+
rc Revision control commands, see -h for details
|
239
|
+
ctags Generate ctags file (can be used for code navigation)
|
240
|
+
save Save the new or changed files from the last run or a given log file
|
241
|
+
lsf Monitor and manage LSF jobs (short-cut alias: "l")
|
242
|
+
web Web page tools, see -h for details
|
243
|
+
time Tools for test time analysis and forecasting
|
244
|
+
lint Lint and style check (and correct) your application code
|
245
|
+
plugin Manage Origen plugins (short-cut alias: "pl")
|
246
|
+
|
247
|
+
EOT
|
248
|
+
if @application_commands && !@application_commands.empty?
|
249
|
+
puts <<-EOT
|
250
|
+
In addition to these the application has added:
|
251
|
+
#{@application_commands}
|
252
|
+
EOT
|
253
|
+
end
|
254
|
+
|
255
|
+
if @plugin_commands && !@plugin_commands.empty?
|
256
|
+
puts 'The following commands are provided by plugins:'
|
257
|
+
@plugin_commands.each do |str|
|
258
|
+
puts str
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
puts <<-EOT
|
263
|
+
|
264
|
+
All commands can be run with -d (or --debugger) to enable the debugger.
|
265
|
+
All commands can be run with --coverage to enable code coverage.
|
266
|
+
Many commands can be run with -h (or --help) for more information.
|
267
|
+
|
268
|
+
EOT
|
269
|
+
|
270
|
+
# dispatch Dispatch an Origen command to a worker farm
|
271
|
+
exit(1)
|
272
|
+
end
|