Class: Maven::Gwt::Generator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Maven::Gwt::Generator
- Includes:
- Thor::Actions
- Defined in:
- lib/maven/gwt/generator.rb
Instance Method Summary collapse
- #application_class_name ⇒ Object
- #application_name ⇒ Object
- #application_name_humanized ⇒ Object
- #base_package ⇒ Object
- #basedir ⇒ Object
- #camelize(str) ⇒ Object
- #clientdir ⇒ Object
- #layout ⇒ Object
- #setup(java_package, app_name = nil) ⇒ Object
Instance Method Details
#application_class_name ⇒ Object
56 57 58 |
# File 'lib/maven/gwt/generator.rb', line 56 def application_class_name @application_name ||= camelize( application_name ) end |
#application_name ⇒ Object
48 49 50 |
# File 'lib/maven/gwt/generator.rb', line 48 def application_name @application_name ||= File.basename( @basedir ) end |
#application_name_humanized ⇒ Object
52 53 54 |
# File 'lib/maven/gwt/generator.rb', line 52 def application_name_humanized @application_name_humanized ||= application_name.split( /_/ ).collect{ |p| p.capitalize }.join( ' ' ) end |
#base_package ⇒ Object
36 37 38 |
# File 'lib/maven/gwt/generator.rb', line 36 def base_package @base_package ||= @java_package + '.client' end |
#basedir ⇒ Object
40 41 42 |
# File 'lib/maven/gwt/generator.rb', line 40 def basedir @basedir ||= File.join( layout.java_root, *@java_package.split( /\./ ) ) end |
#camelize(str) ⇒ Object
60 61 62 |
# File 'lib/maven/gwt/generator.rb', line 60 def camelize( str ) str.split( "_" ).collect { |s| s.capitalize }.join end |
#clientdir ⇒ Object
44 45 46 |
# File 'lib/maven/gwt/generator.rb', line 44 def clientdir @clientdir ||= File.join( basedir, 'client' ) end |
#layout ⇒ Object
32 33 34 |
# File 'lib/maven/gwt/generator.rb', line 32 def layout @layout ||= Layout.new end |
#setup(java_package, app_name = nil) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/maven/gwt/generator.rb', line 64 def setup( java_package, app_name = nil ) @java_package = java_package @application_name = app_name template( 'Module.gwt.xml', "#{basedir}/#{application_class_name}.gwt.xml" ) template( 'ModuleDevelopment.gwt.xml', "#{basedir}/#{application_class_name}Development.gwt.xml" ) template( 'EntryPoint.java', "#{clientdir}/#{application_class_name}EntryPoint.java" ) template( 'Application.java', "#{clientdir}/#{application_class_name}Application.java" ) template( 'Application.ui.xml', "#{clientdir}/#{application_class_name}Application.ui.xml" ) template( 'index.html', 'public/index.html' ) template( 'gwt.css', "public/#{application_name}.css" ) end |