From fc0d6f90ee4ca67d888538fb55efe7b9c6b46541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnaro=CC=88k?= Date: Thu, 18 Apr 2013 09:37:18 -0700 Subject: [PATCH 1/2] Removes ActiveRecord from all the things. --- Gemfile | 5 ----- Gemfile.lock | 4 ---- config/application.rb | 6 +++++- config/database.yml | 28 ---------------------------- db/schema.rb | 16 ---------------- 5 files changed, 5 insertions(+), 54 deletions(-) delete mode 100644 config/database.yml delete mode 100644 db/schema.rb diff --git a/Gemfile b/Gemfile index 343d656d..988b5868 100644 --- a/Gemfile +++ b/Gemfile @@ -40,11 +40,6 @@ group :development, :test do gem 'cucumber-rails', require: false gem "faker" gem 'pry' - gem 'sqlite3' -end - -group :production do - gem 'pg' # ugh heroku end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 7ffccfa5..0d2a957b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -138,7 +138,6 @@ GEM multi_json (1.0.4) nokogiri (1.5.0) orm_adapter (0.4.0) - pg (0.12.2) plucky (0.4.4) mongo (~> 1.5) polyglot (0.3.3) @@ -207,7 +206,6 @@ GEM hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.5) term-ansicolor (1.0.7) thor (0.14.6) tilt (1.3.3) @@ -249,7 +247,6 @@ DEPENDENCIES mm-devise (~> 2.0) mocha mongo_mapper - pg pry rails (= 3.1.11) rdiscount @@ -257,7 +254,6 @@ DEPENDENCIES sass-rails (~> 3.1.0) semantic_menu! simple_form! - sqlite3 uglifier unicorn will_paginate diff --git a/config/application.rb b/config/application.rb index d2382e0a..d7a2e952 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,10 @@ require File.expand_path('../boot', __FILE__) -require 'rails/all' +require "action_controller/railtie" +require "action_mailer/railtie" +require "active_resource/railtie" +require "rails/test_unit/railtie" +require "sprockets/railtie" if defined?(Bundler) # If you precompile assets before deploying to production, use this line diff --git a/config/database.yml b/config/database.yml deleted file mode 100644 index 09cc85a2..00000000 --- a/config/database.yml +++ /dev/null @@ -1,28 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -development: - adapter: sqlite3 - database: db/development.sqlite3 - pool: 5 - timeout: 5000 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: &test - adapter: sqlite3 - database: db/test.sqlite3 - pool: 5 - timeout: 5000 - -production: - adapter: sqlite3 - database: db/production.sqlite3 - pool: 5 - timeout: 5000 - -cucumber: - <<: *test \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb deleted file mode 100644 index b5e6a796..00000000 --- a/db/schema.rb +++ /dev/null @@ -1,16 +0,0 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 0) do - -end From 45606ad84acd53fc55de129ddc18aa6ff9b35b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnaro=CC=88k?= Date: Thu, 18 Apr 2013 18:28:15 -0700 Subject: [PATCH 2/2] Trade logic in Ruby for logic in YAML. I don't like this, I think it might be worth :skull:ing Mongo's `db:test:prepare` task and replacing it with a no op one. The logic in the config/mongo.yml file mirrors the logic in the Ruby initializer, but no one should rightfully expect logic to exist in the yml file. --- config/initializers/mongo_mapper.rb | 9 --------- config/mongo.yml | 18 ++++++++++++++++++ lib/tasks/cucumber.rake | 3 --- 3 files changed, 18 insertions(+), 12 deletions(-) delete mode 100644 config/initializers/mongo_mapper.rb create mode 100644 config/mongo.yml diff --git a/config/initializers/mongo_mapper.rb b/config/initializers/mongo_mapper.rb deleted file mode 100644 index 0d1f648e..00000000 --- a/config/initializers/mongo_mapper.rb +++ /dev/null @@ -1,9 +0,0 @@ -if ENV['MONGOHQ_URL'] - MongoMapper.config = { - Rails.env => { 'uri' => ENV['MONGOHQ_URL'] } - } - - MongoMapper.connect(Rails.env) -else - MongoMapper.database = "hackety-hack-com-#{Rails.env}" -end diff --git a/config/mongo.yml b/config/mongo.yml new file mode 100644 index 00000000..7bc08895 --- /dev/null +++ b/config/mongo.yml @@ -0,0 +1,18 @@ +<% if ENV['MONGOHQ_URL'] %> +defaults: &defaults + url: <%= ENV['MONGOHQ_URL'] %> +<% else %> +defaults: &defaults + host: 127.0.0.1 + port: 27017 + database: hackety_hack_com_<%= ENV['RAILS_ENV'] %> +<% end %> + +development: + <<: *defaults + +test: + <<: *defaults + +production: + <<: *defaults diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index 83f79471..6818cfe2 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -50,9 +50,6 @@ begin STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***" end - # In case we don't have ActiveRecord, append a no-op task that we can depend upon. - task 'db:test:prepare' do - end task :stats => 'cucumber:statsetup' rescue LoadError