From 50ece28ab653c84751fd040ec66d49ab19d6bc9a Mon Sep 17 00:00:00 2001 From: Meutel Date: Sun, 28 Jun 2015 13:58:53 +0200 Subject: [PATCH] query calibre --- .gitignore | 1 + Gemfile.lock | 2 ++ app/controllers/static_pages_controller.rb | 1 + app/models/book.rb | 2 ++ app/views/static_pages/home.html.erb | 2 +- config/environment.rb | 2 ++ test/models/book_test.rb | 7 +++++++ 7 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 app/models/book.rb create mode 100644 test/models/book_test.rb diff --git a/.gitignore b/.gitignore index ec96ab8..a210281 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ *~ *.*.swp +/vendor/ruby diff --git a/Gemfile.lock b/Gemfile.lock index 5f00de5..6096249 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -70,9 +70,11 @@ GEM mail (2.6.3) mime-types (>= 1.16, < 3) mime-types (2.6.1) + mini_portile (0.6.2) minitest (5.7.0) multi_json (1.11.1) nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index 7248a86..486c329 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -1,6 +1,7 @@ class StaticPagesController < ApplicationController def home @title = "Home" + @books_count = Calibre::Book.count end def about diff --git a/app/models/book.rb b/app/models/book.rb new file mode 100644 index 0000000..6f68b44 --- /dev/null +++ b/app/models/book.rb @@ -0,0 +1,2 @@ +class Book < ActiveRecord::Base +end diff --git a/app/views/static_pages/home.html.erb b/app/views/static_pages/home.html.erb index 776f7e1..be2a515 100644 --- a/app/views/static_pages/home.html.erb +++ b/app/views/static_pages/home.html.erb @@ -1,2 +1,2 @@

Welcome

-

Coming soon, an e-book library

+

<%= @books_count %> books in library

diff --git a/config/environment.rb b/config/environment.rb index bd5aafc..87d119e 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -4,6 +4,8 @@ require File.expand_path('../application', __FILE__) # Initialize the Rails application. Rails.application.initialize! +ENV['GEM_PATH']='/home/meutel/gems/:/usr/local/lib/ruby/gems/2.1/' +ENV['GEM_HOME']='/home/meutel/gems' require 'magic_multi_connections' module Calibre diff --git a/test/models/book_test.rb b/test/models/book_test.rb new file mode 100644 index 0000000..e48079d --- /dev/null +++ b/test/models/book_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class BookTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end