Class: OrigenAppGenerators::OrigenInfrastructure::AppGeneratorPlugin

Inherits:
Plugin
  • Object
show all
Defined in:
lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb

Overview

Generates a generic application shell

Instance Method Summary collapse

Methods inherited from Plugin

#get_common_user_input

Methods inherited from Base

#get_common_user_input, #get_lastest_origen_version, #set_source_paths, #set_type

Constructor Details

#initialize(*args) ⇒ AppGeneratorPlugin

Returns a new instance of AppGeneratorPlugin.



7
8
9
10
11
# File 'lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb', line 7

def initialize(*args)
  @audience = :internal
  @validate_release_tests = ['origen app_gen:test --regression']
  super
end

Instance Method Details

#concludeObject



48
49
50
51
52
53
54
55
# File 'lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb', line 48

def conclude
  # Print out anything you think the user should know about their new application at the end
  puts "New app created at: #{destination_root}"
  puts
  puts 'Create your first generator by running this command within your new app:'
  puts '  origen app_gen:new'
  puts
end

#generate_filesObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb', line 23

def generate_files
  @runtime_dependencies = [
    ['origen_app_generators', ">= #{Origen.app!.version}"]
  ]
  @post_runtime_dependency_comments = [
    'DO NOT ADD ANY ADDITIONAL RUNTIME DEPENDENCIES HERE, WHEN THESE GENERATORS',
    'ARE INVOKED TO GENERATE A NEW APPLICATION IT WILL NOT BE LAUNCHED FROM WITHIN',
    'A BUNDLED ENVIRONMENT.',
    '',
    'THEREFORE GENERATORS MUST NOT RELY ON ANY 3RD PARTY GEMS THAT ARE NOT',
    'PRESENT AS PART OF A STANDARD ORIGEN INSTALLATION - I.E. YOU CAN ONLY RELY',
    'ON THE GEMS THAT ORIGEN ITSELF DEPENDS ON.'
  ]
  # Calling this will build all files, directories and symlinks contained in the
  # hash returned by the filelist method
  build_filelist
end

#get_user_inputObject

Any methods that are not protected will get invoked in the order that they are defined when the generator is run, method naming is irrelevant unless you want to override a method that is defined by the parent class



17
18
19
20
21
# File 'lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb', line 17

def get_user_input
  # The methods to get the common user input that applies to all applications will
  # get called at the start automatically, you have a chance here to ask any additional
  # questions that are specific to the type of application being generated
end

#modify_filesObject



41
42
43
44
45
46
# File 'lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb', line 41

def modify_files
  # If you want to modify any of the generated files you can do so now, you have access
  # to all of the Thor Action methods described here:
  # http://www.rubydoc.info/github/wycats/thor/Thor/Actions
  # See the enable method in lib/app_generators/new.rb for some examples of using these.
end