Skip to content

Commit

Permalink
some changes to run on server
Browse files Browse the repository at this point in the history
  • Loading branch information
justinj committed Aug 4, 2013
1 parent c217200 commit 8a39726
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Expand Up @@ -3,14 +3,14 @@ source "https://rubygems.org"
gem 'sinatra'
gem 'rake'
gem 'sequel'
gem 'sqlite3'

group :production do
gem 'pg'
# gem 'pg'
end

group :test, :development do
gem 'minitest'
gem 'sqlite3'
end

ruby '2.0.0'
2 changes: 0 additions & 2 deletions Gemfile.lock
Expand Up @@ -2,7 +2,6 @@ GEM
remote: https://rubygems.org/
specs:
minitest (5.0.4)
pg (0.16.0)
rack (1.5.2)
rake (10.1.0)
sequel (4.0.0)
Expand All @@ -17,7 +16,6 @@ PLATFORMS

DEPENDENCIES
minitest
pg
rake
sequel
sinatra
Expand Down
5 changes: 3 additions & 2 deletions app.rb
@@ -1,10 +1,11 @@
require "sinatra"

require_relative "lib/solves"
require_relative "lib/database"

require_relative "lib/solve"
ReconDatabase::SolveDatabase.init

require_relative "lib/solve"


get "/" do
get_solves(params)
Expand Down
2 changes: 2 additions & 0 deletions config.ru
@@ -0,0 +1,2 @@
require "./app"
run Sinatra::Application
5 changes: 2 additions & 3 deletions lib/database.rb
@@ -1,13 +1,11 @@
require "sequel"
require_relative "solves"

module ReconDatabase
class SolveDatabase
class << self

def init
# @db = Sequel.sqlite
@db = Sequel.connect(ENV['HEROKU_POSTGRESQL_VIOLET_URL'])
@db = Sequel.sqlite

unless @db.table_exists? :solves
@db.create_table :solves do
Expand All @@ -22,6 +20,7 @@ def init
String :puzzle
end

@solves = @db[:solves]
ReconDatabase::SeedData.seed_database

end
Expand Down
2 changes: 0 additions & 2 deletions lib/solve.rb
Expand Up @@ -42,8 +42,6 @@ def queryable_fields

def query(params)
params = params.reject{ |_, s| s.empty? }.map { |k, v| [k.to_sym, v] }
p "MY PARAMS ARE:"
p params
SolveDatabase.where(params)
end
end
Expand Down

0 comments on commit 8a39726

Please sign in to comment.