Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #31 from igrigorik/master

cleanup, update to use latest gems
  • Loading branch information...
commit 8a1630d4ef1645fbe99b1740b5a699fd039cd8f9 2 parents fa6dd9a + 8ab2057
@baroquebobcat baroquebobcat authored
View
77 Rakefile
@@ -18,7 +18,7 @@ Gem::PackageTask.new Gem::Specification.load('dubious.gemspec') do |pkg|
pkg.need_tar = true
end
-Rspec::Core::RakeTask.new
+RSpec::Core::RakeTask.new
task :default => :spec
@@ -41,49 +41,49 @@ end
LIB_MIRAH_SRC = Dir["src/**/*{.duby,.mirah}"]
LIB_JAVA_SRC = Dir["src/**/*.java"]
-
+
LIB_SRC = LIB_MIRAH_SRC + LIB_JAVA_SRC
LIB_CLASSES = class_files_for LIB_SRC
STDLIB_CLASSES= LIB_CLASSES.select{|l|l.include? 'stdlib'}
task :set_compile_options do
mirah_compile_options :compiler_options => ['--classpath', [OUTDIR+'/', SERVLET_JAR,*FileList["lib/*.jar", "javalib/*.jar"].map{|f|File.expand_path(f)}].join(':')],
- :dest_path => OUTDIR,
- :source_paths => SRCDIR
+ :dest_path => OUTDIR,
+ :source_paths => SRCDIR
end
file "#{OUTDIR}/dubious/Inflection.class" => :'compile:java'
file "#{OUTDIR}/dubious/ScopedParameterMap.class" => :'compile:java'
file "#{OUTDIR}/dubious/ActionController.class" => ["#{OUTDIR}/dubious/Params.class",
- "#{OUTDIR}/dubious/FormHelper.class",
+ "#{OUTDIR}/dubious/FormHelper.class",
"#{OUTDIR}/dubious/AssetTimestampsCache.class",
- "#{OUTDIR}/dubious/CustomRoutes.class",
- ]
+ "#{OUTDIR}/dubious/CustomRoutes.class",
+ ]
file "#{OUTDIR}/dubious/Inflections.class" => [
- "#{OUTDIR}/dubious/TextHelper.class",
- "#{OUTDIR}/dubious/Inflection.class"
- ]
+ "#{OUTDIR}/dubious/TextHelper.class",
+ "#{OUTDIR}/dubious/Inflection.class"
+]
file "#{OUTDIR}/dubious/TextHelper.class" => [
- "#{OUTDIR}/dubious/Inflection.class",
- ]
+ "#{OUTDIR}/dubious/Inflection.class",
+]
+
-
file "#{OUTDIR}/dubious/FormHelper.class" => [
- "#{OUTDIR}/dubious/Inflections.class",
- "#{OUTDIR}/dubious/InstanceTag.class",
- "#{OUTDIR}/dubious/Params.class",
- "#{OUTDIR}/dubious/TimeConversion.class",
- *STDLIB_CLASSES]
+ "#{OUTDIR}/dubious/Inflections.class",
+ "#{OUTDIR}/dubious/InstanceTag.class",
+ "#{OUTDIR}/dubious/Params.class",
+ "#{OUTDIR}/dubious/TimeConversion.class",
+*STDLIB_CLASSES]
file "#{OUTDIR}/dubious/InstanceTag.class" => "#{OUTDIR}/dubious/SanitizeHelper.class"
file "#{OUTDIR}/dubious/Params.class" => "#{OUTDIR}/dubious/ScopedParameterMap.class"
file "lib/dubious.jar" => LIB_CLASSES do
includes = FileList[OUTDIR+'/dubious/**/*', OUTDIR+'/stdlib/**/*', OUTDIR + '/testing/**/*'].map {|d|d.sub "#{OUTDIR}/",''}.join(',')
- ant.jar :destfile => "lib/dubious.jar",
- :basedir => OUTDIR,
- :includes => includes
+ ant.jar :destfile => "lib/dubious.jar",
+ :basedir => OUTDIR,
+ :includes => includes
end
desc "compiles mirah & java lib files"
@@ -98,17 +98,16 @@ task :dependencies => 'javalib/mirahdatastore.jar'
directory 'javalib'
file 'javalib/mirahdatastore.jar' => 'javalib' do
-
cp Gem.find_files('mirahdatastore.jar'), 'javalib/'
end
namespace :compile do
task :dubious => "lib/dubious.jar"
task :java => OUTDIR do
- ant.javac :srcdir => SRCDIR,
- :destdir => OUTDIR,
- :classpath => CLASSPATH,
- :includeantruntime => true
+ ant.javac :srcdir => SRCDIR,
+ :destdir => OUTDIR,
+ :classpath => CLASSPATH,
+ :includeantruntime => true
end
end
@@ -117,7 +116,7 @@ directory OUTDIR
(LIB_CLASSES).zip(LIB_SRC).each do |klass,src|
file klass => [:dependencies, :set_compile_options, src]
end
-
+
task :generate_build_properties do
def git_data(dir, file='')
returning = nil
@@ -136,18 +135,18 @@ task :generate_build_properties do
model_data = git_data(File.dirname(Gem.find_files('mirahdatastore.jar')),'mirahdatastore.jar')
prop_file = "config/build.properties"
- File.open(prop_file, 'w') do |f|
+ File.open(prop_file, 'w') do |f|
f.write <<-EOF
-# the current build environment
-application.build.time=#{Time.now.xmlschema}
-dubious.version.commit=#{dubious_data[0][7..-1]}
-dubious.version.time=#{Time.parse(dubious_data[1]).xmlschema}
-mirah.version.commit=#{mirah_data[0][7..-1]}
-mirah.version.time=#{Time.parse(mirah_data[1]).xmlschema}
-bitescript.version.commit=#{bite_data[0][7..-1]}
-bitescript.version.time=#{Time.parse(bite_data[1]).xmlschema}
-model.version.commit=#{model_data[0][7..-1]}
-model.version.time=#{Time.parse(model_data[1]).xmlschema}
- EOF
+ # the current build environment
+ application.build.time=#{Time.now.xmlschema}
+ dubious.version.commit=#{dubious_data[0][7..-1]}
+ dubious.version.time=#{Time.parse(dubious_data[1]).xmlschema}
+ mirah.version.commit=#{mirah_data[0][7..-1]}
+ mirah.version.time=#{Time.parse(mirah_data[1]).xmlschema}
+ bitescript.version.commit=#{bite_data[0][7..-1]}
+ bitescript.version.time=#{Time.parse(bite_data[1]).xmlschema}
+ model.version.commit=#{model_data[0][7..-1]}
+ model.version.time=#{Time.parse(model_data[1]).xmlschema}
+ EOF
end
end
View
13 dubious.gemspec
@@ -5,11 +5,11 @@ require 'dubious/version'
Gem::Specification.new do |s|
s.name = 'dubious'
s.summary = %q{A web framework for Mirah, running on Google App Engine.}
- s.authors = ["John Woodell", "Nick Howard"]
+ s.authors = ["John Woodell", "Nick Howard"]
s.email = ["woodie@netpress.com", "ndh@baroquebobcat.com"]
s.version = Dubious::VERSION
s.license = "Apache-2.0"
- s.date = Time.now.strftime("YYYY-MM-DD")
+ s.date = Time.now.strftime("%Y-%m-%d")
s.description = %q{Dubious is a web framework written in Mirah.}
s.executables = ["dubious"]
s.files = Dir["{bin,lib,test,examples,javalib}/**/*","{*.txt,Rakefile}"] + [
@@ -22,13 +22,14 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
s.platform = "java"
- s.add_dependency("thor","0.13.8")
+
+ s.add_dependency("thor", "0.13.8")
s.add_dependency("activesupport")
s.add_dependency("i18n")
s.add_dependency("mirah", "0.0.5")
s.add_dependency("mirah_model", "0.0.2")
s.add_dependency("appengine-sdk", "~> 1.4.0")
-
- s.add_development_dependency("rspec","2.4.0")
- s.add_development_dependency("mocha","0.9.12")
+
+ s.add_development_dependency("rspec")
+ s.add_development_dependency("mocha")
end
View
2  lib/dubious/templates/base/config/application.properties.tt
@@ -3,4 +3,4 @@
# must be unique per application
session.key=_<%= name %>_session
# be wary of changing this on a live site, it will invalidate your session cookies
-session.secret=<%= ActiveSupport::SecureRandom.hex(64) %>
+session.secret=<%= SecureRandom.hex(64) %>
View
10 lib/dubious_tasks.rb
@@ -15,6 +15,8 @@ module AppEngine::Rake
$CLASSPATH << TOOLS
class AppEngineTask < Rake::Task
+ include Rake::DSL
+
def initialize(*args, &block)
super
AppEngineTask.tasks << self
@@ -39,7 +41,7 @@ def init(src, war)
cp APIS, api_jar
end
- task :server , :address , :port , :needs => [name] do |t, args|
+ task :server, [:address, :port] => [name] do |t, args|
args.with_defaults(:address => '0.0.0.0', :port => '8080')
check_for_updates
args = [
@@ -84,9 +86,9 @@ def update
begin
timestamp = app_yaml_timestamp
@last_app_yaml_timestamp ||= timestamp
-
+
needed_prerequisites = real_prerequisites.select {|r|r.needed?}
-
+
needed_prerequisites.each {|dep| dep.execute }
unless needed_prerequisites.empty? && timestamp == @last_app_yaml_timestamp
begin
@@ -131,7 +133,7 @@ def webinf_lib_jars
def appengine_app(name,src,hash={}, &block)
war = hash.keys.first
deps = hash[war] || []
-
+
task = AppEngine::Rake::AppEngineTask.define_task(name => deps, &block)
src = File.expand_path(src || 'src')
war = File.expand_path(war || 'war')
View
8 spec/dubious/action_controller_spec.rb
@@ -1,15 +1,15 @@
-require File.dirname(__FILE__)+'/../spec_helper.rb'
+require 'spec_helper'
describe Dubious::ActionController do
subject { Dubious::ActionController.new }
it { should respond_to :do_get }
-
+
describe "#do_get" do
let(:req) { HttpServletRequest.new }
let(:resp){ HttpServletResponse.new }
it {
- req.stubs :get_path_info => '/somepath',
+ req.stubs :get_path_info => '/somepath',
:get_servlet_path => '/someotherpath',
:get_parameter => nil
resp.expects(:set_status).with 404
@@ -19,6 +19,6 @@
end
describe "#action_request" do
-
+
end
end
View
18 spec/dubious_cli_spec.rb
@@ -1,12 +1,13 @@
-require File.dirname(__FILE__)+'/../lib/dubious/cli'
+require 'spec_helper'
+require 'dubious/cli'
describe Dubious::CLI do
-
- before :each do
+
+ before :each do
FileUtils.rm_rf 'spec/temp'
Dir.mkdir 'spec/temp'
end
-
+
describe "subcommands" do
subject { Dubious::CLI::Main.subcommands }
it { should include 'new' }
@@ -14,21 +15,18 @@
end
describe Dubious::CLI::Generator do
-
it 'expects a name' do
lambda {
- Dubious::CLI::Generator.new
+ Dubious::CLI::Generator.new
}.should raise_error
end
-
+
describe "#model" do
it '...' do
- generator = Dubious::CLI::Generator.new(['something'],:quiet=>true)
+ generator = Dubious::CLI::Generator.new(['something'], :quiet=>true)
generator.destination_root=File.dirname(__FILE__)+'/temp'
generator.model
end
end
-
-
end
end
View
10 spec/spec_helper.rb
@@ -1,14 +1,13 @@
require 'java'
require 'bundler/setup'
+require 'rspec/core'
require 'mirah'
require 'appengine-sdk'
-require 'rspec/core'
require 'mocha'
-
require AppEngine::SDK::SDK_ROOT + '/lib/shared/servlet-api.jar'
-require File.dirname(__FILE__)+'/../lib/dubious.jar'
-require File.dirname(__FILE__)+'/../javalib/mirahdatastore.jar'
+require File.dirname(__FILE__) + '/../lib/dubious.jar'
+require File.dirname(__FILE__) + '/../javalib/mirahdatastore.jar'
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
@@ -17,8 +16,7 @@
import javax.servlet.FilterChain
import javax.servlet.FilterConfig
-
-Rspec.configure do |config|
+RSpec.configure do |config|
config.mock_with :mocha
end
Please sign in to comment.
Something went wrong with that request. Please try again.