From 1dd32aaea6d70359f297b89c1590151a164da90c Mon Sep 17 00:00:00 2001 From: kagemusha Date: Sun, 3 Feb 2013 18:19:15 -0500 Subject: [PATCH] initial commit --- .rspec | 1 + .rvmrc | 48 ++++ Gemfile | 29 +++ Gemfile.lock | 223 ++++++++++++++++ README | 19 ++ README.textile | 80 ++++++ Rakefile | 7 + app/assets/javascripts/application.js | 16 ++ app/assets/stylesheets/application.css.scss | 25 ++ .../bootstrap_and_overrides.css.scss | 3 + app/controllers/application_controller.rb | 8 + app/helpers/application_helper.rb | 2 + app/mailers/.gitkeep | 0 app/models/.gitkeep | 0 app/models/ability.rb | 28 ++ app/models/role.rb | 6 + app/models/user.rb | 12 + app/views/devise/registrations/edit.html.haml | 31 +++ app/views/devise/registrations/new.html.haml | 21 ++ app/views/devise/shared/_links.html.haml | 19 ++ app/views/layouts/_messages.html.haml | 5 + app/views/layouts/_navigation.html.haml | 17 ++ app/views/layouts/application.html.haml | 25 ++ config.ru | 4 + config/application.rb | 82 ++++++ config/boot.rb | 6 + config/database.yml | 25 ++ config/environment.rb | 5 + config/environments/development.rb | 37 +++ config/environments/production.rb | 67 +++++ config/environments/test.rb | 37 +++ config/initializers/backtrace_silencers.rb | 7 + config/initializers/devise.rb | 240 ++++++++++++++++++ config/initializers/generators.rb | 2 + config/initializers/inflections.rb | 15 ++ config/initializers/mime_types.rb | 5 + config/initializers/rolify.rb | 8 + config/initializers/secret_token.rb | 7 + config/initializers/session_store.rb | 8 + config/initializers/wrap_parameters.rb | 14 + config/locales/devise.en.yml | 59 +++++ config/locales/en.yml | 5 + config/routes.rb | 3 + .../20130203231007_devise_create_users.rb | 46 ++++ .../20130203231012_add_name_to_users.rb | 5 + .../20130203231022_rolify_create_roles.rb | 19 ++ db/seeds.rb | 7 + features/step_definitions/email_steps.rb | 206 +++++++++++++++ lib/assets/.gitkeep | 0 lib/tasks/.gitkeep | 0 log/.gitkeep | 0 public/404.html | 26 ++ public/422.html | 26 ++ public/500.html | 25 ++ public/favicon.ico | 0 public/humans.txt | 20 ++ public/robots.txt | 5 + script/rails | 6 + spec/factories/users.rb | 6 + spec/models/user_spec.rb | 5 + spec/spec_helper.rb | 51 ++++ spec/support/devise.rb | 3 + vendor/assets/javascripts/.gitkeep | 0 vendor/assets/stylesheets/.gitkeep | 0 vendor/plugins/.gitkeep | 0 65 files changed, 1717 insertions(+) create mode 100644 .rspec create mode 100644 .rvmrc create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README create mode 100644 README.textile create mode 100644 Rakefile create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/stylesheets/application.css.scss create mode 100644 app/assets/stylesheets/bootstrap_and_overrides.css.scss create mode 100644 app/controllers/application_controller.rb create mode 100644 app/helpers/application_helper.rb create mode 100644 app/mailers/.gitkeep create mode 100644 app/models/.gitkeep create mode 100644 app/models/ability.rb create mode 100644 app/models/role.rb create mode 100644 app/models/user.rb create mode 100644 app/views/devise/registrations/edit.html.haml create mode 100644 app/views/devise/registrations/new.html.haml create mode 100644 app/views/devise/shared/_links.html.haml create mode 100644 app/views/layouts/_messages.html.haml create mode 100644 app/views/layouts/_navigation.html.haml create mode 100644 app/views/layouts/application.html.haml create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/database.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/devise.rb create mode 100644 config/initializers/generators.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/rolify.rb create mode 100644 config/initializers/secret_token.rb create mode 100644 config/initializers/session_store.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/devise.en.yml create mode 100644 config/locales/en.yml create mode 100644 config/routes.rb create mode 100644 db/migrate/20130203231007_devise_create_users.rb create mode 100644 db/migrate/20130203231012_add_name_to_users.rb create mode 100644 db/migrate/20130203231022_rolify_create_roles.rb create mode 100644 db/seeds.rb create mode 100644 features/step_definitions/email_steps.rb create mode 100644 lib/assets/.gitkeep create mode 100644 lib/tasks/.gitkeep create mode 100644 log/.gitkeep create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/favicon.ico create mode 100644 public/humans.txt create mode 100644 public/robots.txt create mode 100755 script/rails create mode 100644 spec/factories/users.rb create mode 100644 spec/models/user_spec.rb create mode 100644 spec/spec_helper.rb create mode 100644 spec/support/devise.rb create mode 100644 vendor/assets/javascripts/.gitkeep create mode 100644 vendor/assets/stylesheets/.gitkeep create mode 100644 vendor/plugins/.gitkeep diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..4e1e0d2 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--color diff --git a/.rvmrc b/.rvmrc new file mode 100644 index 0000000..7a17fc8 --- /dev/null +++ b/.rvmrc @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +# This is an RVM Project .rvmrc file, used to automatically load the ruby +# development environment upon cd'ing into the directory + +# First we specify our desired [@], the @gemset name is optional, +# Only full ruby name is supported here, for short names use: +# echo "rvm use 1.9.3" > .rvmrc +environment_id="ruby-1.9.3@ember-rails-devise" + +# Uncomment the following lines if you want to verify rvm version per project +# rvmrc_rvm_version="1.14.2 (latest)" # 1.10.1 seams as a safe start +# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || { +# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading." +# return 1 +# } + +# First we attempt to load the desired environment directly from the environment +# file. This is very fast and efficient compared to running through the entire +# CLI and selector. If you want feedback on which environment was used then +# insert the word 'use' after --create as this triggers verbose mode. +if [[ -d "${rvm_path:-$HOME/.rvm}/environments" + && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] +then + \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id" + [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] && + \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true +else + # If the environment file has not yet been created, use the RVM CLI to select. + rvm --create "$environment_id" || { + echo "Failed to create RVM environment '${environment_id}'." + return 1 + } +fi + +# If you use bundler, this might be useful to you: +# if [[ -s Gemfile ]] && { +# ! builtin command -v bundle >/dev/null || +# builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null +# } +# then +# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n" +# gem install bundler +# fi +# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null +# then +# bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete' +# fi diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..074d9eb --- /dev/null +++ b/Gemfile @@ -0,0 +1,29 @@ +source 'https://rubygems.org' +gem 'rails', '3.2.11' +gem 'sqlite3' +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + gem 'uglifier', '>= 1.0.3' +end +gem 'jquery-rails' +gem "thin", ">= 1.5.0", :group => [:development, :test] +gem "haml", ">= 3.1.7" +gem "haml-rails", ">= 0.3.5", :group => :development +gem "hpricot", ">= 0.8.6", :group => :development +gem "ruby_parser", ">= 3.1.1", :group => :development +gem "rspec-rails", ">= 2.12.2", :group => [:development, :test] +gem "capybara", ">= 2.0.2", :group => :test +gem "database_cleaner", ">= 0.9.1", :group => :test +gem "email_spec", ">= 1.4.0", :group => :test +gem "factory_girl_rails", ">= 4.2.0", :group => [:development, :test] +gem "bootstrap-sass", ">= 2.2.2.0" +gem "devise", ">= 2.2.3" +gem "cancan", ">= 1.6.8" +gem "rolify", ">= 3.2.0" +gem "active_model_serializers" +gem "ember-rails" +gem "quiet_assets", ">= 1.0.1", :group => :development +gem "figaro", ">= 0.5.3" +gem "better_errors", ">= 0.3.2", :group => :development +gem "binding_of_caller", ">= 0.6.8", :group => :development \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..c544fba --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,223 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (3.2.11) + actionpack (= 3.2.11) + mail (~> 2.4.4) + actionpack (3.2.11) + activemodel (= 3.2.11) + activesupport (= 3.2.11) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.4) + rack (~> 1.4.0) + rack-cache (~> 1.2) + rack-test (~> 0.6.1) + sprockets (~> 2.2.1) + active_model_serializers (0.6.0) + activemodel (>= 3.0) + activemodel (3.2.11) + activesupport (= 3.2.11) + builder (~> 3.0.0) + activerecord (3.2.11) + activemodel (= 3.2.11) + activesupport (= 3.2.11) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.11) + activemodel (= 3.2.11) + activesupport (= 3.2.11) + activesupport (3.2.11) + i18n (~> 0.6) + multi_json (~> 1.0) + addressable (2.3.2) + arel (3.0.2) + barber (0.2.0) + execjs + bcrypt-ruby (3.0.1) + better_errors (0.3.2) + coderay (>= 1.0.0) + erubis (>= 2.7.0) + binding_of_caller (0.6.8) + bootstrap-sass (2.2.2.0) + sass (~> 3.2) + builder (3.0.4) + cancan (1.6.8) + capybara (2.0.2) + 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.7) + ffi (~> 1.0, >= 1.0.6) + coderay (1.0.8) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.4.0) + daemons (1.1.9) + database_cleaner (0.9.1) + devise (2.2.3) + bcrypt-ruby (~> 3.0) + orm_adapter (~> 0.1) + railties (~> 3.1) + warden (~> 1.2.1) + diff-lcs (1.1.3) + email_spec (1.4.0) + launchy (~> 2.1) + mail (~> 2.2) + ember-rails (0.9.2) + active_model_serializers + barber + execjs (>= 1.2) + railties (>= 3.1) + erubis (2.7.0) + eventmachine (1.0.0) + execjs (1.4.0) + multi_json (~> 1.0) + factory_girl (4.2.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.2.0) + factory_girl (~> 4.2.0) + railties (>= 3.0.0) + ffi (1.3.1) + figaro (0.5.3) + rails (~> 3.0) + haml (3.1.7) + haml-rails (0.3.5) + actionpack (>= 3.1, < 4.1) + activesupport (>= 3.1, < 4.1) + haml (~> 3.1) + railties (>= 3.1, < 4.1) + hike (1.2.1) + hpricot (0.8.6) + i18n (0.6.1) + journey (1.0.4) + jquery-rails (2.2.0) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + json (1.7.6) + launchy (2.1.2) + addressable (~> 2.3) + mail (2.4.4) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.19) + multi_json (1.5.0) + nokogiri (1.5.6) + orm_adapter (0.4.0) + polyglot (0.3.3) + quiet_assets (1.0.1) + railties (~> 3.1) + rack (1.4.4) + rack-cache (1.2) + rack (>= 0.4) + rack-ssl (1.3.3) + rack + rack-test (0.6.2) + rack (>= 1.0) + rails (3.2.11) + actionmailer (= 3.2.11) + actionpack (= 3.2.11) + activerecord (= 3.2.11) + activeresource (= 3.2.11) + activesupport (= 3.2.11) + bundler (~> 1.0) + railties (= 3.2.11) + railties (3.2.11) + actionpack (= 3.2.11) + activesupport (= 3.2.11) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (>= 0.14.6, < 2.0) + rake (10.0.3) + rdoc (3.12) + json (~> 1.4) + rolify (3.2.0) + rspec-core (2.12.2) + rspec-expectations (2.12.1) + diff-lcs (~> 1.1.3) + rspec-mocks (2.12.2) + rspec-rails (2.12.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 2.12.0) + rspec-expectations (~> 2.12.0) + rspec-mocks (~> 2.12.0) + ruby_parser (3.1.1) + sexp_processor (~> 4.1) + rubyzip (0.9.9) + sass (3.2.5) + sass-rails (3.2.6) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + selenium-webdriver (2.29.0) + childprocess (>= 0.2.5) + multi_json (~> 1.0) + rubyzip + websocket (~> 1.0.4) + sexp_processor (4.1.4) + sprockets (2.2.2) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sqlite3 (1.3.7) + thin (1.5.0) + daemons (>= 1.0.9) + eventmachine (>= 0.12.6) + rack (>= 1.0.0) + thor (0.17.0) + tilt (1.3.3) + treetop (1.4.12) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.35) + uglifier (1.3.0) + execjs (>= 0.3.0) + multi_json (~> 1.0, >= 1.0.2) + warden (1.2.1) + rack (>= 1.0) + websocket (1.0.7) + xpath (1.0.0) + nokogiri (~> 1.3) + +PLATFORMS + ruby + +DEPENDENCIES + active_model_serializers + better_errors (>= 0.3.2) + binding_of_caller (>= 0.6.8) + bootstrap-sass (>= 2.2.2.0) + cancan (>= 1.6.8) + capybara (>= 2.0.2) + coffee-rails (~> 3.2.1) + database_cleaner (>= 0.9.1) + devise (>= 2.2.3) + email_spec (>= 1.4.0) + ember-rails + factory_girl_rails (>= 4.2.0) + figaro (>= 0.5.3) + haml (>= 3.1.7) + haml-rails (>= 0.3.5) + hpricot (>= 0.8.6) + jquery-rails + quiet_assets (>= 1.0.1) + rails (= 3.2.11) + rolify (>= 3.2.0) + rspec-rails (>= 2.12.2) + ruby_parser (>= 3.1.1) + sass-rails (~> 3.2.3) + sqlite3 + thin (>= 1.5.0) + uglifier (>= 1.0.3) diff --git a/README b/README new file mode 100644 index 0000000..0ee12bc --- /dev/null +++ b/README @@ -0,0 +1,19 @@ +Ember Rails Devise +======================== + +This application was generated with the rails_apps_composer gem: +https://github.com/RailsApps/rails_apps_composer +provided by the RailsApps Project: +http://railsapps.github.com/ + +________________________ + +Recipes: +["controllers", "email", "extras", "frontend", "gems", "models", "readme", "routes", "setup", "testing", "views"] + +Preferences: +{:dev_webserver=>"thin", :prod_webserver=>nil, :database=>"sqlite", :templates=>"haml", :unit_test=>"rspec", :integration=>"rspec-capybara", :fixtures=>"factory_girl", :frontend=>"bootstrap", :bootstrap=>"sass", :form_builder=>"none", :email=>"none", :authentication=>"devise", :devise_modules=>"default", :authorization=>"cancan", :quiet_assets=>true, :local_env_file=>true, :better_errors=>true, :ban_spiders=>true, :rvmrc=>true, :github=>false, :starter_app=>"none"} + +________________________ + +License diff --git a/README.textile b/README.textile new file mode 100644 index 0000000..28253bc --- /dev/null +++ b/README.textile @@ -0,0 +1,80 @@ +h1. Ember Rails Devise + +This application was generated with the "rails_apps_composer":https://github.com/RailsApps/rails_apps_composer gem provided by the "RailsApps Project":http://railsapps.github.com/. + +h2. Diagnostics + +This application was built with recipes that are NOT known to work together. + +This application was built with preferences that are NOT known to work together. + +If the application doesn't work as expected, please "report an issue":https://github.com/RailsApps/rails_apps_composer/issues and include these diagnostics: + +We'd also like to know if you've found combinations of recipes or preferences that do work together. + +Recipes: +["controllers", "email", "extras", "frontend", "gems", "models", "readme", "routes", "setup", "testing", "views"] + +Preferences: +{:dev_webserver=>"thin", :prod_webserver=>nil, :database=>"sqlite", :templates=>"haml", :unit_test=>"rspec", :integration=>"rspec-capybara", :fixtures=>"factory_girl", :frontend=>"bootstrap", :bootstrap=>"sass", :form_builder=>"none", :email=>"none", :authentication=>"devise", :devise_modules=>"default", :authorization=>"cancan", :quiet_assets=>true, :local_env_file=>true, :better_errors=>true, :ban_spiders=>true, :rvmrc=>true, :github=>false, :starter_app=>"none"} + +h2. Ruby on Rails + +This application requires: + +* Ruby version 1.9.3 +* Rails version 3.2.11 + +Learn more about "Installing Rails":http://railsapps.github.com/installing-rails.html. + +h2. Database + +This application uses SQLite with ActiveRecord. + +h2. Development + +* Template Engine: Haml +* Testing Framework: RSpec and Factory Girl +* Front-end Framework: Twitter Bootstrap (Sass) +* Form Builder: None +* Authentication: Devise +* Authorization: CanCan + + + + + +h2. Getting Started + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. + +h2. Documentation and Support + +This is the only documentation. + +h4. Issues + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. + +h2. Similar Projects + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. + +h2. Contributing + +If you make improvements to this application, please share with others. + +* Fork the project on GitHub. +* Make your feature addition or bug fix. +* Commit with Git. +* Send the author a pull request. + +If you add functionality to this application, create an alternative implementation, or build an application that is similar, please contact me and I'll add a note to the README so that others can find your work. + +h2. Credits + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. + +h2. License + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..b710e8f --- /dev/null +++ b/Rakefile @@ -0,0 +1,7 @@ +#!/usr/bin/env rake +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +EmberRailsDevise::Application.load_tasks diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..8c515ad --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD +// GO AFTER THE REQUIRES BELOW. +// +//= require jquery +//= require jquery_ujs +//= require bootstrap +//= require_tree . diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss new file mode 100644 index 0000000..76da5f2 --- /dev/null +++ b/app/assets/stylesheets/application.css.scss @@ -0,0 +1,25 @@ +/* + * 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 . +*/ + +.content { + background-color: #eee; + padding: 20px; + margin: 0 -20px; /* negative indent the amount of the padding to maintain the grid system */ + -webkit-border-radius: 0 0 6px 6px; + -moz-border-radius: 0 0 6px 6px; + border-radius: 0 0 6px 6px; + -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15); + -moz-box-shadow: 0 1px 2px rgba(0,0,0,.15); + box-shadow: 0 1px 2px rgba(0,0,0,.15); +} diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.scss b/app/assets/stylesheets/bootstrap_and_overrides.css.scss new file mode 100644 index 0000000..fc66ab6 --- /dev/null +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.scss @@ -0,0 +1,3 @@ +@import "bootstrap"; +body { padding-top: 60px; } +@import "bootstrap-responsive"; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..f9a089f --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,8 @@ +class ApplicationController < ActionController::Base + protect_from_forgery + + rescue_from CanCan::AccessDenied do |exception| + redirect_to root_path, :alert => exception.message + end + +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/ability.rb b/app/models/ability.rb new file mode 100644 index 0000000..58929d7 --- /dev/null +++ b/app/models/ability.rb @@ -0,0 +1,28 @@ +class Ability + include CanCan::Ability + + def initialize(user) + # Define abilities for the passed in user here. For example: + # + # user ||= User.new # guest user (not logged in) + # if user.admin? + # can :manage, :all + # else + # can :read, :all + # end + # + # The first argument to `can` is the action you are giving the user permission to do. + # If you pass :manage it will apply to every action. Other common actions here are + # :read, :create, :update and :destroy. + # + # The second argument is the resource the user can perform the action on. If you pass + # :all it will apply to every resource. Otherwise pass a Ruby class of the resource. + # + # The third argument is an optional hash of conditions to further filter the objects. + # For example, here the user can only update published articles. + # + # can :update, Article, :published => true + # + # See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities + end +end diff --git a/app/models/role.rb b/app/models/role.rb new file mode 100644 index 0000000..145baa7 --- /dev/null +++ b/app/models/role.rb @@ -0,0 +1,6 @@ +class Role < ActiveRecord::Base + has_and_belongs_to_many :users, :join_table => :users_roles + belongs_to :resource, :polymorphic => true + + scopify +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..3ed7994 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,12 @@ +class User < ActiveRecord::Base + rolify + # Include default devise modules. Others available are: + # :token_authenticatable, :confirmable, + # :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable + + # Setup accessible (or protected) attributes for your model + attr_accessible :name, :email, :password, :password_confirmation, :remember_me + +end diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml new file mode 100644 index 0000000..fd00ed0 --- /dev/null +++ b/app/views/devise/registrations/edit.html.haml @@ -0,0 +1,31 @@ +%h2 + Edit #{resource_name.to_s.humanize} += form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| + = devise_error_messages! + %p + = f.label :name + %br/ + = f.text_field :name + %div + = f.label :email + %br/ + = f.email_field :email + %div + = f.label :password + %i (leave blank if you don't want to change it) + %br/ + = f.password_field :password, :autocomplete => "off" + %div + = f.label :password_confirmation + %br/ + = f.password_field :password_confirmation + %div + = f.label :current_password + %i (we need your current password to confirm your changes) + %br/ + = f.password_field :current_password + %div= f.submit "Update" +%h3 Cancel my account +%p + Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete}. += link_to "Back", :back diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml new file mode 100644 index 0000000..e832c22 --- /dev/null +++ b/app/views/devise/registrations/new.html.haml @@ -0,0 +1,21 @@ +%h2 Sign up += form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| + = devise_error_messages! + %p + = f.label :name + %br/ + = f.text_field :name + %div + = f.label :email + %br/ + = f.email_field :email + %div + = f.label :password + %br/ + = f.password_field :password + %div + = f.label :password_confirmation + %br/ + = f.password_field :password_confirmation + %div= f.submit "Sign up" += render "devise/shared/links" diff --git a/app/views/devise/shared/_links.html.haml b/app/views/devise/shared/_links.html.haml new file mode 100644 index 0000000..35d07ec --- /dev/null +++ b/app/views/devise/shared/_links.html.haml @@ -0,0 +1,19 @@ +- if controller_name != 'sessions' + = link_to "Sign in", new_session_path(resource_name) + %br/ +- if devise_mapping.registerable? && controller_name != 'registrations' + = link_to "Sign up", new_registration_path(resource_name) + %br/ +- if devise_mapping.recoverable? && controller_name != 'passwords' + = link_to "Forgot your password?", new_password_path(resource_name) + %br/ +- if devise_mapping.confirmable? && controller_name != 'confirmations' + = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) + %br/ +- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' + = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) + %br/ +- if devise_mapping.omniauthable? + - resource_class.omniauth_providers.each do |provider| + = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) + %br/ diff --git a/app/views/layouts/_messages.html.haml b/app/views/layouts/_messages.html.haml new file mode 100644 index 0000000..80e34d4 --- /dev/null +++ b/app/views/layouts/_messages.html.haml @@ -0,0 +1,5 @@ +- flash.each do |name, msg| + - if msg.is_a?(String) + %div{:class => "alert alert-#{name == :notice ? "success" : "error"}"} + %a.close{"data-dismiss" => "alert"} × + = content_tag :div, msg, :id => "flash_#{name}" diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml new file mode 100644 index 0000000..98941c2 --- /dev/null +++ b/app/views/layouts/_navigation.html.haml @@ -0,0 +1,17 @@ += link_to "Ember Rails Devise", root_path, :class => 'brand' +%ul.nav + - if user_signed_in? + %li + = link_to 'Logout', destroy_user_session_path, :method=>'delete' + - else + %li + = link_to 'Login', new_user_session_path + - if user_signed_in? + %li + = link_to 'Edit account', edit_user_registration_path + - if current_user.has_role? :admin + %li + = link_to 'Admin', users_path + - else + %li + = link_to 'Sign up', new_user_registration_path diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml new file mode 100644 index 0000000..60d52bb --- /dev/null +++ b/app/views/layouts/application.html.haml @@ -0,0 +1,25 @@ +!!! +%html + %head + %meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"} + %title= content_for?(:title) ? yield(:title) : "Ember Rails Devise" + %meta{:content => content_for?(:description) ? yield(:description) : "Ember Rails Devise", :name => "description"} + = stylesheet_link_tag "application", :media => "all" + = javascript_include_tag "application" + = csrf_meta_tags + = yield(:head) + %body{:class => "#{controller_name} #{action_name}"} + %header.navbar.navbar-fixed-top + %nav.navbar-inner + .container + = render 'layouts/navigation' + #main{:role => "main"} + .container + .content + .row + .span12 + = render 'layouts/messages' + = yield + %footer + / ! end of .container + / ! end of #main diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..aa45264 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run EmberRailsDevise::Application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..7ecf689 --- /dev/null +++ b/config/application.rb @@ -0,0 +1,82 @@ +require File.expand_path('../boot', __FILE__) + +# Pick the frameworks you want: +require "active_record/railtie" +require "action_controller/railtie" +require "action_mailer/railtie" +require "active_resource/railtie" +require "sprockets/railtie" +# require "rails/test_unit/railtie" + +if defined?(Bundler) + # If you precompile assets before deploying to production, use this line + Bundler.require(*Rails.groups(:assets => %w(development test))) + # If you want your assets lazily compiled in production, use this line + # Bundler.require(:default, :assets, Rails.env) +end + +module EmberRailsDevise + class Application < Rails::Application + + # don't generate RSpec tests for views and helpers + config.generators do |g| + + g.test_framework :rspec, fixture: true + g.fixture_replacement :factory_girl, dir: 'spec/factories' + + + g.view_specs false + g.helper_specs false + end + + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + config.autoload_paths += %W(#{config.root}/lib) + + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password, :password_confirmation] + + # Enable escaping HTML in JSON. + config.active_support.escape_html_entities_in_json = true + + # Use SQL instead of Active Record's schema dumper when creating the database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Enforce whitelist mode for mass assignment. + # This will create an empty whitelist of attributes available for mass-assignment for all models + # in your app. As such, your models will need to explicitly whitelist or blacklist accessible + # parameters by using an attr_accessible or attr_protected declaration. + config.active_record.whitelist_attributes = true + + # Enable the asset pipeline + config.assets.enabled = true + + # Version of your assets, change this if you want to expire all your assets + config.assets.version = '1.0' + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000..4489e58 --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,6 @@ +require 'rubygems' + +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..51a4dd4 --- /dev/null +++ b/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +development: + adapter: sqlite3 + database: db/development.sqlite3 + pool: 5 + timeout: 5000 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: sqlite3 + database: db/test.sqlite3 + pool: 5 + timeout: 5000 + +production: + adapter: sqlite3 + database: db/production.sqlite3 + pool: 5 + timeout: 5000 diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..89f3e5c --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +EmberRailsDevise::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000..1286d46 --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,37 @@ +EmberRailsDevise::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 + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # 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 + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..f1d9c27 --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,67 @@ +EmberRailsDevise::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = false + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to nil and saved in location specified by config.assets.prefix + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Prepend all log lines with the following tags + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + # config.active_record.auto_explain_threshold_in_seconds = 0.5 +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000..e506f91 --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,37 @@ +EmberRailsDevise::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr +end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb new file mode 100644 index 0000000..1d506c3 --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1,240 @@ +# Use this hook to configure devise mailer, warden hooks and so forth. +# Many of these configuration options can be set straight in your model. +Devise.setup do |config| + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in Devise::Mailer, + # note that it will be overwritten if you use your own mailer class with default "from" parameter. + config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com" + + # Configure the class responsible to send e-mails. + # config.mailer = "Devise::Mailer" + + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/active_record' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating a user. The default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating a user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + # You can also supply a hash where the value is a boolean determining whether + # or not authentication should be aborted when the value is not present. + # config.authentication_keys = [ :email ] + + # Configure parameters from the request object used for authentication. Each entry + # given should be a request method and it will automatically be passed to the + # find_for_authentication method and considered in your model lookup. For instance, + # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. + # The same considerations mentioned for authentication_keys also apply to request_keys. + # config.request_keys = [] + + # Configure which authentication keys should be case-insensitive. + # These keys will be downcased upon creating or modifying a user and when used + # to authenticate or find a user. Default is :email. + config.case_insensitive_keys = [ :email ] + + # Configure which authentication keys should have whitespace stripped. + # These keys will have whitespace before and after removed upon creating or + # modifying a user and when used to authenticate or find a user. Default is :email. + config.strip_whitespace_keys = [ :email ] + + # Tell if authentication through request.params is enabled. True by default. + # It can be set to an array that will enable params authentication only for the + # given strategies, for example, `config.params_authenticatable = [:database]` will + # enable it only for database (email + password) authentication. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Basic Auth is enabled. False by default. + # It can be set to an array that will enable http authentication only for the + # given strategies, for example, `config.http_authenticatable = [:token]` will + # enable it only for token authentication. + # config.http_authenticatable = false + + # If http headers should be returned for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication. "Application" by default. + # config.http_authentication_realm = "Application" + + # It will change confirmation, password recovery and other workflows + # to behave the same regardless if the e-mail provided was right or wrong. + # Does not affect registerable. + # config.paranoid = true + + # By default Devise will store the user in session. You can skip storage for + # :http_auth and :token_auth by adding those symbols to the array below. + # Notice that if you are skipping storage for all authentication paths, you + # may want to disable generating routes to Devise's sessions controller by + # passing :skip => :sessions to `devise_for` in your config/routes.rb + config.skip_session_storage = [:http_auth] + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 10. If + # using other encryptors, it sets how many times you want the password re-encrypted. + # + # Limiting the stretches to just one in testing will increase the performance of + # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use + # a value less than 10 in other environments. + config.stretches = Rails.env.test? ? 1 : 10 + + # Setup a pepper to generate the encrypted password. + # config.pepper = "874a5e5dad1215867c6c1659f78b02a6ad5cb91189d58500afa0fd4c4446a50bcbd6a4a3e5e40fd9f5099d1478616b0c4031f0c22fefb5d803f88f62ef61f42d" + + # ==> Configuration for :confirmable + # A period that the user is allowed to access the website even without + # confirming his account. For instance, if set to 2.days, the user will be + # able to access the website for two days without confirming his account, + # access will be blocked just in the third day. Default is 0.days, meaning + # the user cannot access the website without confirming his account. + # config.allow_unconfirmed_access_for = 2.days + + # A period that the user is allowed to confirm their account before their + # token becomes invalid. For example, if set to 3.days, the user can confirm + # their account within 3 days after the mail was sent, but on the fourth day + # their account can't be confirmed with the token any more. + # Default is nil, meaning there is no restriction on how long a user can take + # before confirming their account. + # config.confirm_within = 3.days + + # If true, requires any email changes to be confirmed (exactly the same way as + # initial account confirmation) to be applied. Requires additional unconfirmed_email + # db field (see migrations). Until confirmed new email is stored in + # unconfirmed email column, and copied to email column on successful confirmation. + config.reconfirmable = true + + # Defines which key will be used when confirming an account + # config.confirmation_keys = [ :email ] + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # Options to be passed to the created cookie. For instance, you can set + # :secure => true in order to force SSL only cookies. + # config.rememberable_options = {} + + # ==> Configuration for :validatable + # Range for password length. Default is 8..128. + config.password_length = 8..128 + + # Email regex used to validate email formats. It simply asserts that + # an one (and only one) @ exists in the given string. This is mainly + # to give user feedback and not to assert the e-mail validity. + # config.email_regexp = /\A[^@]+@[^@]+\z/ + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. Default is 30 minutes. + # config.timeout_in = 30.minutes + + # If true, expires auth token on session timeout. + # config.expire_auth_token_on_timeout = false + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which key will be used when locking and unlocking an account + # config.unlock_keys = [ :email ] + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + # config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + # config.unlock_in = 1.hour + + # ==> Configuration for :recoverable + # + # Defines which key will be used when recovering the password for an account + # config.reset_password_keys = [ :email ] + + # Time interval you can reset your password with a reset password key. + # Don't put a too small interval or your users won't have the time to + # change their passwords. + config.reset_password_within = 6.hours + + # ==> Configuration for :encryptable + # Allow you to use another encryption algorithm besides bcrypt (default). You can use + # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, + # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) + # and :restful_authentication_sha1 (then you should set stretches to 10, and copy + # REST_AUTH_SITE_KEY to pepper) + # config.encryptor = :sha512 + + # ==> Configuration for :token_authenticatable + # Defines name of the authentication token params key + # config.token_authentication_key = :auth_token + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = false + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes (usually :user). + # config.default_scope = :user + + # Set this configuration to false if you want /users/sign_out to sign out + # only the current scope. By default, Devise signs out all scopes. + # config.sign_out_all_scopes = true + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. + # + # The "*/*" below is required to match Internet Explorer requests. + # config.navigational_formats = ["*/*", :html] + + # The default HTTP method used to sign out a resource. Default is :delete. + config.sign_out_via = :delete + + # ==> OmniAuth + # Add a new OmniAuth provider. Check the wiki for more information on setting + # up on your models and hooks. + # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' + + # ==> Warden configuration + # If you want to use other strategies, that are not supported by Devise, or + # change the failure app, you can configure them inside the config.warden block. + # + # config.warden do |manager| + # manager.intercept_401 = false + # manager.default_strategies(:scope => :user).unshift :some_external_strategy + # end + + # ==> Mountable engine configurations + # When using Devise inside an engine, let's call it `MyEngine`, and this engine + # is mountable, there are some extra configurations to be taken into account. + # The following options are available, assuming the engine is mounted as: + # + # mount MyEngine, at: "/my_engine" + # + # The router that invoked `devise_for`, in the example above, would be: + # config.router_name = :my_engine + # + # When using omniauth, Devise cannot automatically set Omniauth path, + # so you need to do it manually. For the users scope, it would be: + # config.omniauth_path_prefix = "/my_engine/users/auth" +end diff --git a/config/initializers/generators.rb b/config/initializers/generators.rb new file mode 100644 index 0000000..4b3d83a --- /dev/null +++ b/config/initializers/generators.rb @@ -0,0 +1,2 @@ +Rails.application.config.generators do |g| +end diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 0000000..5d8d9be --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,15 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end +# +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 0000000..72aca7e --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/rolify.rb b/config/initializers/rolify.rb new file mode 100644 index 0000000..c8df67a --- /dev/null +++ b/config/initializers/rolify.rb @@ -0,0 +1,8 @@ +Rolify.configure do |config| + # By default ORM adapter is ActiveRecord. uncomment to use mongoid + # config.use_mongoid + + # Dynamic shortcuts for User class (user.is_admin? like methods). Default is: false + # Enable this feature _after_ running rake db:migrate as it relies on the roles table + # config.use_dynamic_shortcuts +end \ No newline at end of file diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb new file mode 100644 index 0000000..e258384 --- /dev/null +++ b/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +EmberRailsDevise::Application.config.secret_token = '138cd0f69b1e9673d0b9898d36ea6a56e7a3baf9a221f2da8300ab9a69ce60e64d49759ecdf66b0961f9c9554bf511c1df5d26abf7a2054c870afbff53d2f33d' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 0000000..84a880a --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +EmberRailsDevise::Application.config.session_store :cookie_store, key: '_ember-rails-devise_session' + +# Use the database for sessions instead of the cookie-based default, +# which shouldn't be used to store highly confidential information +# (create the session table with "rails generate session_migration") +# EmberRailsDevise::Application.config.session_store :active_record_store diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..999df20 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# Disable root element in JSON by default. +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false +end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml new file mode 100644 index 0000000..d01f375 --- /dev/null +++ b/config/locales/devise.en.yml @@ -0,0 +1,59 @@ +# Additional translations at https://github.com/plataformatec/devise/wiki/I18n + +en: + devise: + confirmations: + confirmed: "Your account was successfully confirmed. You are now signed in." + send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes." + failure: + already_authenticated: "You are already signed in." + inactive: "Your account was not activated yet." + invalid: "Invalid email or password." + invalid_token: "Invalid authentication token." + locked: "Your account is locked." + not_found_in_database: "Invalid email or password." + timeout: "Your session expired, please sign in again to continue." + unauthenticated: "You need to sign in or sign up before continuing." + unconfirmed: "You have to confirm your account before continuing." + mailer: + confirmation_instructions: + subject: "Confirmation instructions" + reset_password_instructions: + subject: "Reset password instructions" + unlock_instructions: + subject: "Unlock Instructions" + omniauth_callbacks: + failure: "Could not authenticate you from %{kind} because \"%{reason}\"." + success: "Successfully authenticated from %{kind} account." + passwords: + no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." + send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." + updated: "Your password was changed successfully. You are now signed in." + updated_not_active: "Your password was changed successfully." + registrations: + destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon." + signed_up: "Welcome! You have signed up successfully." + signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." + signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." + signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account." + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address." + updated: "You updated your account successfully." + sessions: + signed_in: "Signed in successfully." + signed_out: "Signed out successfully." + unlocks: + send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes." + send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes." + unlocked: "Your account has been unlocked successfully. Please sign in to continue." + errors: + messages: + already_confirmed: "was already confirmed, please try signing in" + confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" + expired: "has expired, please request a new one" + not_found: "not found" + not_locked: "was not locked" + not_saved: + one: "1 error prohibited this %{resource} from being saved:" + other: "%{count} errors prohibited this %{resource} from being saved:" diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..179c14c --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,5 @@ +# Sample localization file for English. Add more files in this directory for other locales. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + hello: "Hello world" diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..cad41bf --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,3 @@ +EmberRailsDevise::Application.routes.draw do + devise_for :users +end diff --git a/db/migrate/20130203231007_devise_create_users.rb b/db/migrate/20130203231007_devise_create_users.rb new file mode 100644 index 0000000..2099d99 --- /dev/null +++ b/db/migrate/20130203231007_devise_create_users.rb @@ -0,0 +1,46 @@ +class DeviseCreateUsers < ActiveRecord::Migration + def change + create_table(:users) do |t| + ## Database authenticatable + t.string :email, :null => false, :default => "" + t.string :encrypted_password, :null => false, :default => "" + + ## Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + ## Rememberable + t.datetime :remember_created_at + + ## Trackable + t.integer :sign_in_count, :default => 0 + t.datetime :current_sign_in_at + t.datetime :last_sign_in_at + t.string :current_sign_in_ip + t.string :last_sign_in_ip + + ## Confirmable + # t.string :confirmation_token + # t.datetime :confirmed_at + # t.datetime :confirmation_sent_at + # t.string :unconfirmed_email # Only if using reconfirmable + + ## Lockable + # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts + # t.string :unlock_token # Only if unlock strategy is :email or :both + # t.datetime :locked_at + + ## Token authenticatable + # t.string :authentication_token + + + t.timestamps + end + + add_index :users, :email, :unique => true + add_index :users, :reset_password_token, :unique => true + # add_index :users, :confirmation_token, :unique => true + # add_index :users, :unlock_token, :unique => true + # add_index :users, :authentication_token, :unique => true + end +end diff --git a/db/migrate/20130203231012_add_name_to_users.rb b/db/migrate/20130203231012_add_name_to_users.rb new file mode 100644 index 0000000..bac750e --- /dev/null +++ b/db/migrate/20130203231012_add_name_to_users.rb @@ -0,0 +1,5 @@ +class AddNameToUsers < ActiveRecord::Migration + def change + add_column :users, :name, :string + end +end diff --git a/db/migrate/20130203231022_rolify_create_roles.rb b/db/migrate/20130203231022_rolify_create_roles.rb new file mode 100644 index 0000000..999c94a --- /dev/null +++ b/db/migrate/20130203231022_rolify_create_roles.rb @@ -0,0 +1,19 @@ +class RolifyCreateRoles < ActiveRecord::Migration + def change + create_table(:roles) do |t| + t.string :name + t.references :resource, :polymorphic => true + + t.timestamps + end + + create_table(:users_roles, :id => false) do |t| + t.references :user + t.references :role + end + + add_index(:roles, :name) + add_index(:roles, [ :name, :resource_type, :resource_id ]) + add_index(:users_roles, [ :user_id, :role_id ]) + end +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..4edb1e8 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) diff --git a/features/step_definitions/email_steps.rb b/features/step_definitions/email_steps.rb new file mode 100644 index 0000000..12bcb3f --- /dev/null +++ b/features/step_definitions/email_steps.rb @@ -0,0 +1,206 @@ +# Commonly used email steps +# +# To add your own steps make a custom_email_steps.rb +# The provided methods are: +# +# last_email_address +# reset_mailer +# open_last_email +# visit_in_email +# unread_emails_for +# mailbox_for +# current_email +# open_email +# read_emails_for +# find_email +# +# General form for email scenarios are: +# - clear the email queue (done automatically by email_spec) +# - execute steps that sends an email +# - check the user received an/no/[0-9] emails +# - open the email +# - inspect the email contents +# - interact with the email (e.g. click links) +# +# The Cucumber steps below are setup in this order. + +module EmailHelpers + def current_email_address + # Replace with your a way to find your current email. e.g @current_user.email + # last_email_address will return the last email address used by email spec to find an email. + # Note that last_email_address will be reset after each Scenario. + last_email_address || "example@example.com" + end +end + +World(EmailHelpers) + +# +# Reset the e-mail queue within a scenario. +# This is done automatically before each scenario. +# + +Given /^(?:a clear email queue|no emails have been sent)$/ do + reset_mailer +end + +# +# Check how many emails have been sent/received +# + +Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails?$/ do |address, amount| + unread_emails_for(address).size.should == parse_email_count(amount) +end + +Then /^(?:I|they|"([^"]*?)") should have (an|no|\d+) emails?$/ do |address, amount| + mailbox_for(address).size.should == parse_email_count(amount) +end + +Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject "([^"]*?)"$/ do |address, amount, subject| + unread_emails_for(address).select { |m| m.subject =~ Regexp.new(Regexp.escape(subject)) }.size.should == parse_email_count(amount) +end + +Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject \/([^"]*?)\/$/ do |address, amount, subject| + unread_emails_for(address).select { |m| m.subject =~ Regexp.new(subject) }.size.should == parse_email_count(amount) +end + +Then /^(?:I|they|"([^"]*?)") should receive an email with the following body:$/ do |address, expected_body| + open_email(address, :with_text => expected_body) +end + +# +# Accessing emails +# + +# Opens the most recently received email +When /^(?:I|they|"([^"]*?)") opens? the email$/ do |address| + open_email(address) +end + +When /^(?:I|they|"([^"]*?)") opens? the email with subject "([^"]*?)"$/ do |address, subject| + open_email(address, :with_subject => subject) +end + +When /^(?:I|they|"([^"]*?)") opens? the email with subject \/([^"]*?)\/$/ do |address, subject| + open_email(address, :with_subject => Regexp.new(subject)) +end + +When /^(?:I|they|"([^"]*?)") opens? the email with text "([^"]*?)"$/ do |address, text| + open_email(address, :with_text => text) +end + +When /^(?:I|they|"([^"]*?)") opens? the email with text \/([^"]*?)\/$/ do |address, text| + open_email(address, :with_text => Regexp.new(text)) +end + +# +# Inspect the Email Contents +# + +Then /^(?:I|they) should see "([^"]*?)" in the email subject$/ do |text| + current_email.should have_subject(text) +end + +Then /^(?:I|they) should see \/([^"]*?)\/ in the email subject$/ do |text| + current_email.should have_subject(Regexp.new(text)) +end + +Then /^(?:I|they) should see "([^"]*?)" in the email body$/ do |text| + current_email.default_part_body.to_s.should include(text) +end + +Then /^(?:I|they) should see \/([^"]*?)\/ in the email body$/ do |text| + current_email.default_part_body.to_s.should =~ Regexp.new(text) +end + +Then /^(?:I|they) should see the email delivered from "([^"]*?)"$/ do |text| + current_email.should be_delivered_from(text) +end + +Then /^(?:I|they) should see "([^\"]*)" in the email "([^"]*?)" header$/ do |text, name| + current_email.should have_header(name, text) +end + +Then /^(?:I|they) should see \/([^\"]*)\/ in the email "([^"]*?)" header$/ do |text, name| + current_email.should have_header(name, Regexp.new(text)) +end + +Then /^I should see it is a multi\-part email$/ do + current_email.should be_multipart +end + +Then /^(?:I|they) should see "([^"]*?)" in the email html part body$/ do |text| + current_email.html_part.body.to_s.should include(text) +end + +Then /^(?:I|they) should see "([^"]*?)" in the email text part body$/ do |text| + current_email.text_part.body.to_s.should include(text) +end + +# +# Inspect the Email Attachments +# + +Then /^(?:I|they) should see (an|no|\d+) attachments? with the email$/ do |amount| + current_email_attachments.size.should == parse_email_count(amount) +end + +Then /^there should be (an|no|\d+) attachments? named "([^"]*?)"$/ do |amount, filename| + current_email_attachments.select { |a| a.filename == filename }.size.should == parse_email_count(amount) +end + +Then /^attachment (\d+) should be named "([^"]*?)"$/ do |index, filename| + current_email_attachments[(index.to_i - 1)].filename.should == filename +end + +Then /^there should be (an|no|\d+) attachments? of type "([^"]*?)"$/ do |amount, content_type| + current_email_attachments.select { |a| a.content_type.include?(content_type) }.size.should == parse_email_count(amount) +end + +Then /^attachment (\d+) should be of type "([^"]*?)"$/ do |index, content_type| + current_email_attachments[(index.to_i - 1)].content_type.should include(content_type) +end + +Then /^all attachments should not be blank$/ do + current_email_attachments.each do |attachment| + attachment.read.size.should_not == 0 + end +end + +Then /^show me a list of email attachments$/ do + EmailSpec::EmailViewer::save_and_open_email_attachments_list(current_email) +end + +# +# Interact with Email Contents +# + +When /^(?:I|they) follow "([^"]*?)" in the email$/ do |link| + visit_in_email(link) +end + +When /^(?:I|they) click the first link in the email$/ do + click_first_link_in_email +end + +# +# Debugging +# These only work with Rails and OSx ATM since EmailViewer uses RAILS_ROOT and OSx's 'open' command. +# Patches accepted. ;) +# + +Then /^save and open current email$/ do + EmailSpec::EmailViewer::save_and_open_email(current_email) +end + +Then /^save and open all text emails$/ do + EmailSpec::EmailViewer::save_and_open_all_text_emails +end + +Then /^save and open all html emails$/ do + EmailSpec::EmailViewer::save_and_open_all_html_emails +end + +Then /^save and open all raw emails$/ do + EmailSpec::EmailViewer::save_and_open_all_raw_emails +end diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/log/.gitkeep b/log/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..9a48320 --- /dev/null +++ b/public/404.html @@ -0,0 +1,26 @@ + + + + The page you were looking for doesn't exist (404) + + + + + +
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+ + diff --git a/public/422.html b/public/422.html new file mode 100644 index 0000000..83660ab --- /dev/null +++ b/public/422.html @@ -0,0 +1,26 @@ + + + + The change you wanted was rejected (422) + + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+ + diff --git a/public/500.html b/public/500.html new file mode 100644 index 0000000..f3648a0 --- /dev/null +++ b/public/500.html @@ -0,0 +1,25 @@ + + + + We're sorry, but something went wrong (500) + + + + + +
+

We're sorry, but something went wrong.

+
+ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/public/humans.txt b/public/humans.txt new file mode 100644 index 0000000..4836963 --- /dev/null +++ b/public/humans.txt @@ -0,0 +1,20 @@ +/* the humans responsible & colophon */ +/* humanstxt.org */ + + +/* TEAM */ + : + Site: + Twitter: + Location: + +/* THANKS */ + Daniel Kehoe (@rails_apps) for the RailsApps project + +/* SITE */ + Standards: HTML5, CSS3 + Components: jQuery + Software: Ruby on Rails + +/* GENERATED BY */ +RailsApps application template: http://railsapps.github.com/ diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..8e1d420 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +User-Agent: * +Disallow: / diff --git a/script/rails b/script/rails new file mode 100755 index 0000000..f8da2cf --- /dev/null +++ b/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/spec/factories/users.rb b/spec/factories/users.rb new file mode 100644 index 0000000..26b30ef --- /dev/null +++ b/spec/factories/users.rb @@ -0,0 +1,6 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :user do + end +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 0000000..44032b4 --- /dev/null +++ b/spec/models/user_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe User do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..280231a --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,51 @@ +# This file is copied to spec/ when you run 'rails generate rspec:install' +ENV["RAILS_ENV"] ||= 'test' +require File.expand_path("../../config/environment", __FILE__) +require 'rspec/rails' +require 'email_spec' +require 'rspec/autorun' + +# Requires supporting ruby files with custom matchers and macros, etc, +# in spec/support/ and its subdirectories. +Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} + +RSpec.configure do |config| + config.include(EmailSpec::Helpers) + config.include(EmailSpec::Matchers) + # ## Mock Framework + # + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: + # + # config.mock_with :mocha + # config.mock_with :flexmock + # config.mock_with :rr + + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, remove the following line or assign false + # instead of true. + config.use_transactional_fixtures = true + + # If true, the base class of anonymous controllers will be inferred + # automatically. This will be the default behavior in future versions of + # rspec-rails. + config.infer_base_class_for_anonymous_controllers = false + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = "random" + + config.before(:suite) do + DatabaseCleaner.strategy = :truncation + end + config.before(:each) do + DatabaseCleaner.start + end + config.after(:each) do + DatabaseCleaner.clean + end +end diff --git a/spec/support/devise.rb b/spec/support/devise.rb new file mode 100644 index 0000000..3552bea --- /dev/null +++ b/spec/support/devise.rb @@ -0,0 +1,3 @@ +RSpec.configure do |config| + config.include Devise::TestHelpers, :type => :controller +end diff --git a/vendor/assets/javascripts/.gitkeep b/vendor/assets/javascripts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep new file mode 100644 index 0000000..e69de29