class Maven::Gwt::PomMagic

Public Instance Methods

ensure_mavenfile( dir ) click to toggle source
Calls superclass method
# 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.expand_path( 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 ) click to toggle source
Calls superclass method
# 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 ) click to toggle source
# 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 ) click to toggle source
# 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.expand_path( '.' )}/, '').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