Class: Maven::Jetty::JettyProject
- Inherits:
-
Tools::GemProject
- Object
- Tools::GemProject
- Maven::Jetty::JettyProject
- Defined in:
- lib/maven/jetty/jetty_project.rb
Instance Method Summary collapse
- #add_defaults ⇒ Object
- #connector_xml ⇒ Object
-
#initialize(dir = '.') ⇒ JettyProject
constructor
A new instance of JettyProject.
- #load_gemfile(file) ⇒ Object
- #rails?(dir = '.') ⇒ Boolean
- #web_xml ⇒ Object
Constructor Details
#initialize(dir = '.') ⇒ JettyProject
Returns a new instance of JettyProject.
46 47 48 49 |
# File 'lib/maven/jetty/jetty_project.rb', line 46 def initialize( dir = '.') @dir = dir super *[] end |
Instance Method Details
#add_defaults ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/maven/jetty/jetty_project.rb', line 81 def add_defaults super self.properties.merge!({ "jetty.war" => "${project.build.directory}/${project.build.finalName}.war", "jetty.port" => '8080', "jetty.sslport" => '8443' }) self.properties[ 'rails.env' ] = 'development' if rails?( @dir ) plugin( :gem, "${jruby.plugins.version}" ).execute_goal( :initialize ) profile(:war).plugin("org.mortbay.jetty:jetty-maven-plugin", "${jetty.version}")do |jetty| = { :war => "${jetty.war}", :connectors => connector_xml } jetty.with end profile(:run) do |run| overrideDescriptor = rails?( @dir ) ? '${project.build.directory}/jetty/override-rails-${rails.env}-web.xml' : '${project.build.directory}/jetty/override-rack-web.xml' run.activation.by_default run.plugin("org.mortbay.jetty:jetty-maven-plugin", "${jetty.version}") do |jetty| = { :webAppConfig => { :overrideDescriptor => overrideDescriptor }, :systemProperties => { :systemProperty => { :name => 'jbundle.skip', :value => 'true' } }, :connectors => connector_xml, :webXml => web_xml, :webAppSourceDirectory => "." } jetty.with end end end |
#connector_xml ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/maven/jetty/jetty_project.rb', line 55 def connector_xml if File.exists?( File.join( @dir, 'src', 'test','resources','server.keystore' ) ) CONNECTOR_XML.sub( /..project.build.directory..jetty/, '${project.basedir}/src/test/resources' ) else CONNECTOR_XML end end |
#load_gemfile(file) ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/maven/jetty/jetty_project.rb', line 71 def load_gemfile(file) super file = file.path if file.is_a?(File) if File.exists? file gem 'bundler' #plugin( :bundler, "${jruby.plugins.version}" ).execute_goal( :install ) end super end |
#rails?(dir = '.') ⇒ Boolean
51 52 53 |
# File 'lib/maven/jetty/jetty_project.rb', line 51 def rails?( dir = '.' ) File.exists? File.join( dir, 'config', 'application.rb' ) end |
#web_xml ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/maven/jetty/jetty_project.rb', line 63 def web_xml if File.exists?( File.join( @dir, 'config', 'web.xml' ) ) File.join( @dir, 'config', 'web.xml' ) elsif File.exists?( File.join( @dir, 'web.xml' ) ) 'web.xml' end end |