diff --git a/.Gemfile.swp b/.Gemfile.swp index 1c4154e..4af8a39 100644 Binary files a/.Gemfile.swp and b/.Gemfile.swp differ diff --git a/.gitignore b/.gitignore index 050c9d9..ec96ab8 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,12 @@ # Ignore the default SQLite database. /db/*.sqlite3 /db/*.sqlite3-journal +/db/metadata.db # Ignore all logfiles and tempfiles. /log/* !/log/.keep /tmp + +*~ +*.*.swp diff --git a/Gemfile b/Gemfile index f7a0b56..679e082 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,6 @@ source 'https://rubygems.org' +gem 'magic_multi_connections' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.2' diff --git a/Gemfile.lock b/Gemfile.lock index e3defbd..5f00de5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -66,6 +66,7 @@ GEM json (1.8.3) loofah (2.0.2) nokogiri (>= 1.5.9) + magic_multi_connections (1.2.1) mail (2.6.3) mime-types (>= 1.16, < 3) mime-types (2.6.1) @@ -144,6 +145,7 @@ DEPENDENCIES coffee-rails (~> 4.1.0) jbuilder (~> 2.0) jquery-rails + magic_multi_connections rails (= 4.2.2) sass-rails (~> 5.0) sdoc (~> 0.4.0) diff --git a/app/assets/javascripts/static_pages.coffee b/app/assets/javascripts/static_pages.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/static_pages.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/static_pages.scss b/app/assets/stylesheets/static_pages.scss new file mode 100644 index 0000000..d55836c --- /dev/null +++ b/app/assets/stylesheets/static_pages.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the StaticPages controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb new file mode 100644 index 0000000..7248a86 --- /dev/null +++ b/app/controllers/static_pages_controller.rb @@ -0,0 +1,9 @@ +class StaticPagesController < ApplicationController + def home + @title = "Home" + end + + def about + @title = "About" + end +end diff --git a/app/helpers/static_pages_helper.rb b/app/helpers/static_pages_helper.rb new file mode 100644 index 0000000..2d63e79 --- /dev/null +++ b/app/helpers/static_pages_helper.rb @@ -0,0 +1,2 @@ +module StaticPagesHelper +end diff --git a/app/views/static_pages/about.html.erb b/app/views/static_pages/about.html.erb new file mode 100644 index 0000000..1fefc8c --- /dev/null +++ b/app/views/static_pages/about.html.erb @@ -0,0 +1,2 @@ +

About

+

Bouquins is a web frontend for calibre e-book manager

diff --git a/app/views/static_pages/home.html.erb b/app/views/static_pages/home.html.erb new file mode 100644 index 0000000..776f7e1 --- /dev/null +++ b/app/views/static_pages/home.html.erb @@ -0,0 +1,2 @@ +

Welcome

+

Coming soon, an e-book library

diff --git a/config/database.yml b/config/database.yml index 1c1a37c..82f8b91 100644 --- a/config/database.yml +++ b/config/database.yml @@ -9,6 +9,10 @@ default: &default pool: 5 timeout: 5000 +calibre: + adapter: sqlite3 + database: db/metadata.db + development: <<: *default database: db/development.sqlite3 diff --git a/config/environment.rb b/config/environment.rb index ee8d90d..bd5aafc 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -3,3 +3,9 @@ require File.expand_path('../application', __FILE__) # Initialize the Rails application. Rails.application.initialize! + +require 'magic_multi_connections' + +module Calibre + establish_connection :calibre +end diff --git a/config/environments/calibre.rb b/config/environments/calibre.rb new file mode 100644 index 0000000..b55e214 --- /dev/null +++ b/config/environments/calibre.rb @@ -0,0 +1,41 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb new file mode 100644 index 0000000..f9b4696 --- /dev/null +++ b/test/controllers/static_pages_controller_test.rb @@ -0,0 +1,16 @@ +require 'test_helper' + +class StaticPagesControllerTest < ActionController::TestCase + test "should get home" do + get :home + assert_response :success + assert_select "title", "Home | Bouquins" + end + + test "should get about" do + get :about + assert_response :success + assert_select "title", "About | Bouquins" + end + +end