Skip to content

Commit

Permalink
Add H2 jar; Rubygems.org doesn't like maven deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Stephens committed May 12, 2011
1 parent 6619dfe commit fb8d272
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 139 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -10,6 +10,6 @@ test.rb
foo.rb
nbproject
profile
src/edu/vanderbilt/coupler/*.class
build
output.txt
vendor/cache
1 change: 0 additions & 1 deletion Gemfile
Expand Up @@ -7,7 +7,6 @@ gem 'fastercsv'
gem 'carrierwave'
gem 'mongrel'
gem 'jdbc-mysql'
gem 'mvn:com.h2database:h2'

group :development do
gem 'rake'
Expand Down
2 changes: 0 additions & 2 deletions Gemfile.lock
Expand Up @@ -20,7 +20,6 @@ GEM
mocha (0.9.12)
mongrel (1.1.5-java)
gem_plugin (>= 0.2.3)
mvn:com.h2database:h2 (1.3.153-java)
nokogiri (1.4.4.2-java)
weakling (>= 0.0.3)
rack (1.2.2)
Expand Down Expand Up @@ -59,7 +58,6 @@ DEPENDENCIES
json
mocha
mongrel
mvn:com.h2database:h2
nokogiri
rack-flash
rack-test
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.0.1
0.0.2
8 changes: 3 additions & 5 deletions coupler.gemspec
Expand Up @@ -10,7 +10,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jeremy Stephens"]
s.date = %q{2011-05-11}
s.date = %q{2011-05-12}
s.default_executable = %q{coupler}
s.description = %q{Coupler is a (JRuby) desktop application designed to link datasets together}
s.email = %q{jeremy.f.stephens@vanderbilt.edu}
Expand All @@ -34,6 +34,7 @@ Gem::Specification.new do |s|
"TODO",
"VERSION",
"bin/coupler",
"coupler.gemspec",
"db/.gitignore",
"db/migrate/001_initial_schema.rb",
"db/migrate/002_stub.rb",
Expand Down Expand Up @@ -175,7 +176,7 @@ Gem::Specification.new do |s|
"test/unit/test_runner.rb",
"test/unit/test_scheduler.rb",
"uploads/.gitignore",
"vendor/java/.gitignore",
"vendor/h2-1.3.154.jar",
"webroot/public/css/960.css",
"webroot/public/css/dataTables.css",
"webroot/public/css/jquery-ui.css",
Expand Down Expand Up @@ -297,7 +298,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency(%q<carrierwave>, [">= 0"])
s.add_runtime_dependency(%q<mongrel>, [">= 0"])
s.add_runtime_dependency(%q<jdbc-mysql>, [">= 0"])
s.add_runtime_dependency(%q<mvn:com.h2database:h2>, [">= 0"])
s.add_development_dependency(%q<rake>, [">= 0"])
s.add_development_dependency(%q<jeweler>, [">= 0"])
s.add_development_dependency(%q<forgery>, [">= 0"])
Expand All @@ -321,7 +321,6 @@ Gem::Specification.new do |s|
s.add_dependency(%q<carrierwave>, [">= 0"])
s.add_dependency(%q<mongrel>, [">= 0"])
s.add_dependency(%q<jdbc-mysql>, [">= 0"])
s.add_dependency(%q<mvn:com.h2database:h2>, [">= 0"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
s.add_dependency(%q<forgery>, [">= 0"])
Expand All @@ -346,7 +345,6 @@ Gem::Specification.new do |s|
s.add_dependency(%q<carrierwave>, [">= 0"])
s.add_dependency(%q<mongrel>, [">= 0"])
s.add_dependency(%q<jdbc-mysql>, [">= 0"])
s.add_dependency(%q<mvn:com.h2database:h2>, [">= 0"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
s.add_dependency(%q<forgery>, [">= 0"])
Expand Down
4 changes: 2 additions & 2 deletions lib/coupler.rb
Expand Up @@ -19,9 +19,9 @@
require 'json'
require 'fastercsv'
require 'carrierwave'
require 'mvn:com.h2database:h2'
require 'mongrel'
require 'jdbc/mysql' # FIXME: lazy load this
#require 'jdbc/mysql' # Sequel should load this when it needs to.
require File.dirname(__FILE__) + '/../vendor/h2-1.3.154.jar'

require File.dirname(__FILE__) + "/coupler/logger"
require File.dirname(__FILE__) + "/coupler/database"
Expand Down
2 changes: 1 addition & 1 deletion lib/coupler/base.rb
Expand Up @@ -11,7 +11,7 @@ class Base < Sinatra::Base
set :dump_errors, true
set :logging, Proc.new { !test? }
set :methodoverride, true
set :host, '127.0.0.1'
set :bind, '127.0.0.1'
set :db_path, lambda { |dbname| File.join(data_path, 'db', environment.to_s, dbname) }
set :connection_string, lambda { |dbname| "jdbc:h2:#{db_path(dbname)};IGNORECASE=TRUE" }
set :upload_path, lambda { File.join(data_path, 'uploads', environment.to_s) }
Expand Down
11 changes: 8 additions & 3 deletions lib/coupler/runner.rb
@@ -1,6 +1,6 @@
module Coupler
class Runner
def initialize(argv = ARGV, &block)
def initialize(argv = ARGV, options = {}, &block)
@msg_proc = block
irb = false
OptionParser.new do |opts|
Expand All @@ -23,6 +23,8 @@ def initialize(argv = ARGV, &block)
end
end.parse!(argv)

say "Starting up Coupler..."

say "Migrating database..."
Coupler::Database.instance.migrate!

Expand All @@ -49,8 +51,11 @@ def initialize(argv = ARGV, &block)

if success
Coupler::Base.set(:running, true)
trap("INT") do
shutdown
say "Web server is up and running on http://#{settings.bind}:#{settings.port}"
if !options.has_key?(:trap) || options[:trap]
trap("INT") do
shutdown
end
end

# say <<'EOF'
Expand Down
116 changes: 0 additions & 116 deletions src/edu/vanderbilt/coupler/Main.java

This file was deleted.

1 change: 0 additions & 1 deletion src/edu/vanderbilt/coupler/jruby.properties

This file was deleted.

1 change: 1 addition & 0 deletions tasks/environment.rake
@@ -1,4 +1,5 @@
task :environment do
ENV['COUPLER_HOME'] = File.expand_path(File.join(File.dirname(__FILE__), '..'))
require 'bundler'
Bundler.setup(:default, :development)
require File.join(File.dirname(__FILE__), '..', 'lib', 'coupler')
Expand Down
4 changes: 3 additions & 1 deletion test/helper.rb
Expand Up @@ -27,9 +27,11 @@
$LOAD_PATH.unshift(dir)
require 'table_sets'

$LOAD_PATH.unshift(File.join(dir, '..', 'lib'))
# set here and in the rake environment task
ENV['COUPLER_ENV'] = 'test'
ENV['COUPLER_HOME'] = File.expand_path(File.join(dir, '..'))

$LOAD_PATH.unshift(File.join(dir, '..', 'lib'))
require 'coupler'

Coupler::Base.set(:sessions, false) # workaround
Expand Down
15 changes: 15 additions & 0 deletions test/unit/test_runner.rb
Expand Up @@ -16,6 +16,7 @@ def setup
Mongrel::HttpServer.stubs(:new).returns(@mongrel)
@settings = stub('settings', :bind => '0.0.0.0', :port => 123)
Base.stubs(:set => nil, :settings => @settings)
Runner.any_instance.stubs(:trap)
end

def capture_stdout
Expand Down Expand Up @@ -86,5 +87,19 @@ def capture_stdout
end
assert !messages.empty?
end

test "traps INT" do
capture_stdout do
Runner.any_instance.expects(:trap).with("INT")
r = Runner.new([])
end
end

test "doesn't trap INT" do
capture_stdout do
Runner.any_instance.expects(:trap).with("INT").never
r = Runner.new([], :trap => false)
end
end
end
end
Binary file added vendor/h2-1.3.154.jar
Binary file not shown.
5 changes: 0 additions & 5 deletions vendor/java/.gitignore

This file was deleted.

0 comments on commit fb8d272

Please sign in to comment.