gwt-run 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +47 -0
  3. data/bin/gwt +98 -0
  4. data/bin/gwt~ +97 -0
  5. data/bin/jetty-run~ +84 -0
  6. data/lib/gwt-run.rb +21 -0
  7. data/lib/gwt-run.rb~ +1 -0
  8. data/lib/gwt_run.rb +21 -0
  9. data/lib/gwt_run.rb~ +1 -0
  10. data/lib/jetty-run.rb~ +1 -0
  11. data/lib/jetty_run.rb~ +1 -0
  12. data/lib/maven/gwt/Mavenfile +68 -0
  13. data/lib/maven/gwt/Mavenfile~ +62 -0
  14. data/lib/maven/gwt/cli.rb +34 -0
  15. data/lib/maven/gwt/cli.rb~ +14 -0
  16. data/lib/maven/gwt/generator.rb +86 -0
  17. data/lib/maven/gwt/generator.rb~ +62 -0
  18. data/lib/maven/gwt/jetty_project.rb~ +69 -0
  19. data/lib/maven/gwt/layout.rb +51 -0
  20. data/lib/maven/gwt/layout.rb~ +27 -0
  21. data/lib/maven/gwt/pom_magic.rb +74 -0
  22. data/lib/maven/gwt/pom_magic.rb~ +54 -0
  23. data/lib/maven/gwt/rack-web.xml +86 -0
  24. data/lib/maven/gwt/rack-web.xml~ +48 -0
  25. data/lib/maven/gwt/rack_gwt.rb~ +7 -0
  26. data/lib/maven/gwt/rack_project.rb~ +105 -0
  27. data/lib/maven/gwt/rails-web.xml +68 -0
  28. data/lib/maven/gwt/rails-web.xml~ +48 -0
  29. data/lib/maven/gwt/rails_project.rb~ +13 -0
  30. data/lib/maven/gwt/ruby_maven.rb~ +24 -0
  31. data/lib/maven/gwt/templates/Application.java +68 -0
  32. data/lib/maven/gwt/templates/Application.java~ +46 -0
  33. data/lib/maven/gwt/templates/Application.ui.xml +30 -0
  34. data/lib/maven/gwt/templates/Application.ui.xml~ +9 -0
  35. data/lib/maven/gwt/templates/EntryPoint.java +80 -0
  36. data/lib/maven/gwt/templates/EntryPoint.java~ +55 -0
  37. data/lib/maven/gwt/templates/Module.gwt.xml +44 -0
  38. data/lib/maven/gwt/templates/Module.gwt.xml~ +24 -0
  39. data/lib/maven/gwt/templates/ModuleDevelopment.gwt.xml +31 -0
  40. data/lib/maven/gwt/templates/ModuleDevelopment.gwt.xml~ +7 -0
  41. data/lib/maven/gwt/templates/gwt.css +95 -0
  42. data/lib/maven/gwt/templates/index.html +49 -0
  43. data/lib/maven/gwt/templates/index.html~ +29 -0
  44. data/lib/maven/gwt/version.rb +25 -0
  45. data/lib/maven/gwt/version.rb~ +5 -0
  46. data/lib/maven/gwt/web.xml~ +37 -0
  47. data/lib/rack/gwt/rack_gwt.rb~ +7 -0
  48. data/lib/rack/gwt/static.rb +58 -0
  49. data/lib/rack/gwt/static.rb~ +28 -0
  50. metadata +188 -0
@@ -0,0 +1,54 @@
1
+ require 'maven/jetty/cli'
2
+ require 'maven/tools/gem_project'
3
+ require 'maven/gwt/layout'
4
+ require 'fileutils'
5
+
6
+ module Maven
7
+ module Gwt
8
+ class PomMagic < Maven::Jetty::PomMagic
9
+
10
+ def generate_pom( dir = '.', *args )
11
+
12
+ proj = Maven::Tools::GemProject.new
13
+
14
+ ensure_web_xml( dir, proj )
15
+ ensure_mavenfile( dir )
16
+
17
+ load_standard_files( dir, proj )
18
+
19
+ pom_xml( dir, proj, args )
20
+ end
21
+
22
+ def gwt_module( layout )
23
+ gwt_module = layout.find_gwt_xml
24
+ unless gwt_module
25
+ path = layout.java_root.sub( /#{File.expand_path( '.' )}/, '').sub( /^\//, '' )
26
+ 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"
27
+
28
+ def e.backtrace
29
+ []
30
+ end
31
+ raise e
32
+ end
33
+ gwt_module
34
+ end
35
+
36
+ def ensure_mavenfile( dir )
37
+ unless File.exists?( File.join( dir, 'Mavenfile' ) )
38
+ layout = Layout.new( dir )
39
+ file = File.expand_path( gwt_module( layout ) )
40
+ gwt_module = file.sub( /#{layout.java_root}\/?/, '' ).sub( /.gwt.xml$/, '' ).gsub( /\//, '.')
41
+ app_name = gwt_module.sub( /.*\./, '' )
42
+ unless File.exists?( File.join( layout.public_dir, app_name + ".html" ) )
43
+ app_name = 'index'
44
+ end
45
+ super dir, File.dirname( __FILE__ ), 'GWT_MODULE' => gwt_module, 'APP_NAME' => app_name
46
+ end
47
+ end
48
+
49
+ def ensure_web_xml( dir, proj )
50
+ super dir, proj, File.dirname( __FILE__ ), File.join( dir, 'public', 'WEB-INF', 'web.xml' )
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,86 @@
1
+ <!--
2
+ Copyright (C) 2013 Christian Meier
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ this software and associated documentation files (the "Software"), to deal in
6
+ the Software without restriction, including without limitation the rights to
7
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ the Software, and to permit persons to whom the Software is furnished to do so,
9
+ subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ -->
21
+ <!DOCTYPE web-app PUBLIC
22
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
23
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
24
+ <web-app>
25
+ <welcome-file-list>
26
+ <welcome-file>/index.html</welcome-file>
27
+ </welcome-file-list>
28
+
29
+ <context-param>
30
+ <param-name>jruby.max.runtimes</param-name>
31
+ <param-value>1</param-value>
32
+ </context-param>
33
+ <context-param>
34
+ <param-name>jruby.min.runtimes</param-name>
35
+ <param-value>1</param-value>
36
+ </context-param>
37
+ <context-param>
38
+ <param-name>jruby.compat.version</param-name>
39
+ <param-value>1.9</param-value>
40
+ </context-param>
41
+ <context-param>
42
+ <param-name>rackup</param-name>
43
+ <param-value>
44
+
45
+ $LOAD_PATH.push File.expand_path( File.join( '..', '..', 'lib' ) )
46
+ self.send :eval, File.read( File.expand_path( File.join( '..', '..', 'config.ru' ) ) )
47
+
48
+ </param-value>
49
+ </context-param>
50
+ <context-param>
51
+ <!-- must match the place where the gems are located -->
52
+ <param-name>gem.path</param-name>
53
+ <param-value>../../target/rubygems</param-value>
54
+ </context-param>
55
+ <context-param>
56
+ <param-name>jruby.rack.logging</param-name>
57
+ <param-value>stdout</param-value>
58
+ </context-param>
59
+ <!-- for more config options see https://github.com/jruby/jruby-rack -->
60
+
61
+ <filter>
62
+ <filter-name>RackFilter</filter-name>
63
+ <filter-class>org.jruby.rack.RackFilter</filter-class>
64
+ <!-- optional filter configuration init-params : -->
65
+ <init-param>
66
+ <param-name>resetUnhandledResponse</param-name>
67
+ <param-value>true</param-value> <!-- true (default), false or buffer -->
68
+ </init-param>
69
+ <init-param>
70
+ <param-name>addsHtmlToPathInfo</param-name>
71
+ <param-value>true</param-value> <!-- true (default), false -->
72
+ </init-param>
73
+ <init-param>
74
+ <param-name>verifiesHtmlResource</param-name>
75
+ <param-value>false</param-value> <!-- true, false (default) -->
76
+ </init-param>
77
+ </filter>
78
+ <filter-mapping>
79
+ <filter-name>RackFilter</filter-name>
80
+ <url-pattern>/*</url-pattern>
81
+ </filter-mapping>
82
+
83
+ <listener>
84
+ <listener-class>org.jruby.rack.RackServletContextListener</listener-class>
85
+ </listener>
86
+ </web-app>
@@ -0,0 +1,48 @@
1
+ <!DOCTYPE web-app PUBLIC
2
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
3
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
4
+ <web-app>
5
+ <welcome-file-list>
6
+ <welcome-file>/index.html</welcome-file>
7
+ </welcome-file-list>
8
+
9
+ <context-param>
10
+ <param-name>jruby.max.runtimes</param-name>
11
+ <param-value>1</param-value>
12
+ </context-param>
13
+ <context-param>
14
+ <param-name>jruby.min.runtimes</param-name>
15
+ <param-value>1</param-value>
16
+ </context-param>
17
+ <context-param>
18
+ <param-name>jruby.compat.version</param-name>
19
+ <param-value>1.9</param-value>
20
+ </context-param>
21
+ <!-- for more config options see https://github.com/jruby/jruby-rack -->
22
+
23
+ <filter>
24
+ <filter-name>RackFilter</filter-name>
25
+ <filter-class>org.jruby.rack.RackFilter</filter-class>
26
+ <!-- optional filter configuration init-params : -->
27
+ <init-param>
28
+ <param-name>resetUnhandledResponse</param-name>
29
+ <param-value>true</param-value> <!-- true (default), false or buffer -->
30
+ </init-param>
31
+ <init-param>
32
+ <param-name>addsHtmlToPathInfo</param-name>
33
+ <param-value>true</param-value> <!-- true (default), false -->
34
+ </init-param>
35
+ <init-param>
36
+ <param-name>verifiesHtmlResource</param-name>
37
+ <param-value>false</param-value> <!-- true, false (default) -->
38
+ </init-param>
39
+ </filter>
40
+ <filter-mapping>
41
+ <filter-name>RackFilter</filter-name>
42
+ <url-pattern>/*</url-pattern>
43
+ </filter-mapping>
44
+
45
+ <listener>
46
+ <listener-class>org.jruby.rack.RackServletContextListener</listener-class>
47
+ </listener>
48
+ </web-app>
@@ -0,0 +1,7 @@
1
+ module Rack
2
+ module Gwt
3
+ module Static < Rack::Static
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,105 @@
1
+ require 'maven/tools/rails_project'
2
+
3
+ module Maven
4
+ module Jetty
5
+ class RailsProject < Maven::Tools::RailsProject
6
+
7
+ tags :dummy
8
+
9
+ private
10
+
11
+ CONNECTOR_XML = <<-XML
12
+
13
+ <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
14
+ <port>${jetty.port}</port>
15
+ </connector>
16
+ <connector implementation="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
17
+ <port>${jetty.sslport}</port>
18
+ <keystore>${project.basedir}/src/test/resources/server.keystore</keystore>
19
+ <keyPassword>123456</keyPassword>
20
+ <password>123456</password>
21
+ </connector>
22
+ XML
23
+
24
+ public
25
+
26
+
27
+ def add_defaults
28
+ super
29
+ self.properties.merge!({
30
+ "jetty.version" => '7.6.4.v20120524',
31
+ "jetty.war" => "${project.build.directory}/${project.build.finalName}.war",
32
+ "jetty.port" => '8080',
33
+ "jetty.sslport" => '8443'
34
+ })
35
+
36
+ profile(:war).plugin("org.mortbay.jetty:jetty-maven-plugin",
37
+ "${jetty.version}")do |jetty|
38
+ options = {
39
+ :war => "${jetty.war}",
40
+ :connectors => CONNECTOR_XML
41
+ }
42
+ jetty.with options
43
+ end
44
+
45
+ profile(:run) do |run|
46
+ overrideDescriptor = '${project.build.directory}/jetty/override-${rails.env}-web.xml'
47
+ run.activation.by_default
48
+ run.plugin("org.mortbay.jetty:jetty-maven-plugin",
49
+ "${jetty.version}") do |jetty|
50
+ options = {
51
+ :webAppConfig => {
52
+ :overrideDescriptor => overrideDescriptor
53
+ },
54
+ :systemProperties => {
55
+ :systemProperty => {
56
+ :name => 'jbundle.skip',
57
+ :value => 'true'
58
+ }
59
+ },
60
+ :connectors => CONNECTOR_XML
61
+ }
62
+ options[:webXml] = 'config/web.xml' if File.exists?('config/web.xml')
63
+ jetty.with options
64
+ end
65
+ end
66
+
67
+ profile(:warshell) do |exec|
68
+ exec.plugin_repository('kos').url = 'http://opensource.kantega.no/nexus/content/groups/public/'
69
+ exec.plugin('org.simplericity.jettyconsole:jetty-console-maven-plugin', '1.42').execution do |jetty|
70
+ jetty.execute_goal(:createconsole)
71
+ jetty.configuration.comment <<-TEXT
72
+ see http://simplericity.com/2009/11/10/1257880778509.html for more info
73
+ -->
74
+ <!--
75
+ <backgroundImage>${basedir}/src/main/jettyconsole/puffin.jpg</backgroundImage>
76
+ <additionalDependencies>
77
+ <additionalDependency>
78
+ <artifactId>jetty-console-winsrv-plugin</artifactId>
79
+ </additionalDependency>
80
+ <additionalDependency>
81
+ <artifactId>jetty-console-requestlog-plugin</artifactId>
82
+ </additionalDependency>
83
+ <additionalDependency>
84
+ <artifactId>jetty-console-log4j-plugin</artifactId>
85
+ </additionalDependency>
86
+ <additionalDependency>
87
+ <artifactId>jetty-console-jettyxml-plugin</artifactId>
88
+ </additionalDependency>
89
+ <additionalDependency>
90
+ <artifactId>jetty-console-ajp-plugin</artifactId>
91
+ </additionalDependency>
92
+ <additionalDependency>
93
+ <artifactId>jetty-console-gzip-plugin</artifactId>
94
+ </additionalDependency>
95
+ <additionalDependency>
96
+ <artifactId>jetty-console-startstop-plugin</artifactId>
97
+ </additionalDependency>
98
+ </additionalDependencies>
99
+ TEXT
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,68 @@
1
+ <!--
2
+ Copyright (C) 2013 Christian Meier
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ this software and associated documentation files (the "Software"), to deal in
6
+ the Software without restriction, including without limitation the rights to
7
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ the Software, and to permit persons to whom the Software is furnished to do so,
9
+ subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ -->
21
+ <!DOCTYPE web-app PUBLIC
22
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
23
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
24
+ <web-app>
25
+ <welcome-file-list>
26
+ <welcome-file>/index.html</welcome-file>
27
+ </welcome-file-list>
28
+
29
+ <context-param>
30
+ <param-name>jruby.max.runtimes</param-name>
31
+ <param-value>1</param-value>
32
+ </context-param>
33
+ <context-param>
34
+ <param-name>jruby.min.runtimes</param-name>
35
+ <param-value>1</param-value>
36
+ </context-param>
37
+ <context-param>
38
+ <param-name>jruby.compat.version</param-name>
39
+ <param-value>1.9</param-value>
40
+ </context-param>
41
+ <!-- for more config options see https://github.com/jruby/jruby-rack -->
42
+
43
+ <filter>
44
+ <filter-name>RackFilter</filter-name>
45
+ <filter-class>org.jruby.rack.RackFilter</filter-class>
46
+ <!-- optional filter configuration init-params : -->
47
+ <init-param>
48
+ <param-name>resetUnhandledResponse</param-name>
49
+ <param-value>true</param-value> <!-- true (default), false or buffer -->
50
+ </init-param>
51
+ <init-param>
52
+ <param-name>addsHtmlToPathInfo</param-name>
53
+ <param-value>true</param-value> <!-- true (default), false -->
54
+ </init-param>
55
+ <init-param>
56
+ <param-name>verifiesHtmlResource</param-name>
57
+ <param-value>false</param-value> <!-- true, false (default) -->
58
+ </init-param>
59
+ </filter>
60
+ <filter-mapping>
61
+ <filter-name>RackFilter</filter-name>
62
+ <url-pattern>/*</url-pattern>
63
+ </filter-mapping>
64
+
65
+ <listener>
66
+ <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
67
+ </listener>
68
+ </web-app>
@@ -0,0 +1,48 @@
1
+ <!DOCTYPE web-app PUBLIC
2
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
3
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
4
+ <web-app>
5
+ <welcome-file-list>
6
+ <welcome-file>/index.html</welcome-file>
7
+ </welcome-file-list>
8
+
9
+ <context-param>
10
+ <param-name>jruby.max.runtimes</param-name>
11
+ <param-value>1</param-value>
12
+ </context-param>
13
+ <context-param>
14
+ <param-name>jruby.min.runtimes</param-name>
15
+ <param-value>1</param-value>
16
+ </context-param>
17
+ <context-param>
18
+ <param-name>jruby.compat.version</param-name>
19
+ <param-value>1.8</param-value>
20
+ </context-param>
21
+ <!-- for more config options see https://github.com/jruby/jruby-rack -->
22
+
23
+ <filter>
24
+ <filter-name>RackFilter</filter-name>
25
+ <filter-class>org.jruby.rack.RackFilter</filter-class>
26
+ <!-- optional filter configuration init-params : -->
27
+ <init-param>
28
+ <param-name>resetUnhandledResponse</param-name>
29
+ <param-value>true</param-value> <!-- true (default), false or buffer -->
30
+ </init-param>
31
+ <init-param>
32
+ <param-name>addsHtmlToPathInfo</param-name>
33
+ <param-value>true</param-value> <!-- true (default), false -->
34
+ </init-param>
35
+ <init-param>
36
+ <param-name>verifiesHtmlResource</param-name>
37
+ <param-value>false</param-value> <!-- true, false (default) -->
38
+ </init-param>
39
+ </filter>
40
+ <filter-mapping>
41
+ <filter-name>RackFilter</filter-name>
42
+ <url-pattern>/*</url-pattern>
43
+ </filter-mapping>
44
+
45
+ <listener>
46
+ <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
47
+ </listener>
48
+ </web-app>
@@ -0,0 +1,13 @@
1
+ require 'maven/tools/rails_project'
2
+
3
+ module Maven
4
+ module Jetty
5
+ class RailsProject < Maven::Tools::RailsProject
6
+
7
+ def add_defaults
8
+ super
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,24 @@
1
+ require 'ruby_maven'
2
+ require 'maven/jetty/rails_project'
3
+
4
+ module Maven
5
+ module Jetty
6
+ class RubyMaven < Maven::RubyMaven
7
+
8
+ def new_rails_project
9
+ RailsProject.new
10
+ end
11
+
12
+ def exec(*args)
13
+ # first make sure the jetty resources are in place
14
+ if !File.exists?(File.join('config', 'web.xml')) && !File.exists?(File.join('src', 'main', 'webapp', 'WEB-INF', 'web.xml'))
15
+ web_xml = Gem.find_files( 'maven/jetty/web.xml').first
16
+ FileUtils.cp(web_xml, 'config')
17
+ end
18
+
19
+ # now just continue
20
+ super
21
+ end
22
+ end
23
+ end
24
+ end