dubious 0.0.0-java → 0.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,40 +21,10 @@ make. Mirah uses the Java type system. Join the mirah mailing list to get
21
21
  involved: http://groups.google.com/group/mirah
22
22
 
23
23
  === Getting Started
24
- Since Dubious relies on features of Mirah and Bitescript that have not been
25
- released yet, you need to clone the repositories and manually build and install
26
- the gems for each of them.
27
-
28
- #assuming you are in a workspace directory.
29
- git clone http://github.com/headius/bitescript.git
30
- git clone http://github.com/mirah/mirah.git
31
- git clone http://github.com/mirah/dubious.git
32
-
33
- #assuming your gem and rake commands are from jruby
34
- cd bitescript
35
- gem build bitescript.gemspec
36
- gem install bitescript-*
37
- cd ../mirah
38
- git checkout 5e98ddab33ee4d581881f7822f8148704426af1a #checkout mirah before the new parser.
39
- rake jar:bootstrap
40
- gem build mirah.gemspec
41
- gem install mirah-*
42
- cd ../dubious
43
- rake jar #compile the mirah src and put the jar in lib
44
- gem build dubious.gemspec
45
- gem install dubious-*
46
-
47
- In the future, you will be able to simply install Dubious as a JRuby gem. That will look like the following:
48
-
49
- If your gem command is the JRuby one, run
50
24
 
51
- gem install dubious
25
+ Install Dubious(Note: Dubious requires JRuby).
52
26
 
53
- * this currently only installs Dubious and not Mirah.
54
-
55
- If not run
56
-
57
- jruby -S gem install dubious
27
+ gem install dubious
58
28
 
59
29
  This will add a `dubious` command that you can create new apps, generate controllers and models etc with.
60
30
 
@@ -68,51 +38,44 @@ Once dubious is installed, you can generate an app skeleton.
68
38
  The layout is based on Rails' with some Java WAR directories, and files geared towards deploying on AppEngine.
69
39
 
70
40
  * WEB-INF/app.yaml
71
- contains handlers for different routes. It's like a lightweight version of web.xml--I think it actually generates it
41
+ contains handlers for different routes, as well as filters and settings for serving static files.
72
42
 
73
- http://code.google.com/appengine/docs/python/config/appconfig.html#About_app_yaml
43
+ http://code.google.com/appengine/docs/java/configyaml/appconfig_yaml.html
74
44
 
75
45
  ==Hacking on Dubious
76
46
  ===Setup the Mirah development environment
77
47
 
78
- Fetch App Engine Java SDK and JRuby, then install them into /usr/local
79
-
80
- //-included in the gem-* http://googleappengine.googlecode.com/files/appengine-java-sdk-1.3.7.zip
81
- * http://jruby.org.s3.amazonaws.com/downloads/1.5.1/jruby-bin-1.5.1.tar.gz
48
+ * Install JRuby. You can find good instructions on the JRuby website http://jruby.org/
49
+ * Install the prerelease appengine-sdk gem from http://code.google.com/p/appengine-jruby/
82
50
 
83
- Make sure the appengine tools are executable
84
-
85
- sudo chmod a+x /usr/local/appengine-java-sdk-1.3.7/bin/*.sh
86
-
87
- Now git clone bitescript, mirah and dubious to your drive
51
+ * Now git clone bitescript, mirah and dubious to your drive
88
52
 
89
53
  mkdir -p ~/mystuff; cd ~/mystuff
90
54
  git clone http://github.com/headius/bitescript.git
91
55
  git clone http://github.com/mirah/mirah.git
92
56
  git clone http://github.com/mirah/dubious.git
93
57
 
94
- Edit .bash_profile to find these tools
95
-
96
- export JRUBY_HOME=/usr/local/jruby-1.5.1
97
- export MIRAH_HOME=~/mystuff/mirah
98
- export APPENGINE_JAVA_SDK=/usr/local/appengine-java-sdk-1.3.7
99
- export PATH=$PATH:$JRUBY_HOME/bin:$MIRAH_HOME/bin:$APPENGINE_JAVA_SDK/bin
58
+ * Then build and install the gems for Mirah, Bitescript and Dubious
100
59
 
101
- Verify tools are configured properly, and check to see
102
- that script/build.sh has the correct path to the SDK.
60
+ cd bitescript
61
+ gem build bitescript.gemspec
62
+ gem install bitescript-*
63
+ cd -
64
+ cd mirah
65
+ rake jar:bootstrap
66
+ gem build mirah.gemspec
67
+ gem install mirah-*
68
+ cd -
69
+ cd dubious
70
+ rake jar
71
+ gem build dubious.gemspec
72
+ gem install dubious-*
73
+ cd -
103
74
 
104
- which appcfg.sh
105
- which dev_appserver.sh
106
- which mirah
107
- which jruby
108
-
109
- After that you should install the appengine-sdk gem
110
-
111
- jgem install appengine-sdk
112
75
 
113
76
  To build the gem
114
77
 
115
- jgem build dubious.gemspec
78
+ gem build dubious.gemspec
116
79
 
117
80
  ===Developing your App
118
81
 
@@ -127,26 +90,8 @@ Generate your app
127
90
 
128
91
  There are two ways to develop the app. The first way is to run the build script each time you make a change. The new way is to use the Rakefile. If you are using jruby's rake, the task will watch for source file changes and update the running class files. Otherwise, you need to restart the server when you have changes.
129
92
 
130
- === Use the Original Scripts
131
-
132
- Compile the Mirah files and populate the WEB-INF/lib dir
133
-
134
- ./script/build.sh
135
-
136
- Run the app locally
137
-
138
- ./script/server.sh
139
-
140
- Edit the app-id in app.yaml, then publish to appspot.com
141
-
142
- ./script/publish.sh
143
-
144
93
  === Use the New Rakefile
145
94
 
146
- Populate the WEB-INF/lib dir
147
-
148
- ./script/environment.rb
149
-
150
95
  Run the app locally
151
96
 
152
97
  jruby -S rake server
data/Rakefile CHANGED
@@ -7,6 +7,14 @@ rescue LoadError
7
7
  exit 1
8
8
  end
9
9
 
10
+
11
+ neighbor_mirah = File.expand_path '../mirah'
12
+
13
+ if File.exists?(neighbor_mirah)
14
+ ENV['MIRAH_HOME'] ||= neighbor_mirah
15
+ end
16
+
17
+
10
18
  MIRAH_HOME = ENV['MIRAH_HOME'] ? ENV['MIRAH_HOME'] : Gem.find_files('mirah').first.sub(/lib\/mirah.rb/,'')
11
19
 
12
20
  if ENV['MIRAH_HOME'] && File.exist?(ENV['MIRAH_HOME'] +'/lib/mirah.rb')
@@ -35,7 +43,7 @@ def class_files_for files
35
43
  end
36
44
 
37
45
  #MODEL_JAR = "#{OUTDIR}/dubydatastore.jar"
38
- LIB_MIRAH_SRC = Dir["src/**/*.duby"]
46
+ LIB_MIRAH_SRC = Dir["src/**/*{.duby,.mirah}"]
39
47
  LIB_JAVA_SRC = Dir["src/**/*.java"]
40
48
 
41
49
  LIB_SRC = LIB_MIRAH_SRC + LIB_JAVA_SRC
@@ -55,11 +63,20 @@ file "#{OUTDIR}/dubious/ActionController.class" => ["#{OUTDIR}/dubious/Params.cl
55
63
  "#{OUTDIR}/dubious/CustomRoutes.class",
56
64
  ]
57
65
 
58
- file "#{OUTDIR}/dubious/Inflections.class" => ["#{OUTDIR}/dubious/TextHelper.class",
59
- "#{OUTDIR}/dubious/Inflection.class"]
66
+ file "#{OUTDIR}/dubious/Inflections.class" => [
67
+ "#{OUTDIR}/dubious/TextHelper.class",
68
+ "#{OUTDIR}/dubious/Inflection.class"
69
+ ]
70
+
71
+ file "#{OUTDIR}/dubious/TextHelper.class" => [
72
+ "#{OUTDIR}/dubious/Inflection.class",
73
+ ]
74
+
75
+
60
76
  file "#{OUTDIR}/dubious/FormHelper.class" => [
61
77
  "#{OUTDIR}/dubious/Inflections.class",
62
78
  "#{OUTDIR}/dubious/InstanceTag.class",
79
+ "#{OUTDIR}/dubious/Params.class",
63
80
  "#{OUTDIR}/dubious/TimeConversion.class",
64
81
  *STDLIB_CLASSES]
65
82
  file "#{OUTDIR}/dubious/InstanceTag.class" => "#{OUTDIR}/dubious/SanitizeHelper.class"
@@ -1,4 +1,4 @@
1
- application: contacts
1
+ application: dubious-demo # duby-primer
2
2
  version: duby
3
3
  runtime: java
4
4
  public_root: /public
@@ -6,4 +6,39 @@ public_root: /public
6
6
  resource_files:
7
7
  - exclude: /build/**
8
8
 
9
+ static_files:
10
+ - include: /**/*.ico
11
+ expiration: 365d
12
+ - include: /**/*.gif
13
+ expiration: 365d
14
+ - include: /**/*.jpeg
15
+ expiration: 365d
16
+ - include: /**/*.jpg
17
+ expiration: 365d
18
+ - include: /**/*.png
19
+ expiration: 365d
20
+ - include: /**/*.js
21
+ expiration: 365d
22
+ - include: /**/*.css
23
+ expiration: 365d
24
+
9
25
  handlers:
26
+ - url: /info/properties
27
+ servlet: controllers.InfoPropertiesController
28
+ name: info_properties
29
+
30
+ - url: /contacts/*
31
+ servlet: controllers.ContactsController
32
+ name: contacts
33
+
34
+ - url: /source/*
35
+ servlet: controllers.SourceController
36
+ name: source
37
+
38
+ - url: /simple_duby/*
39
+ servlet: testing.SimpleDuby
40
+ name: dimple_duby
41
+
42
+ - url: /simple_java/*
43
+ servlet: testing.SimpleJava
44
+ name: simple_java
@@ -0,0 +1,4 @@
1
+ <!-- Indices written at Thu, 11 Nov 2010 15:17:40 UTC -->
2
+
3
+ <datastore-indexes/>
4
+
@@ -1,9 +1,16 @@
1
1
  <!-- Generated from app.yaml. Do not edit. -->
2
2
  <appengine-web-app xmlns='http://appengine.google.com/ns/1.0'>
3
- <application>contacts</application>
3
+ <application>dubious-demo</application>
4
4
  <version>duby</version>
5
5
  <public-root>/public</public-root>
6
6
  <static-files>
7
+ <include path='/**/*.ico' expiration='365d'/>
8
+ <include path='/**/*.gif' expiration='365d'/>
9
+ <include path='/**/*.jpeg' expiration='365d'/>
10
+ <include path='/**/*.jpg' expiration='365d'/>
11
+ <include path='/**/*.png' expiration='365d'/>
12
+ <include path='/**/*.js' expiration='365d'/>
13
+ <include path='/**/*.css' expiration='365d'/>
7
14
  </static-files>
8
15
  <resource-files>
9
16
  <exclude path='/build/**'/>
@@ -0,0 +1,285 @@
1
+ // Generated from contacts_controller.mirah
2
+ package controllers;
3
+ public class ContactsController extends controllers.ApplicationController {
4
+ private models.Contact[] contacts;
5
+ private models.Contact contact;
6
+ public static void main(java.lang.String[] argv) {
7
+ public java.lang.Object index() {
8
+ this.contacts = models.Contact.all().run();
9
+ return this.render(this.index_erb(), this.main_erb());
10
+ }
11
+ public java.lang.Object show() {
12
+ this.contact = models.Contact.get(this.params().id());
13
+ return this.render(this.show_erb(), this.main_erb());
14
+ }
15
+ public java.lang.Object new() {
16
+ this.contact = new models.Contact();
17
+ return this.render(this.new_erb(), this.main_erb());
18
+ }
19
+ public java.lang.Object edit() {
20
+ this.contact = models.Contact.get(this.params().id());
21
+ return this.render(this.edit_erb(), this.main_erb());
22
+ }
23
+ public java.lang.Object delete() {
24
+ models.Contact.delete(models.Contact.get(this.params().id()).key());
25
+ return this.redirect_to(this.params().index());
26
+ }
27
+ public java.lang.Object create() {
28
+ new models.Contact().update(this.params().for("contact")).save();
29
+ return this.redirect_to(this.params().index());
30
+ }
31
+ public java.lang.Object update() {
32
+ models.Contact.get(this.params().id()).update(this.params().for("contact")).save();
33
+ return this.redirect_to(this.params().show());
34
+ }
35
+ public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
36
+ this.action_response(response, this.action_request(request, "get"));
37
+ }
38
+ public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
39
+ this.action_response(response, this.action_request(request, "post"));
40
+ }
41
+ public java.lang.String index_erb() {
42
+ java.lang.StringBuilder _edbout = new java.lang.StringBuilder();
43
+ _edbout.append("<h1>Listing contacts</h1>\n\n<table>\n <tr>\n <th>Title</th>\n <th>Summary</th>\n <th>Birthday</th>\n <th>URL</th>\n <th>Platform</th>\n <th>Editor</th>\n <th>Address</th>\n <th>Phone</th>\n <th>Private</th>\n <th>Happy</th>\n </tr>\n\n");
44
+ int __xform_tmp_1 = 0;
45
+ models.Contact[] __xform_tmp_2 = this.contacts;
46
+ label1:
47
+ while ((__xform_tmp_1 < __xform_tmp_2.length)) {
48
+ models.Contact contact = __xform_tmp_2[__xform_tmp_1];
49
+ label2:
50
+ {
51
+ _edbout.append("\n <tr>\n <td>");
52
+ _edbout.append(this.h(contact.title()));
53
+ _edbout.append("</td>\n <td>");
54
+ _edbout.append(this.h(contact.summary()));
55
+ _edbout.append("</td>\n <td>");
56
+ _edbout.append(this.date_format(contact.birthday()));
57
+ _edbout.append("</td>\n <td>");
58
+ _edbout.append(this.h(contact.url()));
59
+ _edbout.append("</td>\n <td>");
60
+ _edbout.append(this.h(contact.platform()));
61
+ _edbout.append("</td>\n <td>");
62
+ _edbout.append(this.h(contact.editor()));
63
+ _edbout.append("</td>\n <td>");
64
+ _edbout.append(this.h(contact.address()));
65
+ _edbout.append("</td>\n <td>");
66
+ _edbout.append(this.h(contact.phone()));
67
+ _edbout.append("</td>\n <td>");
68
+ _edbout.append(contact.private() ? ("true") : ("false"));
69
+ _edbout.append("</td>\n <td>");
70
+ _edbout.append(this.link_to("Show", this.resource(contact)));
71
+ _edbout.append("</td>\n <td>");
72
+ _edbout.append(this.link_to("Edit", this.resource(contact, "edit")));
73
+ _edbout.append("</td>\n <td>");
74
+ java.lang.String temp$3 = null;
75
+ java.lang.String temp$4 = this.resource(contact);
76
+ java.util.HashMap temp$5 = null;
77
+ {
78
+ {
79
+ java.util.HashMap temp$6 = null;
80
+ {
81
+ java.util.HashMap self$2000 = new java.util.HashMap(16);
82
+ self$2000.put("confirm", "Are you sure?");
83
+ temp$6 = self$2000;
84
+ }
85
+ java.util.HashMap self$2002 = temp$6;
86
+ self$2002.put("method", "delete");
87
+ temp$5 = self$2002;
88
+ }
89
+ }
90
+ temp$3 = this.link_to("Destroy", temp$4, temp$5);
91
+ _edbout.append(temp$3);
92
+ _edbout.append("</td>\n </tr>\n");
93
+ }
94
+ __xform_tmp_1 = (__xform_tmp_1 + 1);
95
+ }
96
+ _edbout.append("\n</table>\n\n<br />\n\n");
97
+ _edbout.append(this.link_to("New contact", this.resource("contacts", "new")));
98
+ _edbout.append("\n");
99
+ return _edbout.toString();
100
+ }
101
+ public java.lang.String show_erb() {
102
+ java.lang.StringBuilder _edbout = new java.lang.StringBuilder();
103
+ _edbout.append("<p>\n <b>Title:</b>\n ");
104
+ _edbout.append(this.h(this.contact.title()));
105
+ _edbout.append("\n</p>\n\n<p>\n <b>Summary:</b>\n ");
106
+ _edbout.append(this.h(this.contact.summary()));
107
+ _edbout.append("\n</p>\n\n<p>\n <b>Birthday:</b>\n ");
108
+ _edbout.append(this.h(this.contact.birthday()));
109
+ _edbout.append("\n</p>\n\n<p>\n <b>Platform:</b>\n ");
110
+ _edbout.append(this.h(this.contact.platform()));
111
+ _edbout.append("\n</p>\n\n<p>\n <b>Editor:</b>\n ");
112
+ _edbout.append(this.h(this.contact.editor()));
113
+ _edbout.append("\n</p>\n\n<p>\n <b>Url:</b>\n ");
114
+ _edbout.append(this.h(this.contact.url()));
115
+ _edbout.append("\n</p>\n\n<p>\n <b>Address:</b>\n ");
116
+ _edbout.append(this.h(this.contact.address()));
117
+ _edbout.append("\n</p>\n\n<p>\n <b>Phone:</b>\n ");
118
+ _edbout.append(this.h(this.contact.phone()));
119
+ _edbout.append("\n</p>\n\n<p>\n <b>Private:</b>\n ");
120
+ _edbout.append(this.contact.private());
121
+ _edbout.append("\n</p>\n\n");
122
+ _edbout.append(this.link_to("edit", this.resource(this.contact, "edit")));
123
+ _edbout.append(" |\n");
124
+ _edbout.append(this.link_to("Back", this.resource("contacts")));
125
+ _edbout.append("\n");
126
+ return _edbout.toString();
127
+ }
128
+ public java.lang.String new_erb() {
129
+ java.lang.StringBuilder _edbout = new java.lang.StringBuilder();
130
+ _edbout.append("<h1>New contact</h1>\n\n");
131
+ dubious.FormHelper f = this.form_for(this.contact);
132
+ _edbout.append("\n ");
133
+ _edbout.append(f.start_form());
134
+ _edbout.append("\n ");
135
+ _edbout.append(f.error_messages());
136
+ _edbout.append("\n <p>\n ");
137
+ _edbout.append(f.label("title"));
138
+ _edbout.append("<br />\n ");
139
+ _edbout.append(f.text_field("title"));
140
+ _edbout.append("\n </p>\n <p>\n ");
141
+ _edbout.append(f.label("summary"));
142
+ _edbout.append("<br />\n ");
143
+ _edbout.append(f.text_area("summary"));
144
+ _edbout.append("\n </p>\n <p>\n ");
145
+ _edbout.append(f.label("birthday"));
146
+ _edbout.append("<br />\n ");
147
+ _edbout.append(f.date_select("birthday"));
148
+ _edbout.append("\n </p>\n <p>\n ");
149
+ _edbout.append(f.label("platform"));
150
+ _edbout.append("<br />\n ");
151
+ _edbout.append(f.radio_button("platform", "Mac"));
152
+ _edbout.append("Mac\n ");
153
+ _edbout.append(f.radio_button("platform", "PC"));
154
+ _edbout.append("PC\n ");
155
+ _edbout.append(f.radio_button("platform", "Linux"));
156
+ _edbout.append("Linux\n </p>\n <p>\n ");
157
+ _edbout.append(f.label("editor"));
158
+ _edbout.append("<br />\n ");
159
+ _edbout.append(f.select("editor", java.util.Collections.unmodifiableList(java.util.Arrays.asList("Vim", "Emacs", "TextMate", "Other"))));
160
+ _edbout.append("\n </p>\n <p>\n ");
161
+ _edbout.append(f.label("url"));
162
+ _edbout.append("<br />\n ");
163
+ java.lang.String temp$1 = null;
164
+ java.util.HashMap temp$2 = null;
165
+ {
166
+ {
167
+ java.util.HashMap self$2004 = new java.util.HashMap(16);
168
+ self$2004.put("size", "60");
169
+ temp$2 = self$2004;
170
+ }
171
+ }
172
+ temp$1 = f.text_field("url", temp$2);
173
+ _edbout.append(temp$1);
174
+ _edbout.append("\n </p>\n <p>\n ");
175
+ _edbout.append(f.label("address"));
176
+ _edbout.append("<br />\n ");
177
+ _edbout.append(f.text_field("address"));
178
+ _edbout.append("\n </p>\n <p>\n ");
179
+ _edbout.append(f.label("phone"));
180
+ _edbout.append("<br />\n ");
181
+ _edbout.append(f.text_field("phone"));
182
+ _edbout.append("\n </p>\n <p>\n ");
183
+ _edbout.append(f.label("private"));
184
+ _edbout.append("<br />\n ");
185
+ _edbout.append(f.check_box("private"));
186
+ _edbout.append("\n </p>\n <p>\n ");
187
+ _edbout.append(f.submit("Create"));
188
+ _edbout.append("\n </p>\n ");
189
+ _edbout.append(f.end_form());
190
+ _edbout.append("\n\n");
191
+ _edbout.append(this.link_to("Back", this.resource("contacts")));
192
+ _edbout.append("\n");
193
+ return _edbout.toString();
194
+ }
195
+ public java.lang.String edit_erb() {
196
+ java.lang.StringBuilder _edbout = new java.lang.StringBuilder();
197
+ _edbout.append("<h1>Editing contact</h1>\n\n");
198
+ dubious.FormHelper f = this.form_for(this.contact);
199
+ _edbout.append("\n ");
200
+ _edbout.append(f.start_form());
201
+ _edbout.append("\n ");
202
+ _edbout.append(f.error_messages());
203
+ _edbout.append("\n <p>\n ");
204
+ _edbout.append(f.label("title"));
205
+ _edbout.append("<br />\n ");
206
+ _edbout.append(f.text_field("title"));
207
+ _edbout.append("\n </p>\n <p>\n ");
208
+ _edbout.append(f.label("summary"));
209
+ _edbout.append("<br />\n ");
210
+ _edbout.append(f.text_area("summary"));
211
+ _edbout.append("\n </p>\n <p>\n ");
212
+ _edbout.append(f.label("birthday"));
213
+ _edbout.append("<br />\n ");
214
+ _edbout.append(f.date_select("birthday"));
215
+ _edbout.append("\n </p>\n <p>\n ");
216
+ _edbout.append(f.label("platform"));
217
+ _edbout.append("<br />\n ");
218
+ _edbout.append(f.radio_button("platform", "Mac"));
219
+ _edbout.append("Mac\n ");
220
+ _edbout.append(f.radio_button("platform", "PC"));
221
+ _edbout.append("PC\n ");
222
+ _edbout.append(f.radio_button("platform", "Linux"));
223
+ _edbout.append("Linux\n </p>\n <p>\n ");
224
+ _edbout.append(f.label("editor"));
225
+ _edbout.append("<br />\n ");
226
+ _edbout.append(f.select("editor", java.util.Collections.unmodifiableList(java.util.Arrays.asList("Vim", "Emacs", "TextMate", "Other"))));
227
+ _edbout.append("\n </p>\n <p>\n ");
228
+ _edbout.append(f.label("url"));
229
+ _edbout.append("<br />\n ");
230
+ java.lang.String temp$1 = null;
231
+ java.util.HashMap temp$2 = null;
232
+ {
233
+ {
234
+ java.util.HashMap self$2006 = new java.util.HashMap(16);
235
+ self$2006.put("size", "60");
236
+ temp$2 = self$2006;
237
+ }
238
+ }
239
+ temp$1 = f.text_field("url", temp$2);
240
+ _edbout.append(temp$1);
241
+ _edbout.append("\n </p>\n <p>\n ");
242
+ _edbout.append(f.label("address"));
243
+ _edbout.append("<br />\n ");
244
+ _edbout.append(f.text_field("address"));
245
+ _edbout.append("\n </p>\n <p>\n ");
246
+ _edbout.append(f.label("phone"));
247
+ _edbout.append("<br />\n ");
248
+ _edbout.append(f.text_field("phone"));
249
+ _edbout.append("\n </p>\n <p>\n ");
250
+ _edbout.append(f.label("private"));
251
+ _edbout.append("<br />\n ");
252
+ _edbout.append(f.check_box("private"));
253
+ _edbout.append("\n </p>\n <p>\n ");
254
+ _edbout.append(f.submit("Update"));
255
+ _edbout.append("\n </p>\n ");
256
+ _edbout.append(f.end_form());
257
+ _edbout.append("\n\n");
258
+ _edbout.append(this.link_to("Show", this.resource(this.contact, "show")));
259
+ _edbout.append(" |\n");
260
+ _edbout.append(this.link_to("Back", this.resource("contacts")));
261
+ _edbout.append("\n");
262
+ return _edbout.toString();
263
+ }
264
+ public java.lang.String main_erb() {
265
+ java.lang.StringBuilder _edbout = new java.lang.StringBuilder();
266
+ _edbout.append("<!DOCTYPE html>\n<head>\n <meta charset=\"UTF-8\" /> \n <meta name=\"csrf-param\" content=\"authenticity_token\"/>\n <meta name=\"csrf-token\" content=\"123\"/>\n <title>Contacts: ");
267
+ _edbout.append(this.params().action());
268
+ _edbout.append("</title>\n ");
269
+ _edbout.append(this.stylesheet_link_tag("scaffold"));
270
+ _edbout.append("\n ");
271
+ _edbout.append(this.stylesheet_link_tag("http://jqueryui.com/themes/base/jquery.ui.all.css"));
272
+ _edbout.append("\n ");
273
+ _edbout.append(this.javascript_include_tag("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"));
274
+ _edbout.append("\n ");
275
+ _edbout.append(this.javascript_include_tag("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"));
276
+ _edbout.append("\n ");
277
+ _edbout.append(this.javascript_include_tag("jquery.rails.min"));
278
+ _edbout.append("\n</head>\n<body>\n\n<p style=\"color: green\">");
279
+ _edbout.append(this.flash_notice());
280
+ _edbout.append("</p>\n\n");
281
+ _edbout.append(this.yield_body());
282
+ _edbout.append("\n\n</body>\n</html>\n");
283
+ return _edbout.toString();
284
+ }
285
+ }
@@ -1,3 +1,43 @@
1
1
  <!-- Generated from app.yaml. Do not edit. -->
2
2
  <web-app version='2.5' xmlns='http://java.sun.com/xml/ns/javaee'>
3
+ <servlet>
4
+ <servlet-name>info_properties</servlet-name>
5
+ <servlet-class>controllers.InfoPropertiesController</servlet-class>
6
+ </servlet>
7
+ <servlet-mapping>
8
+ <servlet-name>info_properties</servlet-name>
9
+ <url-pattern>/info/properties</url-pattern>
10
+ </servlet-mapping>
11
+ <servlet>
12
+ <servlet-name>contacts</servlet-name>
13
+ <servlet-class>controllers.ContactsController</servlet-class>
14
+ </servlet>
15
+ <servlet-mapping>
16
+ <servlet-name>contacts</servlet-name>
17
+ <url-pattern>/contacts/*</url-pattern>
18
+ </servlet-mapping>
19
+ <servlet>
20
+ <servlet-name>source</servlet-name>
21
+ <servlet-class>controllers.SourceController</servlet-class>
22
+ </servlet>
23
+ <servlet-mapping>
24
+ <servlet-name>source</servlet-name>
25
+ <url-pattern>/source/*</url-pattern>
26
+ </servlet-mapping>
27
+ <servlet>
28
+ <servlet-name>dimple_duby</servlet-name>
29
+ <servlet-class>testing.SimpleDuby</servlet-class>
30
+ </servlet>
31
+ <servlet-mapping>
32
+ <servlet-name>dimple_duby</servlet-name>
33
+ <url-pattern>/simple_duby/*</url-pattern>
34
+ </servlet-mapping>
35
+ <servlet>
36
+ <servlet-name>simple_java</servlet-name>
37
+ <servlet-class>testing.SimpleJava</servlet-class>
38
+ </servlet>
39
+ <servlet-mapping>
40
+ <servlet-name>simple_java</servlet-name>
41
+ <url-pattern>/simple_java/*</url-pattern>
42
+ </servlet-mapping>
3
43
  </web-app>
@@ -45,14 +45,6 @@ class ContactsController < ApplicationController
45
45
  redirect_to params.show
46
46
  end
47
47
 
48
- def doGet(request, response)
49
- action_response(response, action_request(request, 'get'))
50
- end
51
-
52
- def doPost(request, response)
53
- action_response(response, action_request(request, 'post'))
54
- end
55
-
56
48
  # render templates
57
49
  def_edb(index_erb, 'views/contacts/index.html.erb')
58
50
  def_edb(show_erb, 'views/contacts/show.html.erb')
@@ -27,7 +27,7 @@
27
27
  </p>
28
28
  <p>
29
29
  <%= f.label :url %><br />
30
- <%= f.text_field :url, :size => '60' %>
30
+ <%= f.text_field :url, size: '60' %>
31
31
  </p>
32
32
  <p>
33
33
  <%= f.label :address %><br />
@@ -27,8 +27,7 @@
27
27
  <td><%= contact.private ? :true : :false %></td>
28
28
  <td><%= link_to 'Show', resource(contact) %></td>
29
29
  <td><%= link_to 'Edit', resource(contact, :edit) %></td>
30
- <td><%= link_to 'Destroy', resource(contact),
31
- :confirm => 'Are you sure?', :method => :delete %></td>
30
+ <td><%= link_to 'Destroy', resource(contact), confirm: 'Are you sure?', method: :delete %></td>
32
31
  </tr>
33
32
  <% end %>
34
33
  </table>
@@ -27,7 +27,7 @@
27
27
  </p>
28
28
  <p>
29
29
  <%= f.label :url %><br />
30
- <%= f.text_field :url, :size => '60' %>
30
+ <%= f.text_field :url, size: '60' %>
31
31
  </p>
32
32
  <p>
33
33
  <%= f.label :address %><br />
Binary file
Binary file
@@ -1,65 +1,24 @@
1
1
  require 'thor'
2
2
  require 'thor/group'
3
- require 'active_support'
3
+ require 'active_support/core_ext'
4
4
 
5
- module Dubious
6
- class Init < Thor::Group
7
- include Thor::Actions
8
- argument :name, :required => true, :desc => "Name of the application/directory"
9
- source_root File.dirname(__FILE__)+"/templates/base"
10
-
11
- no_tasks do
12
- def name= name
13
- @name = name.sub /\/$/,'' #remove trailing slash
14
- end
15
- end
16
-
17
- def self.subcommand_help *args
18
- %Q(
19
- Creates a new dubious project application structure in the NAME directory.
20
- Uses NAME as the appengine app name.
21
- )
22
- end
23
-
24
- def init
25
- directory '.', "#{name}/"
26
- end
27
-
28
- def cp_dubious_jar
29
- copy_file '../../../dubious.jar', "#{name}/WEB-INF/lib/dubious.jar"
30
- end
31
-
32
- def cp_dubydatastore_jar
33
- copy_file '../../../../javalib/dubydatastore.jar', "#{name}/WEB-INF/lib/dubydatastore.jar"
34
- end
35
-
36
- end
37
-
38
- class Generator < Thor
39
- include Thor::Actions
40
- source_root File.dirname(__FILE__)+"/templates/generator"
41
- argument :name
5
+ require File.dirname(__FILE__) + '/cli/init'
6
+ require File.dirname(__FILE__) + '/cli/generator'
42
7
 
8
+ module Dubious
43
9
 
44
- desc "model NAME", "creates model file"
45
- def model#(name)
46
- template "model.mirah.tt", "app/models/#{name.underscore}.mirah"
10
+ module CLI
11
+
12
+ class Main < Thor
13
+ desc "new NAME", "creates a new dubious project in NAME"
14
+ subcommand :new, Init
15
+
16
+ desc "generate GENERATOR", "run generator GENERATOR"
17
+ subcommand :generate, Generator
47
18
  end
48
-
49
- desc "controller NAME", "creates controller file"
50
- def controller#(name)
51
- template "controller.mirah.tt", "app/controllers/#{name.underscore}_controller.mirah"
52
- empty_directory "app/views/#{name.underscore}"
53
- inject_into_file "WEB-INF/app.yaml", " - url: /#{name.underscore}/*\n servlet: controller.#{name.classify}Controller\n name: #{name.underscore}\n",:after => "handlers:\n"
19
+
20
+ def self.start
21
+ Main.start
54
22
  end
55
23
  end
56
-
57
- class CLI < Thor
58
- desc "new NAME", "creates a new dubious project in NAME"
59
- subcommand :new, Init
60
-
61
- desc "generate GENERATOR", "run generator GENERATOR"
62
- subcommand :generate, Generator
63
- end
64
-
65
24
  end
@@ -0,0 +1,23 @@
1
+ module Dubious
2
+ module CLI
3
+ class Generator < Thor
4
+ include Thor::Actions
5
+ source_root File.dirname(__FILE__)+"/../templates/generator"
6
+ argument :name
7
+
8
+
9
+ desc "model NAME", "creates model file"
10
+ def model#(name)
11
+ template "model.mirah.tt", "app/models/#{name.underscore}.mirah"
12
+ end
13
+
14
+ desc "controller NAME", "creates controller file"
15
+ def controller#(name)
16
+ template "controller.mirah.tt", "app/controllers/#{name.underscore}_controller.mirah"
17
+ empty_directory "app/views/#{name.underscore}"
18
+ inject_into_file "WEB-INF/app.yaml", " - url: /#{name.underscore}/*\n servlet: controllers.#{name.classify}Controller\n name: #{name.underscore}\n",:after => "handlers:\n"
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,35 @@
1
+ module Dubious
2
+ module CLI
3
+ class Init < Thor::Group
4
+ include Thor::Actions
5
+ argument :name, :required => true, :desc => "Name of the application/directory"
6
+ source_root File.dirname(__FILE__)+"/../templates/base"
7
+
8
+ no_tasks do
9
+ def name= name
10
+ @name = name.sub /\/$/,'' #remove trailing slash
11
+ end
12
+ end
13
+
14
+ def self.subcommand_help *args
15
+ %Q(
16
+ Creates a new dubious project application structure in the NAME directory.
17
+ Uses NAME as the appengine app name.
18
+ )
19
+ end
20
+
21
+ def init
22
+ directory '.', "#{name}/"
23
+ end
24
+
25
+ def cp_dubious_jar
26
+ copy_file '../../../dubious.jar', "#{name}/WEB-INF/lib/dubious.jar"
27
+ end
28
+
29
+ def cp_dubydatastore_jar
30
+ copy_file '../../../../javalib/dubydatastore.jar', "#{name}/WEB-INF/lib/dubydatastore.jar"
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -5,10 +5,21 @@ rescue LoadError
5
5
  exit 1
6
6
  end
7
7
 
8
+
9
+ neighbor_mirah = File.expand_path '../mirah'
10
+
11
+ if File.exists?(neighbor_mirah)
12
+ ENV['MIRAH_HOME'] ||= neighbor_mirah
13
+ end
14
+
8
15
  if ENV['MIRAH_HOME'] && File.exist?(ENV['MIRAH_HOME'] +'/lib/mirah.rb')
9
16
  $: << File.expand_path(ENV['MIRAH_HOME'] +'/lib')
10
17
  end
11
18
 
19
+ require 'rake/clean'
20
+ require 'mirah/appengine_tasks'
21
+
22
+
12
23
  if File.exist?('../bitescript/lib/bitescript.rb')
13
24
  $: << File.expand_path('../bitescript/lib/')
14
25
  end
@@ -19,9 +30,6 @@ MODEL_SRC_JAR = File.join(MIRAH_HOME, 'examples', 'appengine', 'war',
19
30
  'WEB-INF', 'lib', 'dubydatastore.jar')
20
31
 
21
32
 
22
- require 'rake/clean'
23
- require 'mirah/appengine_tasks'
24
-
25
33
  def mirahc *files
26
34
  if files[-1].kind_of?(Hash)
27
35
  options = files.pop
@@ -45,7 +53,6 @@ def mirahc *files
45
53
  end
46
54
  end
47
55
 
48
-
49
56
  OUTDIR = 'WEB-INF/classes'
50
57
 
51
58
  def class_files_for files
@@ -59,18 +66,15 @@ end
59
66
 
60
67
  MODEL_JAR = "WEB-INF/lib/dubydatastore.jar"
61
68
 
62
- LIB_MIRAH_SRC = Dir["lib/**/*.duby"]
69
+ LIB_MIRAH_SRC = Dir["lib/**/*.{duby,mirah}"]
63
70
  LIB_JAVA_SRC = Dir["lib/**/*.java"]
64
71
  LIB_SRC = LIB_MIRAH_SRC + LIB_JAVA_SRC
65
72
  LIB_CLASSES = class_files_for LIB_SRC
66
73
 
67
74
  STDLIB_CLASSES= LIB_CLASSES.select{|l|l.include? 'stdlib'}
68
75
 
69
-
70
76
  CLASSPATH = [AppEngine::Rake::SERVLET, AppEngine::SDK::API_JAR].join(":")
71
77
 
72
-
73
-
74
78
  Duby.dest_paths << OUTDIR
75
79
  Duby.source_paths << 'lib'
76
80
  Duby.source_paths << 'app'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 0
9
- version: 0.0.0
8
+ - 1
9
+ version: 0.0.1
10
10
  platform: java
11
11
  authors:
12
12
  - John Woodell
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-24 11:24:42.191000 -06:00
18
+ date: 2010-11-21 23:30:22.996000 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -45,9 +45,35 @@ dependencies:
45
45
  type: :runtime
46
46
  version_requirements: *id002
47
47
  - !ruby/object:Gem::Dependency
48
- name: appengine-sdk
48
+ name: i18n
49
49
  prerelease: false
50
50
  requirement: &id003 !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ type: :runtime
58
+ version_requirements: *id003
59
+ - !ruby/object:Gem::Dependency
60
+ name: mirah
61
+ prerelease: false
62
+ requirement: &id004 !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
68
+ - 0
69
+ - 4
70
+ version: 0.0.4
71
+ type: :runtime
72
+ version_requirements: *id004
73
+ - !ruby/object:Gem::Dependency
74
+ name: appengine-sdk
75
+ prerelease: false
76
+ requirement: &id005 !ruby/object:Gem::Requirement
51
77
  requirements:
52
78
  - - ~>
53
79
  - !ruby/object:Gem::Version
@@ -56,7 +82,7 @@ dependencies:
56
82
  - 3
57
83
  version: "1.3"
58
84
  type: :runtime
59
- version_requirements: *id003
85
+ version_requirements: *id005
60
86
  description: Dubious is a web framework written in Mirah.
61
87
  email:
62
88
  - woodie@netpress.com
@@ -74,6 +100,8 @@ files:
74
100
  - lib/dubious.jar
75
101
  - lib/dubious.rb
76
102
  - lib/dubious/cli.rb
103
+ - lib/dubious/cli/generator.rb
104
+ - lib/dubious/cli/init.rb
77
105
  - lib/dubious/templates/base/Rakefile
78
106
  - lib/dubious/templates/base/app/controllers/application_controller.mirah
79
107
  - lib/dubious/templates/base/config/application.properties.tt
@@ -98,7 +126,6 @@ files:
98
126
  - lib/dubious/templates/base/WEB-INF/app.yaml.tt
99
127
  - lib/dubious/templates/generator/controller.mirah.tt
100
128
  - lib/dubious/templates/generator/model.mirah.tt
101
- - examples/contacts/app.yaml
102
129
  - examples/contacts/Rakefile
103
130
  - examples/contacts/app/controllers/application_controller.mirah
104
131
  - examples/contacts/app/controllers/contacts_controller.mirah
@@ -152,8 +179,10 @@ files:
152
179
  - examples/contacts/WEB-INF/app.yaml
153
180
  - examples/contacts/WEB-INF/appengine-web.xml
154
181
  - examples/contacts/WEB-INF/web.xml
182
+ - examples/contacts/WEB-INF/appengine-generated/datastore-indexes-auto.xml
155
183
  - examples/contacts/WEB-INF/classes/controllers/ApplicationController.class
156
184
  - examples/contacts/WEB-INF/classes/controllers/ContactsController.class
185
+ - examples/contacts/WEB-INF/classes/controllers/ContactsController.java
157
186
  - examples/contacts/WEB-INF/classes/controllers/InfoPropertiesController.class
158
187
  - examples/contacts/WEB-INF/classes/controllers/SourceController.class
159
188
  - examples/contacts/WEB-INF/classes/models/Contact$Query.class
@@ -191,8 +220,8 @@ files:
191
220
  - README.rdoc
192
221
  has_rdoc: true
193
222
  homepage: http://github.com/mirah/dubious/
194
- licenses: []
195
-
223
+ licenses:
224
+ - Apache-2.0
196
225
  post_install_message:
197
226
  rdoc_options:
198
227
  - --main
@@ -1,44 +0,0 @@
1
- application: dubious-demo # duby-primer
2
- version: duby
3
- runtime: java
4
- public_root: /public
5
-
6
- resource_files:
7
- - exclude: /build/**
8
-
9
- static_files:
10
- - include: /**/*.ico
11
- expiration: 365d
12
- - include: /**/*.gif
13
- expiration: 365d
14
- - include: /**/*.jpeg
15
- expiration: 365d
16
- - include: /**/*.jpg
17
- expiration: 365d
18
- - include: /**/*.png
19
- expiration: 365d
20
- - include: /**/*.js
21
- expiration: 365d
22
- - include: /**/*.css
23
- expiration: 365d
24
-
25
- handlers:
26
- - url: /info/properties
27
- servlet: controllers.InfoPropertiesController
28
- name: info_properties
29
-
30
- - url: /contacts/*
31
- servlet: controllers.ContactsController
32
- name: contacts
33
-
34
- - url: /source/*
35
- servlet: controllers.SourceController
36
- name: source
37
-
38
- - url: /simple_duby/*
39
- servlet: testing.SimpleDuby
40
- name: dimple_duby
41
-
42
- - url: /simple_java/*
43
- servlet: testing.SimpleJava
44
- name: simple_java