Class: Maven::Gwt::PomMagic
- Inherits:
-
Jetty::PomMagic
- Object
- Jetty::PomMagic
- Maven::Gwt::PomMagic
- Defined in:
- lib/maven/gwt/pom_magic.rb
Instance Method Summary collapse
- #ensure_mavenfile(dir) ⇒ Object
- #ensure_web_xml(dir, proj) ⇒ Object
- #generate_pom(dir = '.', *args) ⇒ Object
- #gwt_module(layout) ⇒ Object
Instance Method Details
#ensure_mavenfile(dir) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/maven/gwt/pom_magic.rb', line 56 def ensure_mavenfile( dir ) unless File.exists?( File.join( dir, 'Mavenfile' ) ) layout = Layout.new( dir ) file = File.( gwt_module( layout ) ) gwt_module = file.sub( /#{layout.java_root}\/?/, '' ).sub( /.gwt.xml$/, '' ).gsub( /\//, '.') app_name = gwt_module.sub( /.*\./, '' ) unless File.exists?( File.join( layout.public_dir, app_name + ".html" ) ) app_name = 'index' end super dir, File.dirname( __FILE__ ), 'GWT_MODULE' => gwt_module, 'APP_NAME' => app_name, 'GWT_MODULE_NAME' => gwt_module.sub( /.*\./, '' ) end end |
#ensure_web_xml(dir, proj) ⇒ Object
69 70 71 |
# File 'lib/maven/gwt/pom_magic.rb', line 69 def ensure_web_xml( dir, proj ) super dir, proj, File.dirname( __FILE__ ), File.join( dir, 'public', 'WEB-INF', 'web.xml' ) end |
#generate_pom(dir = '.', *args) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/maven/gwt/pom_magic.rb', line 30 def generate_pom( dir = '.', *args ) proj = Maven::Tools::GemProject.new ensure_web_xml( dir, proj ) ensure_mavenfile( dir ) load_standard_files( dir, proj ) pom_xml( dir, proj, args ) end |
#gwt_module(layout) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/maven/gwt/pom_magic.rb', line 42 def gwt_module( layout ) gwt_module = layout.find_gwt_xml unless gwt_module path = layout.java_root.sub( /#{File.( '.' )}/, '').sub( /^\//, '' ) e = StandardError.new "no gwt module found in '#{path}'. try to run the command below to setup a minimal gwt application.\n\n\t\t#{File.basename( $0 )} setup JAVA_PACKAGE [APP_NAME]\n\n" def e.backtrace [] end raise e end gwt_module end |