From 99d802dd8869845d0f1a32adb0292f675082ec91 Mon Sep 17 00:00:00 2001 From: Meutel Date: Sun, 28 Jun 2015 11:48:20 +0200 Subject: [PATCH] Add calibre database --- .Gemfile.swp | Bin 12288 -> 12288 bytes .gitignore | 4 ++ Gemfile | 1 + Gemfile.lock | 2 + app/assets/javascripts/static_pages.coffee | 3 ++ app/assets/stylesheets/static_pages.scss | 3 ++ app/controllers/static_pages_controller.rb | 9 ++++ app/helpers/static_pages_helper.rb | 2 + app/views/static_pages/about.html.erb | 2 + app/views/static_pages/home.html.erb | 2 + config/database.yml | 4 ++ config/environment.rb | 6 +++ config/environments/calibre.rb | 41 ++++++++++++++++++ .../static_pages_controller_test.rb | 16 +++++++ 14 files changed, 95 insertions(+) create mode 100644 app/assets/javascripts/static_pages.coffee create mode 100644 app/assets/stylesheets/static_pages.scss create mode 100644 app/controllers/static_pages_controller.rb create mode 100644 app/helpers/static_pages_helper.rb create mode 100644 app/views/static_pages/about.html.erb create mode 100644 app/views/static_pages/home.html.erb create mode 100644 config/environments/calibre.rb create mode 100644 test/controllers/static_pages_controller_test.rb diff --git a/.Gemfile.swp b/.Gemfile.swp index 1c4154e1b7bff6e8ed3a225a4af9ab294680d52e..4af8a3931f0b281c43b0222f5521256f5bc8aee0 100644 GIT binary patch delta 305 zcmXBOF-rmg7{>8e>?G|{qb4Ccj64uLBZ`8Mz$Gf8$)-T-FgxhZp>uLb+8Uz4?_fid z9J&T7Ee$QTr??d@QP9?3df*4o@V@ZWi}hmcWchGsUt2d;g+xV054ZW+fgOOlKapWXWPl#JxPpx=GMK|}SmY7+sNo2+_?Q-X zM;|S0!N5ordBP1WoFS*mp6HY$0{EE{`Nk{m(8M*?ki-&R7~4S`D_Fz=;vvsBu^nt= nQ90EK3 delta 268 zcmXBPF-rmg7{>8O?S{L~G!g5a z*P(Mekn)eC+eoKnN=0kmOzk$vG9oST3l9S{;NS|USRF~%!(h~Wg=LuraHe4vIhZn5FeAI$N98= 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