dubious 0.0.2-java → 0.0.3-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,6 +53,7 @@ http://code.google.com/appengine/docs/java/configyaml/appconfig_yaml.html
53
53
  mkdir -p ~/mystuff; cd ~/mystuff
54
54
  git clone http://github.com/headius/bitescript.git
55
55
  git clone http://github.com/mirah/mirah.git
56
+ git clone http://github.com/mirah/mirah_model.git
56
57
  git clone http://github.com/mirah/dubious.git
57
58
 
58
59
  * Then build and install the gems for Mirah, Bitescript and Dubious
@@ -72,9 +73,9 @@ http://code.google.com/appengine/docs/java/configyaml/appconfig_yaml.html
72
73
  cd -
73
74
 
74
75
 
75
- To build the gem
76
+ To build the gem (requires RubyGems ~> 1.5.0 to build)
76
77
 
77
- gem build dubious.gemspec
78
+ rake package
78
79
 
79
80
  ===Developing your App
80
81
 
data/Rakefile CHANGED
@@ -1,6 +1,10 @@
1
1
  require 'rubygems'
2
2
  require 'rubygems/package_task'
3
3
  require 'rake/clean'
4
+ require 'bundler/setup'
5
+ require 'rspec/core/rake_task'
6
+
7
+ Bundler.setup
4
8
 
5
9
  begin
6
10
  require 'ant'
@@ -14,32 +18,17 @@ Gem::PackageTask.new Gem::Specification.load('dubious.gemspec') do |pkg|
14
18
  pkg.need_tar = true
15
19
  end
16
20
 
17
- task :gem => :jar
18
-
19
- neighbor_mirah = File.expand_path '../mirah'
20
-
21
- if File.exists?(neighbor_mirah)
22
- ENV['MIRAH_HOME'] ||= neighbor_mirah
23
- end
24
-
25
-
26
- MIRAH_HOME = ENV['MIRAH_HOME'] ? ENV['MIRAH_HOME'] : Gem.find_files('mirah').first.sub(/lib\/mirah.rb/,'')
27
-
28
- if ENV['MIRAH_HOME'] && File.exist?(ENV['MIRAH_HOME'] +'/lib/mirah.rb')
29
- $: << File.expand_path(ENV['MIRAH_HOME'] +'/lib')
30
- end
21
+ Rspec::Core::RakeTask.new
31
22
 
32
- if File.exist?('../bitescript/lib/bitescript.rb')
33
- $: << File.expand_path('../bitescript/lib/')
34
- end
23
+ task :default => :spec
35
24
 
36
- require 'mirah/appengine_tasks'
25
+ require 'dubious_tasks'
37
26
 
38
27
  OUTDIR = File.expand_path 'build'
39
28
  SRCDIR = File.expand_path 'src'
40
29
 
41
30
  CLEAN.include(OUTDIR)
42
- CLOBBER.include("lib/dubious.jar")
31
+ CLOBBER.include("lib/dubious.jar", "javalib/mirahdatastore.jar")
43
32
 
44
33
  def class_files_for files
45
34
  files.map do |f|
@@ -50,7 +39,6 @@ def class_files_for files
50
39
  end
51
40
  end
52
41
 
53
- #MODEL_JAR = "#{OUTDIR}/dubydatastore.jar"
54
42
  LIB_MIRAH_SRC = Dir["src/**/*{.duby,.mirah}"]
55
43
  LIB_JAVA_SRC = Dir["src/**/*.java"]
56
44
 
@@ -58,10 +46,11 @@ LIB_SRC = LIB_MIRAH_SRC + LIB_JAVA_SRC
58
46
  LIB_CLASSES = class_files_for LIB_SRC
59
47
  STDLIB_CLASSES= LIB_CLASSES.select{|l|l.include? 'stdlib'}
60
48
 
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(':')
64
-
49
+ task :set_compile_options do
50
+ mirah_compile_options :compiler_options => ['--classpath', [OUTDIR+'/', SERVLET_JAR,*FileList["lib/*.jar", "javalib/*.jar"].map{|f|File.expand_path(f)}].join(':')],
51
+ :dest_path => OUTDIR,
52
+ :source_paths => SRCDIR
53
+ end
65
54
 
66
55
  file "#{OUTDIR}/dubious/Inflection.class" => :'compile:java'
67
56
  file "#{OUTDIR}/dubious/ScopedParameterMap.class" => :'compile:java'
@@ -103,21 +92,30 @@ task :compile => LIB_CLASSES
103
92
  desc "compiles jar for gemification"
104
93
  task :jar => "lib/dubious.jar"
105
94
 
95
+ desc "pull dependencies"
96
+ task :dependencies => 'javalib/mirahdatastore.jar'
97
+
98
+ directory 'javalib'
99
+
100
+ file 'javalib/mirahdatastore.jar' => 'javalib' do
101
+
102
+ cp Gem.find_files('mirahdatastore.jar'), 'javalib/'
103
+ end
104
+
106
105
  namespace :compile do
107
106
  task :dubious => "lib/dubious.jar"
108
107
  task :java => OUTDIR do
109
108
  ant.javac :srcdir => SRCDIR,
110
- :destdir => OUTDIR,
111
- :classpath => CLASSPATH
109
+ :destdir => OUTDIR,
110
+ :classpath => CLASSPATH,
111
+ :includeantruntime => true
112
112
  end
113
113
  end
114
114
 
115
- CLASSPATH = [AppEngine::Rake::SERVLET, AppEngine::SDK::API_JAR].join(":")
116
-
117
115
  directory OUTDIR
118
116
 
119
117
  (LIB_CLASSES).zip(LIB_SRC).each do |klass,src|
120
- file klass => src
118
+ file klass => [:dependencies, :set_compile_options, src]
121
119
  end
122
120
 
123
121
  task :generate_build_properties do
@@ -135,7 +133,7 @@ task :generate_build_properties do
135
133
  dubious_data = git_data(".")
136
134
  mirah_data = git_data(MIRAH_HOME)
137
135
  bite_data = git_data(MIRAH_HOME + '/../bitescript')
138
- model_data = git_data(File.dirname(MODEL_SRC_JAR),File.basename(MODEL_SRC_JAR))
136
+ model_data = git_data(File.dirname(Gem.find_files('mirahdatastore.jar')),'mirahdatastore.jar')
139
137
 
140
138
  prop_file = "config/build.properties"
141
139
  File.open(prop_file, 'w') do |f|
@@ -0,0 +1,2 @@
1
+ gem 'dubious', :path => '../..'
2
+ gem 'rake'
@@ -0,0 +1,31 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ dubious (0.0.3.dev-java)
5
+ activesupport
6
+ appengine-sdk (~> 1.4.0)
7
+ i18n
8
+ mirah (= 0.0.5)
9
+ mirah_model (= 0.0.2)
10
+ thor (= 0.13.8)
11
+
12
+ GEM
13
+ specs:
14
+ activesupport (3.0.4)
15
+ appengine-sdk (1.4.2)
16
+ bitescript (0.0.7)
17
+ i18n (0.5.0)
18
+ mirah (0.0.5-java)
19
+ bitescript (>= 0.0.6)
20
+ mirah_model (0.0.2-java)
21
+ appengine-sdk (~> 1.4.0)
22
+ mirah (= 0.0.5)
23
+ rake (0.8.7)
24
+ thor (0.13.8)
25
+
26
+ PLATFORMS
27
+ java
28
+
29
+ DEPENDENCIES
30
+ dubious!
31
+ rake
@@ -10,12 +10,15 @@ require 'dubious_tasks'
10
10
 
11
11
  OUTDIR = 'WEB-INF/classes'
12
12
  CLEAN.include(OUTDIR)
13
- CLOBBER.include("WEB-INF/lib/dubious.jar", 'WEB-INF/appengine-generated')
14
-
15
-
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 ]
13
+ CLOBBER.include('WEB-INF/appengine-generated')
14
+
15
+ task :set_compile_options do |t|
16
+ def t.needed?;false;end
17
+
18
+ mirah_compile_options :dest_path => OUTDIR,
19
+ :source_paths => [File.expand_path('lib'), File.expand_path('app') ],
20
+ :compiler_options => ['--classpath', [File.expand_path(OUTDIR), *FileList["WEB-INF/lib/*.jar"].map{|f|File.expand_path(f)}].join(':') + ':' + CLASSPATH ]
21
+ end
19
22
 
20
23
  def class_files_for files
21
24
  files.map do |f|
@@ -26,7 +29,7 @@ def class_files_for files
26
29
  end
27
30
  end
28
31
 
29
- MODEL_JAR = "WEB-INF/lib/dubydatastore.jar"
32
+ MODEL_JAR = "WEB-INF/lib/mirahdatastore.jar"
30
33
 
31
34
  LIB_MIRAH_SRC = Dir["lib/**/*.{duby,mirah}"]
32
35
  LIB_JAVA_SRC = Dir["lib/**/*.java"]
@@ -63,7 +66,7 @@ file MODEL_JAR => MODEL_SRC_JAR do |t|
63
66
  cp MODEL_SRC_JAR, MODEL_JAR
64
67
  end
65
68
 
66
- appengine_app :app, 'app', '' => APP_CLASSES+LIB_CLASSES
69
+ appengine_app :app, '', '.' => [:set_compile_options] + APP_CLASSES + LIB_CLASSES
67
70
 
68
71
  namespace :compile do
69
72
  task :app => APP_CLASSES
@@ -1,4 +1,4 @@
1
- <!-- Indices written at Tue, 14 Dec 2010 02:36:14 UTC -->
1
+ <!-- Indices written at Wed, 23 Feb 2011 06:51:55 UTC -->
2
2
 
3
3
  <datastore-indexes/>
4
4
 
@@ -1,4 +1,4 @@
1
- import com.google.appengine.ext.duby.db.Model
1
+ import com.google.appengine.ext.mirah.db.Model
2
2
  import com.google.appengine.api.datastore.*
3
3
  import dubious.TimeConversion
4
4
  import java.util.Date
@@ -14,7 +14,7 @@ mirah_compile_options :dest_path => OUTDIR,
14
14
  :source_paths => '.',
15
15
  :compiler_options => ['--classpath', [File.expand_path(OUTDIR), *FileList["WEB-INF/lib/*.jar"].map{|f|File.expand_path(f)}].join(':') + ':' + CLASSPATH]
16
16
 
17
- MODEL_JAR = "WEB-INF/lib/dubydatastore.jar"
17
+ MODEL_JAR = "WEB-INF/lib/mirahdatastore.jar"
18
18
 
19
19
  CLEAN.include(OUTDIR)
20
20
  CLOBBER.include("WEB-INF/lib/dubious.jar", 'WEB-INF/appengine-generated')
@@ -1,5 +1,5 @@
1
1
  import com.google.appengine.api.datastore.Text
2
- import com.google.appengine.ext.duby.db.Model
2
+ import com.google.appengine.ext.mirah.db.Model
3
3
  import com.google.appengine.api.datastore.*
4
4
  import java.util.HashMap
5
5
  import dubious.*
Binary file
@@ -1,6 +1,7 @@
1
1
  require 'thor'
2
2
  require 'thor/group'
3
3
  require 'active_support/core_ext'
4
+ require 'active_support'
4
5
 
5
6
  require File.dirname(__FILE__) + '/cli/init'
6
7
  require File.dirname(__FILE__) + '/cli/generator'
@@ -4,9 +4,9 @@ module Dubious
4
4
  include Thor::Actions
5
5
  source_root File.dirname(__FILE__)+"/../templates/generator"
6
6
  argument :name
7
+ add_runtime_options!
7
8
 
8
-
9
- desc "model NAME", "creates model file"
9
+ desc "model NAME", "creates model file"
10
10
  def model#(name)
11
11
  template "model.mirah.tt", "app/models/#{name.underscore}.mirah"
12
12
  end
@@ -26,8 +26,8 @@ Uses NAME as the appengine app name.
26
26
  copy_file '../../../dubious.jar', "#{name}/WEB-INF/lib/dubious.jar"
27
27
  end
28
28
 
29
- def cp_dubydatastore_jar
30
- copy_file '../../../../javalib/dubydatastore.jar', "#{name}/WEB-INF/lib/dubydatastore.jar"
29
+ def cp_mirahdatastore_jar
30
+ copy_file '../../../../javalib/mirahdatastore.jar', "#{name}/WEB-INF/lib/mirahdatastore.jar"
31
31
  end
32
32
 
33
33
  end
@@ -0,0 +1,46 @@
1
+ require 'appengine-sdk'
2
+ module Dubious
3
+ module CLI
4
+ class Server < Thor::Group
5
+ SERVLET = AppEngine::SDK::SDK_ROOT + '/lib/shared/servlet-api.jar'
6
+ APIS = AppEngine::SDK::API_JAR
7
+ TOOLS = AppEngine::SDK::TOOLS_JAR
8
+
9
+ class_option :port,:type=>:numeric,:desc=>'port to run on',:default => 8080
10
+ class_option :address, :type=>:string,:desc => 'address to run on eg localhost',:default => '0.0.0.0'
11
+
12
+ def start_watcher
13
+ @done=false
14
+ Thread.new do
15
+ until @done
16
+ sleep_time = next_time - Time.now
17
+ sleep(sleep_time) if sleep_time > 0
18
+ next_time = Time.now + 5
19
+ #success = `rake compile:reload`
20
+ # if
21
+ puts 'foo'
22
+ sleep 5
23
+ end
24
+ end
25
+
26
+ end
27
+
28
+ def start_server
29
+
30
+ args = [
31
+ 'java', '-cp', TOOLS,
32
+ 'com.google.appengine.tools.KickStart',
33
+ 'com.google.appengine.tools.development.DevAppServerMain',
34
+ "--address=#{options[:address]}",
35
+ "--port=#{options[:port]}",
36
+ '.']
37
+ system *args
38
+ @done=true
39
+ end
40
+
41
+ def self.subcommand_help *args
42
+ %Q(Runs the Appengine dev server along with a file watcher that recompiles the app on changes.)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -10,12 +10,15 @@ require 'dubious_tasks'
10
10
 
11
11
  OUTDIR = 'WEB-INF/classes'
12
12
  CLEAN.include(OUTDIR)
13
- CLOBBER.include("WEB-INF/lib/dubious.jar", 'WEB-INF/appengine-generated')
14
-
15
-
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 ]
13
+ CLOBBER.include('WEB-INF/appengine-generated')
14
+
15
+ task :set_compile_options do |t|
16
+ def t.needed?;false;end
17
+
18
+ mirah_compile_options :dest_path => OUTDIR,
19
+ :source_paths => [File.expand_path('lib'), File.expand_path('app') ],
20
+ :compiler_options => ['--classpath', [File.expand_path(OUTDIR), *FileList["WEB-INF/lib/*.jar"].map{|f|File.expand_path(f)}].join(':') + ':' + CLASSPATH ]
21
+ end
19
22
 
20
23
  def class_files_for files
21
24
  files.map do |f|
@@ -26,7 +29,7 @@ def class_files_for files
26
29
  end
27
30
  end
28
31
 
29
- MODEL_JAR = "WEB-INF/lib/dubydatastore.jar"
32
+ MODEL_JAR = "WEB-INF/lib/mirahdatastore.jar"
30
33
 
31
34
  LIB_MIRAH_SRC = Dir["lib/**/*.{duby,mirah}"]
32
35
  LIB_JAVA_SRC = Dir["lib/**/*.java"]
@@ -63,7 +66,7 @@ file MODEL_JAR => MODEL_SRC_JAR do |t|
63
66
  cp MODEL_SRC_JAR, MODEL_JAR
64
67
  end
65
68
 
66
- appengine_app :app, 'app', '' => APP_CLASSES+LIB_CLASSES
69
+ appengine_app :app, '', '.' => [:set_compile_options] + APP_CLASSES + LIB_CLASSES
67
70
 
68
71
  namespace :compile do
69
72
  task :app => APP_CLASSES
@@ -1,4 +1,4 @@
1
- import com.google.appengine.ext.duby.db.Model
1
+ import com.google.appengine.ext.mirah.db.Model
2
2
  import com.google.appengine.api.datastore.*
3
3
 
4
4
  class <%= name.classify%> < Model
@@ -1,3 +1,3 @@
1
1
  module Dubious
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,14 +1,152 @@
1
- require 'mirah/appengine_tasks'
1
+ require 'appengine-sdk'
2
+ require 'mirah_task'
3
+ require 'java'
4
+ require 'open-uri'
5
+ require 'rake'
6
+ require 'yaml'
2
7
 
8
+ module AppEngine::Rake
9
+ SERVLET = AppEngine::SDK::SDK_ROOT + '/lib/shared/servlet-api.jar'
10
+ APIS = AppEngine::SDK::API_JAR
11
+ TOOLS = AppEngine::SDK::TOOLS_JAR
12
+
13
+ $CLASSPATH << SERVLET
14
+ $CLASSPATH << APIS
15
+ $CLASSPATH << TOOLS
16
+
17
+ class AppEngineTask < Rake::Task
18
+ def initialize(*args, &block)
19
+ super
20
+ AppEngineTask.tasks << self
21
+ end
22
+
23
+ def init(src, war)
24
+ @src = src
25
+ @war = war
26
+ unless $CLASSPATH.include?(webinf_classes)
27
+ $CLASSPATH << webinf_classes
28
+ end
29
+ webinf_lib_jars.each do |jar|
30
+ $CLASSPATH << jar unless $CLASSPATH.include?(jar)
31
+ end
32
+ Mirah.source_paths << src
33
+ Mirah.dest_paths << webinf_classes
34
+ directory(webinf_classes)
35
+ directory(webinf_lib)
36
+
37
+ file_create api_jar => webinf_lib do
38
+ puts 'Copying api jars'
39
+ cp APIS, api_jar
40
+ end
41
+
42
+ task :server , :address , :port , :needs => [name] do |t, args|
43
+ args.with_defaults(:address => '0.0.0.0', :port => '8080')
44
+ check_for_updates
45
+ args = [
46
+ 'java', '-cp', TOOLS,
47
+ 'com.google.appengine.tools.KickStart',
48
+ 'com.google.appengine.tools.development.DevAppServerMain',
49
+ "--address=#{args.address}",
50
+ "--port=#{args.port}",
51
+ @war]
52
+ system *args
53
+ @done = true
54
+ @update_thread.join
55
+ end
56
+
57
+ desc "publish to appengine"
58
+ task :upload => ['compile:app', name] do
59
+ Java::ComGoogleAppengineToolsAdmin::AppCfg.main(
60
+ ['update', @war].to_java(:string))
61
+ end
62
+
63
+ enhance([api_jar])
64
+ end
65
+
66
+ def real_prerequisites
67
+ prerequisites.map {|n| application[n, scope]}
68
+ end
69
+
70
+ def check_for_updates
71
+ @update_thread = Thread.new do
72
+ # Give the server time to start
73
+ next_time = Time.now + 5
74
+ until @done
75
+ sleep_time = next_time - Time.now
76
+ sleep(sleep_time) if sleep_time > 0
77
+ next_time = Time.now + 1
78
+ update
79
+ end
80
+ end
81
+ end
82
+
83
+ def update
84
+ begin
85
+ timestamp = app_yaml_timestamp
86
+ @last_app_yaml_timestamp ||= timestamp
87
+
88
+ needed_prerequisites = real_prerequisites.select {|r|r.needed?}
89
+
90
+ needed_prerequisites.each {|dep| dep.execute }
91
+ unless needed_prerequisites.empty? && timestamp == @last_app_yaml_timestamp
92
+ begin
93
+ open('http://localhost:8080/_ah/reloadwebapp')
94
+ @last_app_yaml_timestamp = timestamp
95
+ rescue OpenURI::HTTPError
96
+ end
97
+ end
98
+ rescue Exception
99
+ puts $!, $@
100
+ end
101
+ end
102
+
103
+ def app_yaml_timestamp
104
+ if File.exist?(app_yaml)
105
+ File.mtime(app_yaml)
106
+ end
107
+ end
108
+
109
+ def app_yaml
110
+ @war + '/WEB-INF/app.yaml'
111
+ end
112
+
113
+ def webinf_classes
114
+ @war + '/WEB-INF/classes'
115
+ end
116
+
117
+ def webinf_lib
118
+ @war + '/WEB-INF/lib'
119
+ end
120
+
121
+ def api_jar
122
+ File.join(webinf_lib, File.basename(APIS))
123
+ end
124
+
125
+ def webinf_lib_jars
126
+ Dir.glob(webinf_lib + '/*.jar')
127
+ end
128
+ end
129
+ end
130
+
131
+ def appengine_app(name,src,hash={}, &block)
132
+ war = hash.keys.first
133
+ deps = hash[war] || []
134
+
135
+ task = AppEngine::Rake::AppEngineTask.define_task(name => deps, &block)
136
+ src = File.expand_path(src || 'src')
137
+ war = File.expand_path(war || 'war')
138
+ task.init(src, war)
139
+ task
140
+ end
3
141
 
4
142
  # sets mirah compile opts
5
143
  # @param [Hash] opts
6
144
  # @option opts [String] :dest_path
7
- # @option opts [Array<String>] :source_paths
8
- # @option opts [Array<String>] :compiler_options commandline style options
145
+ # @option opts [Array<String>] :source_paths
146
+ # @option opts [Array<String>] :compiler_options commandline style options
9
147
  def mirah_compile_options opts
10
148
  Mirah.dest_paths << opts[:dest_path]
11
- Mirah.source_paths.push *opts[:source_paths]
149
+ Mirah.source_paths.unshift *opts[:source_paths]
12
150
  Mirah.compiler_options.push *opts[:compiler_options]
13
151
  end
14
152
 
@@ -19,10 +157,10 @@ if JRUBY_VERSION < "1.5.6"
19
157
  else
20
158
  options = {}
21
159
  end
22
- source_dir = options.fetch(:dir, Duby.source_path)
23
- dest = File.expand_path(options.fetch(:dest, Duby.dest_path))
160
+ source_dir = options.fetch(:dir, Mirah.source_path)
161
+ dest = File.expand_path(options.fetch(:dest, Mirah.dest_path))
24
162
  files = files.map {|f| f.sub(/^#{source_dir}\//, '')}
25
- flags = options.fetch(:options, Duby.compiler_options)
163
+ flags = options.fetch(:options, Mirah.compiler_options)
26
164
  args = ['-d', dest, *flags] + files
27
165
  chdir(source_dir) do
28
166
  cmd = "mirahc #{args.join ' '}"
@@ -30,14 +168,14 @@ if JRUBY_VERSION < "1.5.6"
30
168
  if files.any? {|f|f.include? 'controllers'}
31
169
  system cmd
32
170
  else
33
- Duby.compile(*args)
34
- Duby.reset
171
+ Mirah.compile(*args)
172
+ Mirah.reset
35
173
  end
36
174
  end
37
175
  end
38
176
  end
39
177
 
40
- SERVLET_JAR = File.join(AppEngine::SDK::SDK_ROOT, *%w{lib shared servlet-api.jar})
178
+ SERVLET_JAR = File.join(AppEngine::SDK::SDK_ROOT, *%w{lib shared servlet-api.jar})
41
179
 
42
180
  unless $CLASSPATH.include? SERVLET_JAR
43
181
  $CLASSPATH << SERVLET_JAR
@@ -45,16 +183,11 @@ end
45
183
 
46
184
  CLASSPATH = [SERVLET_JAR, AppEngine::SDK::API_JAR].join(":")
47
185
 
48
- MIRAH_HOME = ENV['MIRAH_HOME'] ? ENV['MIRAH_HOME'] : Gem.find_files('mirah').first.sub(/lib\/mirah.rb/,'')
186
+ MODEL_SRC_JAR = File.dirname(Gem.find_files('dubious.rb').first) + '/../javalib/mirahdatastore.jar'
49
187
 
50
- MODEL_SRC_JAR = File.join(MIRAH_HOME, 'examples', 'appengine', 'war',
51
- 'WEB-INF', 'lib', 'dubydatastore.jar')
188
+ MIRAH_HOME = ENV['MIRAH_HOME'] ? ENV['MIRAH_HOME'] : Gem.find_files('mirah').first.sub(/lib\/mirah.rb/,'')
52
189
 
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
190
+ task :publish => :upload
58
191
 
59
192
  desc "run development server"
60
193
  task :server
@@ -79,7 +212,7 @@ task :generate_build_properties do
79
212
  model_data = git_data(File.dirname(MODEL_SRC_JAR),File.basename(MODEL_SRC_JAR))
80
213
 
81
214
  prop_file = "config/build.properties"
82
- File.open(prop_file, 'w') do |f|
215
+ File.open(prop_file, 'w') do |f|
83
216
  f.write <<-EOF
84
217
  # the current build environment
85
218
  application.build.time=#{Time.now.xmlschema}
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dubious
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 2
9
- version: 0.0.2
4
+ prerelease:
5
+ version: 0.0.3
10
6
  platform: java
11
7
  authors:
12
8
  - John Woodell
@@ -15,75 +11,97 @@ autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
13
 
18
- date: 2011-01-03 23:04:19.458000 -07:00
14
+ date: 2011-03-17 22:02:50.458000 -06:00
19
15
  default_executable:
20
16
  dependencies:
21
17
  - !ruby/object:Gem::Dependency
22
18
  name: thor
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
19
+ version_requirements: &id001 !ruby/object:Gem::Requirement
20
+ none: false
25
21
  requirements:
26
22
  - - "="
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 13
31
- - 8
32
24
  version: 0.13.8
25
+ requirement: *id001
26
+ prerelease: false
33
27
  type: :runtime
34
- version_requirements: *id001
35
28
  - !ruby/object:Gem::Dependency
36
29
  name: activesupport
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
30
+ version_requirements: &id002 !ruby/object:Gem::Requirement
31
+ none: false
39
32
  requirements:
40
33
  - - ">="
41
34
  - !ruby/object:Gem::Version
42
- segments:
43
- - 0
44
35
  version: "0"
36
+ requirement: *id002
37
+ prerelease: false
45
38
  type: :runtime
46
- version_requirements: *id002
47
39
  - !ruby/object:Gem::Dependency
48
40
  name: i18n
49
- prerelease: false
50
- requirement: &id003 !ruby/object:Gem::Requirement
41
+ version_requirements: &id003 !ruby/object:Gem::Requirement
42
+ none: false
51
43
  requirements:
52
44
  - - ">="
53
45
  - !ruby/object:Gem::Version
54
- segments:
55
- - 0
56
46
  version: "0"
47
+ requirement: *id003
48
+ prerelease: false
57
49
  type: :runtime
58
- version_requirements: *id003
59
50
  - !ruby/object:Gem::Dependency
60
51
  name: mirah
52
+ version_requirements: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - "="
56
+ - !ruby/object:Gem::Version
57
+ version: 0.0.5
58
+ requirement: *id004
61
59
  prerelease: false
62
- requirement: &id004 !ruby/object:Gem::Requirement
60
+ type: :runtime
61
+ - !ruby/object:Gem::Dependency
62
+ name: mirah_model
63
+ version_requirements: &id005 !ruby/object:Gem::Requirement
64
+ none: false
63
65
  requirements:
64
- - - ">="
66
+ - - "="
65
67
  - !ruby/object:Gem::Version
66
- segments:
67
- - 0
68
- - 0
69
- - 4
70
- version: 0.0.4
68
+ version: 0.0.2
69
+ requirement: *id005
70
+ prerelease: false
71
71
  type: :runtime
72
- version_requirements: *id004
73
72
  - !ruby/object:Gem::Dependency
74
73
  name: appengine-sdk
75
- prerelease: false
76
- requirement: &id005 !ruby/object:Gem::Requirement
74
+ version_requirements: &id006 !ruby/object:Gem::Requirement
75
+ none: false
77
76
  requirements:
78
77
  - - ~>
79
78
  - !ruby/object:Gem::Version
80
- segments:
81
- - 1
82
- - 4
83
- - 0
84
79
  version: 1.4.0
80
+ requirement: *id006
81
+ prerelease: false
85
82
  type: :runtime
86
- version_requirements: *id005
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ version_requirements: &id007 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - "="
89
+ - !ruby/object:Gem::Version
90
+ version: 2.4.0
91
+ requirement: *id007
92
+ prerelease: false
93
+ type: :development
94
+ - !ruby/object:Gem::Dependency
95
+ name: mocha
96
+ version_requirements: &id008 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - "="
100
+ - !ruby/object:Gem::Version
101
+ version: 0.9.12
102
+ requirement: *id008
103
+ prerelease: false
104
+ type: :development
87
105
  description: Dubious is a web framework written in Mirah.
88
106
  email:
89
107
  - woodie@netpress.com
@@ -105,6 +123,7 @@ files:
105
123
  - lib/dubious/version.rb
106
124
  - lib/dubious/cli/generator.rb
107
125
  - lib/dubious/cli/init.rb
126
+ - lib/dubious/cli/server.rb
108
127
  - lib/dubious/templates/base/Rakefile
109
128
  - lib/dubious/templates/base/app/controllers/application_controller.mirah
110
129
  - lib/dubious/templates/base/config/application.properties.tt
@@ -129,6 +148,8 @@ files:
129
148
  - lib/dubious/templates/base/WEB-INF/app.yaml.tt
130
149
  - lib/dubious/templates/generator/controller.mirah.tt
131
150
  - lib/dubious/templates/generator/model.mirah.tt
151
+ - examples/contacts/Gemfile
152
+ - examples/contacts/Gemfile.lock
132
153
  - examples/contacts/Rakefile
133
154
  - examples/contacts/app/controllers/application_controller.mirah
134
155
  - examples/contacts/app/controllers/contacts_controller.mirah
@@ -185,7 +206,6 @@ files:
185
206
  - examples/contacts/WEB-INF/appengine-generated/datastore-indexes-auto.xml
186
207
  - examples/contacts/WEB-INF/classes/controllers/ApplicationController.class
187
208
  - examples/contacts/WEB-INF/classes/controllers/ContactsController.class
188
- - examples/contacts/WEB-INF/classes/controllers/ContactsController.java
189
209
  - examples/contacts/WEB-INF/classes/controllers/InfoPropertiesController.class
190
210
  - examples/contacts/WEB-INF/classes/controllers/SourceController.class
191
211
  - examples/contacts/WEB-INF/classes/models/Contact$Query.class
@@ -193,6 +213,7 @@ files:
193
213
  - examples/contacts/WEB-INF/lib/appengine-api.jar
194
214
  - examples/contacts/WEB-INF/lib/dubious.jar
195
215
  - examples/contacts/WEB-INF/lib/dubydatastore.jar
216
+ - examples/contacts/WEB-INF/lib/mirahdatastore.jar
196
217
  - examples/shout/app.mirah
197
218
  - examples/shout/app.yaml
198
219
  - examples/shout/Rakefile
@@ -229,7 +250,7 @@ files:
229
250
  - examples/shout/WEB-INF/lib/appengine-api.jar
230
251
  - examples/shout/WEB-INF/lib/dubious.jar
231
252
  - examples/shout/WEB-INF/lib/dubydatastore.jar
232
- - javalib/dubydatastore.jar
253
+ - javalib/mirahdatastore.jar
233
254
  - Rakefile
234
255
  - LICENSE
235
256
  - ROADMAP.rdoc
@@ -245,25 +266,29 @@ rdoc_options:
245
266
  require_paths:
246
267
  - lib
247
268
  required_ruby_version: !ruby/object:Gem::Requirement
269
+ none: false
248
270
  requirements:
249
271
  - - ">="
250
272
  - !ruby/object:Gem::Version
273
+ hash: 2
251
274
  segments:
252
275
  - 0
253
276
  version: "0"
254
277
  required_rubygems_version: !ruby/object:Gem::Requirement
278
+ none: false
255
279
  requirements:
256
280
  - - ">="
257
281
  - !ruby/object:Gem::Version
282
+ hash: 2
258
283
  segments:
259
284
  - 0
260
285
  version: "0"
261
286
  requirements: []
262
287
 
263
288
  rubyforge_project:
264
- rubygems_version: 1.3.6
289
+ rubygems_version: 1.5.0
265
290
  signing_key:
266
291
  specification_version: 3
267
- summary: A web framework for Mirah, running on appengine.
292
+ summary: A web framework for Mirah, running on Google App Engine.
268
293
  test_files: []
269
294
 
@@ -1,285 +0,0 @@
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
- }
Binary file