Add calibre database

This commit is contained in:
Meutel 2015-06-28 11:48:20 +02:00
parent ead20d3d73
commit 99d802dd88
14 changed files with 95 additions and 0 deletions

Binary file not shown.

4
.gitignore vendored
View File

@ -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

View File

@ -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'

View File

@ -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)

View File

@ -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/

View File

@ -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/

View File

@ -0,0 +1,9 @@
class StaticPagesController < ApplicationController
def home
@title = "Home"
end
def about
@title = "About"
end
end

View File

@ -0,0 +1,2 @@
module StaticPagesHelper
end

View File

@ -0,0 +1,2 @@
<h1>About</h1>
<p>Bouquins is a web frontend for calibre e-book manager</p>

View File

@ -0,0 +1,2 @@
<h1>Welcome</h1>
<p>Coming soon, an e-book library</p>

View File

@ -9,6 +9,10 @@ default: &default
pool: 5
timeout: 5000
calibre:
adapter: sqlite3
database: db/metadata.db
development:
<<: *default
database: db/development.sqlite3

View File

@ -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

View File

@ -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

View File

@ -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