dubious 0.0.1-java → 0.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -3
- data/Rakefile +11 -3
- data/examples/contacts/Rakefile +12 -103
- data/examples/contacts/WEB-INF/appengine-generated/datastore-indexes-auto.xml +1 -1
- data/examples/contacts/WEB-INF/lib/dubious.jar +0 -0
- data/examples/shout/Rakefile +8 -97
- data/examples/shout/WEB-INF/app.yaml +12 -0
- data/examples/shout/WEB-INF/appengine-generated/datastore-indexes-auto.xml +4 -0
- data/examples/shout/WEB-INF/appengine-web.xml +1 -0
- data/examples/shout/WEB-INF/classes/App.class +0 -0
- data/examples/shout/WEB-INF/classes/Shout$Query.class +0 -0
- data/examples/shout/WEB-INF/classes/Shout.class +0 -0
- data/examples/shout/WEB-INF/classes/ShoutController.class +0 -0
- data/examples/shout/WEB-INF/classes/Users/nick/hacking/dubious/examples/shout/App.class +0 -0
- data/examples/shout/WEB-INF/classes/Users/nick/hacking/dubious/examples/shout/Shout$Query.class +0 -0
- data/examples/shout/WEB-INF/classes/Users/nick/hacking/dubious/examples/shout/Shout.class +0 -0
- data/examples/shout/WEB-INF/classes/Users/nick/hacking/dubious/examples/shout/ShoutController.class +0 -0
- data/examples/shout/WEB-INF/lib/appengine-api.jar +0 -0
- data/examples/shout/WEB-INF/lib/dubious.jar +0 -0
- data/examples/shout/WEB-INF/lib/dubydatastore.jar +0 -0
- data/examples/shout/WEB-INF/web.xml +3 -3
- data/lib/dubious.rb +2 -0
- data/lib/dubious/templates/base/Rakefile +11 -106
- data/lib/dubious/version.rb +3 -0
- data/lib/dubious_tasks.rb +97 -0
- metadata +21 -5
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubygems/package_task'
|
1
3
|
require 'rake/clean'
|
2
4
|
|
3
5
|
begin
|
@@ -7,6 +9,12 @@ rescue LoadError
|
|
7
9
|
exit 1
|
8
10
|
end
|
9
11
|
|
12
|
+
Gem::PackageTask.new Gem::Specification.load('dubious.gemspec') do |pkg|
|
13
|
+
pkg.need_zip = true
|
14
|
+
pkg.need_tar = true
|
15
|
+
end
|
16
|
+
|
17
|
+
task :gem => :jar
|
10
18
|
|
11
19
|
neighbor_mirah = File.expand_path '../mirah'
|
12
20
|
|
@@ -50,9 +58,9 @@ LIB_SRC = LIB_MIRAH_SRC + LIB_JAVA_SRC
|
|
50
58
|
LIB_CLASSES = class_files_for LIB_SRC
|
51
59
|
STDLIB_CLASSES= LIB_CLASSES.select{|l|l.include? 'stdlib'}
|
52
60
|
|
53
|
-
|
54
|
-
|
55
|
-
|
61
|
+
Mirah.dest_paths << OUTDIR
|
62
|
+
Mirah.source_paths << SRCDIR
|
63
|
+
Mirah.compiler_options << '--classpath' << [File.expand_path(OUTDIR), *FileList["lib/*.jar", "javalib/*.jar"].map{|f|File.expand_path(f)}].join(':')
|
56
64
|
|
57
65
|
|
58
66
|
file "#{OUTDIR}/dubious/Inflection.class" => :'compile:java'
|
data/examples/contacts/Rakefile
CHANGED
@@ -5,48 +5,17 @@ rescue LoadError
|
|
5
5
|
exit 1
|
6
6
|
end
|
7
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
8
|
require 'rake/clean'
|
23
|
-
require '
|
9
|
+
require 'dubious_tasks'
|
24
10
|
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
11
|
+
OUTDIR = 'WEB-INF/classes'
|
12
|
+
CLEAN.include(OUTDIR)
|
13
|
+
CLOBBER.include("WEB-INF/lib/dubious.jar", 'WEB-INF/appengine-generated')
|
47
14
|
|
48
15
|
|
49
|
-
|
16
|
+
mirah_compile_options :dest_path => OUTDIR,
|
17
|
+
:source_paths => ['lib', 'app' ],
|
18
|
+
:compiler_options => ['--classpath', [File.expand_path(OUTDIR), *FileList["WEB-INF/lib/*.jar"].map{|f|File.expand_path(f)}].join(':') + ':' + CLASSPATH ]
|
50
19
|
|
51
20
|
def class_files_for files
|
52
21
|
files.map do |f|
|
@@ -59,32 +28,18 @@ end
|
|
59
28
|
|
60
29
|
MODEL_JAR = "WEB-INF/lib/dubydatastore.jar"
|
61
30
|
|
62
|
-
LIB_MIRAH_SRC = Dir["lib/**/*.duby"]
|
31
|
+
LIB_MIRAH_SRC = Dir["lib/**/*.{duby,mirah}"]
|
63
32
|
LIB_JAVA_SRC = Dir["lib/**/*.java"]
|
64
33
|
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
34
|
|
82
35
|
APP_SRC = Dir["app/**/{*.duby,*.mirah}"]
|
36
|
+
TEMPLATES = Dir["app/views/**/*.erb"]
|
37
|
+
|
38
|
+
LIB_CLASSES = class_files_for LIB_SRC
|
83
39
|
APP_CLASSES = class_files_for APP_SRC
|
84
40
|
APP_MODEL_CLASSES = APP_CLASSES.select {|app| app.include? '/models' }
|
85
41
|
APP_CONTROLLER_CLASSES = APP_CLASSES.select {|app| app.include? '/controllers' }
|
86
42
|
APP_APPLICATION_CONTROLLER_CLASS = APP_CONTROLLER_CLASSES.find {|controller| controller.include? 'ApplicationController' }
|
87
|
-
TEMPLATES = Dir["app/views/**/*.erb"]
|
88
43
|
|
89
44
|
directory OUTDIR
|
90
45
|
|
@@ -92,7 +47,7 @@ directory OUTDIR
|
|
92
47
|
file klass => src
|
93
48
|
end
|
94
49
|
|
95
|
-
APP_CONTROLLER_CLASSES.reject
|
50
|
+
APP_CONTROLLER_CLASSES.reject{|k| k == APP_APPLICATION_CONTROLLER_CLASS }.each do |klass|
|
96
51
|
file klass => APP_APPLICATION_CONTROLLER_CLASS
|
97
52
|
end
|
98
53
|
|
@@ -110,60 +65,14 @@ end
|
|
110
65
|
|
111
66
|
appengine_app :app, 'app', '' => APP_CLASSES+LIB_CLASSES
|
112
67
|
|
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
68
|
namespace :compile do
|
120
69
|
task :app => APP_CLASSES
|
121
70
|
|
122
71
|
task :java => OUTDIR do
|
123
72
|
ant.javac :srcdir => 'lib', :destdir => OUTDIR, :classpath => CLASSPATH
|
124
73
|
end
|
125
|
-
|
126
74
|
end
|
127
75
|
|
128
76
|
desc "compile app"
|
129
77
|
task :compile => 'compile:app'
|
130
78
|
|
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
|
Binary file
|
data/examples/shout/Rakefile
CHANGED
@@ -5,75 +5,29 @@ rescue LoadError
|
|
5
5
|
exit 1
|
6
6
|
end
|
7
7
|
|
8
|
-
|
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
|
-
MODEL_JAR = "WEB-INF/lib/dubydatastore.jar"
|
21
|
-
|
8
|
+
require 'dubious_tasks'
|
22
9
|
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
10
|
|
49
11
|
OUTDIR = 'WEB-INF/classes'
|
50
12
|
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
-
CLASSPATH = [AppEngine::Rake::SERVLET, AppEngine::SDK::API_JAR].join(":")
|
13
|
+
mirah_compile_options :dest_path => OUTDIR,
|
14
|
+
:source_paths => '.',
|
15
|
+
:compiler_options => ['--classpath', [File.expand_path(OUTDIR), *FileList["WEB-INF/lib/*.jar"].map{|f|File.expand_path(f)}].join(':') + ':' + CLASSPATH]
|
61
16
|
|
62
|
-
|
63
|
-
Duby.source_paths << '.'
|
64
|
-
Duby.compiler_options << '--classpath' << [File.expand_path(OUTDIR), *FileList["WEB-INF/lib/*.jar"].map{|f|File.expand_path(f)}].join(':') + ':' + CLASSPATH
|
17
|
+
MODEL_JAR = "WEB-INF/lib/dubydatastore.jar"
|
65
18
|
|
66
19
|
CLEAN.include(OUTDIR)
|
67
20
|
CLOBBER.include("WEB-INF/lib/dubious.jar", 'WEB-INF/appengine-generated')
|
68
21
|
|
69
|
-
APP_SRC = [
|
22
|
+
APP_SRC = ["app.mirah"]
|
70
23
|
APP_CLASSES = ["#{OUTDIR}/ShoutController.class","#{OUTDIR}/Shout.class"]
|
71
24
|
TEMPLATES = Dir["views/**/*.erb"]
|
72
25
|
|
73
26
|
directory OUTDIR
|
74
27
|
|
75
28
|
APP_CLASSES.each do |klass|
|
76
|
-
|
29
|
+
p klass
|
30
|
+
file klass => APP_SRC do
|
77
31
|
mirahc *APP_SRC
|
78
32
|
end
|
79
33
|
end
|
@@ -84,12 +38,6 @@ end
|
|
84
38
|
|
85
39
|
appengine_app :app, 'app', '' => APP_CLASSES
|
86
40
|
|
87
|
-
#there is an upload task in appengine_tasks, but I couldn't get it to work
|
88
|
-
desc "publish to appengine"
|
89
|
-
task :publish => 'compile:app' do
|
90
|
-
sh "appcfg.sh update ."
|
91
|
-
end
|
92
|
-
|
93
41
|
namespace :compile do
|
94
42
|
task :app => APP_CLASSES
|
95
43
|
end
|
@@ -97,42 +45,5 @@ end
|
|
97
45
|
desc "compile app"
|
98
46
|
task :compile => 'compile:app'
|
99
47
|
|
100
|
-
desc "run development server"
|
101
|
-
task :server
|
102
|
-
|
103
48
|
task :default => :server
|
104
49
|
|
105
|
-
task :generate_build_properties do
|
106
|
-
def git_data(dir, file='')
|
107
|
-
returning = nil
|
108
|
-
chdir dir do
|
109
|
-
# ["commit abc....123", "2010-06-23 12:58:06 -0700"]
|
110
|
-
IO.popen("git rev-list --pretty=format:%ci -1 HEAD #{file}") do |f|
|
111
|
-
returning = [f.gets.chomp, f.gets.chomp]
|
112
|
-
end
|
113
|
-
end
|
114
|
-
returning
|
115
|
-
end
|
116
|
-
|
117
|
-
dubious_data = git_data(".")
|
118
|
-
mirah_data = git_data(MIRAH_HOME)
|
119
|
-
bite_data = git_data(MIRAH_HOME + '/../bitescript')
|
120
|
-
model_data = git_data(File.dirname(MODEL_SRC_JAR),File.basename(MODEL_SRC_JAR))
|
121
|
-
|
122
|
-
prop_file = "config/build.properties"
|
123
|
-
File.open(prop_file, 'w') do |f|
|
124
|
-
f.write <<-EOF
|
125
|
-
# the current build environment
|
126
|
-
application.build.time=#{Time.now.xmlschema}
|
127
|
-
dubious.version.commit=#{dubious_data[0][7..-1]}
|
128
|
-
dubious.version.time=#{Time.parse(dubious_data[1]).xmlschema}
|
129
|
-
mirah.version.commit=#{mirah_data[0][7..-1]}
|
130
|
-
mirah.version.time=#{Time.parse(mirah_data[1]).xmlschema}
|
131
|
-
bitescript.version.commit=#{bite_data[0][7..-1]}
|
132
|
-
bitescript.version.time=#{Time.parse(bite_data[1]).xmlschema}
|
133
|
-
model.version.commit=#{model_data[0][7..-1]}
|
134
|
-
model.version.time=#{Time.parse(model_data[1]).xmlschema}
|
135
|
-
EOF
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/examples/shout/WEB-INF/classes/Users/nick/hacking/dubious/examples/shout/Shout$Query.class
ADDED
Binary file
|
Binary file
|
data/examples/shout/WEB-INF/classes/Users/nick/hacking/dubious/examples/shout/ShoutController.class
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,11 +1,11 @@
|
|
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
3
|
<servlet>
|
4
|
-
<servlet-name>
|
4
|
+
<servlet-name>shout</servlet-name>
|
5
5
|
<servlet-class>ShoutController</servlet-class>
|
6
6
|
</servlet>
|
7
7
|
<servlet-mapping>
|
8
|
-
<servlet-name>
|
9
|
-
<url-pattern
|
8
|
+
<servlet-name>shout</servlet-name>
|
9
|
+
<url-pattern>/shout/*</url-pattern>
|
10
10
|
</servlet-mapping>
|
11
11
|
</web-app>
|
data/lib/dubious.rb
CHANGED
@@ -5,55 +5,17 @@ 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
|
-
|
15
|
-
if ENV['MIRAH_HOME'] && File.exist?(ENV['MIRAH_HOME'] +'/lib/mirah.rb')
|
16
|
-
$: << File.expand_path(ENV['MIRAH_HOME'] +'/lib')
|
17
|
-
end
|
18
|
-
|
19
8
|
require 'rake/clean'
|
20
|
-
require '
|
21
|
-
|
22
|
-
|
23
|
-
if File.exist?('../bitescript/lib/bitescript.rb')
|
24
|
-
$: << File.expand_path('../bitescript/lib/')
|
25
|
-
end
|
9
|
+
require 'dubious_tasks'
|
26
10
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
'WEB-INF', 'lib', 'dubydatastore.jar')
|
11
|
+
OUTDIR = 'WEB-INF/classes'
|
12
|
+
CLEAN.include(OUTDIR)
|
13
|
+
CLOBBER.include("WEB-INF/lib/dubious.jar", 'WEB-INF/appengine-generated')
|
31
14
|
|
32
15
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
else
|
37
|
-
options = {}
|
38
|
-
end
|
39
|
-
source_dir = options.fetch(:dir, Duby.source_path)
|
40
|
-
dest = File.expand_path(options.fetch(:dest, Duby.dest_path))
|
41
|
-
files = files.map {|f| f.sub(/^#{source_dir}\//, '')}
|
42
|
-
flags = options.fetch(:options, Duby.compiler_options)
|
43
|
-
args = ['-d', dest, *flags] + files
|
44
|
-
chdir(source_dir) do
|
45
|
-
cmd = "mirahc #{args.join ' '}"
|
46
|
-
puts cmd
|
47
|
-
if files.any? {|f|f.include? 'controllers'}
|
48
|
-
system cmd
|
49
|
-
else
|
50
|
-
Duby.compile(*args)
|
51
|
-
Duby.reset
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
OUTDIR = 'WEB-INF/classes'
|
16
|
+
mirah_compile_options :dest_path => OUTDIR,
|
17
|
+
:source_paths => ['lib', 'app' ],
|
18
|
+
:compiler_options => ['--classpath', [File.expand_path(OUTDIR), *FileList["WEB-INF/lib/*.jar"].map{|f|File.expand_path(f)}].join(':') + ':' + CLASSPATH ]
|
57
19
|
|
58
20
|
def class_files_for files
|
59
21
|
files.map do |f|
|
@@ -69,26 +31,15 @@ MODEL_JAR = "WEB-INF/lib/dubydatastore.jar"
|
|
69
31
|
LIB_MIRAH_SRC = Dir["lib/**/*.{duby,mirah}"]
|
70
32
|
LIB_JAVA_SRC = Dir["lib/**/*.java"]
|
71
33
|
LIB_SRC = LIB_MIRAH_SRC + LIB_JAVA_SRC
|
72
|
-
LIB_CLASSES = class_files_for LIB_SRC
|
73
|
-
|
74
|
-
STDLIB_CLASSES= LIB_CLASSES.select{|l|l.include? 'stdlib'}
|
75
|
-
|
76
|
-
CLASSPATH = [AppEngine::Rake::SERVLET, AppEngine::SDK::API_JAR].join(":")
|
77
|
-
|
78
|
-
Duby.dest_paths << OUTDIR
|
79
|
-
Duby.source_paths << 'lib'
|
80
|
-
Duby.source_paths << 'app'
|
81
|
-
Duby.compiler_options << '--classpath' << [File.expand_path(OUTDIR), *FileList["WEB-INF/lib/*.jar"].map{|f|File.expand_path(f)}].join(':') + ':' + CLASSPATH
|
82
|
-
|
83
|
-
CLEAN.include(OUTDIR)
|
84
|
-
CLOBBER.include("WEB-INF/lib/dubious.jar", 'WEB-INF/appengine-generated')
|
85
34
|
|
86
35
|
APP_SRC = Dir["app/**/{*.duby,*.mirah}"]
|
36
|
+
TEMPLATES = Dir["app/views/**/*.erb"]
|
37
|
+
|
38
|
+
LIB_CLASSES = class_files_for LIB_SRC
|
87
39
|
APP_CLASSES = class_files_for APP_SRC
|
88
40
|
APP_MODEL_CLASSES = APP_CLASSES.select {|app| app.include? '/models' }
|
89
41
|
APP_CONTROLLER_CLASSES = APP_CLASSES.select {|app| app.include? '/controllers' }
|
90
42
|
APP_APPLICATION_CONTROLLER_CLASS = APP_CONTROLLER_CLASSES.find {|controller| controller.include? 'ApplicationController' }
|
91
|
-
TEMPLATES = Dir["app/views/**/*.erb"]
|
92
43
|
|
93
44
|
directory OUTDIR
|
94
45
|
|
@@ -96,7 +47,7 @@ directory OUTDIR
|
|
96
47
|
file klass => src
|
97
48
|
end
|
98
49
|
|
99
|
-
APP_CONTROLLER_CLASSES.reject
|
50
|
+
APP_CONTROLLER_CLASSES.reject{|k| k == APP_APPLICATION_CONTROLLER_CLASS }.each do |klass|
|
100
51
|
file klass => APP_APPLICATION_CONTROLLER_CLASS
|
101
52
|
end
|
102
53
|
|
@@ -114,60 +65,14 @@ end
|
|
114
65
|
|
115
66
|
appengine_app :app, 'app', '' => APP_CLASSES+LIB_CLASSES
|
116
67
|
|
117
|
-
#there is an upload task in appengine_tasks, but I couldn't get it to work
|
118
|
-
desc "publish to appengine"
|
119
|
-
task :publish => 'compile:app' do
|
120
|
-
sh "appcfg.sh update ."
|
121
|
-
end
|
122
|
-
|
123
68
|
namespace :compile do
|
124
69
|
task :app => APP_CLASSES
|
125
70
|
|
126
71
|
task :java => OUTDIR do
|
127
72
|
ant.javac :srcdir => 'lib', :destdir => OUTDIR, :classpath => CLASSPATH
|
128
73
|
end
|
129
|
-
|
130
74
|
end
|
131
75
|
|
132
76
|
desc "compile app"
|
133
77
|
task :compile => 'compile:app'
|
134
78
|
|
135
|
-
desc "run development server"
|
136
|
-
task :server
|
137
|
-
|
138
|
-
task :default => :server
|
139
|
-
|
140
|
-
task :generate_build_properties do
|
141
|
-
def git_data(dir, file='')
|
142
|
-
returning = nil
|
143
|
-
chdir dir do
|
144
|
-
# ["commit abc....123", "2010-06-23 12:58:06 -0700"]
|
145
|
-
IO.popen("git rev-list --pretty=format:%ci -1 HEAD #{file}") do |f|
|
146
|
-
returning = [f.gets.chomp, f.gets.chomp]
|
147
|
-
end
|
148
|
-
end
|
149
|
-
returning
|
150
|
-
end
|
151
|
-
|
152
|
-
dubious_data = git_data(".")
|
153
|
-
mirah_data = git_data(MIRAH_HOME)
|
154
|
-
bite_data = git_data(MIRAH_HOME + '/../bitescript')
|
155
|
-
model_data = git_data(File.dirname(MODEL_SRC_JAR),File.basename(MODEL_SRC_JAR))
|
156
|
-
|
157
|
-
prop_file = "config/build.properties"
|
158
|
-
File.open(prop_file, 'w') do |f|
|
159
|
-
f.write <<-EOF
|
160
|
-
# the current build environment
|
161
|
-
application.build.time=#{Time.now.xmlschema}
|
162
|
-
dubious.version.commit=#{dubious_data[0][7..-1]}
|
163
|
-
dubious.version.time=#{Time.parse(dubious_data[1]).xmlschema}
|
164
|
-
mirah.version.commit=#{mirah_data[0][7..-1]}
|
165
|
-
mirah.version.time=#{Time.parse(mirah_data[1]).xmlschema}
|
166
|
-
bitescript.version.commit=#{bite_data[0][7..-1]}
|
167
|
-
bitescript.version.time=#{Time.parse(bite_data[1]).xmlschema}
|
168
|
-
model.version.commit=#{model_data[0][7..-1]}
|
169
|
-
model.version.time=#{Time.parse(model_data[1]).xmlschema}
|
170
|
-
EOF
|
171
|
-
end
|
172
|
-
|
173
|
-
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'mirah/appengine_tasks'
|
2
|
+
|
3
|
+
|
4
|
+
# sets mirah compile opts
|
5
|
+
# @param [Hash] opts
|
6
|
+
# @option opts [String] :dest_path
|
7
|
+
# @option opts [Array<String>] :source_paths
|
8
|
+
# @option opts [Array<String>] :compiler_options commandline style options
|
9
|
+
def mirah_compile_options opts
|
10
|
+
Mirah.dest_paths << opts[:dest_path]
|
11
|
+
Mirah.source_paths.push *opts[:source_paths]
|
12
|
+
Mirah.compiler_options.push *opts[:compiler_options]
|
13
|
+
end
|
14
|
+
|
15
|
+
if JRUBY_VERSION < "1.5.6"
|
16
|
+
def mirahc *files
|
17
|
+
if files[-1].kind_of?(Hash)
|
18
|
+
options = files.pop
|
19
|
+
else
|
20
|
+
options = {}
|
21
|
+
end
|
22
|
+
source_dir = options.fetch(:dir, Duby.source_path)
|
23
|
+
dest = File.expand_path(options.fetch(:dest, Duby.dest_path))
|
24
|
+
files = files.map {|f| f.sub(/^#{source_dir}\//, '')}
|
25
|
+
flags = options.fetch(:options, Duby.compiler_options)
|
26
|
+
args = ['-d', dest, *flags] + files
|
27
|
+
chdir(source_dir) do
|
28
|
+
cmd = "mirahc #{args.join ' '}"
|
29
|
+
puts cmd
|
30
|
+
if files.any? {|f|f.include? 'controllers'}
|
31
|
+
system cmd
|
32
|
+
else
|
33
|
+
Duby.compile(*args)
|
34
|
+
Duby.reset
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
SERVLET_JAR = File.join(AppEngine::SDK::SDK_ROOT, *%w{lib shared servlet-api.jar})
|
41
|
+
|
42
|
+
unless $CLASSPATH.include? SERVLET_JAR
|
43
|
+
$CLASSPATH << SERVLET_JAR
|
44
|
+
end
|
45
|
+
|
46
|
+
CLASSPATH = [SERVLET_JAR, AppEngine::SDK::API_JAR].join(":")
|
47
|
+
|
48
|
+
MIRAH_HOME = ENV['MIRAH_HOME'] ? ENV['MIRAH_HOME'] : Gem.find_files('mirah').first.sub(/lib\/mirah.rb/,'')
|
49
|
+
|
50
|
+
MODEL_SRC_JAR = File.join(MIRAH_HOME, 'examples', 'appengine', 'war',
|
51
|
+
'WEB-INF', 'lib', 'dubydatastore.jar')
|
52
|
+
|
53
|
+
#there is an upload task in appengine_tasks, but I couldn't get it to work
|
54
|
+
desc "publish to appengine"
|
55
|
+
task :publish => 'compile:app' do
|
56
|
+
sh "appcfg.sh update ."
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "run development server"
|
60
|
+
task :server
|
61
|
+
|
62
|
+
task :default => :server
|
63
|
+
|
64
|
+
task :generate_build_properties do
|
65
|
+
def git_data(dir, file='')
|
66
|
+
returning = nil
|
67
|
+
chdir dir do
|
68
|
+
# ["commit abc....123", "2010-06-23 12:58:06 -0700"]
|
69
|
+
IO.popen("git rev-list --pretty=format:%ci -1 HEAD #{file}") do |f|
|
70
|
+
returning = [f.gets.chomp, f.gets.chomp]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
returning
|
74
|
+
end
|
75
|
+
|
76
|
+
dubious_data = git_data(".")
|
77
|
+
mirah_data = git_data(MIRAH_HOME)
|
78
|
+
bite_data = git_data(MIRAH_HOME + '/../bitescript')
|
79
|
+
model_data = git_data(File.dirname(MODEL_SRC_JAR),File.basename(MODEL_SRC_JAR))
|
80
|
+
|
81
|
+
prop_file = "config/build.properties"
|
82
|
+
File.open(prop_file, 'w') do |f|
|
83
|
+
f.write <<-EOF
|
84
|
+
# the current build environment
|
85
|
+
application.build.time=#{Time.now.xmlschema}
|
86
|
+
dubious.version.commit=#{dubious_data[0][7..-1]}
|
87
|
+
dubious.version.time=#{Time.parse(dubious_data[1]).xmlschema}
|
88
|
+
mirah.version.commit=#{mirah_data[0][7..-1]}
|
89
|
+
mirah.version.time=#{Time.parse(mirah_data[1]).xmlschema}
|
90
|
+
bitescript.version.commit=#{bite_data[0][7..-1]}
|
91
|
+
bitescript.version.time=#{Time.parse(bite_data[1]).xmlschema}
|
92
|
+
model.version.commit=#{model_data[0][7..-1]}
|
93
|
+
model.version.time=#{Time.parse(model_data[1]).xmlschema}
|
94
|
+
EOF
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
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:
|
18
|
+
date: 2011-01-03 23:04:19.458000 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -79,8 +79,9 @@ dependencies:
|
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
segments:
|
81
81
|
- 1
|
82
|
-
-
|
83
|
-
|
82
|
+
- 4
|
83
|
+
- 0
|
84
|
+
version: 1.4.0
|
84
85
|
type: :runtime
|
85
86
|
version_requirements: *id005
|
86
87
|
description: Dubious is a web framework written in Mirah.
|
@@ -99,7 +100,9 @@ files:
|
|
99
100
|
- bin/dubious
|
100
101
|
- lib/dubious.jar
|
101
102
|
- lib/dubious.rb
|
103
|
+
- lib/dubious_tasks.rb
|
102
104
|
- lib/dubious/cli.rb
|
105
|
+
- lib/dubious/version.rb
|
103
106
|
- lib/dubious/cli/generator.rb
|
104
107
|
- lib/dubious/cli/init.rb
|
105
108
|
- lib/dubious/templates/base/Rakefile
|
@@ -211,8 +214,21 @@ files:
|
|
211
214
|
- examples/shout/public/stylesheets/scaffold.css
|
212
215
|
- examples/shout/views/application.html.erb
|
213
216
|
- examples/shout/views/list.html.erb
|
217
|
+
- examples/shout/WEB-INF/app.yaml
|
214
218
|
- examples/shout/WEB-INF/appengine-web.xml
|
215
219
|
- examples/shout/WEB-INF/web.xml
|
220
|
+
- examples/shout/WEB-INF/appengine-generated/datastore-indexes-auto.xml
|
221
|
+
- examples/shout/WEB-INF/classes/App.class
|
222
|
+
- examples/shout/WEB-INF/classes/Shout$Query.class
|
223
|
+
- examples/shout/WEB-INF/classes/Shout.class
|
224
|
+
- examples/shout/WEB-INF/classes/ShoutController.class
|
225
|
+
- examples/shout/WEB-INF/classes/Users/nick/hacking/dubious/examples/shout/App.class
|
226
|
+
- examples/shout/WEB-INF/classes/Users/nick/hacking/dubious/examples/shout/Shout$Query.class
|
227
|
+
- examples/shout/WEB-INF/classes/Users/nick/hacking/dubious/examples/shout/Shout.class
|
228
|
+
- examples/shout/WEB-INF/classes/Users/nick/hacking/dubious/examples/shout/ShoutController.class
|
229
|
+
- examples/shout/WEB-INF/lib/appengine-api.jar
|
230
|
+
- examples/shout/WEB-INF/lib/dubious.jar
|
231
|
+
- examples/shout/WEB-INF/lib/dubydatastore.jar
|
216
232
|
- javalib/dubydatastore.jar
|
217
233
|
- Rakefile
|
218
234
|
- LICENSE
|