Class: OrigenAppGenerators::New
- Inherits:
-
Base
- Object
- Origen::CodeGenerators::Base
- Base
- OrigenAppGenerators::New
show all
- Includes:
- Origen::Utility::InputCapture
- Defined in:
- lib/origen_app_generators/new.rb
Instance Method Summary
collapse
Methods inherited from Base
#get_lastest_origen_version, #set_source_paths
Instance Method Details
#conclude ⇒ Object
57
58
59
60
61
62
63
64
65
|
# File 'lib/origen_app_generators/new.rb', line 57
def conclude
puts
puts "New generator created at: #{filelist[:generator][:dest]}"
puts
puts "Create any template files you need for this generator in: #{filelist[:templates_dir][:dest]}"
puts
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"
puts
end
|
#customize_doc_page ⇒ Object
Can’t compile this as contains some final ERB, so substitute instead
47
48
49
50
51
52
53
54
55
|
# File 'lib/origen_app_generators/new.rb', line 47
def customize_doc_page
file = filelist[:doc_info][:dest]
gsub_file file, 'TITLE_GOES_HERE', @title
if @type == :plugin
gsub_file file, 'INTRO_GOES_HERE', "This generates a customized version of the [Generic Plugin](<%= path 'origen_app_generators/plugin' %>)."
else
gsub_file file, 'INTRO_GOES_HERE', "This generates a customized version of the [Generic Application](<%= path 'origen_app_generators/application' %>)."
end
end
|
#enable ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/origen_app_generators/new.rb', line 24
def enable
module_declaration = /\nmodule OrigenAppGenerators/
inject_into_file 'lib/origen_app_generators.rb', "require 'origen_app_generators/#{@domain_namespace.underscore}/#{@classname.underscore}'\n",
before: module_declaration
if OrigenAppGenerators::AVAILABLE[@domain_summary]
existing_domain = /\s*('|")#{@domain_summary}('|") => \[\s*\n/
inject_into_file 'lib/origen_app_generators.rb', " OrigenAppGenerators::#{@domain_namespace}::#{@classname},\n",
after: existing_domain
else
new_domain = <<-END
'#{@domain_summary}' => [
OrigenAppGenerators::#{@domain_namespace}::#{@classname},
],
END
available_hash = /AVAILABLE = {\s*\n/
inject_into_file 'lib/origen_app_generators.rb', new_domain, after: available_hash
end
end
|
#generate_files ⇒ Object
20
21
22
|
# File 'lib/origen_app_generators/new.rb', line 20
def generate_files
build_filelist
end
|
Naming of this method is important here to override the default user input which does not apply to this generator
9
10
11
12
13
14
|
# File 'lib/origen_app_generators/new.rb', line 9
def get_common_user_input
get_domain
get_name
get_type
get_summary
end
|
#set_type ⇒ Object
16
17
18
|
# File 'lib/origen_app_generators/new.rb', line 16
def set_type
end
|