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,10 @@
1
+ # The target file is run before *every* Origen operation and is used to instantiate
2
+ # the runtime environment - usually this means instantiating a top-level SoC or
3
+ # IP model.
4
+ #
5
+ # Naming is arbitrary but instances names should be prefixed with $ which indicates a
6
+ # global variable in Ruby, and this is required in order for the objects instantiated
7
+ # here to be visible throughout your application code.
8
+
9
+ $dut = <%= @namespace %>::TopLevel.new # Instantiate a DUT instance
10
+ $tester = Testers::UltraFLEX.new
@@ -0,0 +1,10 @@
1
+ # The target file is run before *every* Origen operation and is used to instantiate
2
+ # the runtime environment - usually this means instantiating a top-level SoC or
3
+ # IP model.
4
+ #
5
+ # Naming is arbitrary but instances names should be prefixed with $ which indicates a
6
+ # global variable in Ruby, and this is required in order for the objects instantiated
7
+ # here to be visible throughout your application code.
8
+
9
+ $dut = <%= @namespace %>::TopLevel.new # Instantiate a DUT instance
10
+ $tester = Testers::V93K.new
@@ -0,0 +1,166 @@
1
+ <a class="anchor release_tag" name="v0_4_5"></a>
2
+ <h1><a href="#v0_4_5">Tag: v0.4.5</a></h1>
3
+
4
+ ##### Branch: 'Trunk'
5
+
6
+ ##### by Stephen McGinty on 28-May-2015 08:52AM
7
+
8
+
9
+ Fixed generic plugin build
10
+
11
+ <a class="anchor release_tag" name="v0_4_4"></a>
12
+ <h1><a href="#v0_4_4">Tag: v0.4.4</a></h1>
13
+
14
+ ##### Branch: 'Trunk'
15
+
16
+ ##### by Stephen McGinty on 21-May-2015 07:56AM
17
+
18
+
19
+ Added pattern dir to generic test block
20
+
21
+ <a class="anchor release_tag" name="v0_4_3"></a>
22
+ <h1><a href="#v0_4_3">Tag: v0.4.3</a></h1>
23
+
24
+ ##### Branch: 'Trunk'
25
+
26
+ ##### by Stephen McGinty on 20-May-2015 08:56AM
27
+
28
+
29
+ Updates symlink handling and other patches to fix new app creation on Windows.
30
+
31
+ <a class="anchor release_tag" name="v0_4_2"></a>
32
+ <h1><a href="#v0_4_2">Tag: v0.4.2</a></h1>
33
+
34
+ ##### Branch: 'Trunk'
35
+
36
+ ##### by Stephen McGinty on 23-Apr-2015 09:50AM
37
+
38
+
39
+ Added Testers plugin and basic test program setup to the generic test block template
40
+
41
+ <a class="anchor release_tag" name="v0_4_1"></a>
42
+ <h1><a href="#v0_4_1">Tag: v0.4.1</a></h1>
43
+
44
+ ##### Branch: 'Trunk'
45
+
46
+ ##### by Stephen McGinty on 31-Mar-2015 04:12AM
47
+
48
+
49
+ Removed the code coverage boiler plate code in the generated config/commands.rb file, Origen
50
+ core now provides this and new apps don't need it.
51
+
52
+ <a class="anchor release_tag" name="v0_4_0"></a>
53
+ <h1><a href="#v0_4_0">Tag: v0.4.0</a></h1>
54
+
55
+ ##### Branch: 'Trunk'
56
+
57
+ ##### by Ronald Lajaunie on 08-Mar-2015 20:19PM
58
+
59
+
60
+ Added MPG Test Block plugin template.
61
+
62
+ <a class="anchor release_tag" name="v0_4_0_pre0"></a>
63
+ <h2><a href="#v0_4_0_pre0">Tag: v0.4.0.pre0</a></h2>
64
+
65
+ ##### Branch: 'Trunk'
66
+
67
+ ##### by Corey Engelken on 24-Feb-2015 13:32PM
68
+
69
+
70
+ Added first version of the MPG BOM Application generator.
71
+
72
+ <a class="anchor release_tag" name="v0_3_5"></a>
73
+ <h1><a href="#v0_3_5">Tag: v0.3.5</a></h1>
74
+
75
+ ##### Branch: 'Trunk'
76
+
77
+ ##### by Stephen McGinty on 19-Feb-2015 05:33AM
78
+
79
+
80
+ Added debugger gems to Gemfile templates
81
+
82
+ <a class="anchor release_tag" name="v0_3_4"></a>
83
+ <h1><a href="#v0_3_4">Tag: v0.3.4</a></h1>
84
+
85
+ ##### Branch: 'Trunk'
86
+
87
+ ##### by Stephen McGinty on 15-Jan-2015 05:51AM
88
+
89
+
90
+ All plugins now come with a templates/shared directory
91
+
92
+ <a class="anchor release_tag" name="v0_3_3"></a>
93
+ <h1><a href="#v0_3_3">Tag: v0.3.3</a></h1>
94
+
95
+ ##### Branch: 'Trunk'
96
+
97
+ ##### by Stephen McGinty on 15-Jan-2015 04:57AM
98
+
99
+
100
+ Patch to all plugin generators to require config/application.rb from the main plugin
101
+ require file (lib/plugin\_name.rb).
102
+ This is required for Origen to identify that the given gem is an Origen plugin, it is not
103
+ required for top-level applications where Origen will automatically load
104
+ config/application.rb
105
+
106
+ <a class="anchor release_tag" name="v0_3_2"></a>
107
+ <h1><a href="#v0_3_2">Tag: v0.3.2</a></h1>
108
+
109
+ ##### Branch: 'Trunk'
110
+
111
+ ##### by Stephen McGinty on 15-Jan-2015 03:27AM
112
+
113
+
114
+ Fixed the generated wild card require code in lib/app\_name.rb to work correctly in the
115
+ case of a plugin being used by another app.
116
+
117
+ <a class="anchor release_tag" name="v0_3_1"></a>
118
+ <h1><a href="#v0_3_1">Tag: v0.3.1</a></h1>
119
+
120
+ ##### Branch: 'Trunk'
121
+
122
+ ##### by Stephen McGinty on 09-Jan-2015 05:11AM
123
+
124
+
125
+ New apps will now start from version 0.1.0, this is to avoid Bundler issues with
126
+ pre-release
127
+ tags of 0.0.0.
128
+
129
+ Updated the plugin web template to give a better install instruction.
130
+
131
+ <a class="anchor release_tag" name="v0_3_0"></a>
132
+ <h1><a href="#v0_3_0">Tag: v0.3.0</a></h1>
133
+
134
+ ##### Branch: 'Trunk'
135
+
136
+ ##### by Stephen McGinty on 11-Dec-2014 06:57AM
137
+
138
+
139
+ Added a generator and rake task (rake new) to create a new generator within this application and
140
+ documentation on how to create a new generator.
141
+
142
+ The generator selection process now supports domain specific generators.
143
+
144
+ Added a generic test block generator as an initial example of a domain specific generator.
145
+
146
+ <a class="anchor release_tag" name="v0_2_0"></a>
147
+ <h1><a href="#v0_2_0">Tag: v0.2.0</a></h1>
148
+
149
+ ##### Branch: 'Trunk'
150
+
151
+ ##### by Stephen McGinty on 08-Dec-2014 10:55AM
152
+
153
+
154
+ Added initial 2.5.0 compatible plugin shell
155
+
156
+ <a class="anchor release_tag" name="v0_1_0"></a>
157
+ <h1><a href="#v0_1_0">Tag: v0.1.0</a></h1>
158
+
159
+ ##### Branch: 'Trunk'
160
+
161
+ ##### by Stephen McGinty on 05-Dec-2014 11:21AM
162
+
163
+
164
+ Initial release with a working generic application builder
165
+
166
+
@@ -0,0 +1,11 @@
1
+ % render "layouts/basic.html", tab: :archive, yammer_comments: false do
2
+
3
+ # Archive
4
+
5
+ Documentation from previous releases is available via the links below:
6
+
7
+ % Origen.app.versions.reverse_each do |version|
8
+ * [<%= version %>](<%= Origen.app.config.web_domain %>/<%= version.gsub(".", "_") %>)
9
+ % end
10
+
11
+ % end
@@ -0,0 +1,36 @@
1
+ % render "layouts/basic.html", tab: :contact, yammer_comments: false do
2
+
3
+ # Contact Us
4
+
5
+ The following engineers can be contacted about this application:
6
+
7
+ % Origen.app.developers.each do |user|
8
+ * [<%= user.name %>](http://freeshare.freescale.net:2222/my/Person.aspx?accountname=fsl\<%= user.r_number %>)
9
+ % end
10
+
11
+ %# An example of how to write a contact page:
12
+ %#Please use PDM For any bug reports or change/feature requests:
13
+ %#
14
+ %#* [C90TFS_NVM_tester on PDM](http://designpdm.freescale.net/Agile/PLMServlet?fromPCClient=true&module=PartFamilyHandler&requestUrl=module%3DPartFamilyHandler%26opcode%3DdisplayObject%26classid%3D2000004409%26objid%3D17718323%26tabid%3D2%26)
15
+ %#
16
+ %#For test related issues you can contact:
17
+ %#
18
+ %#* [Stephen McGinty](http://freeshare.freescale.net:2222/my/Person.aspx?accountname=fsl\r49409)
19
+ %#* [Thao Huynh](http://freeshare.freescale.net:2222/my/Person.aspx?accountname=fsl%5CR6AANF)
20
+ %#
21
+ %#For product/yield issues contact:
22
+ %#
23
+ %#* [Andrew Hardell](http://freeshare.freescale.net:2222/my/Person.aspx?accountname=fsl%5CR12635)
24
+ %#* [Eddie Lepore](http://freeshare.freescale.net:2222/my/Person.aspx?accountname=fsl%5CB06626)
25
+ %#
26
+ %#The manager of this project is:
27
+ %#
28
+ %#* [Wendy Malloch](http://freeshare.freescale.net:2222/my/Person.aspx?accountname=fsl%5CTTZ231)
29
+ %#
30
+ %#
31
+ %#Finally if you are not sure who to contact, or if your question may have device/reliability
32
+ %#implications, then you can use the Split Gate Flash Test and Reliability mailing list:
33
+ %#
34
+ %#* [Email SGFTANDR](mailto:SGFTANDR@freescale.com)
35
+
36
+ % end
@@ -0,0 +1,290 @@
1
+ % render "../../layouts/doc.html" do
2
+
3
+ This document outlines the process for creating a new application generator.
4
+
5
+ ### Background
6
+
7
+ This plugin uses a code generator API from Origen core which itself leans heavily on a 3rd party gem library called
8
+ Thor. This gem is used quite widely in the Ruby community for this kind of thing, not least by the code generators
9
+ provided by the Ruby on Rails platform.
10
+
11
+ The code generator API allows the user to do things like:
12
+
13
+ * Run code to collect user input
14
+ * Compile templates to produce dynamic output based on the user's responses
15
+ * Copy files verbatim
16
+ * Create directories and symlinks
17
+ * Delete and inject lines into existing files
18
+
19
+ Each application type that can be generated by this plugin is an example of a code generator.
20
+
21
+ The code new application generators are organized into the following hierarchy:
22
+
23
+ ~~~text
24
+ OrigenAppGenerators::Base
25
+ |
26
+ -> OrigenAppGenerators::Application
27
+ |
28
+ -> OrigenAppGenerators::Plugin
29
+ ~~~
30
+
31
+ **All additional generators within this application must be a subclass of either <code>OrigenAppGenerators::Application</code>
32
+ or <code>OrigenAppGenerators::Plugin</code> depending on whether the end application is intended to be a plugin or not.**
33
+
34
+ The new application generators should all perform the following functions:
35
+
36
+ * Prompt the user with some questions to get the new application name and so on
37
+ * Create the new application files by either copying or compiling source files and creating
38
+ symlinks or directories as required
39
+ * Make any final modifications to the resulting files
40
+ * Display any information that the user should know about their new application
41
+
42
+ #### Generator Execution
43
+
44
+ When a generator is executed any methods defined in it will be called in the order that they are
45
+ defined.
46
+ Any methods that are marked as <code>protected</code> will not be called.
47
+
48
+ For example when the following generator is executed:
49
+
50
+ ~~~ruby
51
+ module OrigenAppGenerators
52
+ class MyAppGenerator < Application
53
+ def say_hello
54
+ puts "Hello"
55
+ end
56
+
57
+ def call_a_helper
58
+ puts "About to call"
59
+ a_helper_method
60
+ puts "Returned from call"
61
+ end
62
+
63
+ protected
64
+
65
+ def a_helper_method
66
+ puts "Helper method called!"
67
+ end
68
+
69
+ def this_does_nothing
70
+ puts "Another method called!"
71
+ end
72
+ end
73
+ end
74
+ ~~~
75
+
76
+ Then you would see this:
77
+
78
+ ~~~text
79
+ Hello
80
+ About to call
81
+ Helper method called!
82
+ Returned from call
83
+ ~~~
84
+
85
+ Note that any methods defined by the parent class will get called first. In this application the
86
+ parent <code>Application</code> and <code>Plugin</code> classes implement a method to get the user
87
+ input that will be common to all applications.
88
+
89
+ You can disable this behavior if required by re-defining the relevant methods within the child generator class.
90
+
91
+ #### Source Files
92
+
93
+ All template or static source files for the generators live in <code>templates/app_generators/</code> and from
94
+ there in sub folders based on the name of the particular generator.
95
+
96
+ All path references to source files made in your generator should be relative to its source file folder, and in
97
+ practice what this means is that if you want to refer to the source file of what will become
98
+ <code>Origen.root/config/application.rb</code> then you just refer to <code>config/application.rb</code>.
99
+
100
+ When looking for a particular source file the generator will search in the various source directories
101
+ belonging to your generator's parent classes.
102
+ For example let's say you make a test engineering generator that has the following class hierarchy:
103
+
104
+ ~~~text
105
+ OrigenAppGenerators::Base
106
+ |
107
+ -> OrigenAppGenerators::Application
108
+ |
109
+ -> OrigenAppGenerators::Plugin
110
+ |
111
+ -> OrigenAppGenerators::TestEngineering::TestBlock
112
+ ~~~
113
+
114
+ Then the following source paths will be searched in this order:
115
+
116
+ ~~~text
117
+ templates/app_generators/test_engineering/test_block
118
+ templates/app_generators/plugin
119
+ templates/app_generators/application
120
+ ~~~
121
+
122
+ This means that if you create a file called <code>config/application.rb</code> within
123
+ <code>templates/app_generators/test_engineering/test_block</code> then this will override the corresponding
124
+ file from the plugin sources and which would itself override the same file from the application sources.
125
+
126
+ However see the warning in [The Filelist](<%= path "docs/developers/creating#The_Filelist" %>) section below before doing this!
127
+
128
+ ### Creating a New Generator
129
+
130
+ A rake task is provided to create a new generator, run it as follows:
131
+
132
+ ~~~text
133
+ rake new
134
+ ~~~
135
+
136
+ ### Lean Environment
137
+
138
+ When the generator is run by a user to generate a new application, it will not run within the scope of an
139
+ Origen application.
140
+ This means that any references to <code>Origen.app</code> within the generator code are meaningless and will
141
+ result in an error.
142
+
143
+ Furthermore because there is no application there is also no associated gem bundle, so the generator must
144
+ be able to run within the lean Ruby environment that is used to boot Origen. In practice what this means is
145
+ that you can use any gems that Origen itself relies on (these will be installed in the base Ruby installation),
146
+ but you cannot use any others.
147
+
148
+ The rake tasks provided for testing your new generator will run it within the lean environment, so if it
149
+ works there you can be confident that it will also run in production.
150
+
151
+ ### The Filelist
152
+
153
+ Each generator should return the list of files to be created in the new application via its
154
+ <code>filelist</code> method.
155
+ If you don't make any changes to this then it will simply inherit the list of files defined
156
+ by the generator's parent class.
157
+
158
+ The filelist is also used to define any directories or symlinks that should be created.
159
+ The generator class created by the <code>rake new</code> task contains a commented example of how to add or
160
+ remove the various elements from the filelist.
161
+
162
+ Some application generators may not make any changes to the filelist and will simply augment
163
+ the basic application/plugin shell by adding additional code to some of the existing files.
164
+
165
+ This can be done by either overriding the source file by defining it in the generator's own
166
+ source directory, or by [post-modifying](<%= path "docs/developers/creating#Post_Generation_Modifications" %>)
167
+ the files after the filelist has been rendered.
168
+
169
+ <div class="alert">
170
+ <strong>Warning!</strong> While it is tempting (and easier) to simply copy a source file and then
171
+ edit it as required for your target application, this will make your generator harder to maintain as it
172
+ will not automatically pick up changes and improvements to the master templates that will occur over time.
173
+ Therefore it is always preferable to post-modify the file to delete sections or to modify or add additional code
174
+ whenever possible.
175
+ </div>
176
+
177
+ **Note that developers should not add logic to the application/plugin master source files to
178
+ implement generator specific output. This approach is not scalable as in the future this plugin
179
+ is expected to support many different application types.**
180
+
181
+ Instead individual generators must either completely override or post-modify the master files
182
+ as appropriate.
183
+
184
+ #### Templates
185
+
186
+ All files in the file list will be compiled unless explicitly marked with <code>copy: true</code>
187
+ or if the destination file name ends in <code>.erb</code>.
188
+
189
+ ERB markup can be used the same way as in regular Origen templates with the following exceptions:
190
+
191
+ Whole line Ruby is not enabled (a limitation imposed by Thor), therefore instead of this:
192
+
193
+ ~~~eruby
194
+ <%= "%" %> if x_is_true
195
+ Include something
196
+ <%= "%" %> end
197
+ ~~~
198
+
199
+ You must do:
200
+
201
+ ~~~eruby
202
+ <%= "<" + "% if x_is_true -%" + ">" %>
203
+ Include something
204
+ <%= "<" + "% end -%" + ">" %>
205
+ ~~~
206
+
207
+ Access to variables collected by your generator at runtime is done by assigning them to instance
208
+ variables (instead of the options hash used by the Origen compiler).
209
+
210
+ So for example if you have your user input a product name, then you should assign that to an
211
+ instance variable:
212
+
213
+ ~~~ruby
214
+ @product_name = get_product_name
215
+ ~~~
216
+
217
+ Then in the template:
218
+
219
+ ~~~eruby
220
+ The product name is <%= "<" + "%= @product_name %" + ">" %>
221
+ ~~~
222
+
223
+ By convention templates in this plugin do not end in <code>.erb</code> and this is reserved
224
+ for files that would become <code>.erb</code> files in the end application.
225
+
226
+ ### Post Generation Modifications
227
+
228
+ It is better to customize any files that are common to all applications
229
+ by post modification rather than by completely overriding the entire file.
230
+
231
+ To do this you have access to the Thor Action methods described here:
232
+ [Thor Action API](http://www.rubydoc.info/github/wycats/thor/Thor/Actions)
233
+
234
+ You can see some examples of these being used in the <code>enable</code> method in
235
+ <code>lib/app_generators/new.rb</code> where they are used to add the new generator details
236
+ to <code>lib/origen_app_generators.rb</code>.
237
+
238
+ As a quick example say you wanted to add a method to <code>config/application.rb</code>, this
239
+ could be achieved by injecting it at the end of the class like this:
240
+
241
+ ~~~ruby
242
+ # Always ensure the filelist has been rendered first
243
+ def generate_files
244
+ build_filelist
245
+ end
246
+
247
+ # Add a custom domain method to config/application.rb
248
+ def add_method_to_application
249
+ # Define a regular expression to define a point in the file where you want to inject, in this
250
+ # case the 'end' of the class definition (the only 'end' that occurs at the beginning of a line)
251
+ end_of_class = /^end/
252
+ # Define the code snippet
253
+ code = <<-END
254
+ def some_domain_specific_method
255
+ do_something
256
+ end
257
+ END
258
+ # Now inject it
259
+ inject_into_file "config/application.rb", code, before: end_of_class
260
+ end
261
+ ~~~
262
+
263
+ ### Documentation
264
+
265
+ The rake task will create a documentation file for your new generator in
266
+ <code>templates/web/origen_app_generators/</code> and this should be used to document
267
+ any information about the new application shell that your target audience might find useful.
268
+
269
+ This page will be automatically linked to from the [OrigenAppGenerators Homepage](<%= path "/" %>)
270
+ when it is next released.
271
+
272
+ ### Testing the Generator
273
+
274
+ Rake tasks are provided to test your new generator, to run the <code>origen new</code> command as
275
+ it would appear to your audience run <code>rake test</code>.
276
+
277
+ Alternatively to skip the first section that selects the required generator you can run
278
+ <code>rake 'run[TestEngineering::TestBlock]'</code>, substituting the class name for that of
279
+ your new generator.
280
+
281
+ In both cases the new application will be built in <code>tmp/</code> and you can cd into
282
+ that and run it to see if everything works.
283
+
284
+ ### Releasing the Generator
285
+
286
+ To release the generator simply release a new production version of this plugin, the
287
+ <code>origen new</code> command will automatically check for and run the latest production version
288
+ of it every time it is invoked.
289
+
290
+ % end
@@ -0,0 +1,12 @@
1
+ % render "layouts/doc.html" do
2
+
3
+ Execute the following commands to create a development workspace:
4
+
5
+ ~~~
6
+ mkdir <%= Origen.app.name %>
7
+ cd <%= Origen.app.name %>
8
+ dssc setvault <%= Origen.config.vault %> .
9
+ dssc pop -rec -uni -force -get -ver <%= Origen.app.version %> .
10
+ ~~~
11
+
12
+ % end
@@ -0,0 +1,10 @@
1
+ % render "layouts/doc.html" do
2
+
3
+ This documentation is primarily aimed at engineers who want to either create a new shell generator
4
+ or to maintain or modify an existing one.
5
+
6
+ All of the user facing documentation is contained on the [Home page](<%= path "/" %>) and
7
+ which includes links to any shell specific information that has been provided by the
8
+ shell authors.
9
+
10
+ % end
@@ -0,0 +1,73 @@
1
+ % render "layouts/basic.html" do
2
+
3
+ %# HTML tags can be embedded in mark down files if you want to do specific custom
4
+ %# formatting like this, but in most cases that is not required.
5
+ <h1><%= Origen.config.name %> <span style="font-size: 14px">(<%= Origen.app.version %>)</span></h1>
6
+
7
+ Welcome to your application's documentation...
8
+
9
+ Here are some pointers to get you started with writing Origen documents:
10
+
11
+ ### Markdown
12
+
13
+ Most of your documents (such as this one you are reading) will be written in Markdown. This
14
+ allows you to create good looking and well formatted web-based documents easily and without
15
+ having to know anything about HTML.
16
+
17
+ Origen uses the Kramdown library to process the Markdown, this has a good quick reference
18
+ guide on the Markdown syntax here: [Markdown Quick Reference](http://kramdown.rubyforge.org/quickref.html)
19
+
20
+ ### Links
21
+
22
+ Links can be added to your documents easily, like this one for example:
23
+
24
+ * [Freescale](http://www.freescale.com)
25
+
26
+ For linking to other pages within your own documents it is recommended that you use the
27
+ 'path' helper to generate the url. By doing this Origen should generate links that work
28
+ correctly for both serving documents locally when developing and when deploying to a remote
29
+ web server. Here is an example:
30
+
31
+ * [Docs](<%= path "/docs/environment/introduction" %>)
32
+
33
+ ### Code Examples
34
+
35
+ In the course of writing documentation you will probably want to show code examples
36
+ from time to time. Generic code snippets can be easily formatted with a mono-spaced
37
+ font like this:
38
+
39
+ ~~~
40
+ origen t debug
41
+ origen g list/production.list
42
+ ~~~
43
+
44
+ If you are showing examples of Ruby then they can be easily syntax-highlighted for
45
+ better presentation:
46
+
47
+ ~~~ruby
48
+ # Cool, this is easy
49
+ def some_ruby
50
+ @blah = Blah.new
51
+ end
52
+ ~~~
53
+
54
+ Origen uses the Coderay library for syntax highlighting and therefore should in theory
55
+ be able to highlight all languages listed here: [CodeRay Syntax Highlighting](http://coderay.rubychan.de/)
56
+
57
+ ### Custom HTML
58
+
59
+ You may occasionally wish to have low level control of your documentation's HTML, this
60
+ can be done by simply embedding the HTML directly alongside the Markdown.
61
+
62
+ Origen already uses the [Twitter Bootstrap](http://twitter.github.io/bootstrap/index.html)
63
+ framework to generate these documents, so you already have full access to the features
64
+ provided by that framework.
65
+
66
+ For example here is how to insert a [Bootstrap alert](http://twitter.github.io/bootstrap/components.html#alerts):
67
+
68
+ <div class="alert">
69
+ <button type="button" class="close" data-dismiss="alert">&times;</button>
70
+ <strong>Warning!</strong> This example was just copied directly from the bootstrap documentation!
71
+ </div>
72
+
73
+ % end
@@ -0,0 +1,48 @@
1
+ % render "layouts/basic.html" do
2
+
3
+ %# HTML tags can be embedded in mark down files if you want to do specific custom
4
+ %# formatting like this, but in most cases that is not required.
5
+ <h1><%= Origen.app.namespace %> <span style="font-size: 14px">(<%= Origen.app.version %>)</span></h1>
6
+
7
+ ### Introduction
8
+
9
+ This plugin is used by Origen Core to generate new application shells via the <code>origen new</code>
10
+ command.
11
+
12
+ As well as providing generic plugin and application shells many customized builds for a particular
13
+ engineering domain, function, or business group are available to.
14
+
15
+ ### How to Use
16
+
17
+ Run the <code>origen new</code> command outside of an application workspace, this will automatically
18
+ run the latest production release of this plugin to generate the new application:
19
+
20
+ ~~~text
21
+ origen new my_app_name
22
+ ~~~
23
+
24
+ If you want to use a pre-release or older version of the generator a version can be specified
25
+ like this:
26
+
27
+ ~~~text
28
+ origen new my_app_name --version 0.1.0
29
+ ~~~
30
+
31
+ ### Available Application Shells
32
+
33
+ The following application shells are currently available, click the links to see any specific
34
+ information that the shell author has provided:
35
+
36
+ * [Generic Application](<%= path "origen_app_generators/application" %>)
37
+ * [Generic Plugin](<%= path "origen_app_generators/plugin" %>)
38
+
39
+ % OrigenAppGenerators::AVAILABLE.reverse_each do |domain, generators|
40
+ #### <%= domain %>
41
+
42
+ % generators.reverse_each do |generator|
43
+ * [<%= generator.desc %>](<%= path generator.to_s.underscore %>)
44
+ % end
45
+
46
+ % end
47
+
48
+ % end