dubious 0.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +202 -0
- data/README.rdoc +160 -0
- data/ROADMAP.rdoc +28 -0
- data/Rakefile +130 -0
- data/bin/dubious +4 -0
- data/examples/contacts/Rakefile +169 -0
- data/examples/contacts/WEB-INF/app.yaml +9 -0
- data/examples/contacts/WEB-INF/appengine-web.xml +14 -0
- data/examples/contacts/WEB-INF/classes/controllers/ApplicationController.class +0 -0
- data/examples/contacts/WEB-INF/classes/controllers/ContactsController.class +0 -0
- data/examples/contacts/WEB-INF/classes/controllers/InfoPropertiesController.class +0 -0
- data/examples/contacts/WEB-INF/classes/controllers/SourceController.class +0 -0
- data/examples/contacts/WEB-INF/classes/models/Contact$Query.class +0 -0
- data/examples/contacts/WEB-INF/classes/models/Contact.class +0 -0
- data/examples/contacts/WEB-INF/lib/appengine-api.jar +0 -0
- data/examples/contacts/WEB-INF/lib/dubious.jar +0 -0
- data/examples/contacts/WEB-INF/lib/dubydatastore.jar +0 -0
- data/examples/contacts/WEB-INF/web.xml +3 -0
- data/examples/contacts/app.yaml +44 -0
- data/examples/contacts/app/controllers/application_controller.mirah +5 -0
- data/examples/contacts/app/controllers/contacts_controller.mirah +62 -0
- data/examples/contacts/app/controllers/info_properties_controller.mirah +55 -0
- data/examples/contacts/app/controllers/source_controller.mirah +30 -0
- data/examples/contacts/app/models/contact.mirah +28 -0
- data/examples/contacts/app/views/contacts/edit.html.erb +50 -0
- data/examples/contacts/app/views/contacts/index.html.erb +38 -0
- data/examples/contacts/app/views/contacts/new.html.erb +49 -0
- data/examples/contacts/app/views/contacts/show.html.erb +47 -0
- data/examples/contacts/app/views/layouts/application.html.erb +10 -0
- data/examples/contacts/app/views/layouts/contacts.html.erb +20 -0
- data/examples/contacts/app/views/source/list.html.erb +27 -0
- data/examples/contacts/app/views/source/show.html.erb +15 -0
- data/examples/contacts/config/application.properties +4 -0
- data/examples/contacts/config/asset.properties +32 -0
- data/examples/contacts/config/build.properties +10 -0
- data/examples/contacts/config/routes.properties +1 -0
- data/examples/contacts/public/404.html +30 -0
- data/examples/contacts/public/422.html +30 -0
- data/examples/contacts/public/500.html +30 -0
- data/examples/contacts/public/favicon.ico +0 -0
- data/examples/contacts/public/images/appengine_duby.png +0 -0
- data/examples/contacts/public/images/back.gif +0 -0
- data/examples/contacts/public/images/dir.gif +0 -0
- data/examples/contacts/public/images/dubious.png +0 -0
- data/examples/contacts/public/images/file.gif +0 -0
- data/examples/contacts/public/images/silver-120x30.gif +0 -0
- data/examples/contacts/public/index.html +144 -0
- data/examples/contacts/public/javascripts/effects.js +1128 -0
- data/examples/contacts/public/javascripts/jquery.rails.min.js +117 -0
- data/examples/contacts/public/javascripts/lang/sh_css.min.js +1 -0
- data/examples/contacts/public/javascripts/lang/sh_duby.min.js +1 -0
- data/examples/contacts/public/javascripts/lang/sh_erb.min.js +1 -0
- data/examples/contacts/public/javascripts/lang/sh_html.min.js +1 -0
- data/examples/contacts/public/javascripts/lang/sh_java.min.js +1 -0
- data/examples/contacts/public/javascripts/lang/sh_js.min.js +1 -0
- data/examples/contacts/public/javascripts/lang/sh_mirah.min.js +1 -0
- data/examples/contacts/public/javascripts/lang/sh_properties.min.js +1 -0
- data/examples/contacts/public/javascripts/lang/sh_rb.min.js +1 -0
- data/examples/contacts/public/javascripts/lang/sh_sh.min.js +1 -0
- data/examples/contacts/public/javascripts/lang/sh_xml.min.js +1 -0
- data/examples/contacts/public/javascripts/lang/sh_yaml.min.js +1 -0
- data/examples/contacts/public/javascripts/prototype.js +4320 -0
- data/examples/contacts/public/javascripts/sh_main.min.js +4 -0
- data/examples/contacts/public/robots.txt +0 -0
- data/examples/contacts/public/stylesheets/main.css +188 -0
- data/examples/contacts/public/stylesheets/scaffold.css +57 -0
- data/examples/contacts/public/stylesheets/sh_style.css +66 -0
- data/examples/contacts/public/stylesheets/source.css +27 -0
- data/examples/shout/Rakefile +138 -0
- data/examples/shout/WEB-INF/appengine-web.xml +14 -0
- data/examples/shout/WEB-INF/web.xml +11 -0
- data/examples/shout/app.mirah +35 -0
- data/examples/shout/app.yaml +11 -0
- data/examples/shout/public/404.html +30 -0
- data/examples/shout/public/422.html +30 -0
- data/examples/shout/public/500.html +30 -0
- data/examples/shout/public/favicon.ico +0 -0
- data/examples/shout/public/images/appengine_duby.png +0 -0
- data/examples/shout/public/images/back.gif +0 -0
- data/examples/shout/public/images/dir.gif +0 -0
- data/examples/shout/public/images/file.gif +0 -0
- data/examples/shout/public/images/silver-120x30.gif +0 -0
- data/examples/shout/public/index.html +116 -0
- data/examples/shout/public/javascripts/effects.js +1128 -0
- data/examples/shout/public/javascripts/jquery.rails.min.js +117 -0
- data/examples/shout/public/javascripts/prototype.js +4320 -0
- data/examples/shout/public/robots.txt +0 -0
- data/examples/shout/public/stylesheets/main.css +185 -0
- data/examples/shout/public/stylesheets/scaffold.css +57 -0
- data/examples/shout/views/application.html.erb +10 -0
- data/examples/shout/views/list.html.erb +14 -0
- data/javalib/dubydatastore.jar +0 -0
- data/lib/dubious.jar +0 -0
- data/lib/dubious.rb +2 -0
- data/lib/dubious/cli.rb +65 -0
- data/lib/dubious/templates/base/Rakefile +169 -0
- data/lib/dubious/templates/base/WEB-INF/app.yaml.tt +9 -0
- data/lib/dubious/templates/base/app/controllers/application_controller.mirah +5 -0
- data/lib/dubious/templates/base/config/application.properties.tt +6 -0
- data/lib/dubious/templates/base/config/asset.properties +0 -0
- data/lib/dubious/templates/base/config/build.properties +0 -0
- data/lib/dubious/templates/base/config/routes.properties +1 -0
- data/lib/dubious/templates/base/public/404.html +30 -0
- data/lib/dubious/templates/base/public/422.html +30 -0
- data/lib/dubious/templates/base/public/500.html +30 -0
- data/lib/dubious/templates/base/public/favicon.ico +0 -0
- data/lib/dubious/templates/base/public/images/appengine_duby.png +0 -0
- data/lib/dubious/templates/base/public/images/back.gif +0 -0
- data/lib/dubious/templates/base/public/images/dir.gif +0 -0
- data/lib/dubious/templates/base/public/images/dubious.png +0 -0
- data/lib/dubious/templates/base/public/images/file.gif +0 -0
- data/lib/dubious/templates/base/public/images/silver-120x30.gif +0 -0
- data/lib/dubious/templates/base/public/index.html +144 -0
- data/lib/dubious/templates/base/public/javascripts/jquery.rails.min.js +117 -0
- data/lib/dubious/templates/base/public/robots.txt +0 -0
- data/lib/dubious/templates/base/public/stylesheets/main.css +188 -0
- data/lib/dubious/templates/base/public/stylesheets/scaffold.css +57 -0
- data/lib/dubious/templates/generator/controller.mirah.tt +5 -0
- data/lib/dubious/templates/generator/model.mirah.tt +6 -0
- metadata +224 -0
File without changes
|
@@ -0,0 +1,185 @@
|
|
1
|
+
body {
|
2
|
+
margin: 0;
|
3
|
+
margin-bottom: 25px;
|
4
|
+
padding: 0;
|
5
|
+
background-color: #f0f0f0;
|
6
|
+
font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
|
7
|
+
font-size: 13px;
|
8
|
+
color: #333;
|
9
|
+
}
|
10
|
+
|
11
|
+
h1 {
|
12
|
+
font-size: 28px;
|
13
|
+
color: #000;
|
14
|
+
}
|
15
|
+
|
16
|
+
a {color: #666}
|
17
|
+
a:hover {
|
18
|
+
background-color: #ccc;
|
19
|
+
color: white;
|
20
|
+
text-decoration: none;
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
#page {
|
25
|
+
background-color: #f0f0f0;
|
26
|
+
width: 750px;
|
27
|
+
margin: 0;
|
28
|
+
margin-left: auto;
|
29
|
+
margin-right: auto;
|
30
|
+
}
|
31
|
+
|
32
|
+
#content {
|
33
|
+
float: left;
|
34
|
+
background-color: white;
|
35
|
+
border: 3px solid #aaa;
|
36
|
+
border-top: none;
|
37
|
+
padding: 25px;
|
38
|
+
width: 500px;
|
39
|
+
}
|
40
|
+
|
41
|
+
#sidebar {
|
42
|
+
float: right;
|
43
|
+
width: 175px;
|
44
|
+
}
|
45
|
+
|
46
|
+
#footer {
|
47
|
+
clear: both;
|
48
|
+
}
|
49
|
+
|
50
|
+
#header, #about, #getting-started {
|
51
|
+
padding-left: 75px;
|
52
|
+
padding-right: 30px;
|
53
|
+
}
|
54
|
+
|
55
|
+
#header {
|
56
|
+
height: 64px;
|
57
|
+
}
|
58
|
+
|
59
|
+
#header h1, #header h2 {margin: 0}
|
60
|
+
#header h2 {
|
61
|
+
color: #888;
|
62
|
+
font-weight: normal;
|
63
|
+
font-size: 16px;
|
64
|
+
}
|
65
|
+
|
66
|
+
td.mono { font-family: "Andale Mono", "monospace"; }
|
67
|
+
|
68
|
+
#about h3 {
|
69
|
+
margin: 0;
|
70
|
+
margin-bottom: 10px;
|
71
|
+
font-size: 14px;
|
72
|
+
}
|
73
|
+
|
74
|
+
#about-content {
|
75
|
+
background-color: #ffd;
|
76
|
+
border: 1px solid #fc0;
|
77
|
+
margin-left: -11px;
|
78
|
+
}
|
79
|
+
#about-content table {
|
80
|
+
margin-top: 10px;
|
81
|
+
margin-bottom: 10px;
|
82
|
+
font-size: 11px;
|
83
|
+
border-collapse: collapse;
|
84
|
+
}
|
85
|
+
#about-content td {
|
86
|
+
padding: 10px;
|
87
|
+
padding-top: 3px;
|
88
|
+
padding-bottom: 3px;
|
89
|
+
}
|
90
|
+
#about-content td.name {color: #555}
|
91
|
+
#about-content td.value {color: #000}
|
92
|
+
|
93
|
+
#about-content.failure {
|
94
|
+
background-color: #fcc;
|
95
|
+
border: 1px solid #f00;
|
96
|
+
}
|
97
|
+
#about-content.failure p {
|
98
|
+
margin: 0;
|
99
|
+
padding: 10px;
|
100
|
+
}
|
101
|
+
|
102
|
+
code {
|
103
|
+
color: Brown;
|
104
|
+
}
|
105
|
+
|
106
|
+
#getting-started {
|
107
|
+
border-top: 1px solid #ccc;
|
108
|
+
margin-top: 25px;
|
109
|
+
padding-top: 15px;
|
110
|
+
}
|
111
|
+
#getting-started h1 {
|
112
|
+
margin: 0;
|
113
|
+
font-size: 20px;
|
114
|
+
}
|
115
|
+
#getting-started h2 {
|
116
|
+
margin: 0;
|
117
|
+
font-size: 14px;
|
118
|
+
font-weight: normal;
|
119
|
+
color: #333;
|
120
|
+
margin-bottom: 25px;
|
121
|
+
}
|
122
|
+
#getting-started ul {
|
123
|
+
margin-left: 0;
|
124
|
+
padding-left: 0;
|
125
|
+
}
|
126
|
+
#getting-started ol {
|
127
|
+
margin-left: 0;
|
128
|
+
padding-left: 0;
|
129
|
+
}
|
130
|
+
#getting-started li {
|
131
|
+
font-size: 18px;
|
132
|
+
color: #888;
|
133
|
+
margin-bottom: 25px;
|
134
|
+
}
|
135
|
+
#getting-started li h2 {
|
136
|
+
margin: 0;
|
137
|
+
font-weight: normal;
|
138
|
+
font-size: 18px;
|
139
|
+
color: #333;
|
140
|
+
}
|
141
|
+
#getting-started li p {
|
142
|
+
color: #555;
|
143
|
+
font-size: 13px;
|
144
|
+
}
|
145
|
+
|
146
|
+
|
147
|
+
#search {
|
148
|
+
margin: 0;
|
149
|
+
padding-top: 10px;
|
150
|
+
padding-bottom: 10px;
|
151
|
+
font-size: 11px;
|
152
|
+
}
|
153
|
+
#search input {
|
154
|
+
font-size: 11px;
|
155
|
+
margin: 2px;
|
156
|
+
}
|
157
|
+
#search-text {width: 170px}
|
158
|
+
|
159
|
+
|
160
|
+
#sidebar ul {
|
161
|
+
margin-left: 0;
|
162
|
+
padding-left: 0;
|
163
|
+
}
|
164
|
+
#sidebar ul h3 {
|
165
|
+
margin-top: 25px;
|
166
|
+
font-size: 16px;
|
167
|
+
padding-bottom: 10px;
|
168
|
+
border-bottom: 1px solid #ccc;
|
169
|
+
}
|
170
|
+
#sidebar li {
|
171
|
+
list-style-type: none;
|
172
|
+
}
|
173
|
+
#sidebar ul.links li {
|
174
|
+
margin-bottom: 5px;
|
175
|
+
}
|
176
|
+
span.comment {
|
177
|
+
color: blue;
|
178
|
+
font-weight: plain;
|
179
|
+
}
|
180
|
+
pre {
|
181
|
+
font-size: 12pt;
|
182
|
+
}
|
183
|
+
span.appid {
|
184
|
+
color: green;
|
185
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
div.ui-datepicker-title { font-size: 8pt; }
|
2
|
+
th { font-size: 8pt; }
|
3
|
+
|
4
|
+
body { background-color: #fff; color: #333; }
|
5
|
+
|
6
|
+
body, p, ol, ul, td {
|
7
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
8
|
+
font-size: 13px;
|
9
|
+
line-height: 18px;
|
10
|
+
}
|
11
|
+
|
12
|
+
pre {
|
13
|
+
background-color: #eee;
|
14
|
+
padding: 10px;
|
15
|
+
font-size: 11px;
|
16
|
+
}
|
17
|
+
|
18
|
+
a { color: #000; }
|
19
|
+
a:visited { color: #666; }
|
20
|
+
a:hover { color: #fff; background-color:#000; }
|
21
|
+
|
22
|
+
.fieldWithErrors {
|
23
|
+
padding: 2px;
|
24
|
+
background-color: red;
|
25
|
+
display: table;
|
26
|
+
}
|
27
|
+
|
28
|
+
#errorExplanation {
|
29
|
+
width: 400px;
|
30
|
+
border: 2px solid red;
|
31
|
+
padding: 7px;
|
32
|
+
padding-bottom: 12px;
|
33
|
+
margin-bottom: 20px;
|
34
|
+
background-color: #f0f0f0;
|
35
|
+
}
|
36
|
+
|
37
|
+
#errorExplanation h2 {
|
38
|
+
text-align: left;
|
39
|
+
font-weight: bold;
|
40
|
+
padding: 5px 5px 5px 15px;
|
41
|
+
font-size: 12px;
|
42
|
+
margin: -7px;
|
43
|
+
background-color: #c00;
|
44
|
+
color: #fff;
|
45
|
+
}
|
46
|
+
|
47
|
+
#errorExplanation p {
|
48
|
+
color: #333;
|
49
|
+
margin-bottom: 0;
|
50
|
+
padding: 5px;
|
51
|
+
}
|
52
|
+
|
53
|
+
#errorExplanation ul li {
|
54
|
+
font-size: 12px;
|
55
|
+
list-style: square;
|
56
|
+
}
|
57
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
<h1>All Shouts:</h1>
|
3
|
+
<% for shout in @shouts %>
|
4
|
+
<p><b><%=h shout.title %></b> — <%=h shout.body %></p>
|
5
|
+
<% end %>
|
6
|
+
<hr>
|
7
|
+
<h1>New Shout:</h1>
|
8
|
+
<form method=post>
|
9
|
+
Title: <input id='shout_title' type='text' name='title' /><br/>
|
10
|
+
Body: <input id='shout_body' type='text' name='body' /><br/>
|
11
|
+
<input type=submit>
|
12
|
+
</form>
|
13
|
+
<br/><% options = HashMap.new; options.put("size", "120x30") %>
|
14
|
+
<%= image_tag "silver-120x30.gif", options %>
|
Binary file
|
data/lib/dubious.jar
ADDED
Binary file
|
data/lib/dubious.rb
ADDED
data/lib/dubious/cli.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'thor/group'
|
3
|
+
require 'active_support'
|
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
|
42
|
+
|
43
|
+
|
44
|
+
desc "model NAME", "creates model file"
|
45
|
+
def model#(name)
|
46
|
+
template "model.mirah.tt", "app/models/#{name.underscore}.mirah"
|
47
|
+
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"
|
54
|
+
end
|
55
|
+
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
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
begin
|
2
|
+
require 'ant'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'This Rakefile requires JRuby. Please use jruby -S rake.'
|
5
|
+
exit 1
|
6
|
+
end
|
7
|
+
|
8
|
+
if ENV['MIRAH_HOME'] && File.exist?(ENV['MIRAH_HOME'] +'/lib/mirah.rb')
|
9
|
+
$: << File.expand_path(ENV['MIRAH_HOME'] +'/lib')
|
10
|
+
end
|
11
|
+
|
12
|
+
if File.exist?('../bitescript/lib/bitescript.rb')
|
13
|
+
$: << File.expand_path('../bitescript/lib/')
|
14
|
+
end
|
15
|
+
|
16
|
+
MIRAH_HOME = ENV['MIRAH_HOME'] ? ENV['MIRAH_HOME'] : Gem.find_files('mirah').first.sub(/lib\/mirah.rb/,'')
|
17
|
+
|
18
|
+
MODEL_SRC_JAR = File.join(MIRAH_HOME, 'examples', 'appengine', 'war',
|
19
|
+
'WEB-INF', 'lib', 'dubydatastore.jar')
|
20
|
+
|
21
|
+
|
22
|
+
require 'rake/clean'
|
23
|
+
require 'mirah/appengine_tasks'
|
24
|
+
|
25
|
+
def mirahc *files
|
26
|
+
if files[-1].kind_of?(Hash)
|
27
|
+
options = files.pop
|
28
|
+
else
|
29
|
+
options = {}
|
30
|
+
end
|
31
|
+
source_dir = options.fetch(:dir, Duby.source_path)
|
32
|
+
dest = File.expand_path(options.fetch(:dest, Duby.dest_path))
|
33
|
+
files = files.map {|f| f.sub(/^#{source_dir}\//, '')}
|
34
|
+
flags = options.fetch(:options, Duby.compiler_options)
|
35
|
+
args = ['-d', dest, *flags] + files
|
36
|
+
chdir(source_dir) do
|
37
|
+
cmd = "mirahc #{args.join ' '}"
|
38
|
+
puts cmd
|
39
|
+
if files.any? {|f|f.include? 'controllers'}
|
40
|
+
system cmd
|
41
|
+
else
|
42
|
+
Duby.compile(*args)
|
43
|
+
Duby.reset
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
OUTDIR = 'WEB-INF/classes'
|
50
|
+
|
51
|
+
def class_files_for files
|
52
|
+
files.map do |f|
|
53
|
+
explode = f.split('/')[1..-1]
|
54
|
+
explode.last.gsub!(/(^[a-z]|_[a-z])/) {|m|m.sub('_','').upcase}
|
55
|
+
explode.last.sub! /\.(duby|java|mirah)$/, '.class'
|
56
|
+
OUTDIR + '/' + explode.join('/')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
MODEL_JAR = "WEB-INF/lib/dubydatastore.jar"
|
61
|
+
|
62
|
+
LIB_MIRAH_SRC = Dir["lib/**/*.duby"]
|
63
|
+
LIB_JAVA_SRC = Dir["lib/**/*.java"]
|
64
|
+
LIB_SRC = LIB_MIRAH_SRC + LIB_JAVA_SRC
|
65
|
+
LIB_CLASSES = class_files_for LIB_SRC
|
66
|
+
|
67
|
+
STDLIB_CLASSES= LIB_CLASSES.select{|l|l.include? 'stdlib'}
|
68
|
+
|
69
|
+
|
70
|
+
CLASSPATH = [AppEngine::Rake::SERVLET, AppEngine::SDK::API_JAR].join(":")
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
Duby.dest_paths << OUTDIR
|
75
|
+
Duby.source_paths << 'lib'
|
76
|
+
Duby.source_paths << 'app'
|
77
|
+
Duby.compiler_options << '--classpath' << [File.expand_path(OUTDIR), *FileList["WEB-INF/lib/*.jar"].map{|f|File.expand_path(f)}].join(':') + ':' + CLASSPATH
|
78
|
+
|
79
|
+
CLEAN.include(OUTDIR)
|
80
|
+
CLOBBER.include("WEB-INF/lib/dubious.jar", 'WEB-INF/appengine-generated')
|
81
|
+
|
82
|
+
APP_SRC = Dir["app/**/{*.duby,*.mirah}"]
|
83
|
+
APP_CLASSES = class_files_for APP_SRC
|
84
|
+
APP_MODEL_CLASSES = APP_CLASSES.select {|app| app.include? '/models' }
|
85
|
+
APP_CONTROLLER_CLASSES = APP_CLASSES.select {|app| app.include? '/controllers' }
|
86
|
+
APP_APPLICATION_CONTROLLER_CLASS = APP_CONTROLLER_CLASSES.find {|controller| controller.include? 'ApplicationController' }
|
87
|
+
TEMPLATES = Dir["app/views/**/*.erb"]
|
88
|
+
|
89
|
+
directory OUTDIR
|
90
|
+
|
91
|
+
(APP_CLASSES+LIB_CLASSES).zip(APP_SRC+LIB_SRC).each do |klass,src|
|
92
|
+
file klass => src
|
93
|
+
end
|
94
|
+
|
95
|
+
APP_CONTROLLER_CLASSES.reject {|k|k == APP_APPLICATION_CONTROLLER_CLASS}.each do |klass|
|
96
|
+
file klass => APP_APPLICATION_CONTROLLER_CLASS
|
97
|
+
end
|
98
|
+
|
99
|
+
APP_CONTROLLER_CLASSES.each do |f|
|
100
|
+
file f => APP_MODEL_CLASSES + TEMPLATES
|
101
|
+
end
|
102
|
+
|
103
|
+
APP_CLASSES.each do |f|
|
104
|
+
file f => LIB_CLASSES
|
105
|
+
end
|
106
|
+
|
107
|
+
file MODEL_JAR => MODEL_SRC_JAR do |t|
|
108
|
+
cp MODEL_SRC_JAR, MODEL_JAR
|
109
|
+
end
|
110
|
+
|
111
|
+
appengine_app :app, 'app', '' => APP_CLASSES+LIB_CLASSES
|
112
|
+
|
113
|
+
#there is an upload task in appengine_tasks, but I couldn't get it to work
|
114
|
+
desc "publish to appengine"
|
115
|
+
task :publish => 'compile:app' do
|
116
|
+
sh "appcfg.sh update ."
|
117
|
+
end
|
118
|
+
|
119
|
+
namespace :compile do
|
120
|
+
task :app => APP_CLASSES
|
121
|
+
|
122
|
+
task :java => OUTDIR do
|
123
|
+
ant.javac :srcdir => 'lib', :destdir => OUTDIR, :classpath => CLASSPATH
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
desc "compile app"
|
129
|
+
task :compile => 'compile:app'
|
130
|
+
|
131
|
+
desc "run development server"
|
132
|
+
task :server
|
133
|
+
|
134
|
+
task :default => :server
|
135
|
+
|
136
|
+
task :generate_build_properties do
|
137
|
+
def git_data(dir, file='')
|
138
|
+
returning = nil
|
139
|
+
chdir dir do
|
140
|
+
# ["commit abc....123", "2010-06-23 12:58:06 -0700"]
|
141
|
+
IO.popen("git rev-list --pretty=format:%ci -1 HEAD #{file}") do |f|
|
142
|
+
returning = [f.gets.chomp, f.gets.chomp]
|
143
|
+
end
|
144
|
+
end
|
145
|
+
returning
|
146
|
+
end
|
147
|
+
|
148
|
+
dubious_data = git_data(".")
|
149
|
+
mirah_data = git_data(MIRAH_HOME)
|
150
|
+
bite_data = git_data(MIRAH_HOME + '/../bitescript')
|
151
|
+
model_data = git_data(File.dirname(MODEL_SRC_JAR),File.basename(MODEL_SRC_JAR))
|
152
|
+
|
153
|
+
prop_file = "config/build.properties"
|
154
|
+
File.open(prop_file, 'w') do |f|
|
155
|
+
f.write <<-EOF
|
156
|
+
# the current build environment
|
157
|
+
application.build.time=#{Time.now.xmlschema}
|
158
|
+
dubious.version.commit=#{dubious_data[0][7..-1]}
|
159
|
+
dubious.version.time=#{Time.parse(dubious_data[1]).xmlschema}
|
160
|
+
mirah.version.commit=#{mirah_data[0][7..-1]}
|
161
|
+
mirah.version.time=#{Time.parse(mirah_data[1]).xmlschema}
|
162
|
+
bitescript.version.commit=#{bite_data[0][7..-1]}
|
163
|
+
bitescript.version.time=#{Time.parse(bite_data[1]).xmlschema}
|
164
|
+
model.version.commit=#{model_data[0][7..-1]}
|
165
|
+
model.version.time=#{Time.parse(model_data[1]).xmlschema}
|
166
|
+
EOF
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|