diff --git a/Gemfile b/Gemfile index 48bc44e..e561a0d 100644 --- a/Gemfile +++ b/Gemfile @@ -40,8 +40,14 @@ gem 'jquery-rails' group :development, :test do gem 'rspec-rails' + gem 'github' + gem 'tddium' gem "rails_best_practices", "~> 1.11.1" gem "flay" gem 'simplecov' gem 'machinist' + gem 'cucumber-rails' , :require => false + gem 'capybara' + gem 'database_cleaner' + gem 'selenium-webdriver' end diff --git a/Gemfile.lock b/Gemfile.lock index 5a6e966..4d780b8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -28,9 +28,19 @@ GEM activesupport (3.2.10) i18n (~> 0.6) multi_json (~> 1.0) + addressable (2.3.2) arel (3.0.2) awesome_print (1.1.0) builder (3.0.4) + capybara (2.0.1) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + selenium-webdriver (~> 2.0) + xpath (~> 1.0.0) + childprocess (0.3.6) + ffi (~> 1.0, >= 1.0.6) code_analyzer (0.3.0) sexp_processor coffee-rails (3.2.2) @@ -41,22 +51,45 @@ GEM execjs coffee-script-source (1.4.0) colored (1.2) + cucumber (1.2.1) + builder (>= 2.1.2) + diff-lcs (>= 1.1.3) + gherkin (~> 2.11.0) + json (>= 1.4.6) + cucumber-rails (1.3.0) + capybara (>= 1.1.2) + cucumber (>= 1.1.8) + nokogiri (>= 1.5.0) daemons (1.1.9) + database_cleaner (0.9.1) diff-lcs (1.1.3) erubis (2.7.0) eventmachine (1.0.0) execjs (1.4.0) multi_json (~> 1.0) + ffi (1.2.0) flay (2.0.0) ruby_parser (~> 3.0.0) sexp_processor (~> 4.0) + gherkin (2.11.5) + json (>= 1.4.6) + github (0.1.1) + highline (1.6.15) hike (1.2.1) + httparty (0.8.3) + multi_json (~> 1.0) + multi_xml i18n (0.6.1) journey (1.0.4) jquery-rails (2.1.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.7.6) + launchy (2.1.2) + addressable (~> 2.3) + libwebsocket (0.1.7.1) + addressable + websocket machinist (2.0) mail (2.4.4) i18n (>= 0.4.0) @@ -64,6 +97,8 @@ GEM treetop (~> 1.4.8) mime-types (1.19) multi_json (1.5.0) + multi_xml (0.5.1) + nokogiri (1.5.5) pg (0.14.1) polyglot (0.3.3) progressbar (0.11.0) @@ -115,11 +150,17 @@ GEM rspec (~> 2.11.0) ruby_parser (3.0.1) sexp_processor (~> 4.1) + rubyzip (0.9.9) sass (3.2.5) sass-rails (3.2.5) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) + selenium-webdriver (2.27.2) + childprocess (>= 0.2.5) + libwebsocket (~> 0.1.3) + multi_json (~> 1.0) + rubyzip sexp_processor (4.1.2) simplecov (0.7.1) multi_json (~> 1.0) @@ -133,6 +174,15 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) + tddium (1.5.8) + highline + json + launchy + tddium_client (~> 0.2.0) + thor + tddium_client (0.2.0) + httparty (>= 0.8.1) + json temple (0.4.1) thin (1.5.0) daemons (>= 1.0.9) @@ -147,13 +197,20 @@ GEM uglifier (1.3.0) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) + websocket (1.0.4) + xpath (1.0.0) + nokogiri (~> 1.3) PLATFORMS ruby DEPENDENCIES + capybara coffee-rails (~> 3.2.1) + cucumber-rails + database_cleaner flay + github jquery-rails machinist pg @@ -161,7 +218,9 @@ DEPENDENCIES rails_best_practices (~> 1.11.1) rspec-rails sass-rails (~> 3.2.3) + selenium-webdriver simplecov slim + tddium thin uglifier (>= 1.0.3) diff --git a/app/assets/javascripts/book.js.coffee b/app/assets/javascripts/book.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/book.js.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://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/home.js.coffee b/app/assets/javascripts/home.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/home.js.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://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/user.js.coffee b/app/assets/javascripts/user.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/user.js.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://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 3192ec8..b29a06d 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,13 +1,16 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, - * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the top of the - * compiled file, but it's generally better to create a new file per style scope. - * - *= require_self - *= require_tree . - */ +body { + padding-top: 60px; + padding-bottom: 40px; + + text-shadow: white 0 1px 0; + font-weight: 100; +} +.main{ + min-height: 500px; +} + +#footer{ + background-color: whiteSmoke; + height: 60px; + padding-bottom: 0; +} \ No newline at end of file diff --git a/app/assets/stylesheets/book.css.scss b/app/assets/stylesheets/book.css.scss new file mode 100644 index 0000000..3c371b0 --- /dev/null +++ b/app/assets/stylesheets/book.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Book controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/home.css.scss b/app/assets/stylesheets/home.css.scss new file mode 100644 index 0000000..7131aac --- /dev/null +++ b/app/assets/stylesheets/home.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Home controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/user.css.scss b/app/assets/stylesheets/user.css.scss new file mode 100644 index 0000000..c47a13e --- /dev/null +++ b/app/assets/stylesheets/user.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the User 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/book_controller.rb b/app/controllers/book_controller.rb new file mode 100644 index 0000000..9a5a1f8 --- /dev/null +++ b/app/controllers/book_controller.rb @@ -0,0 +1,2 @@ +class BookController < ApplicationController +end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100644 index 0000000..41e9799 --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,6 @@ +class HomeController < ApplicationController + + def index + + end +end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb new file mode 100644 index 0000000..11046fd --- /dev/null +++ b/app/controllers/user_controller.rb @@ -0,0 +1,2 @@ +class UserController < ApplicationController +end diff --git a/app/helpers/book_helper.rb b/app/helpers/book_helper.rb new file mode 100644 index 0000000..2b0a0ca --- /dev/null +++ b/app/helpers/book_helper.rb @@ -0,0 +1,2 @@ +module BookHelper +end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb new file mode 100644 index 0000000..23de56a --- /dev/null +++ b/app/helpers/home_helper.rb @@ -0,0 +1,2 @@ +module HomeHelper +end diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb new file mode 100644 index 0000000..0147c3f --- /dev/null +++ b/app/helpers/user_helper.rb @@ -0,0 +1,2 @@ +module UserHelper +end diff --git a/app/models/book.rb b/app/models/book.rb index c8c6d1e..8d6e481 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -1,3 +1,5 @@ class Book < ActiveRecord::Base - attr_accessible :author, :image, :isbn, :name + attr_accessible :author, :image, :isbn, :name, :users + + has_many :users end diff --git a/app/models/user.rb b/app/models/user.rb index 942ec39..6d2834d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,4 @@ class User < ActiveRecord::Base - attr_accessible :email, :name + attr_accessible :email, :name, :books + has_many :books end diff --git a/app/models/user_to_book.rb b/app/models/user_to_book.rb new file mode 100644 index 0000000..f0feb35 --- /dev/null +++ b/app/models/user_to_book.rb @@ -0,0 +1,6 @@ +class UserToBook < ActiveRecord::Base + + belongs_to :user + belongs_to :book + +end diff --git a/app/views/home/index.html.slim b/app/views/home/index.html.slim new file mode 100644 index 0000000..09a0111 --- /dev/null +++ b/app/views/home/index.html.slim @@ -0,0 +1 @@ +p Hello \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index f2bb150..0000000 --- a/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - Libr - <%= stylesheet_link_tag "application", :media => "all" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim new file mode 100644 index 0000000..b27e23d --- /dev/null +++ b/app/views/layouts/application.html.slim @@ -0,0 +1,35 @@ +doctype html +html + head + title Ocelots + link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" + = stylesheet_link_tag '/bootstrap/css/bootstrap.min.css' + = stylesheet_link_tag '/bootstrap/css/bootstrap-responsive.min.css' + = stylesheet_link_tag 'application', media: 'all' + = csrf_meta_tags + = yield :style_includes + + body + + div.navbar.navbar-fixed-top + div.navbar-inner + div.container + a.brand href="/" Home + div.nav + ul.nav + li + a href="" books + ul.nav.pull-right + li + a href="" logout + + div.container.main + = yield + + div#footer + div.container + p.muted.credit 2013 ThoughtWorks + + = javascript_include_tag 'application' + = javascript_include_tag '/bootstrap/js/bootstrap.min.js' + = yield :javascript_includes diff --git a/config/routes.rb b/config/routes.rb index e730c0d..074f008 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,7 @@ Libr::Application.routes.draw do + + root to:'home#index' + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/db/migrate/20130107052141_create_user_to_books.rb b/db/migrate/20130107052141_create_user_to_books.rb new file mode 100644 index 0000000..73ff054 --- /dev/null +++ b/db/migrate/20130107052141_create_user_to_books.rb @@ -0,0 +1,10 @@ +class CreateUserToBooks < ActiveRecord::Migration + def change + create_table :user_to_books do |t| + t.integer :user_id + t.integer :book_id + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 4a73699..e85ea35 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130107031555) do +ActiveRecord::Schema.define(:version => 20130107052141) do create_table "books", :force => true do |t| t.string "name" @@ -22,6 +22,13 @@ ActiveRecord::Schema.define(:version => 20130107031555) do t.datetime "updated_at", :null => false end + create_table "user_to_books", :force => true do |t| + t.integer "user_id" + t.integer "book_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "users", :force => true do |t| t.string "email" t.string "name" diff --git a/public/index.html b/public/index.html deleted file mode 100644 index a1d5099..0000000 --- a/public/index.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - Ruby on Rails: Welcome aboard - - - - -
- - -
- - - - -
-

Getting started

-

Here’s how to get rolling:

- -
    -
  1. -

    Use rails generate to create your models and controllers

    -

    To see all available options, run it without parameters.

    -
  2. - -
  3. -

    Set up a default route and remove public/index.html

    -

    Routes are set up in config/routes.rb.

    -
  4. - -
  5. -

    Create your database

    -

    Run rake db:create to create your database. If you're not using SQLite (the default), edit config/database.yml with your username and password.

    -
  6. -
-
-
- - -
- - diff --git a/spec/controllers/book_controller_controller_spec.rb b/spec/controllers/book_controller_controller_spec.rb new file mode 100644 index 0000000..237d02c --- /dev/null +++ b/spec/controllers/book_controller_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe BookControllerController do + +end diff --git a/spec/controllers/book_controller_spec.rb b/spec/controllers/book_controller_spec.rb new file mode 100644 index 0000000..179299a --- /dev/null +++ b/spec/controllers/book_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe BookController do + +end diff --git a/spec/controllers/home_controller_controller_spec.rb b/spec/controllers/home_controller_controller_spec.rb new file mode 100644 index 0000000..4fa0ce1 --- /dev/null +++ b/spec/controllers/home_controller_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe HomeControllerController do + +end diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb new file mode 100644 index 0000000..9d48b6a --- /dev/null +++ b/spec/controllers/home_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe HomeController do + +end diff --git a/spec/controllers/user_controller_controller_spec.rb b/spec/controllers/user_controller_controller_spec.rb new file mode 100644 index 0000000..6511ee9 --- /dev/null +++ b/spec/controllers/user_controller_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe UserControllerController do + +end diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb new file mode 100644 index 0000000..4bbc2d9 --- /dev/null +++ b/spec/controllers/user_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe UserController do + +end diff --git a/spec/helpers/book_controller_helper_spec.rb b/spec/helpers/book_controller_helper_spec.rb new file mode 100644 index 0000000..85926b9 --- /dev/null +++ b/spec/helpers/book_controller_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the BookControllerHelper. For example: +# +# describe BookControllerHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe BookControllerHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/book_helper_spec.rb b/spec/helpers/book_helper_spec.rb new file mode 100644 index 0000000..ec4082d --- /dev/null +++ b/spec/helpers/book_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the BookHelper. For example: +# +# describe BookHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe BookHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/home_controller_helper_spec.rb b/spec/helpers/home_controller_helper_spec.rb new file mode 100644 index 0000000..3cfb534 --- /dev/null +++ b/spec/helpers/home_controller_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the HomeControllerHelper. For example: +# +# describe HomeControllerHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe HomeControllerHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/home_helper_spec.rb b/spec/helpers/home_helper_spec.rb new file mode 100644 index 0000000..4a37633 --- /dev/null +++ b/spec/helpers/home_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the HomeHelper. For example: +# +# describe HomeHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe HomeHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/user_controller_helper_spec.rb b/spec/helpers/user_controller_helper_spec.rb new file mode 100644 index 0000000..e7b123b --- /dev/null +++ b/spec/helpers/user_controller_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the UserControllerHelper. For example: +# +# describe UserControllerHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe UserControllerHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/user_helper_spec.rb b/spec/helpers/user_helper_spec.rb new file mode 100644 index 0000000..c73fc76 --- /dev/null +++ b/spec/helpers/user_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the UserHelper. For example: +# +# describe UserHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe UserHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/user_to_book_spec.rb b/spec/models/user_to_book_spec.rb new file mode 100644 index 0000000..8ae76a3 --- /dev/null +++ b/spec/models/user_to_book_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe UserToBook do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/user_controller/BookController.html.erb_spec.rb b/spec/views/user_controller/BookController.html.erb_spec.rb new file mode 100644 index 0000000..9e6cb06 --- /dev/null +++ b/spec/views/user_controller/BookController.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe "user_controller/BookController.html.erb" do + pending "add some examples to (or delete) #{__FILE__}" +end