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,280 @@
|
|
1
|
+
module Origen
|
2
|
+
class Application
|
3
|
+
class PluginsManager
|
4
|
+
# Returns the temporary plugin instance if set, otherwise nil
|
5
|
+
attr_reader :temporary
|
6
|
+
|
7
|
+
# Returns the current plugin instance, this will be the temporary plugin if set, if
|
8
|
+
# not then the current default plugin if set, otherwise nil
|
9
|
+
def current
|
10
|
+
if @disabled || @set_to_nil
|
11
|
+
nil
|
12
|
+
else
|
13
|
+
temporary || default
|
14
|
+
end
|
15
|
+
end
|
16
|
+
alias_method :instance, :current
|
17
|
+
alias_method :current_plugin_instance, :current
|
18
|
+
|
19
|
+
def disable
|
20
|
+
@disabled = true
|
21
|
+
end
|
22
|
+
|
23
|
+
def enable
|
24
|
+
@disabled = false
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns the current plugin name, equivalent to calling current.name
|
28
|
+
def name
|
29
|
+
current ? current.name : nil
|
30
|
+
end
|
31
|
+
|
32
|
+
# Sets the given plugin as the temporary current plugin, this will last until
|
33
|
+
# changed or the end of the current Origen thread
|
34
|
+
def temporary=(plugin_name)
|
35
|
+
if !plugin_name || plugin_name.to_sym == :none
|
36
|
+
@set_to_nil = true
|
37
|
+
@temporary = nil
|
38
|
+
else
|
39
|
+
@set_to_nil = false
|
40
|
+
@temporary = find_plugin!(plugin_name)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Same as temporary= except it will be remembered in the next Origen thread.
|
45
|
+
# Setting this will also clear any temporary assignment that is currently in
|
46
|
+
# effect.
|
47
|
+
def default=(plugin_name)
|
48
|
+
self.temporary = nil
|
49
|
+
if !plugin_name || plugin_name.to_sym == :none
|
50
|
+
@default = nil
|
51
|
+
else
|
52
|
+
@default = find_plugin!(plugin_name)
|
53
|
+
Origen.app.session.origen_core[:default_plugin] = @default.name
|
54
|
+
@default
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Returns the current plugin instance currently set as the default plugin,
|
59
|
+
# otherwise nil
|
60
|
+
def default
|
61
|
+
return @default if @default
|
62
|
+
if name = Origen.app.session.origen_core[:default_plugin]
|
63
|
+
begin
|
64
|
+
@default = find_plugin!(name)
|
65
|
+
rescue
|
66
|
+
# Hit here if what has been set to the default plugin has since been
|
67
|
+
# removed from the application
|
68
|
+
self.default = :none
|
69
|
+
nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Checks the given plugin name with the list of installed plugins
|
75
|
+
# and returns true if found else returns false
|
76
|
+
def valid_plugin_name?(plugin_name)
|
77
|
+
Origen.import_manager.names.include?(plugin_name)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Lists all the plugins available on server
|
81
|
+
def list
|
82
|
+
puts 'The following plugins are available to add to your application:'
|
83
|
+
puts ''
|
84
|
+
Origen.client.plugins.group_by { |p| p[:category] }.sort_by { |k, _v| k }.each do |category, plugins|
|
85
|
+
puts category.upcase
|
86
|
+
puts '=' * category.length
|
87
|
+
plugins.sort_by { |p| p[:name] }.each do |plugin|
|
88
|
+
line = "#{plugin[:origen_name]}".ljust(25) + plugin[:name].strip.ljust(30)
|
89
|
+
if plugin[:latest_version_prod] || plugin[:latest_version_dev]
|
90
|
+
line += [plugin[:latest_version_prod] || plugin[:latest_version_dev]].compact.join(', ')
|
91
|
+
end
|
92
|
+
puts line
|
93
|
+
end
|
94
|
+
puts ''
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Updates the plugin to the supplied version
|
99
|
+
def update(plugin_name, version)
|
100
|
+
if plugin_name.class != Symbol
|
101
|
+
plugin_name = plugin_name.to_sym
|
102
|
+
end
|
103
|
+
if valid_plugin_name?(plugin_name)
|
104
|
+
update_config_file!(version: version,
|
105
|
+
plugin_name: plugin_name,
|
106
|
+
action: :update)
|
107
|
+
else
|
108
|
+
puts "Plugin #{plugin_name} not found in this app!"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Adds the given plugin to the current app
|
113
|
+
def add(plugin_name, version, options)
|
114
|
+
if plugin_name.class != Symbol
|
115
|
+
plugin_name = plugin_name.to_sym
|
116
|
+
end
|
117
|
+
if !valid_plugin_name?(plugin_name)
|
118
|
+
plugin_data = read_plugin_info_from_server(plugin_name)
|
119
|
+
update_config_file!(vault: plugin_data[:vault],
|
120
|
+
version: version,
|
121
|
+
plugin_name: plugin_name,
|
122
|
+
action: :add,
|
123
|
+
dev_import: options[:dev_import])
|
124
|
+
|
125
|
+
puts 'Plugin added successfully!'
|
126
|
+
else
|
127
|
+
puts "Plugin #{plugin_name} is already included in this app!"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def remove(plugin_name)
|
132
|
+
if plugin_name.class != Symbol
|
133
|
+
plugin_name = plugin_name.to_sym
|
134
|
+
end
|
135
|
+
if valid_plugin_name?(plugin_name)
|
136
|
+
update_config_file!(plugin_name: plugin_name,
|
137
|
+
action: :remove)
|
138
|
+
if File.exist?("#{imports_dir}/#{plugin_name}")
|
139
|
+
FileUtils.rm_rf("#{imports_dir}/#{plugin_name}")
|
140
|
+
puts "Plugin '#{plugin_name}' removed successfully!"
|
141
|
+
end
|
142
|
+
else
|
143
|
+
puts "Plugin #{plugin_name} not found in this app!"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Lists out the currently added plugins within the app on console
|
148
|
+
def list_added_plugins
|
149
|
+
puts 'The following plugins are included in this app:'
|
150
|
+
format = "%30s\t%30s\t%30s\n"
|
151
|
+
printf(format, 'Origen_Name', 'Name', 'Version')
|
152
|
+
printf(format, '---------', '----', '-------')
|
153
|
+
|
154
|
+
Origen.plugins.each do |plugin|
|
155
|
+
printf(format, plugin.name, plugin.config.name, plugin.version)
|
156
|
+
end
|
157
|
+
puts ''
|
158
|
+
end
|
159
|
+
|
160
|
+
# Describes the plugin
|
161
|
+
def describe(plugin_name)
|
162
|
+
if plugin_name
|
163
|
+
if plugin_name.class != Symbol
|
164
|
+
plugin_name = plugin_name.to_sym
|
165
|
+
end
|
166
|
+
description = nil
|
167
|
+
Origen.client.plugins.each do |plugin|
|
168
|
+
if plugin[:origen_name].to_sym == plugin_name
|
169
|
+
description = <<-EOT
|
170
|
+
Origen_Name: #{plugin[:origen_name]}
|
171
|
+
Actual Name: #{plugin[:name]}
|
172
|
+
Category: #{plugin[:category]}
|
173
|
+
Description: #{plugin[:description]}
|
174
|
+
EOT
|
175
|
+
break
|
176
|
+
end
|
177
|
+
end
|
178
|
+
if description.nil?
|
179
|
+
puts "Plugin #{plugin_name} not found or it does not include a description"
|
180
|
+
exit 1
|
181
|
+
end
|
182
|
+
description
|
183
|
+
else
|
184
|
+
puts 'No plugin name provided'
|
185
|
+
exit 1
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
private
|
190
|
+
|
191
|
+
def find_plugin!(name)
|
192
|
+
plugin = Origen.plugins.find { |p| p.name.to_sym == name.to_sym }
|
193
|
+
return plugin if plugin
|
194
|
+
puts ''
|
195
|
+
puts "No plugin named '#{name}' is included in this application!"
|
196
|
+
puts 'The plugins currently available are:'
|
197
|
+
Origen.plugins.each do |plugin|
|
198
|
+
puts " #{plugin.name}"
|
199
|
+
end
|
200
|
+
puts ''
|
201
|
+
fail 'Missing plugin error!'
|
202
|
+
end
|
203
|
+
|
204
|
+
def read_plugin_info_from_server(plugin_name)
|
205
|
+
plugin_data = nil
|
206
|
+
Origen.client.plugins.each do |plugin|
|
207
|
+
if plugin[:origen_name].to_sym == plugin_name
|
208
|
+
plugin_data = plugin
|
209
|
+
break
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
if plugin_data.nil?
|
214
|
+
fail "No plugin with name #{plugin_name} found!"
|
215
|
+
end
|
216
|
+
plugin_data
|
217
|
+
end
|
218
|
+
|
219
|
+
def update_config_file!(options = {})
|
220
|
+
file = "#{Origen.root}/config/application.rb"
|
221
|
+
lines = File.readlines(file)
|
222
|
+
if options[:action] == :add && !valid_plugin_name?(options[:plugin_name])
|
223
|
+
if options[:dev_import]
|
224
|
+
unless lines.find_index { |line| line =~ /config.imports_dev/ }
|
225
|
+
index = lines.find_index { |line| line =~ /config.vault =/ }
|
226
|
+
lines.insert(index + 1, ' config.imports_dev = [', '', ' ]')
|
227
|
+
end
|
228
|
+
else
|
229
|
+
unless lines.find_index { |line| line =~ /config.imports\s=\s/ }
|
230
|
+
index = lines.find_index { |line| line =~ /config.vault =/ }
|
231
|
+
lines.insert(index + 1, ' config.imports = [', '', ' ]')
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
File.open(file, 'w') do |f|
|
236
|
+
lines.each do |line|
|
237
|
+
f.puts line
|
238
|
+
if line =~ (options[:dev_import] ? (/config.imports_dev\s=\s/) : (/config.imports\s=\s/))
|
239
|
+
f.puts ' {'
|
240
|
+
f.puts " :vault => \"#{options[:vault]}\","
|
241
|
+
f.puts " :version => \"#{options[:version]}\","
|
242
|
+
if (options[:dev_import] ? (Origen.config.imports_dev) : (Origen.config.imports)).size == 0
|
243
|
+
f.puts ' }'
|
244
|
+
else
|
245
|
+
f.puts ' },'
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
elsif options[:action] == :remove && valid_plugin_name?(options[:plugin_name])
|
251
|
+
lines.slice!(plugin_index_range(lines, options))
|
252
|
+
File.open(file, 'w') { |f| lines.each { |line| f.puts line } }
|
253
|
+
elsif options[:action] == :update && valid_plugin_name?(options[:plugin_name])
|
254
|
+
range = plugin_index_range(lines, options)
|
255
|
+
version_index = lines[range].find_index { |line| line =~ /:version/ }
|
256
|
+
version_index += range.first
|
257
|
+
lines[version_index] = " :version => \"#{options[:version]}\","
|
258
|
+
File.open(file, 'w') { |f| lines.each { |line| f.puts line } }
|
259
|
+
end
|
260
|
+
load "#{Origen.root}/config/application.rb"
|
261
|
+
Origen.import_manager.required = false
|
262
|
+
Origen.import_manager.require!
|
263
|
+
end
|
264
|
+
|
265
|
+
def plugin_index_range(file_lines, options)
|
266
|
+
center = file_lines.find_index { |line| line =~ /:vault(.*)(#{options[:plugin_name]})/i }
|
267
|
+
if center
|
268
|
+
first = file_lines[0..center].length - 1 - file_lines[0..center].rindex.find_index { |line| line =~ /^(\s*)({)(\s*)$/ }
|
269
|
+
last = file_lines[center..(file_lines.size - 1)].find_index { |line| line =~ /^\s*}(,?)\s*$/ }
|
270
|
+
last = center + last
|
271
|
+
first..last
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
def imports_dir
|
276
|
+
Origen.application.workspace_manager.imports_directory
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
@@ -0,0 +1,359 @@
|
|
1
|
+
require 'colored'
|
2
|
+
module Origen
|
3
|
+
class Application
|
4
|
+
# Responsible for co-ordinating application releases
|
5
|
+
class Release
|
6
|
+
include Users
|
7
|
+
include Utility::TimeAndDate
|
8
|
+
include Utility::InputCapture
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@mailer = Utility::Mailer.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.valid_types
|
15
|
+
if Origen.config.semantically_version
|
16
|
+
if Origen.app.version.development?
|
17
|
+
[:development, :production]
|
18
|
+
else
|
19
|
+
[:development, :tiny, :minor, :major]
|
20
|
+
end
|
21
|
+
else
|
22
|
+
[:development, :production]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Release a new application version
|
27
|
+
def run(options)
|
28
|
+
# Don't want plugin callbacks kicking in during the release process
|
29
|
+
Origen.current_plugin.disable
|
30
|
+
@options = options
|
31
|
+
if authorized?
|
32
|
+
Origen.import_manager.validate_production_status(true)
|
33
|
+
unless Origen.app.rc.local_modifications.empty?
|
34
|
+
puts <<-EOT
|
35
|
+
Your workspace has local modifications that are preventing the requested action
|
36
|
+
- run 'origen rc mods' to see them.
|
37
|
+
EOT
|
38
|
+
exit 1
|
39
|
+
end
|
40
|
+
get_release_type unless type
|
41
|
+
validate_branch
|
42
|
+
# For development tags always include the latest updates from everyone else,
|
43
|
+
# for production tag exactly what is in the user's workspace
|
44
|
+
if type == :development && !options[:no_fetch]
|
45
|
+
puts 'Fetching the latest version of all application files...'
|
46
|
+
Origen.app.rc.checkout(force: true)
|
47
|
+
end
|
48
|
+
Origen.app.listeners_for(:validate_release).each(&:validate_release)
|
49
|
+
lint_test
|
50
|
+
get_latest_version_files
|
51
|
+
base_version = Origen.app.version(refresh: true) # Read in the latest version
|
52
|
+
get_release_note unless note
|
53
|
+
new_version = get_or_confirm_version(type) # Don't mask this like the above!
|
54
|
+
write_version(new_version)
|
55
|
+
# Refresh the version in the current thread
|
56
|
+
Origen.app.version(refresh: true)
|
57
|
+
if Origen.app.version != new_version
|
58
|
+
fail "Sorry something has gone wrong trying to update the version counter to #{new_version}!"
|
59
|
+
end
|
60
|
+
Origen.app.version_tracker.add_version(Origen.app.version) if Origen.app.version.production?
|
61
|
+
write_history
|
62
|
+
Origen.app.listeners_for(:before_release_tag).each do |listener|
|
63
|
+
listener.before_release_tag(tag, note, type, selector, options)
|
64
|
+
end
|
65
|
+
puts "Tagging workspace, this could take a few minutes, don't interrupt..."
|
66
|
+
Origen.app.rc.checkin("#{version_file} #{history_file} Gemfile.lock", force: true, comment: 'Updated app version and history')
|
67
|
+
workspace_dirs.each do |wdir|
|
68
|
+
Origen.app.rc.tag tag
|
69
|
+
end
|
70
|
+
begin
|
71
|
+
Origen.client.release!
|
72
|
+
rescue
|
73
|
+
# Don't allow any server post errors to kill the release process
|
74
|
+
end
|
75
|
+
release_gem
|
76
|
+
Origen.app.listeners_for(:after_release_tag).each do |listener|
|
77
|
+
listener.after_release_tag(tag, note, type, selector, options)
|
78
|
+
end
|
79
|
+
# @mailer.send_release_notice(tag, note, type, selector) unless options[:silent]
|
80
|
+
Origen.app.listeners_for(:after_release_email).each do |listener|
|
81
|
+
listener.after_release_email(tag, note, type, selector, options)
|
82
|
+
end
|
83
|
+
puts "Successfully released version #{Origen.app.version}!"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
protected
|
88
|
+
|
89
|
+
def validate_branch
|
90
|
+
if Origen.app.rc.git?
|
91
|
+
if Origen.app.config.rc_workflow == :gitflow
|
92
|
+
if type == :development && Origen.app.rc.current_branch == 'master'
|
93
|
+
puts "Development releases can only be made on the develop branch, your current branch is: #{Origen.app.rc.current_branch}"
|
94
|
+
exit 1
|
95
|
+
elsif type == :production && Origen.app.rc.current_branch != 'master'
|
96
|
+
puts "Production releases can only be made on the master branch, your current branch is: #{Origen.app.rc.current_branch}"
|
97
|
+
exit 1
|
98
|
+
end
|
99
|
+
else
|
100
|
+
unless Origen.app.rc.current_branch == 'master'
|
101
|
+
puts "With Git you can only release onto the master branch, your current branch is: #{Origen.app.rc.current_branch}"
|
102
|
+
puts
|
103
|
+
puts 'If you want to use a Gitflow workflow you will be able to do development releases on the develop branch, to'
|
104
|
+
puts 'do that set config.rc_workflow = :gitflow in your config/application.rb'
|
105
|
+
puts
|
106
|
+
puts 'Otherwise, for release on a non-standard branch you will need to manage it yourself.'
|
107
|
+
exit 1
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def release_gem
|
114
|
+
if File.exist?(File.join Origen.root, "#{Origen.app.gem_name}.gemspec")
|
115
|
+
unless system 'rake gem:release'
|
116
|
+
puts '***************************************'.red
|
117
|
+
puts '***************************************'.red
|
118
|
+
puts 'SOMETHING WENT WRONG RELEASING THE GEM!'.red
|
119
|
+
puts '***************************************'.red
|
120
|
+
puts '***************************************'.red
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Run the lint test and require that it passes if enabled
|
126
|
+
def lint_test
|
127
|
+
if Origen.config.lint_test[:run_on_tag]
|
128
|
+
unless system('origen lint --no-correct')
|
129
|
+
puts ''
|
130
|
+
puts "Can't release due to lint/style errors, fix any errors from running 'origen lint' before trying again"
|
131
|
+
exit 1
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
# Sets the current release type
|
137
|
+
def type=(type)
|
138
|
+
type = type.to_s.chomp.downcase.to_sym
|
139
|
+
@type = self.class.valid_types.include?(type) ? type : nil
|
140
|
+
end
|
141
|
+
|
142
|
+
def type
|
143
|
+
@type ||= @options[:type]
|
144
|
+
end
|
145
|
+
|
146
|
+
# Sets the release note, returns nil if invalid
|
147
|
+
def note=(note)
|
148
|
+
if note.to_s =~ /[a-f]|[A-F]/
|
149
|
+
@note = note
|
150
|
+
else
|
151
|
+
@note = nil
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def note
|
156
|
+
@note ||= @options[:note]
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the selector, formatted as a string
|
160
|
+
def selector
|
161
|
+
"Branch: '#{Origen.app.rc.current_branch}'"
|
162
|
+
end
|
163
|
+
|
164
|
+
def version_file
|
165
|
+
File.join(Origen.root, 'config', 'version.rb')
|
166
|
+
end
|
167
|
+
|
168
|
+
def history_file
|
169
|
+
Origen.config.history_file
|
170
|
+
end
|
171
|
+
|
172
|
+
def workspace_dirs
|
173
|
+
dirs = ["#{Origen.root}"]
|
174
|
+
Origen.app.config.external_app_dirs.each do |edir|
|
175
|
+
dirs << edir
|
176
|
+
end
|
177
|
+
dirs
|
178
|
+
end
|
179
|
+
|
180
|
+
# Pull the latest versions of the history and version ID files into the workspace
|
181
|
+
def get_latest_version_files
|
182
|
+
# Get the latest version of the version and history files
|
183
|
+
if Origen.app.rc.dssc?
|
184
|
+
# Legacy code that makes use of the fact that DesignSync can handle different branch selectors
|
185
|
+
# for individual files, this capability has not been abstracted by the newer object oriented
|
186
|
+
# revision controllers since most others cannot do it
|
187
|
+
system "dssc co -get -force \"#{history_file};Trunk:Latest\" #{version_file}"
|
188
|
+
# Force the history selector to Trunk, only 1 branch of this file should ever exist
|
189
|
+
system "dssc setselector Trunk #{history_file}"
|
190
|
+
# Make sure both are writable
|
191
|
+
if Origen.running_on_windows?
|
192
|
+
`attrib -R #{history_file.gsub('/', '\\')} #{version_file.gsub('/', '\\')}`
|
193
|
+
else
|
194
|
+
`chmod 666 #{history_file} #{version_file}`
|
195
|
+
end
|
196
|
+
else
|
197
|
+
Origen.app.rc.checkout "#{history_file} #{version_file}", force: true
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
# Prompts the user to enter a release note
|
202
|
+
def get_release_note
|
203
|
+
puts ''
|
204
|
+
if @options[:note_file]
|
205
|
+
f = Origen.file_handler.clean_path_to(@options[:note_file])
|
206
|
+
else
|
207
|
+
f = "#{Origen.root}/release_note.txt"
|
208
|
+
end
|
209
|
+
if File.exist?(f)
|
210
|
+
lines = File.readlines(f)
|
211
|
+
puts 'HAPPY TO USE THIS RELEASE NOTE?:'
|
212
|
+
puts '------------------------------------------------------------------------------------------'
|
213
|
+
lines.each { |l| puts l }
|
214
|
+
puts '------------------------------------------------------------------------------------------'
|
215
|
+
if get_text(confirm: :return_boolean)
|
216
|
+
self.note = lines.join('')
|
217
|
+
return if note
|
218
|
+
end
|
219
|
+
end
|
220
|
+
puts 'RELEASE NOTE:'
|
221
|
+
self.note = get_text
|
222
|
+
unless note
|
223
|
+
puts 'Sorry but you must supply at least a minor description for this release!'
|
224
|
+
get_release_note
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# Prompts the user to enter a release type
|
229
|
+
def get_release_type
|
230
|
+
puts ''
|
231
|
+
puts "RELEASE TYPE (#{self.class.valid_types.join(', ')}):"
|
232
|
+
self.type = get_text(default: self.class.valid_types.first, single: true)
|
233
|
+
unless type
|
234
|
+
puts 'Sorry but that release type is not valid!'
|
235
|
+
get_release_type
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# Prompts the user to confirm the proposed version or enter a different one
|
240
|
+
def get_or_confirm_version(type)
|
241
|
+
proposed = nil
|
242
|
+
until version_unique?(proposed)
|
243
|
+
proposed ||= Origen.app.version
|
244
|
+
if type == :development
|
245
|
+
proposed = proposed.next_dev
|
246
|
+
else
|
247
|
+
proposed = proposed.next_prod(type)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
if Origen.config.semantically_version
|
251
|
+
puts
|
252
|
+
puts 'HAPPY TO RELEASE THIS VERSION?:'
|
253
|
+
unless get_text(default: proposed, confirm: :return_boolean)
|
254
|
+
valid = false
|
255
|
+
puts
|
256
|
+
until valid
|
257
|
+
puts
|
258
|
+
puts 'ENTER THE VERSION NUMBER YOU WOULD LIKE TO USE INSTEAD:'
|
259
|
+
proposed = Origen::VersionString.new(get_text(single: true).strip)
|
260
|
+
valid = proposed.semantic?
|
261
|
+
unless valid
|
262
|
+
puts 'SORRY BUT THAT IS NOT A VALID VERSION NUMBER'
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
else
|
267
|
+
valid = false
|
268
|
+
until valid
|
269
|
+
puts
|
270
|
+
puts 'RELEASE TAG:'
|
271
|
+
proposed = Origen::VersionString.new(get_text(default: proposed, single: true).strip)
|
272
|
+
valid = proposed.timestamp?
|
273
|
+
unless valid
|
274
|
+
puts 'SORRY BUT THAT IS NOT A VALID VERSION NUMBER'
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
proposed
|
279
|
+
end
|
280
|
+
|
281
|
+
def version_unique?(version)
|
282
|
+
if version
|
283
|
+
if version.semantic?
|
284
|
+
if Origen.app.rc.git?
|
285
|
+
!Origen.app.rc.tag_exists?(version.prefixed)
|
286
|
+
else
|
287
|
+
# Don't worry about dssc, since a single branch is used for the version it will
|
288
|
+
# always be unique
|
289
|
+
true
|
290
|
+
end
|
291
|
+
else
|
292
|
+
true
|
293
|
+
end
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
# For now apply a leading 'v' to keep design sync happy, will make this CM type
|
298
|
+
# specific in future
|
299
|
+
def tag
|
300
|
+
tag = Origen.app.version
|
301
|
+
if tag =~ /^\d/
|
302
|
+
"v#{tag}"
|
303
|
+
else
|
304
|
+
tag
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
# Write out details of the given version to the history file
|
309
|
+
def write_history
|
310
|
+
text = File.read(history_file) # Read the existing contents
|
311
|
+
File.open(history_file, 'w') do |file| # Write them back, substituting the version number as required
|
312
|
+
if Origen.app.version.production?
|
313
|
+
file.puts "<a class=\"anchor release_tag\" name=\"#{tag.gsub('.', '_')}\"></a>"
|
314
|
+
file.puts "<h1><a href=\"##{tag.gsub('.', '_')}\">Tag: #{tag}</a></h1>"
|
315
|
+
file.puts ''
|
316
|
+
file.puts "##### #{selector}".escape_underscores
|
317
|
+
file.puts ''
|
318
|
+
file.puts "##### by #{User.current.name} on #{time_now}"
|
319
|
+
file.puts ''
|
320
|
+
else
|
321
|
+
file.puts "<a class=\"anchor release_tag\" name=\"#{tag.gsub('.', '_')}\"></a>"
|
322
|
+
file.puts "<h2><a href=\"##{tag.gsub('.', '_')}\">Tag: #{tag}</a></h2>"
|
323
|
+
file.puts ''
|
324
|
+
file.puts "##### #{selector}".escape_underscores
|
325
|
+
file.puts ''
|
326
|
+
file.puts "##### by #{User.current.name} on #{time_now}"
|
327
|
+
file.puts ''
|
328
|
+
end
|
329
|
+
file.puts ''
|
330
|
+
file.puts note.escape_underscores
|
331
|
+
file.puts ''
|
332
|
+
file.puts text
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
# Sets the version number in the file store
|
337
|
+
def write_version(version)
|
338
|
+
if version.semantic?
|
339
|
+
Origen::CodeGenerators.invoke 'semver', [], config: { change: version }
|
340
|
+
else
|
341
|
+
Origen::CodeGenerators.invoke 'timever', [], config: { change: version }
|
342
|
+
end
|
343
|
+
system 'origen -v' # Invoke Origen under the new version, this updates Gemfile.lock
|
344
|
+
end
|
345
|
+
|
346
|
+
# Only allows admins to release
|
347
|
+
def authorized?
|
348
|
+
# Not sure yet if this concept can work in the open source world...
|
349
|
+
true
|
350
|
+
# if User.current.admin?
|
351
|
+
# true
|
352
|
+
# else
|
353
|
+
# puts "Sorry but you can't run the release script, please contact a development team member"
|
354
|
+
# false
|
355
|
+
# end
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
359
|
+
end
|