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,105 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
options = {}
|
4
|
+
|
5
|
+
# App options are options that the application can supply to extend this command
|
6
|
+
# app_options = @application_options || []
|
7
|
+
opt_parser = OptionParser.new do |opts|
|
8
|
+
opts.banner = <<-EOT
|
9
|
+
Usage: origen pl
|
10
|
+
origen pl [plugin name]
|
11
|
+
origen pl [CMD] [plugin name] [options]
|
12
|
+
|
13
|
+
Quickstart Examples:
|
14
|
+
origen pl # Displays the current plugin
|
15
|
+
origen pl added # Lists the included plugins
|
16
|
+
origen pl plugin_name # Sets the specified plugin as current plugin
|
17
|
+
origen pl reset # Resets the current plugin to none
|
18
|
+
origen pl describe plugin_name # Describes the specified plugin
|
19
|
+
origen pl add plugin_name va.b.c.dev0 # Adds the plugin of version va.b.c.dev0
|
20
|
+
|
21
|
+
The following commands are available:
|
22
|
+
|
23
|
+
list Displays all known plugins from the server
|
24
|
+
added Displays all plugins that are currently included in this app locally
|
25
|
+
describe [plugin_name] Describes the plugin
|
26
|
+
add [plugin_name] [version] Adds the specified plugin if found on server to the local app
|
27
|
+
remove [plugin_name] Removes the specified plugin from this local app
|
28
|
+
update [plugin_name] [version] Updates the specific plugin to the given version
|
29
|
+
|
30
|
+
The following options are available:
|
31
|
+
EOT
|
32
|
+
opts.on('--dev', 'Adds the plugin to config.imports_dev rather that config.imports') { options[:dev_import] = true }
|
33
|
+
opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
|
34
|
+
opts.on('-h', '--help', 'Show this message') { puts opts; exit }
|
35
|
+
end
|
36
|
+
|
37
|
+
opt_parser.parse! ARGV
|
38
|
+
|
39
|
+
if !ARGV[0]
|
40
|
+
if Origen.current_plugin.default
|
41
|
+
puts "Current plugin is: #{Origen.current_plugin.name}"
|
42
|
+
else
|
43
|
+
puts <<-EOT
|
44
|
+
No plugin set!
|
45
|
+
|
46
|
+
To work with an included plugin, set it as current plugin using the following command:
|
47
|
+
origen pl <plugin-name>
|
48
|
+
EOT
|
49
|
+
end
|
50
|
+
else
|
51
|
+
case input = ARGV.shift
|
52
|
+
when 'reset', 'none'
|
53
|
+
Origen.current_plugin.default = :none
|
54
|
+
puts 'Successfully cleared the default plugin!'
|
55
|
+
when 'add'
|
56
|
+
plugin_name = ARGV.shift
|
57
|
+
version = ARGV.shift
|
58
|
+
if plugin_name && version
|
59
|
+
Origen.plugins_manager.add(plugin_name, version, options)
|
60
|
+
else
|
61
|
+
puts 'Zero or less arguments provided!'
|
62
|
+
end
|
63
|
+
when 'added'
|
64
|
+
Origen.plugins_manager.list_added_plugins
|
65
|
+
when 'list'
|
66
|
+
Origen.plugins_manager.list
|
67
|
+
when 'describe'
|
68
|
+
puts Origen.plugins_manager.describe(ARGV.shift)
|
69
|
+
when 'remove'
|
70
|
+
plugin_name = ARGV.shift
|
71
|
+
if plugin_name
|
72
|
+
Origen.plugins_manager.remove(plugin_name)
|
73
|
+
else
|
74
|
+
puts 'No plugin name provided!'
|
75
|
+
end
|
76
|
+
when 'update'
|
77
|
+
plugin_name = ARGV.shift
|
78
|
+
version = ARGV.shift
|
79
|
+
if plugin_name && version
|
80
|
+
Origen.plugins_manager.update(plugin_name, version)
|
81
|
+
else
|
82
|
+
puts 'Zero or less arguments provided!'
|
83
|
+
end
|
84
|
+
|
85
|
+
else
|
86
|
+
|
87
|
+
Origen.current_plugin.default = input.to_sym
|
88
|
+
puts "#{Origen.current_plugin.default.name} is now set as the current plugin."
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
# def _workspace_plugin_command
|
94
|
+
# puts 'local'
|
95
|
+
# end
|
96
|
+
#
|
97
|
+
# def _global_plugin_command
|
98
|
+
# puts 'global'
|
99
|
+
# end
|
100
|
+
|
101
|
+
# if Origen.in_application_directory? || Origen.in_application_subdirectory?
|
102
|
+
# _workspace_plugin_command
|
103
|
+
# else
|
104
|
+
# _global_plugin_command
|
105
|
+
# end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
options = {}
|
4
|
+
|
5
|
+
# App options are options that the application can supply to extend this command
|
6
|
+
app_options = @application_options || []
|
7
|
+
opt_parser = OptionParser.new do |opts|
|
8
|
+
opts.banner = 'Usage: origen p [space separated files or directories] [options]'
|
9
|
+
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 }
|
10
|
+
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 }
|
11
|
+
opts.on('-l', '--lsf [ACTION]', [:clear, :add], "Submit jobs to the LSF, optionally specify whether to 'clear' or 'add' to existing jobs") { |a| options[:lsf] = true; options[:lsf_action] = a }
|
12
|
+
opts.on('-w', '--wait', 'Wait for LSF processing to complete') { options[:wait_for_lsf_completion] = true }
|
13
|
+
opts.on('-c', '--continue', 'Continue on error (to the next file)') { options[:continue] = true }
|
14
|
+
opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
|
15
|
+
opts.on('-f', '--file FILE', String, 'Override the default log file') { |o| options[:log_file] = o }
|
16
|
+
opts.on('-pl', '--plugin PLUGIN_NAME', String, 'Set current plugin') { |pl_n| options[:current_plugin] = pl_n }
|
17
|
+
opts.on('-o', '--output DIR', String, 'Override the default output directory') { |o| options[:output] = o }
|
18
|
+
opts.on('-r', '--reference DIR', String, 'Override the default reference directory') { |o| options[:reference] = o }
|
19
|
+
opts.on('--list FILE', String, 'Override the default pattern list file name') { |o| options[:referenced_pattern_list] = o }
|
20
|
+
opts.on('--doc', 'Generate into doc (yaml) format, requires a Doc interface to be setup in your application') { options[:doc] = true }
|
21
|
+
opts.on('-q', '--queue NAME', String, 'Specify the LSF queue, default is short') { |o| options[:queue] = o }
|
22
|
+
opts.on('-p', '--project NAME', String, 'Specify the LSF project, default is msg.te') { |o| options[:project] = o }
|
23
|
+
opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
|
24
|
+
opts.on('-m', '--mode MODE', Origen::Mode::MODES, 'Force the Origen operating mode:', ' ' + Origen::Mode::MODES.join(', ')) { |_m| }
|
25
|
+
app_options.each do |app_option|
|
26
|
+
opts.on(*app_option) {}
|
27
|
+
end
|
28
|
+
opts.separator ''
|
29
|
+
opts.on('-h', '--help', 'Show this message') { puts opts; exit }
|
30
|
+
end
|
31
|
+
|
32
|
+
opt_parser.parse! ARGV
|
33
|
+
options[:files] = ARGV
|
34
|
+
|
35
|
+
Origen.load_application
|
36
|
+
|
37
|
+
if options[:queue]
|
38
|
+
Origen.config.lsf.queue = options.delete(:queue)
|
39
|
+
end
|
40
|
+
if options[:project]
|
41
|
+
Origen.config.lsf.project = options.delete(:project)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self._with_doc_tester(options)
|
45
|
+
if options[:doc]
|
46
|
+
Origen.app.with_doc_tester do
|
47
|
+
yield
|
48
|
+
end
|
49
|
+
else
|
50
|
+
yield
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
_with_doc_tester(options) do
|
55
|
+
Origen.current_plugin.temporary = options[:current_plugin] if options[:current_plugin]
|
56
|
+
Origen.environment.temporary = options[:environment] if options[:environment]
|
57
|
+
Origen.target.temporary = options[:target] if options[:target]
|
58
|
+
Origen.app.load_target! # This initial load is required to appply any configuration
|
59
|
+
# options present in the target, it will loaded again before
|
60
|
+
# each generate/compile job
|
61
|
+
|
62
|
+
if Origen.config.test_program_output_directory && !options[:output]
|
63
|
+
options[:output] = Origen.config.test_program_output_directory
|
64
|
+
end
|
65
|
+
|
66
|
+
options[:action] = :program # Let the generator know this is a test program generation
|
67
|
+
Origen.app.runner.launch(options)
|
68
|
+
end
|
69
|
+
|
70
|
+
Origen.lsf.wait_for_completion if options[:wait_for_lsf_completion]
|
@@ -0,0 +1,442 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
include Origen::Utility::InputCapture
|
4
|
+
|
5
|
+
def _unmanaged_files
|
6
|
+
unmanaged_files = Origen::RevisionControl::IGNORE_FILES
|
7
|
+
unmanaged_files += config.unmanaged_files || []
|
8
|
+
unmanaged_files += Origen.import_manager.all_symlinks || []
|
9
|
+
|
10
|
+
# If the given files are not full paths then prefix with Origen.root, unless they
|
11
|
+
# are wildcards
|
12
|
+
unmanaged_files.map do |f|
|
13
|
+
if f =~ /\*/ || Pathname.new(f).absolute?
|
14
|
+
f
|
15
|
+
else
|
16
|
+
"#{Origen.root}/#{f}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def _unmanaged_dirs
|
22
|
+
# List of unmanaged files and directories for an Origen workspace
|
23
|
+
unmanaged_dirs = Origen::RevisionControl::IGNORE_DIRS
|
24
|
+
unmanaged_dirs += config.unmanaged_dirs || []
|
25
|
+
|
26
|
+
# If the given dirs are not full paths then prefix with Origen.root
|
27
|
+
unmanaged_dirs.map do |d|
|
28
|
+
if Pathname.new(d).absolute?
|
29
|
+
d
|
30
|
+
else
|
31
|
+
"#{Origen.root}/#{d}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def workspace_dirs
|
37
|
+
"#{Origen.root} " + Origen.app.config.external_app_dirs.join(' ')
|
38
|
+
end
|
39
|
+
|
40
|
+
module Origen
|
41
|
+
options = {}
|
42
|
+
|
43
|
+
Origen.load_application
|
44
|
+
|
45
|
+
# App options are options that the application can supply to extend this command
|
46
|
+
app_options = @application_options || []
|
47
|
+
opt_parser = OptionParser.new do |opts|
|
48
|
+
opts.banner = <<-EOT
|
49
|
+
Origen Revision Control commands.
|
50
|
+
|
51
|
+
This command set provides a universal command line interface for working with a revision control
|
52
|
+
system, thereby providing the following benefits to the user:
|
53
|
+
|
54
|
+
* Intimate knowledge of how the underlying revision control system works is not required,
|
55
|
+
the command maintainers will ensure that you are using it in an efficient and correct way.
|
56
|
+
* The workflow remains the same regardless of what underlying revision control tool is used.
|
57
|
+
|
58
|
+
Currently supported backend systems are:
|
59
|
+
|
60
|
+
* Design Sync
|
61
|
+
|
62
|
+
Usage: origen rc CMD [options]
|
63
|
+
|
64
|
+
Quickstart examples:
|
65
|
+
|
66
|
+
Checkout
|
67
|
+
--------
|
68
|
+
origen rc co # Checkout the latest version of the application, local edits will be merged
|
69
|
+
origen rc co -v v1.2.3 # As above but a specific version
|
70
|
+
origen rc co -f # As above but force overwrite of local edits
|
71
|
+
origen rc co file.txt # As above but on a specific file or directory, -v and -f will work to
|
72
|
+
|
73
|
+
Checkin
|
74
|
+
-------
|
75
|
+
origen rc ci # Check in the application
|
76
|
+
origen rc ci --unman # As above but also include files that are currently unmanaged
|
77
|
+
origen rc ci file.txt # Check in a specific file
|
78
|
+
origen rc new file.txt # Create the given file and check in an initial version of it
|
79
|
+
|
80
|
+
Deleting
|
81
|
+
--------
|
82
|
+
TBD
|
83
|
+
|
84
|
+
Moving
|
85
|
+
------
|
86
|
+
TBD
|
87
|
+
|
88
|
+
Branching
|
89
|
+
---------
|
90
|
+
TBD
|
91
|
+
|
92
|
+
Management
|
93
|
+
----------
|
94
|
+
origen rc unman # Show unmanaged files
|
95
|
+
origen rc mods # Show modified files in local workspace
|
96
|
+
origen rc mods -a # Show modified files in local workspace AND repository modifications
|
97
|
+
origen rc tag # Tag and release the application
|
98
|
+
|
99
|
+
The following commands are available:
|
100
|
+
co Checkout the whole application(default) or specific application files
|
101
|
+
|
102
|
+
ci Checkin the whole application(default) or specific application files
|
103
|
+
|
104
|
+
tag Tags the application, maintains the application history and emails the application users.
|
105
|
+
All files must be checked in before this command will be allowed to run.
|
106
|
+
|
107
|
+
The release note can be entered live during the release process or it can be prepared
|
108
|
+
beforehand. To prepare the note prior to release it should be created in a file named
|
109
|
+
release_note.txt at the top level of your application.
|
110
|
+
|
111
|
+
Alternatively a different file can be used and specified via the -f option.
|
112
|
+
|
113
|
+
mods List any modified files in your workspace, or show the diffs vs. a previous tag.
|
114
|
+
Use the -v switch to supply a version to compare against.
|
115
|
+
Use the -a switch to include list of files updated in repository (Adds some time!)
|
116
|
+
|
117
|
+
unman List any unmanaged files in your workspace.
|
118
|
+
|
119
|
+
init Initialize a new application workspace (perform the first commit).
|
120
|
+
|
121
|
+
new FILE [ORIG] Create and add a new file to revision control, then open the new file in the editor if you
|
122
|
+
have the $EDITOR environment variable defined.
|
123
|
+
Optionally supply a file from which the original version of the new file should be copied
|
124
|
+
from.
|
125
|
+
|
126
|
+
The following options are available:
|
127
|
+
EOT
|
128
|
+
opts.on('-h', '--help', 'Show this message') { puts opts; exit }
|
129
|
+
app_options.each do |app_option|
|
130
|
+
opts.on(*app_option) {}
|
131
|
+
end
|
132
|
+
opts.separator ''
|
133
|
+
opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
|
134
|
+
opts.on('-m', '--mode MODE', Origen::Mode::MODES, 'Force the Origen operating mode:', ' ' + Origen::Mode::MODES.join(', ')) { |_m| }
|
135
|
+
opts.separator ''
|
136
|
+
opts.separator "The following options apply to the 'tag' command only:"
|
137
|
+
opts.on('-s', '--silent', "Release silently, don't send email notifications") { options[:silent] = true }
|
138
|
+
opts.on('-l', '--local', 'Inhibit deploy or any other post tag tasks (application must implement)') { options[:local] = true }
|
139
|
+
types = Origen::Application::Release.valid_types
|
140
|
+
opts.on('-t', '--type TYPE', types, 'Release type:', ' ' + types.join(', ')) { |t| options[:type] = t ? t.to_sym : :development }
|
141
|
+
opts.on('-n', '--note TEXT', String, 'Supply the release note') { |t| options[:note] = t }
|
142
|
+
opts.on('-f', '--file FILE', String, 'Supply the release note in a file') { |f| options[:note_file] = f }
|
143
|
+
unless Origen.config.semantically_version
|
144
|
+
msg = 'Supply an explicit version identifier (tag)'
|
145
|
+
opts.on('-i', '--identifier TEXT', String, msg) { |t| options[:tag] = t }
|
146
|
+
end
|
147
|
+
opts.on('--no-fetch', "Don't fetch the latest application files, i.e. tag the workspace as is") { options[:no_fetch] = true }
|
148
|
+
opts.separator ''
|
149
|
+
opts.separator "The following options apply to the 'mods' and 'co' commands only:"
|
150
|
+
opts.on('-v', '--version TAG', String, 'Supply a version tag to compare against or checkout') { |f| options[:version] = f }
|
151
|
+
opts.separator ''
|
152
|
+
opts.separator "The following options apply to the 'mods' command only:"
|
153
|
+
opts.on('-a', '--all', 'Include server modifications to files by others.') { options[:allmods] = true }
|
154
|
+
opts.separator ''
|
155
|
+
opts.separator "The following options apply to the 'co' command only:"
|
156
|
+
opts.on('-f', '--force', 'Force overwrite of local edits') { options[:force] = true }
|
157
|
+
opts.separator ''
|
158
|
+
opts.separator "The following options apply to the 'ci' command only:"
|
159
|
+
opts.on('--unman', 'Include un-managed files in the check in') { options[:unmanaged] = true }
|
160
|
+
end
|
161
|
+
|
162
|
+
opt_parser.parse! ARGV
|
163
|
+
|
164
|
+
# Take the chance to clear world writable permissions to stop the annoying Ruby warnings
|
165
|
+
dirs = Origen.root.to_s
|
166
|
+
if File.exist?("#{dirs}/lbin")
|
167
|
+
dirs += " #{dirs}/lbin"
|
168
|
+
end
|
169
|
+
`chmod o-w #{dirs}`
|
170
|
+
|
171
|
+
if ARGV[0]
|
172
|
+
case ARGV.shift
|
173
|
+
when 'new'
|
174
|
+
if ARGV[0]
|
175
|
+
file = ARGV[0]
|
176
|
+
else
|
177
|
+
puts 'You must supply a path to the new file you want to create!'
|
178
|
+
exit 1
|
179
|
+
end
|
180
|
+
if ARGV[1]
|
181
|
+
`cp #{ARGV[1]} #{file}`
|
182
|
+
else
|
183
|
+
unless File.exist?(file)
|
184
|
+
`touch #{file}`
|
185
|
+
end
|
186
|
+
end
|
187
|
+
options[:comment] ||= 'Initial version'
|
188
|
+
options[:unmanaged] = true
|
189
|
+
Origen.app.rc.checkin(file, options)
|
190
|
+
if ENV['EDITOR']
|
191
|
+
spawn "#{ENV['EDITOR']} #{file} &"
|
192
|
+
else
|
193
|
+
puts "Created and checked in: #{file}"
|
194
|
+
end
|
195
|
+
|
196
|
+
when 'tag'
|
197
|
+
Origen.app.release(options)
|
198
|
+
|
199
|
+
when 'co'
|
200
|
+
if ARGV.empty?
|
201
|
+
path = workspace_dirs
|
202
|
+
else
|
203
|
+
path = ARGV.join(' ')
|
204
|
+
end
|
205
|
+
Origen.app.rc.checkout(path, version: options[:version], force: options[:force])
|
206
|
+
|
207
|
+
when 'ci'
|
208
|
+
if Origen.config.lint_test[:run_on_tag]
|
209
|
+
Dir.chdir Origen.root do
|
210
|
+
lint_dirs = []
|
211
|
+
lint_files = []
|
212
|
+
[Origen.config.lint_test[:files] || 'lib'].flatten.each do |f|
|
213
|
+
if File.directory?(f)
|
214
|
+
lint_dirs << f
|
215
|
+
else
|
216
|
+
lint_files << f
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
if ARGV.empty?
|
221
|
+
mods = Origen.app.rc.local_modifications
|
222
|
+
if mods.empty?
|
223
|
+
puts 'No changes to check in'
|
224
|
+
exit 0
|
225
|
+
else
|
226
|
+
files = mods
|
227
|
+
end
|
228
|
+
else
|
229
|
+
files = ARGV
|
230
|
+
end
|
231
|
+
|
232
|
+
lint = []
|
233
|
+
files.each do |file|
|
234
|
+
file = Pathname.new(file)
|
235
|
+
if file.absolute?
|
236
|
+
file = file.relative_path_from(Pathname.pwd).to_s
|
237
|
+
else
|
238
|
+
file = file.to_s
|
239
|
+
end
|
240
|
+
|
241
|
+
# Lint test any files or dirs that have specifically been marked for lint
|
242
|
+
if lint_files.include?(file) || lint_dirs.include?(file)
|
243
|
+
lint << file
|
244
|
+
# Or any Ruby files within a marked directory
|
245
|
+
elsif file =~ /.rb$/
|
246
|
+
if lint_dirs.any? { |dir| file =~ /^#{dir}/ }
|
247
|
+
lint << file
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
if lint.empty?
|
252
|
+
result = true
|
253
|
+
else
|
254
|
+
result = system("origen lint #{lint.join(' ')}")
|
255
|
+
end
|
256
|
+
unless result
|
257
|
+
puts ''
|
258
|
+
puts 'Some lint/style errors were found, if these were all corrected just re-run the previous command, otherwise go and fix those that remain and then try again.'
|
259
|
+
exit 1
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
# Don't allow force check-in via this API, if you want to do this you should really know what
|
265
|
+
# you are doing and use the RC tool directly
|
266
|
+
options.delete(:force)
|
267
|
+
|
268
|
+
unless options[:comment]
|
269
|
+
puts 'CHECKIN COMMENT:'
|
270
|
+
options[:comment] = get_text.strip.gsub("\n", ' ')
|
271
|
+
end
|
272
|
+
if ARGV.empty?
|
273
|
+
if options[:unmanaged]
|
274
|
+
puts "--unman is not allowed at application level, use 'origen rc init' if you want"
|
275
|
+
puts ' to commit a whole application for the first time.'
|
276
|
+
exit 1
|
277
|
+
else
|
278
|
+
path = workspace_dirs
|
279
|
+
end
|
280
|
+
else
|
281
|
+
path = ARGV.join(' ')
|
282
|
+
end
|
283
|
+
Origen.app.rc.checkin(path, options)
|
284
|
+
|
285
|
+
when 'modifications', 'mods'
|
286
|
+
if options[:allmods]
|
287
|
+
options[:version] = nil
|
288
|
+
puts 'Checking for differences vs. latest version ...'
|
289
|
+
else
|
290
|
+
if options[:version]
|
291
|
+
puts "Checking for differences vs. #{options[:version]} ..."
|
292
|
+
else
|
293
|
+
puts 'Checking for local modifications ...'
|
294
|
+
end
|
295
|
+
end
|
296
|
+
changes = []
|
297
|
+
path_array = workspace_dirs.split(' ')
|
298
|
+
puts
|
299
|
+
if options[:version]
|
300
|
+
all_changes = {
|
301
|
+
added: [], removed: [], changed: []
|
302
|
+
}
|
303
|
+
# Check for changes in Origen.root and external app dirs
|
304
|
+
path_array.each do |d|
|
305
|
+
changes = Origen.app.rc.changes(d, options)
|
306
|
+
if changes[:present]
|
307
|
+
all_changes.merge!(changes) do |_key, old, new|
|
308
|
+
if old.is_a? Array
|
309
|
+
old << new
|
310
|
+
else
|
311
|
+
old || new
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
if all_changes[:present]
|
317
|
+
unless all_changes[:removed].empty?
|
318
|
+
puts 'The following files have been removed:'
|
319
|
+
all_changes[:removed].flatten.each do |file|
|
320
|
+
puts " #{file}"
|
321
|
+
end
|
322
|
+
puts ''
|
323
|
+
end
|
324
|
+
unless all_changes[:added].empty?
|
325
|
+
puts 'The following files have been added:'
|
326
|
+
all_changes[:added].flatten.each do |file|
|
327
|
+
puts " #{ENV['EDITOR']} #{file}"
|
328
|
+
end
|
329
|
+
puts ''
|
330
|
+
end
|
331
|
+
# Remove Origen controlled files that always change
|
332
|
+
all_changes[:changed].reject! do |file|
|
333
|
+
file == 'doc/history' || file == 'lib/origen/version.rb' || file == 'config/version.rb'
|
334
|
+
end
|
335
|
+
unless all_changes[:changed].empty?
|
336
|
+
puts 'The following files are different:'
|
337
|
+
all_changes[:changed].flatten.each do |file|
|
338
|
+
puts " #{Origen.app.rc.diff_cmd(file, options[:version])}"
|
339
|
+
end
|
340
|
+
puts ''
|
341
|
+
end
|
342
|
+
else
|
343
|
+
puts 'Your workspace is clean!'
|
344
|
+
end
|
345
|
+
else
|
346
|
+
path_array.each { |d| changes << Origen.app.rc.local_modifications(d, options) }
|
347
|
+
changes.flatten!
|
348
|
+
if changes.empty?
|
349
|
+
puts 'Your workspace is clean!'
|
350
|
+
else
|
351
|
+
puts 'The following files have been modified:'
|
352
|
+
changes.flatten.each do |file|
|
353
|
+
puts " #{Origen.app.rc.diff_cmd(file, Origen.app.version)}"
|
354
|
+
end
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
when 'unmanaged', 'unman'
|
359
|
+
# merge standard with custom unmanaged dir/file lists
|
360
|
+
unmanaged_dirs = _unmanaged_dirs
|
361
|
+
unmanaged_files = _unmanaged_files
|
362
|
+
# This method still very slow-- to improve need to skip listing
|
363
|
+
# unmanaged directories in the first place, as they could hold many files
|
364
|
+
filelist = Origen.app.rc.unmanaged.reject do |file|
|
365
|
+
reject = false
|
366
|
+
unmanaged_dirs.each do |dir_filter|
|
367
|
+
if file =~ /^#{Regexp.escape(dir_filter)}\//i # dir matching
|
368
|
+
reject = true
|
369
|
+
end
|
370
|
+
end
|
371
|
+
unless reject
|
372
|
+
unmanaged_files.each do |file_filter|
|
373
|
+
if file_filter =~ /\*/ # wildcard used
|
374
|
+
temp_file_filter = file_filter.gsub('.', '___') # replace . with ___
|
375
|
+
temp_file_filter2 = temp_file_filter.sub(/\*/, '') # remove *
|
376
|
+
temp_file = file.gsub('.', '___') # replace . with __
|
377
|
+
if temp_file =~ /#{temp_file_filter2}/i
|
378
|
+
reject = true
|
379
|
+
end
|
380
|
+
else
|
381
|
+
if file.downcase == file_filter.downcase # exact match
|
382
|
+
reject = true
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
387
|
+
reject
|
388
|
+
end
|
389
|
+
if filelist.size == 0
|
390
|
+
puts 'Your workspace is clean!'
|
391
|
+
else
|
392
|
+
puts 'Your workspace has the following unmanaged files, run the given command to check them in:'
|
393
|
+
filelist.each do |file|
|
394
|
+
puts ' origen rc ci --unman ' + file
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
when 'init', 'initialize'
|
399
|
+
if !File.zero?("#{Origen.root}/doc/history") && !options[:force]
|
400
|
+
puts "Sorry can't initialize, it looks like your app has already completed its first commit!"
|
401
|
+
# TODO: Need the configuration to be made generic enough to handle Git and co.
|
402
|
+
elsif !(Origen.app.config.rc_url || Origen.app.config.vault)
|
403
|
+
puts 'Before initializing you must first set the rc_url/vault in config/application.rb'
|
404
|
+
else
|
405
|
+
puts ''
|
406
|
+
puts 'You are about to commit this directory:'
|
407
|
+
puts " #{Origen.root}"
|
408
|
+
puts ''
|
409
|
+
puts 'To this url:'
|
410
|
+
puts " #{Origen.app.config.rc_url || Origen.app.config.vault}"
|
411
|
+
puts ''
|
412
|
+
puts 'DOES THAT LOOK CORRECT? (if not update config.application.rb)'
|
413
|
+
puts ''
|
414
|
+
get_text confirm: true
|
415
|
+
Origen::Log.console_only do
|
416
|
+
Dir.chdir Origen.root do
|
417
|
+
# Blow away these temporary files to make sure they are not committed
|
418
|
+
Origen.import_manager.send(:remove_all_symlinks!) # removes symlinks from plugins
|
419
|
+
system("rm -fr #{_unmanaged_dirs.join(' ')} #{_unmanaged_files.join(' ')}")
|
420
|
+
options.delete(:force)
|
421
|
+
options[:comment] ||= 'Initial'
|
422
|
+
options[:unmanaged] = true
|
423
|
+
options[:initial] = true
|
424
|
+
if Origen.app.rc.git?
|
425
|
+
Origen.app.rc.send(:create_gitignore) unless File.exist?("#{Origen.root}/.gitignore")
|
426
|
+
end
|
427
|
+
Origen.app.rc.checkin(options)
|
428
|
+
end
|
429
|
+
end
|
430
|
+
puts
|
431
|
+
puts "Your application is initialized, you can now use 'origen rc tag' to record its history"
|
432
|
+
end
|
433
|
+
|
434
|
+
else
|
435
|
+
puts "Unknown command, see 'origen rc -h' for a list of commands"
|
436
|
+
end
|
437
|
+
else
|
438
|
+
puts "You must supply a command, see 'origen rc -h' for a list of commands"
|
439
|
+
end
|
440
|
+
|
441
|
+
exit 0
|
442
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
options = {}
|
4
|
+
|
5
|
+
# App options are options that the application can supply to extend this command
|
6
|
+
app_options = @application_options || []
|
7
|
+
opt_parser = OptionParser.new do |opts|
|
8
|
+
opts.banner = <<-EOT
|
9
|
+
Parse the log file and execute all commands to save NEW or CHANGED patterns or files.
|
10
|
+
|
11
|
+
Usage: origen save TYPE [options]
|
12
|
+
valid TYPE values: all, new, changed
|
13
|
+
EOT
|
14
|
+
opts.on('-f', '--file FILE', String, 'Override the default log file') { |o| options[:log_file] = o }
|
15
|
+
opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
|
16
|
+
opts.on('-m', '--mode MODE', Origen::Mode::MODES, 'Force the Origen operating mode:', ' ' + Origen::Mode::MODES.join(', ')) { |_m| }
|
17
|
+
app_options.each do |app_option|
|
18
|
+
opts.on(*app_option) {}
|
19
|
+
end
|
20
|
+
opts.separator ''
|
21
|
+
opts.on('-h', '--help', 'Show this message') { puts opts; exit }
|
22
|
+
end
|
23
|
+
|
24
|
+
opt_parser.parse! ARGV
|
25
|
+
|
26
|
+
type = ARGV.first
|
27
|
+
unless %w(all new changed).include?(type)
|
28
|
+
puts "Invalid TYPE parameter supplied, must be 'all', 'new' or 'changed'"
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
|
32
|
+
if options[:log_file]
|
33
|
+
file = "#{Origen.root}/#{options[:log_file]}"
|
34
|
+
else
|
35
|
+
file = Origen::Log.log_file
|
36
|
+
end
|
37
|
+
|
38
|
+
if type == 'new'
|
39
|
+
match = /.*(NEW FILE).*(#{Origen.config.copy_command} .*)/
|
40
|
+
elsif type == 'changed'
|
41
|
+
match = /.*(CHANGE DETECTED).*(#{Origen.config.copy_command} .*)/
|
42
|
+
else
|
43
|
+
match = /.*(NEW FILE|CHANGE DETECTED).*(#{Origen.config.copy_command} .*)/
|
44
|
+
end
|
45
|
+
|
46
|
+
File.open(file) do |f|
|
47
|
+
f.readlines.each do |line|
|
48
|
+
if line =~ match
|
49
|
+
system(Regexp.last_match[2])
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
puts 'Reference updated!'
|
55
|
+
|
56
|
+
exit 0
|