Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed up some general module stuff

Fixed commands.py to drop in default groovy controller and test, removed
old files
  • Loading branch information...
commit fa168019d608101405960ec21c5e812c5014f7e6 1 parent b854003
@clarkdave authored
View
1  .gitignore
@@ -1,5 +1,6 @@
*.pyc
tmp
+dist
play-groovy-compiler.jar
play-groovy.jar
test-result
View
149 app/views/defaults/welcome.html
@@ -0,0 +1,149 @@
+#{set title:'Your application is ready !' /}
+
+#{if play.mode.toString() == 'DEV'}
+
+#{set 'moreStyles'}
+ <link rel="stylesheet" href="@{'/public/playmanual/manual.css'}" type="text/css" media="screen" charset="${_response_encoding}">
+ <link rel="stylesheet" href="@{'/public/playmanual/wiki.css'}" type="text/css" media="screen" charset="${_response_encoding}">
+#{/set}
+
+<div class="wrapper">
+
+ <div id="docSidebar">
+
+ <div id="logo">
+ <img src="@{'/public/playmanual/logo.png'}">
+ <h2 id="version">Play ${play.version}</h2>
+ </div>
+
+ <h2>Browse</h2>
+ <ul>
+ <li id="gotoc"><a href="/@documentation/home">Local documentation</a></li>
+ <li id="gotoc"><a href="/@api/index.html">Browse Java API</a></li>
+ </ul>
+
+ <h2>Contents</h2>
+ <div id="toc"></div>
+
+ #{if modules}
+ <h2>Installed modules</h2>
+ <ul>
+ #{list modules, as:'module'}
+ <li>
+ <a href="modules/${module}/home">${module}</a>
+ #{if apis.contains(module)}
+ — <a href="/@api/-${module}/index.html">Browse API</a>
+ #{/if}
+ </li>
+ #{/list}
+ </ul>
+ #{/if}
+
+ <h2>Search</h2>
+ <p>Get help with google</p>
+ <div id="searchBox"><form action="http://www.google.com/cse" id="cse-search-box"><div><input type="hidden" name="cx" value="002614023023983855063:jn1mu_7bof0" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" size="28" style="font-size:14px"/></div></form><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script></div>
+
+ </div>
+
+ <div id="pageContent">
+
+ <div class="wikistyle">
+ <h1>Your new application is ready!</h1>
+ <p>
+ Congratulation, you've just created a new Groovy Play application. This page will help you in the few next steps.
+ </p>
+ <h2><a name="why">Why do you see this page?</a></h2>
+ <p>
+ The <strong>conf/routes</strong> file defines a route that tell play to invoke the <strong>Application.index</strong> action
+ when a browser requests the <strong>/</strong> URI using the <strong>GET</strong> method:
+ </p>
+ <pre><code># Application home page
+GET / Application.index</code></pre>
+ <p>
+ So play has invoked the <strong>controllers&#46;Application&#46;index()</strong> method:
+ </p>
+ <pre><code>package controllers
+
+import play.*
+import play.mvc.*
+
+import models
+
+class Application extends Controller {
+
+ static void index() {
+ render()
+ }
+}</code></pre>
+ <p>
+ Using the <strong>render()</strong> call, this action asks play to display a template. By convention play has
+ displayed the <strong>app/views/Application/index.html</strong> template:
+ </p>
+ <pre><code>&#35;{extends 'main.html' /}
+&#35;{set title:'Home' /}
+
+&#35;{welcome /}</code></pre>
+ <p>
+ This template extends the <strong>app/views/main.html</strong>, and uses the <strong>&#35;{welcome /}</strong> tag to display this
+ welcome page.
+ </p>
+ <h2><a name="ide">Need to set up a Java IDE?</a></h2>
+ <p>
+ You can start right now to hack your application using any text editor. Any changes will be automatically realoaded at the
+ next page refresh, including modifications made to Java sources files.
+ </p>
+ <p>
+ If you want to set up your application in <strong>Eclipse</strong>, <strong>Netbeans</strong> or any other Java IDE, check
+ the <a href="/@documentation/ide">Setting up your preferred IDE</a> page.
+ </p>
+ <h2><a name="db">Need to connect to a database?</a></h2>
+ <p>
+ You can quickly set up a developement database (either in memory or written to the filesystem), by adding one of these
+ lines to the <strong>conf/application.conf</strong> file:
+ </p>
+<pre><code># For a transient in memory database (H2 in memory)
+db=mem
+
+# for a simple file written database (H2 file stored)
+db=fs</code></pre>
+ <p>
+ If you want to connect to an existing <strong>MySQL5 server</strong>, use:
+ </p>
+<pre><code>db=mysql:user:pwd@database_name</code></pre>
+ <p>
+ If you need to connect to another JDBC compliant database, first add the corresponding driver library to the
+ <strong>lib/</strong> directory of your application, and add these lines to the <strong>conf/application.conf</strong> file:
+ </p>
+ <pre><code>db.url=jdbc:postgresql:database_name
+db.driver=org.postgresql.Driver
+db.user=root
+db.pass=secret</code></pre>
+ <h2><a name="doc">Need more help?</a></h2>
+ <p>
+ When your application run in <strong>DEV</strong> mode, you can access directly the current documentation at the
+ <a href="/@documentation">/@documentation</a> URL or go to <a href="http://www.playframework.org">http://www.playframework.org</a>.
+ </p>
+ <p>
+ For specific help with the Groovy plugin, please head to the <a href='http://github.com/clarkdave/play-groovy'>project page</a>. Bug reports and fixes are welcome!
+ </p>
+ <p>
+ The <a href="http://groups.google.com/group/play-framework">Play Google Group</a> is where Play users come to seek help, announce projects, and discuss.
+ If you don't have any google account, you can still join the mailing list sending an email to
+ <br/><strong>play-framework+subscribe@googlegroups.com</strong>.
+ </p>
+ </div>
+ </div>
+
+ </div>
+
+ </div>
+
+</div>
+
+<script type="text/javascript" src="@{'/public/playmanual/jquery-1.3.2.min.js'}"></script>
+<script type="text/javascript" src="@{'/public/playmanual/navigation.js'}"></script>
+
+#{/if}
+#{else}
+ <h1>Your application is ready!</h1>
+#{/else}
View
42 commands.py
@@ -1,10 +1,15 @@
-# Here you can create play commands that are specific to the module, and extend existing commands
+# groovy
+import sys
+import inspect
+import os
+import subprocess
+import shutil
-MODULE = 'groovy'
+from play.utils import *
-# Commands that are specific to your module
+MODULE = 'groovy'
-COMMANDS = ['groovy:hello']
+COMMANDS = ['groovy:console']
def execute(**kargs):
command = kargs.get("command")
@@ -12,11 +17,17 @@ def execute(**kargs):
args = kargs.get("args")
env = kargs.get("env")
- if command == "groovy:hello":
- print "~ Hello"
+ if command == "groovy:console":
+ # add precompiled classes to classpath
+ cp_args = app.cp_args() + ":" + os.path.normpath(os.path.join(app.path,'tmp', 'classes'))
+ # replace last element with the console app
+ java_cmd = app.java_cmd(args, cp_args)
+ java_cmd[len(java_cmd)-2] = "play.console.Console"
+ java_cmd.insert(2, '-Xmx512M')
+ subprocess.call(java_cmd, env=os.environ)
+ print
-# This will be executed before any command (new, run...)
def before(**kargs):
command = kargs.get("command")
app = kargs.get("app")
@@ -24,7 +35,6 @@ def before(**kargs):
env = kargs.get("env")
-# This will be executed after any command (new, run...)
def after(**kargs):
command = kargs.get("command")
app = kargs.get("app")
@@ -32,4 +42,18 @@ def after(**kargs):
env = kargs.get("env")
if command == "new":
- pass
+ #shutil.rmtree(os.path.join(app.path, 'app/controllers'))
+ #shutil.rmtree(os.path.join(app.path, 'app/models'))
+ #shutil.rmtree(os.path.join(app.path, 'app/views/errors'))
+ os.remove(os.path.join(app.path, 'app/controllers/Application.java'))
+ os.remove(os.path.join(app.path, 'test/BasicTest.java'))
+ os.remove(os.path.join(app.path, 'test/ApplicationTest.java'))
+ module_dir = inspect.getfile(inspect.currentframe()).replace("commands.py", "")
+ shutil.copyfile(os.path.join(module_dir, 'resources', 'Application.groovy'), os.path.join(app.path, 'app/controllers', 'Application.groovy'))
+ shutil.copyfile(os.path.join(module_dir, 'resources', 'Tests.groovy'), os.path.join(app.path, 'test', 'Tests.groovy'))
+ ac = open(os.path.join(app.path, 'conf/application.conf'), 'r')
+ conf = ac.read()
+ ac = open(os.path.join(app.path, 'conf/application.conf'), 'w')
+ ac.write(conf)
+
+ # TODO: set up eclipsify and stuff
View
5 conf/messages
@@ -1,5 +0,0 @@
-# Default groovy messages
-# You can specialize this file for each language.
-# For exemple, for french create a messages.fr file
-
-#groovy.name=groovy
View
8 conf/routes
@@ -1,8 +0,0 @@
-# This file defines all module routes (Higher priority routes first)
-#
-# import these routes in the main app as :
-# * / module:groovy
-#
-# ~~~~
-
-GET /? Module.index
View
13 resources/Application.groovy
@@ -0,0 +1,13 @@
+package controllers
+
+import play.*
+import play.mvc.*
+
+import models.*
+
+class Application extends Controller {
+
+ static void index() {
+ render()
+ }
+}
View
12 resources/Tests.groovy
@@ -0,0 +1,12 @@
+import play.test.*
+import models.*
+
+class BasicTest extends SpockTest {
+
+ 'run this pointless test'() {
+ when:
+ def hello = 1
+
+ then:
+ hello == 1
+ }
Please sign in to comment.
Something went wrong with that request. Please try again.