origen_app_generators 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/config/application.rb +146 -0
  3. data/config/commands.rb +75 -0
  4. data/config/environment.rb +1 -0
  5. data/config/users.rb +19 -0
  6. data/config/version.rb +8 -0
  7. data/lib/origen_app_generators/application.rb +62 -0
  8. data/lib/origen_app_generators/base.rb +201 -0
  9. data/lib/origen_app_generators/generic_application.rb +15 -0
  10. data/lib/origen_app_generators/generic_plugin.rb +15 -0
  11. data/lib/origen_app_generators/new.rb +137 -0
  12. data/lib/origen_app_generators/plugin.rb +39 -0
  13. data/lib/origen_app_generators/test_engineering/generic_test_block.rb +68 -0
  14. data/lib/origen_app_generators.rb +67 -0
  15. data/lib/tasks/app_generators.rake +50 -0
  16. data/lib/tasks/boot.rb +42 -0
  17. data/templates/app_generators/application/Gemfile +12 -0
  18. data/templates/app_generators/application/Rakefile +10 -0
  19. data/templates/app_generators/application/config/application.rb +110 -0
  20. data/templates/app_generators/application/config/commands.rb +76 -0
  21. data/templates/app_generators/application/config/environment.rb +4 -0
  22. data/templates/app_generators/application/config/users.rb +29 -0
  23. data/templates/app_generators/application/config/version.rb +8 -0
  24. data/templates/app_generators/application/doc/history +0 -0
  25. data/templates/app_generators/application/lib/app.rake +6 -0
  26. data/templates/app_generators/application/lib/module.rb +17 -0
  27. data/templates/app_generators/application/lib/top_level.rb +12 -0
  28. data/templates/app_generators/application/spec/spec_helper.rb +98 -0
  29. data/templates/app_generators/application/target/debug.rb +8 -0
  30. data/templates/app_generators/application/target/production.rb +9 -0
  31. data/templates/app_generators/application/templates/web/archive.md.erb +11 -0
  32. data/templates/app_generators/application/templates/web/contact.md.erb +36 -0
  33. data/templates/app_generators/application/templates/web/docs/environment/definitions.md.erb +17 -0
  34. data/templates/app_generators/application/templates/web/docs/environment/installation.md.erb +22 -0
  35. data/templates/app_generators/application/templates/web/docs/environment/introduction.md.erb +5 -0
  36. data/templates/app_generators/application/templates/web/index.md.erb +12 -0
  37. data/templates/app_generators/application/templates/web/layouts/_basic.html.erb +14 -0
  38. data/templates/app_generators/application/templates/web/layouts/_doc.html.erb +35 -0
  39. data/templates/app_generators/application/templates/web/partials/_navbar.html.erb +23 -0
  40. data/templates/app_generators/application/templates/web/references.md.erb +39 -0
  41. data/templates/app_generators/application/templates/web/release_notes.md.erb +5 -0
  42. data/templates/app_generators/new/generator.rb +78 -0
  43. data/templates/app_generators/new/info.md.erb +9 -0
  44. data/templates/app_generators/plugin/Gemfile +12 -0
  45. data/templates/app_generators/plugin/config/development.rb +12 -0
  46. data/templates/app_generators/plugin/gemspec.rb +36 -0
  47. data/templates/app_generators/plugin/templates/web/index.md.erb +60 -0
  48. data/templates/app_generators/plugin/templates/web/partials/_navbar.html.erb +22 -0
  49. data/templates/app_generators/test_engineering/generic_test_block/lib/interface.rb +6 -0
  50. data/templates/app_generators/test_engineering/generic_test_block/program/prb1.rb +9 -0
  51. data/templates/app_generators/test_engineering/generic_test_block/target/j750.rb +10 -0
  52. data/templates/app_generators/test_engineering/generic_test_block/target/ultraflex.rb +10 -0
  53. data/templates/app_generators/test_engineering/generic_test_block/target/v93k.rb +10 -0
  54. data/templates/web/_history.md +166 -0
  55. data/templates/web/archive.md.erb +11 -0
  56. data/templates/web/contact.md.erb +36 -0
  57. data/templates/web/docs/developers/creating.md.erb +290 -0
  58. data/templates/web/docs/environment/installation.md.erb +12 -0
  59. data/templates/web/docs/environment/introduction.md.erb +10 -0
  60. data/templates/web/example.md.erb +73 -0
  61. data/templates/web/index.md.erb +48 -0
  62. data/templates/web/layouts/_basic.html.erb +18 -0
  63. data/templates/web/layouts/_doc.html.erb +37 -0
  64. data/templates/web/origen_app_generators/application.md.erb +116 -0
  65. data/templates/web/origen_app_generators/plugin.md.erb +29 -0
  66. data/templates/web/origen_app_generators/test_engineering/generic_test_block.md.erb +16 -0
  67. data/templates/web/partials/_navbar.html.erb +22 -0
  68. data/templates/web/release_notes.md.erb +5 -0
  69. metadata +126 -0
@@ -0,0 +1,137 @@
1
+ module OrigenAppGenerators
2
+ class New < Base
3
+ include Origen::Utility::InputCapture
4
+
5
+ desc 'Creates a new application generator within this application'
6
+
7
+ # Naming of this method is important here to override the default user input which
8
+ # does not apply to this generator
9
+ def get_common_user_input
10
+ get_domain
11
+ get_name
12
+ get_type
13
+ get_summary
14
+ end
15
+
16
+ def set_type
17
+ # Type not applicable in for this generator
18
+ end
19
+
20
+ def generate_files
21
+ build_filelist
22
+ end
23
+
24
+ def enable
25
+ # Add require line
26
+ module_declaration = /\nmodule OrigenAppGenerators/
27
+ inject_into_file 'lib/origen_app_generators.rb', "require 'origen_app_generators/#{@domain_namespace.underscore}/#{@classname.underscore}'\n",
28
+ before: module_declaration
29
+
30
+ # Add to the AVAILABLE hash
31
+ if OrigenAppGenerators::AVAILABLE[@domain_summary]
32
+ existing_domain = /\s*('|")#{@domain_summary}('|") => \[\s*\n/
33
+ inject_into_file 'lib/origen_app_generators.rb', " OrigenAppGenerators::#{@domain_namespace}::#{@classname},\n",
34
+ after: existing_domain
35
+ else
36
+ new_domain = <<-END
37
+ '#{@domain_summary}' => [
38
+ OrigenAppGenerators::#{@domain_namespace}::#{@classname},
39
+ ],
40
+ END
41
+ available_hash = /AVAILABLE = {\s*\n/
42
+ inject_into_file 'lib/origen_app_generators.rb', new_domain, after: available_hash
43
+ end
44
+ end
45
+
46
+ # Can't compile this as contains some final ERB, so substitute instead
47
+ def customize_doc_page
48
+ file = filelist[:doc_info][:dest]
49
+ gsub_file file, 'TITLE_GOES_HERE', @title
50
+ if @type == :plugin
51
+ gsub_file file, 'INTRO_GOES_HERE', "This generates a customized version of the [Generic Plugin](<%= path 'origen_app_generators/plugin' %>)."
52
+ else
53
+ gsub_file file, 'INTRO_GOES_HERE', "This generates a customized version of the [Generic Application](<%= path 'origen_app_generators/application' %>)."
54
+ end
55
+ end
56
+
57
+ def conclude
58
+ puts
59
+ puts "New generator created at: #{filelist[:generator][:dest]}"
60
+ puts
61
+ puts "Create any template files you need for this generator in: #{filelist[:templates_dir][:dest]}"
62
+ puts
63
+ puts "Before you go add some documentation about what this generates to: templates/web/origen_app_generators/origen_app_generators/#{@domain_namespace.underscore}/#{@classname.underscore}.md.erb"
64
+ puts
65
+ end
66
+
67
+ protected
68
+
69
+ def existing_domains
70
+ OrigenAppGenerators::AVAILABLE.keys.map do |key|
71
+ key.sub(/ Engineering$/, '')
72
+ end
73
+ end
74
+
75
+ def get_summary
76
+ puts
77
+ puts 'DESCRIBE YOUR NEW GENERATOR IN A FEW WORDS'
78
+ puts
79
+ @summary = get_text(single: true)
80
+ @title = @summary.sub(/^An? /, '').titleize
81
+ end
82
+
83
+ def get_type
84
+ puts
85
+ puts 'WILL YOUR TEMPLATE GENERATE A PLUGIN OR A TOP-LEVEL APPLICATION?'
86
+ puts
87
+ type = get_text(single: true, accept: %w(application plugin)).downcase
88
+ @parentclass = type.capitalize
89
+ end
90
+
91
+ def get_name
92
+ puts
93
+ puts 'GIVE YOUR NEW GENERATOR CLASS A NAME'
94
+ puts
95
+ puts 'Your new generator needs a class name, this should be reasonably descriptive although it will not be displayed to end users'
96
+ puts 'Some examples: GenericTestBlock, IPBlock, MPGBOMApp'
97
+ puts
98
+ valid = false
99
+ until valid
100
+ @classname = get_text(single: true).split('::').last
101
+ unless @classname.empty?
102
+ if @classname.length >= 3
103
+ valid = valid_constant?("OrigenAppGenerators::#{@domain_namespace}::#{@classname}")
104
+ end
105
+ unless valid
106
+ puts 'That class name is not valid :-('
107
+ puts
108
+ end
109
+ end
110
+ end
111
+ @classname
112
+ end
113
+
114
+ def get_domain
115
+ puts
116
+ puts 'WHAT ENGINEERING DOMAIN WILL YOUR NEW APP TEMPLATE APPLY TO?'
117
+ puts
118
+ puts "Enter something like 'Test', 'Design', 'Product', etc."
119
+ puts
120
+ domain = get_text(single: true)
121
+ domain = domain.sub(/ Engineering$/i, '').titleize
122
+ @domain_summary = "#{domain} Engineering"
123
+ @domain_namespace = @domain_summary.gsub(' ', '')
124
+ end
125
+
126
+ def filelist
127
+ @filelist ||= {
128
+ generator: { source: 'generator.rb',
129
+ dest: "lib/origen_app_generators/#{@domain_namespace.underscore}/#{@classname.underscore}.rb" },
130
+ templates_dir: { dest: "templates/app_generators/#{@domain_namespace.underscore}/#{@classname.underscore}",
131
+ type: :directory },
132
+ doc_info: { source: 'info.md.erb',
133
+ dest: "templates/web/origen_app_generators/#{@domain_namespace.underscore}/#{@classname.underscore}.md.erb" }
134
+ }
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,39 @@
1
+ module OrigenAppGenerators
2
+ # The base generator class that should be used by all plugin generators
3
+ class Plugin < Application
4
+ def get_common_user_input
5
+ get_name_and_namespace
6
+ get_summary
7
+ get_revision_control
8
+ end
9
+
10
+ protected
11
+
12
+ # See Application#filelist for more details
13
+ def filelist
14
+ @filelist ||= begin
15
+ list = super
16
+ list.delete(:web_doc_layout)
17
+ list.delete(:web_references)
18
+ list.delete(:web_defintions)
19
+ list.delete(:web_installation)
20
+ list.delete(:web_introduction)
21
+ list[:config_development] = { source: 'config/development.rb' }
22
+ list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
23
+ list[:templates_shared] = { dest: 'templates/shared', type: :directory }
24
+ list
25
+ end
26
+ end
27
+
28
+ def get_summary
29
+ puts
30
+ puts 'DESCRIBE YOUR NEW PLUGIN IN A FEW WORDS'
31
+ puts
32
+ @summary = get_text(single: true)
33
+ end
34
+
35
+ def type
36
+ :plugin
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,68 @@
1
+ module OrigenAppGenerators
2
+ module TestEngineering
3
+ # Generates a generic plugin shell
4
+ class GenericTestBlock < Plugin
5
+ desc 'A generic test block'
6
+
7
+ def generate_files
8
+ @runtime_dependencies = [
9
+ ['origen_testers', '>= 0.3.0.pre35']
10
+ ]
11
+ build_filelist
12
+ end
13
+
14
+ def add_requires
15
+ prepend_to_file "lib/#{@name}.rb", "require 'origen_testers'\n"
16
+ end
17
+
18
+ def conclude
19
+ puts "New test block created at: #{destination_root}"
20
+ end
21
+
22
+ protected
23
+
24
+ # Defines the filelist for the generator, the default list is inherited from the
25
+ # parent class (Plugin).
26
+ # The filelist can contain references to generate files, directories or symlinks in the
27
+ # new application.
28
+ #
29
+ # Generally to make your generator more maintainable try and re-use as much as possible
30
+ # from the parent generator, this means that your generator will automatically stay up
31
+ # to date with the latest conventions
32
+ #
33
+ # The master templates live in templates/app_generators/plugin, but
34
+ # DO NOT MODIFY THESE FILES DIRECTLY.
35
+ # Either add or remove things post-generation in the modify_files method or copy the
36
+ # master file to the equivalent sub-directory of templates/app_generators/test_engineering/mpg_test_block
37
+ # which will override the version in the master directory.
38
+ #
39
+ # Additional files can be added or removed from the filelist as shown below.
40
+ def filelist
41
+ @filelist ||= begin
42
+ list = super # Always pick up the parent list
43
+ # Example of how to remove a file from the parent list
44
+ list.delete(:target_debug)
45
+ list.delete(:target_production)
46
+ # Example of how to add a file, in this case the file will be compiled and copied to
47
+ # the same location in the new app
48
+ list[:target_v93k] = { source: 'target/v93k.rb' }
49
+ list[:target_j750] = { source: 'target/j750.rb' }
50
+ list[:target_ultraflex] = { source: 'target/ultraflex.rb' }
51
+ list[:program_prb1] = { source: 'program/prb1.rb' }
52
+ list[:lib_interface] = { source: 'lib/interface.rb', dest: "lib/#{@name}/interface.rb" }
53
+ # Alternatively specifying a different destination, typically you would do this when
54
+ # the final location is dynamic
55
+ # list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
56
+ # Example of how to create a directory
57
+ list[:pattern_dir] = { dest: 'pattern', type: :directory }
58
+ # Example of how to create a symlink
59
+ list[:target_default] = { source: 'j750.rb', # Relative to the file being linked to
60
+ dest: 'target/default.rb', # Relative to destination_root
61
+ type: :symlink }
62
+ # Remember to return the final list
63
+ list
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,67 @@
1
+ require 'origen'
2
+ require 'colored'
3
+ require 'origen_app_generators/base'
4
+ require 'origen_app_generators/application'
5
+ require 'origen_app_generators/plugin'
6
+ require 'origen_app_generators/generic_application'
7
+ require 'origen_app_generators/generic_plugin'
8
+ require 'origen_app_generators/new'
9
+ require 'origen_app_generators/test_engineering/generic_test_block'
10
+
11
+ module OrigenAppGenerators
12
+ extend Origen::Utility::InputCapture
13
+
14
+ # If adding any new generators manually always add them at the top, but
15
+ # generally speaking don't, use 'rake new' to create a new generator instead
16
+ AVAILABLE = {
17
+ 'Test Engineering' => [
18
+ OrigenAppGenerators::TestEngineering::GenericTestBlock
19
+ ]
20
+ }
21
+
22
+ def self.invoke(path)
23
+ puts
24
+ puts 'CHOOSE AN ENGINEERING DOMAIN'
25
+ puts
26
+ puts "Domain specific application templates are available for the following areas (enter '0' to build a generic one)"
27
+ puts
28
+ i = 0
29
+ accept = [0]
30
+ puts '0 - Generic / Not listed'
31
+ AVAILABLE.reverse_each do |domain, _generators|
32
+ i += 1
33
+ accept << i
34
+ puts "#{i} - #{domain}"
35
+ end
36
+ puts
37
+ selection = get_text(single: true, default: '0', accept: accept).to_i
38
+ if selection == 0
39
+ puts
40
+ puts "WHAT TYPE OF APPLICATION DO YOU WANT TO BUILD? (if you don't know go with 'application')"
41
+ puts
42
+ type = get_text(single: true, default: 'application', accept: %w(application plugin)).downcase.to_sym
43
+
44
+ if type == :application
45
+ OrigenAppGenerators::GenericApplication.start [path]
46
+ else
47
+ OrigenAppGenerators::GenericPlugin.start [path]
48
+ end
49
+ else
50
+ domain = AVAILABLE.to_a
51
+ domain = domain[domain.size - selection]
52
+ puts
53
+ puts "CHOOSE FROM THE FOLLOWING #{domain[0].upcase} APPLICATION TEMPLATES"
54
+ puts
55
+ accept = []
56
+ i = 0
57
+ domain[1].reverse_each do |generator|
58
+ accept << i
59
+ puts "#{i} - #{generator.desc}"
60
+ i += 1
61
+ end
62
+ puts
63
+ selection = get_text(single: true, accept: accept).to_i
64
+ domain[1][domain[1].size - 1 - selection].start [path]
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,50 @@
1
+ desc 'Create an application generator'
2
+ task :new do
3
+ OrigenAppGenerators::New.start []
4
+ end
5
+
6
+ desc 'Test run the new app process'
7
+ task :test do
8
+ _delete_tmp_dir
9
+ _execute_generator(:invoke)
10
+ end
11
+
12
+ desc "Test run a specific generator: rake 'run[TestEngineering::GenericTestBlock]'"
13
+ task :run, [:generator_class] do |_t, args|
14
+ _delete_tmp_dir
15
+ begin
16
+ klass = eval(args[:generator_class])
17
+ rescue
18
+ klass = eval("OrigenAppGenerators::#{args[:generator_class]}")
19
+ end
20
+ _execute_generator(klass)
21
+ end
22
+
23
+ def _execute_generator(klass)
24
+ # With the generator identified this now launches it in a standalone shell
25
+ # This is to emulate how it will run in real life and cause it to fail if there are
26
+ # any dependencies on running within an Origen app environment
27
+
28
+ boot = "#{File.expand_path(File.dirname(__FILE__))}/boot.rb"
29
+ origen_lib = "#{Origen.top}/lib"
30
+ cmd = "#{boot} #{origen_lib} #{klass}"
31
+ cmd = "ruby #{cmd}" if Origen.running_on_windows?
32
+ # puts cmd
33
+ Bundler.with_clean_env do
34
+ system cmd
35
+ end
36
+ end
37
+
38
+ def _delete_tmp_dir
39
+ sh "rm -rf #{Origen.root}/tmp", verbose: false do |ok, _res|
40
+ # Sometimes vim can lock a dir if the file is being viewed, trying again will
41
+ # usually finish the job
42
+ unless ok
43
+ sh "rm -rf #{Origen.root}/tmp", verbose: false do |ok, _res|
44
+ unless ok
45
+ # I did my best!
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
data/lib/tasks/boot.rb ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ # This is used to boot the generator in an environment with no
3
+ # Origen application loaded.
4
+ # This emulates how it will run when generating an app and means
5
+ # that any unintended dependencies on a real app environment will
6
+ # be highlighted during test.
7
+
8
+ # Path to Origen lib dir must be supplied as first arg
9
+ $LOAD_PATH.unshift ARGV[0]
10
+ $LOAD_PATH.unshift "#{File.expand_path(File.dirname(__FILE__))}/../"
11
+
12
+ require 'fileutils'
13
+
14
+ # Prevent the bundle from loading by running this outside of the
15
+ if RUBY_PLATFORM == 'i386-mingw32'
16
+ tmp_dir = 'C:/tmp/origen_app_generators/new_app'
17
+ else
18
+ tmp_dir = '/tmp/origen_app_generators/new_app'
19
+ end
20
+ FileUtils.rm_rf tmp_dir if File.exist?(tmp_dir)
21
+ FileUtils.mkdir_p tmp_dir
22
+
23
+ begin
24
+ Dir.chdir tmp_dir do
25
+ require 'origen'
26
+ # For some reason this is not being defined by required origen anymore
27
+ User = Origen::Users::User unless defined? User
28
+ if RUBY_VERSION >= '2.0.0'
29
+ gem 'byebug', '~>3.5'
30
+ else
31
+ gem 'debugger', '~>1.6'
32
+ end
33
+ require 'origen_app_generators'
34
+ if ARGV[1] == 'invoke'
35
+ OrigenAppGenerators.invoke('tmp')
36
+ else
37
+ eval(ARGV[1]).start ['tmp']
38
+ end
39
+ end
40
+ ensure
41
+ system "mv #{tmp_dir}/tmp tmp"
42
+ end
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+ source 'http://origen-hub.am.freescale.net:9292'
3
+
4
+ gem "origen_core", ">= <%= @latest_origen_version %>"
5
+
6
+ gem "doc_helpers"
7
+
8
+ if RUBY_VERSION >= '2.0.0'
9
+ gem 'byebug', '~>3.5'
10
+ else
11
+ gem 'debugger', '~>1.6'
12
+ end
@@ -0,0 +1,10 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/app_tasks.rake, and they will automatically be available to Rake.
3
+
4
+ # Any task files found in lib/tasks/shared/*.rake will be available to other apps that
5
+ # include this app as a plugin
6
+
7
+ require "bundler/setup"
8
+ require "origen"
9
+
10
+ Origen.app.load_tasks
@@ -0,0 +1,110 @@
1
+ require 'origen'
2
+ class <%= @namespace %>Application < Origen::Application
3
+
4
+ # See http://origen.freescale.net/origen/latest/api/Origen/Application/Configuration.html
5
+ # for a full list of the configuration options available
6
+
7
+ # These attributes should never be changed, the duplication here will be resolved in future
8
+ # by condensing these attributes that do similar things
9
+ self.name = "<%= @name %>"
10
+ self.namespace = "<%= @namespace %>"
11
+ config.name = "<%= @name %>"
12
+ config.initials = "<%= @namespace %>"
13
+ config.vault = "<%= @vault %>"
14
+
15
+ # To enable deployment of your documentation to a web server (via the 'origen web'
16
+ # command) fill in these attributes. The example here is configured to deploy to
17
+ # the origen.freescale.net domain, which is an easy option if you don't have another
18
+ # server already in mind. To do this you will need an account on CDE and to be a member
19
+ # of the 'origen' group.
20
+ config.web_directory = "/proj/.web_origen/html/<%= @name %>"
21
+ config.web_domain = "http://origen.freescale.net/<%= @name %>"
22
+
23
+ # When false Origen will be less strict about checking for some common coding errors,
24
+ # it is recommended that you leave this to true for better feedback and easier debug.
25
+ # This will be the default setting in Origen v3.
26
+ config.strict_errors = true
27
+
28
+ # See: http://origen.freescale.net/origen/latest/guides/utilities/lint/
29
+ config.lint_test = {
30
+ # Require the lint tests to pass before allowing a release to proceed
31
+ run_on_tag: true,
32
+ # Auto correct violations where possible whenever 'origen lint' is run
33
+ auto_correct: true,
34
+ # Limit the testing for large legacy applications
35
+ #level: :easy,
36
+ # Run on these directories/files by default
37
+ #files: ["lib", "config/application.rb"],
38
+ }
39
+
40
+ config.semantically_version = true
41
+
42
+ # An example of how to set application specific LSF parameters
43
+ #config.lsf.project = "msg.te"
44
+
45
+ # An example of how to specify a prefix to add to all generated patterns
46
+ #config.pattern_prefix = "nvm"
47
+
48
+ # An example of how to add header comments to all generated patterns
49
+ #config.pattern_header do
50
+ # cc "This is a pattern created by the example origen application"
51
+ #end
52
+
53
+ # By default all generated output will end up in ./output.
54
+ # Here you can specify an alternative directory entirely, or make it dynamic such that
55
+ # the output ends up in a setup specific directory.
56
+ #config.output_directory do
57
+ # "#{Origen.root}/output/#{$dut.class}"
58
+ #end
59
+
60
+ # Similarly for the reference files, generally you want to setup the reference directory
61
+ # structure to mirror that of your output directory structure.
62
+ #config.reference_directory do
63
+ # "#{Origen.root}/.ref/#{$dut.class}"
64
+ #end
65
+
66
+ # This will automatically deploy your documentation after every tag
67
+ def after_release_email(tag, note, type, selector, options)
68
+ deployer = Origen.app.deployer
69
+ if deployer.running_on_cde? && deployer.user_belongs_to_origen?
70
+ command = "origen web compile --remote --api"
71
+ if Origen.app.version.production?
72
+ command += " --archive #{Origen.app.version.prefixed}"
73
+ end
74
+ Dir.chdir Origen.root do
75
+ system command
76
+ end
77
+ end
78
+ end
79
+
80
+ # Ensure that all tests pass before allowing a release to continue
81
+ #def validate_release
82
+ # if !system("origen specs") || !system("origen examples")
83
+ # puts "Sorry but you can't release with failing tests, please fix them and try again."
84
+ # exit 1
85
+ # else
86
+ # puts "All tests passing, proceeding with release process!"
87
+ # end
88
+ #end
89
+
90
+ # To enabled source-less pattern generation create a class (for example PatternDispatcher)
91
+ # to generate the pattern. This should return false if the requested pattern has been
92
+ # dispatched, otherwise Origen will proceed with looking up a pattern source as normal.
93
+ #def before_pattern_lookup(requested_pattern)
94
+ # PatternDispatcher.new.dispatch_or_return(requested_pattern)
95
+ #end
96
+
97
+ # If you use pattern iterators you may come across the case where you request a pattern
98
+ # like this:
99
+ # origen g example_pat_b0.atp
100
+ #
101
+ # However it cannot be found by Origen since the pattern name is actually example_pat_bx.atp
102
+ # In the case where the pattern cannot be found Origen will pass the name to this translator
103
+ # if it exists, and here you can make any substitutions to help Origen find the file you
104
+ # want. In this example any instances of _b\d, where \d means a number, are replaced by
105
+ # _bx.
106
+ #config.pattern_name_translator do |name|
107
+ # name.gsub(/_b\d/, "_bx")
108
+ #end
109
+
110
+ end
@@ -0,0 +1,76 @@
1
+ # This file should be used to extend the origen command line tool with tasks
2
+ # specific to your application.
3
+ # The comments below should help to get started and you can also refer to
4
+ # lib/origen/commands.rb in your Origen core workspace for more examples and
5
+ # inspiration.
6
+ #
7
+ # Also see the official docs on adding commands:
8
+ # http://origen.freescale.net/origen/latest/guides/custom/commands/
9
+
10
+ # Map any command aliases here, for example to allow 'origen ex' to refer to a
11
+ # command called execute you would add a reference as shown below:
12
+ aliases ={
13
+ # "ex" => "execute",
14
+ }
15
+
16
+ # The requested command is passed in here as @command, this checks it against
17
+ # the above alias table and should not be removed.
18
+ @command = aliases[@command] || @command
19
+
20
+ # Now branch to the specific task code
21
+ case @command
22
+
23
+ # Here is an example of how to implement a command, the logic can go straight
24
+ # in here or you can require an external file if preferred.
25
+ when "my_command"
26
+ puts "Doing something..."
27
+ require "commands/my_command" # Would load file lib/commands/my_command.rb
28
+ # You must always exit upon successfully capturing a command to prevent
29
+ # control flowing back to Origen
30
+ exit 0
31
+
32
+ ## Example of how to make a command to run unit tests, this simply invokes RSpec on
33
+ ## the spec directory
34
+ #when "specs"
35
+ # ARGV.unshift "spec"
36
+ # require "rspec"
37
+ # require "rspec/autorun"
38
+ # exit 0 # This will never be hit on a fail, RSpec will automatically exit 1
39
+
40
+ ## Example of how to make a command to run diff-based tests
41
+ #when "examples"
42
+ # Origen.load_application
43
+ # status = 0
44
+ #
45
+ # # Compiler tests
46
+ # ARGV = %w(templates/example.txt.erb -t debug -r approved)
47
+ # load "origen/commands/compile.rb"
48
+ # # Pattern generator tests
49
+ # #ARGV = %w(some_pattern -t debug -r approved)
50
+ # #load "#{Origen.top}/lib/origen/commands/generate.rb"
51
+ #
52
+ # if Origen.app.stats.changed_files == 0 &&
53
+ # Origen.app.stats.new_files == 0 &&
54
+ # Origen.app.stats.changed_patterns == 0 &&
55
+ # Origen.app.stats.new_patterns == 0
56
+ #
57
+ # Origen.app.stats.report_pass
58
+ # else
59
+ # Origen.app.stats.report_fail
60
+ # status = 1
61
+ # end
62
+ # puts
63
+ # exit status # Exit with a 1 on the event of a failure per std unix result codes
64
+
65
+ # Always leave an else clause to allow control to fall back through to the
66
+ # Origen command handler.
67
+ else
68
+ # You probably want to also add the your commands to the help shown via
69
+ # origen -h, you can do this be assigning the required text to @application_commands
70
+ # before handing control back to Origen. Un-comment the example below to get started.
71
+ # @application_commands = <<-EOT
72
+ # specs Run the specs (tests), -c will enable coverage
73
+ # examples Run the examples (tests), -c will enable coverage
74
+ # EOT
75
+
76
+ end
@@ -0,0 +1,4 @@
1
+ # This file will be loaded by Origen to boot your application, just leave it as
2
+ # is and modify lib/<%= @name %>.rb to load the additional resources that your
3
+ # application requires
4
+ require "<%= @name %>"
@@ -0,0 +1,29 @@
1
+ # This file defines the users associated with your project, it is basically the
2
+ # mailing list for release notes.
3
+ #
4
+ # You can split your users into "admin" and "user" groups, the main difference
5
+ # between the two is that admin users will get all tag emails, users will get
6
+ # emails on external/official releases only.
7
+ #
8
+ # Users are also prohibited from running the "origen rc tag" command, but this is
9
+ # really just to prevent a casual user from executing it inadvertently and is
10
+ # not intended to be a serious security gate.
11
+ module Origen
12
+ module Users
13
+ def users
14
+ @users ||= [
15
+
16
+ # Admins - Notified on every tag
17
+ User.new("<%= User.current.name %>", "<%= User.current.core_id %>", :admin),
18
+
19
+ # Users - Notified on official release tags only
20
+ #User.new("Stephen McGinty", "r49409"),
21
+ # The r-number attribute can be anything that can be prefixed to an
22
+ # @freescale.com email address, so you can add mailing list references
23
+ # as well like this:
24
+ #User.new("Origen Users", "origen"), # The Origen mailing list
25
+
26
+ ]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,8 @@
1
+ module <%= @namespace %>
2
+ MAJOR = 0
3
+ MINOR = 1
4
+ BUGFIX = 0
5
+ DEV = nil
6
+
7
+ VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
8
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ # You can define any Rake tasks to support your application here (or in any file
2
+ # ending in .rake in this directory).
3
+ #
4
+ # Rake (Ruby Make) is very useful for creating build scripts, see this short video
5
+ # for a quick introduction:
6
+ # http://railscasts.com/episodes/66-custom-rake-tasks