├── app ├── mailers │ ├── .keep │ └── .gitkeep ├── models │ ├── .keep │ ├── .gitkeep │ ├── concerns │ │ └── .keep │ ├── role.rb │ ├── user.rb │ └── ability.rb ├── assets │ ├── images │ │ └── .keep │ ├── stylesheets │ │ └── application.css │ └── javascripts │ │ └── application.js ├── controllers │ ├── concerns │ │ └── .keep │ ├── application_controller.rb │ ├── registrations_controller.rb │ └── users_controller.rb ├── views │ ├── home │ │ └── index.html.haml │ ├── users │ │ ├── show.html.haml │ │ ├── _user.html.haml │ │ └── index.html.haml │ ├── layouts │ │ └── application.html.erb │ └── devise │ │ ├── sessions │ │ └── new.html.haml │ │ ├── registrations │ │ ├── new.html.haml │ │ └── edit.html.haml │ │ └── shared │ │ └── _links.html.haml └── helpers │ └── application_helper.rb ├── lib ├── assets │ ├── .keep │ └── .gitkeep ├── tasks │ ├── .gitkeep │ └── .keep └── templates │ └── haml │ └── scaffold │ └── _form.html.haml ├── public ├── favicon.ico ├── robots.txt ├── humans.txt ├── 500.html ├── 422.html └── 404.html ├── vendor ├── plugins │ └── .gitkeep └── assets │ ├── javascripts │ ├── .keep │ └── .gitkeep │ └── stylesheets │ ├── .keep │ └── .gitkeep ├── bin ├── rake ├── bundle └── rails ├── spec ├── support │ └── devise.rb ├── models │ ├── role_spec.rb │ └── user_spec.rb ├── factories │ ├── roles.rb │ └── users.rb ├── controllers │ ├── home_controller_spec.rb │ └── users_controller_spec.rb └── spec_helper.rb ├── db ├── migrate │ ├── 20140423184816_add_name_to_users.rb │ ├── 20140423184823_rolify_create_roles.rb │ └── 20140423184813_devise_create_users.rb └── seeds.rb ├── config.ru ├── config ├── initializers │ ├── session_store.rb │ ├── filter_parameter_logging.rb │ ├── mime_types.rb │ ├── rolify.rb │ ├── backtrace_silencers.rb │ ├── wrap_parameters.rb │ ├── secret_token.rb │ ├── inflections.rb │ ├── simple_form_bootstrap.rb │ ├── simple_form.rb │ └── devise.rb ├── environment.rb ├── routes.rb ├── boot.rb ├── locales │ ├── en.yml │ ├── simple_form.en.yml │ └── devise.en.yml ├── environments │ ├── development.rb │ ├── test.rb │ └── production.rb └── application.rb ├── Rakefile ├── script └── rails ├── Gemfile ├── README ├── .gitignore ├── Guardfile ├── README.md └── Gemfile.lock /app/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/mailers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/plugins/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/home/index.html.haml: -------------------------------------------------------------------------------- 1 | %h3 Home 2 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /spec/support/devise.rb: -------------------------------------------------------------------------------- 1 | RSpec.configure do |config| 2 | config.include Devise::TestHelpers, :type => :controller 3 | end 4 | -------------------------------------------------------------------------------- /spec/models/role_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Role do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /spec/factories/roles.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :role do 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/views/users/show.html.haml: -------------------------------------------------------------------------------- 1 | %h3 User 2 | %p 3 | User: #{@user.name} 4 | %p 5 | Email: #{@user.email if @user.email} 6 | = link_to 'Edit account', edit_user_path 7 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /db/migrate/20140423184816_add_name_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddNameToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :name, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Tonton::Application.config.session_store :cookie_store, key: '_tonton_session' 4 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Tonton::Application.initialize! 6 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Tonton::Application.routes.draw do 2 | root :to => "home#index" 3 | devise_for :users, :controllers => {:registrations => "registrations"} 4 | resources :users 5 | end -------------------------------------------------------------------------------- /app/models/role.rb: -------------------------------------------------------------------------------- 1 | class Role < ActiveRecord::Base 2 | has_and_belongs_to_many :users, :join_table => :users_roles 3 | belongs_to :resource, :polymorphic => true 4 | 5 | scopify 6 | end 7 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # Set up gems listed in the Gemfile. 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | 4 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 5 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | Disallow: / 6 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Tonton::Application.load_tasks 7 | -------------------------------------------------------------------------------- /spec/controllers/home_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe HomeController do 4 | 5 | describe "GET 'index'" do 6 | it "should be successful" do 7 | get 'index' 8 | response.should be_success 9 | end 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | rolify 3 | # Include default devise modules. Others available are: 4 | # :confirmable, :lockable, :timeoutable and :omniauthable 5 | devise :database_authenticatable, :registerable, 6 | :recoverable, :rememberable, :trackable, :validatable 7 | end 8 | -------------------------------------------------------------------------------- /script/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. 3 | 4 | APP_PATH = File.expand_path('../../config/application', __FILE__) 5 | require File.expand_path('../../config/boot', __FILE__) 6 | require 'rails/commands' 7 | -------------------------------------------------------------------------------- /lib/templates/haml/scaffold/_form.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for(@<%= singular_table_name %>) do |f| 2 | = f.error_notification 3 | 4 | .form-inputs 5 | <%- attributes.each do |attribute| -%> 6 | = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> 7 | <%- end -%> 8 | 9 | .form-actions 10 | = f.button :submit 11 | -------------------------------------------------------------------------------- /config/initializers/rolify.rb: -------------------------------------------------------------------------------- 1 | Rolify.configure do |config| 2 | # By default ORM adapter is ActiveRecord. uncomment to use mongoid 3 | # config.use_mongoid 4 | 5 | # Dynamic shortcuts for User class (user.is_admin? like methods). Default is: false 6 | # Enable this feature _after_ running rake db:migrate as it relies on the roles table 7 | # config.use_dynamic_shortcuts 8 | end -------------------------------------------------------------------------------- /spec/factories/users.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :user do 5 | name 'Test User' 6 | email 'example@example.com' 7 | password 'changeme' 8 | password_confirmation 'changeme' 9 | # required if the Devise Confirmable module is used 10 | # confirmed_at Time.now 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |If you are the application owner check the logs for more information.
56 | 57 | 58 | -------------------------------------------------------------------------------- /db/migrate/20140423184813_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateUsers < ActiveRecord::Migration 2 | def change 3 | create_table(:users) do |t| 4 | ## Database authenticatable 5 | t.string :email, null: false, default: "" 6 | t.string :encrypted_password, null: false, default: "" 7 | 8 | ## Recoverable 9 | t.string :reset_password_token 10 | t.datetime :reset_password_sent_at 11 | 12 | ## Rememberable 13 | t.datetime :remember_created_at 14 | 15 | ## Trackable 16 | t.integer :sign_in_count, default: 0, null: false 17 | t.datetime :current_sign_in_at 18 | t.datetime :last_sign_in_at 19 | t.string :current_sign_in_ip 20 | t.string :last_sign_in_ip 21 | 22 | ## Confirmable 23 | # t.string :confirmation_token 24 | # t.datetime :confirmed_at 25 | # t.datetime :confirmation_sent_at 26 | # t.string :unconfirmed_email # Only if using reconfirmable 27 | 28 | ## Lockable 29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 30 | # t.string :unlock_token # Only if unlock strategy is :email or :both 31 | # t.datetime :locked_at 32 | 33 | 34 | t.timestamps 35 | end 36 | 37 | add_index :users, :email, unique: true 38 | add_index :users, :reset_password_token, unique: true 39 | # add_index :users, :confirmation_token, unique: true 40 | # add_index :users, :unlock_token, unique: true 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Maybe you tried to change something you didn't have access to.
55 |If you are the application owner check the logs for more information.
57 | 58 | 59 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |You may have mistyped the address or the page may have moved.
55 |If you are the application owner check the logs for more information.
57 | 58 | 59 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Tonton::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static asset server for tests with Cache-Control for performance. 16 | config.serve_static_assets = true 17 | config.static_cache_control = "public, max-age=3600" 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Print deprecation notices to the stderr. 35 | config.active_support.deprecation = :stderr 36 | end 37 | -------------------------------------------------------------------------------- /config/initializers/simple_form_bootstrap.rb: -------------------------------------------------------------------------------- 1 | # Use this setup block to configure all options available in SimpleForm. 2 | SimpleForm.setup do |config| 3 | config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b| 4 | b.use :html5 5 | b.use :placeholder 6 | b.use :label 7 | b.wrapper tag: 'div', class: 'controls' do |ba| 8 | ba.use :input 9 | ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' } 10 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 11 | end 12 | end 13 | 14 | config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b| 15 | b.use :html5 16 | b.use :placeholder 17 | b.use :label 18 | b.wrapper tag: 'div', class: 'controls' do |input| 19 | input.wrapper tag: 'div', class: 'input-prepend' do |prepend| 20 | prepend.use :input 21 | end 22 | input.use :hint, wrap_with: { tag: 'span', class: 'help-block' } 23 | input.use :error, wrap_with: { tag: 'span', class: 'help-inline' } 24 | end 25 | end 26 | 27 | config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b| 28 | b.use :html5 29 | b.use :placeholder 30 | b.use :label 31 | b.wrapper tag: 'div', class: 'controls' do |input| 32 | input.wrapper tag: 'div', class: 'input-append' do |append| 33 | append.use :input 34 | end 35 | input.use :hint, wrap_with: { tag: 'span', class: 'help-block' } 36 | input.use :error, wrap_with: { tag: 'span', class: 'help-inline' } 37 | end 38 | end 39 | 40 | # Wrappers for forms and inputs using the Twitter Bootstrap toolkit. 41 | # Check the Bootstrap docs (http://twitter.github.com/bootstrap) 42 | # to learn about the different styles for forms and inputs, 43 | # buttons and other elements. 44 | config.default_wrapper = :bootstrap 45 | end 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Ignore these files when commiting to a git repository. 3 | # 4 | # See http://help.github.com/ignore-files/ for more about ignoring files. 5 | # 6 | # The original version of this file is found here: 7 | # https://github.com/RailsApps/rails-composer/blob/master/files/gitignore.txt 8 | # 9 | # Corrections? Improvements? Create a GitHub issue: 10 | # http://github.com/RailsApps/rails-composer/issues 11 | #---------------------------------------------------------------------------- 12 | 13 | # bundler state 14 | /.bundle 15 | /vendor/bundle/ 16 | /vendor/ruby/ 17 | 18 | # minimal Rails specific artifacts 19 | db/*.sqlite3 20 | /db/*.sqlite3-journal 21 | /log/* 22 | /tmp/* 23 | 24 | # various artifacts 25 | **.war 26 | *.rbc 27 | *.sassc 28 | .rspec 29 | .redcar/ 30 | .sass-cache 31 | /config/config.yml 32 | /config/database.yml 33 | /coverage.data 34 | /coverage/ 35 | /db/*.javadb/ 36 | /db/*.sqlite3 37 | /doc/api/ 38 | /doc/app/ 39 | /doc/features.html 40 | /doc/specs.html 41 | /public/cache 42 | /public/stylesheets/compiled 43 | /public/system/* 44 | /spec/tmp/* 45 | /cache 46 | /capybara* 47 | /capybara-*.html 48 | /gems 49 | /specifications 50 | rerun.txt 51 | pickle-email-*.html 52 | .zeus.sock 53 | 54 | # If you find yourself ignoring temporary files generated by your text editor 55 | # or operating system, you probably want to add a global ignore instead: 56 | # git config --global core.excludesfile ~/.gitignore_global 57 | # 58 | # Here are some files you may want to ignore globally: 59 | 60 | # scm revert files 61 | **.orig 62 | 63 | # Mac finder artifacts 64 | .DS_Store 65 | 66 | # Netbeans project directory 67 | /nbproject/ 68 | 69 | # RubyMine project files 70 | .idea 71 | 72 | # Textmate project files 73 | /*.tmproj 74 | 75 | # vim artifacts 76 | **.swp 77 | 78 | # Environment files that may contain sensitive data 79 | .env 80 | .powenv 81 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | ENV["RAILS_ENV"] ||= 'test' 3 | require File.expand_path("../../config/environment", __FILE__) 4 | require 'rspec/rails' 5 | require 'email_spec' 6 | require 'rspec/autorun' 7 | 8 | # Requires supporting ruby files with custom matchers and macros, etc, 9 | # in spec/support/ and its subdirectories. 10 | Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} 11 | 12 | RSpec.configure do |config| 13 | config.include(EmailSpec::Helpers) 14 | config.include(EmailSpec::Matchers) 15 | # ## Mock Framework 16 | # 17 | # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: 18 | # 19 | # config.mock_with :mocha 20 | # config.mock_with :flexmock 21 | # config.mock_with :rr 22 | 23 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 24 | config.fixture_path = "#{::Rails.root}/spec/fixtures" 25 | 26 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 27 | # examples within a transaction, remove the following line or assign false 28 | # instead of true. 29 | config.use_transactional_fixtures = true 30 | 31 | # If true, the base class of anonymous controllers will be inferred 32 | # automatically. This will be the default behavior in future versions of 33 | # rspec-rails. 34 | config.infer_base_class_for_anonymous_controllers = false 35 | 36 | # Run specs in random order to surface order dependencies. If you find an 37 | # order dependency and want to debug it, you can fix the order by providing 38 | # the seed, which is printed after each run. 39 | # --seed 1234 40 | config.order = "random" 41 | 42 | config.before(:suite) do 43 | DatabaseCleaner.strategy = :truncation 44 | end 45 | config.before(:each) do 46 | DatabaseCleaner.start 47 | end 48 | config.after(:each) do 49 | DatabaseCleaner.clean 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | # A sample Guardfile 2 | # More info at https://github.com/guard/guard#readme 3 | 4 | guard :bundler do 5 | watch('Gemfile') 6 | # Uncomment next line if your Gemfile contains the `gemspec' command. 7 | # watch(/^.+\.gemspec/) 8 | end 9 | 10 | guard 'rails' do 11 | watch('Gemfile.lock') 12 | watch(%r{^(config|lib)/.*}) 13 | end 14 | 15 | 16 | guard :rspec do 17 | watch(%r{^spec/.+_spec\.rb$}) 18 | watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } 19 | watch('spec/spec_helper.rb') { "spec" } 20 | 21 | # Rails example 22 | watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } 23 | watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" } 24 | watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } 25 | watch(%r{^spec/support/(.+)\.rb$}) { "spec" } 26 | watch('config/routes.rb') { "spec/routing" } 27 | watch('app/controllers/application_controller.rb') { "spec/controllers" } 28 | 29 | # Capybara features specs 30 | watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" } 31 | 32 | # Turnip features and steps 33 | watch(%r{^spec/acceptance/(.+)\.feature$}) 34 | watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' } 35 | end 36 | 37 | 38 | guard :bundler do 39 | watch('Gemfile') 40 | # Uncomment next line if your Gemfile contains the `gemspec' command. 41 | # watch(/^.+\.gemspec/) 42 | end 43 | 44 | guard 'rails' do 45 | watch('Gemfile.lock') 46 | watch(%r{^(config|lib)/.*}) 47 | end 48 | 49 | 50 | guard :rspec do 51 | watch(%r{^spec/.+_spec\.rb$}) 52 | watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } 53 | watch('spec/spec_helper.rb') { "spec" } 54 | 55 | # Rails example 56 | watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } 57 | watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" } 58 | watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } 59 | watch(%r{^spec/support/(.+)\.rb$}) { "spec" } 60 | watch('config/routes.rb') { "spec/routing" } 61 | watch('app/controllers/application_controller.rb') { "spec/controllers" } 62 | 63 | # Capybara features specs 64 | watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" } 65 | 66 | # Turnip features and steps 67 | watch(%r{^spec/acceptance/(.+)\.feature$}) 68 | watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' } 69 | end 70 | 71 | -------------------------------------------------------------------------------- /spec/models/user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe User do 4 | 5 | before(:each) do 6 | @attr = { 7 | :name => "Example User", 8 | :email => "user@example.com", 9 | :password => "changeme", 10 | :password_confirmation => "changeme" 11 | } 12 | end 13 | 14 | it "should create a new instance given a valid attribute" do 15 | User.create!(@attr) 16 | end 17 | 18 | it "should require an email address" do 19 | no_email_user = User.new(@attr.merge(:email => "")) 20 | no_email_user.should_not be_valid 21 | end 22 | 23 | it "should accept valid email addresses" do 24 | addresses = %w[user@foo.com THE_USER@foo.bar.org first.last@foo.jp] 25 | addresses.each do |address| 26 | valid_email_user = User.new(@attr.merge(:email => address)) 27 | valid_email_user.should be_valid 28 | end 29 | end 30 | 31 | it "should reject invalid email addresses" do 32 | addresses = %w[user@foo,com user_at_foo.org example.user@foo.] 33 | addresses.each do |address| 34 | invalid_email_user = User.new(@attr.merge(:email => address)) 35 | invalid_email_user.should_not be_valid 36 | end 37 | end 38 | 39 | it "should reject duplicate email addresses" do 40 | User.create!(@attr) 41 | user_with_duplicate_email = User.new(@attr) 42 | user_with_duplicate_email.should_not be_valid 43 | end 44 | 45 | it "should reject email addresses identical up to case" do 46 | upcased_email = @attr[:email].upcase 47 | User.create!(@attr.merge(:email => upcased_email)) 48 | user_with_duplicate_email = User.new(@attr) 49 | user_with_duplicate_email.should_not be_valid 50 | end 51 | 52 | describe "passwords" do 53 | 54 | before(:each) do 55 | @user = User.new(@attr) 56 | end 57 | 58 | it "should have a password attribute" do 59 | @user.should respond_to(:password) 60 | end 61 | 62 | it "should have a password confirmation attribute" do 63 | @user.should respond_to(:password_confirmation) 64 | end 65 | end 66 | 67 | describe "password validations" do 68 | 69 | it "should require a password" do 70 | User.new(@attr.merge(:password => "", :password_confirmation => "")). 71 | should_not be_valid 72 | end 73 | 74 | it "should require a matching password confirmation" do 75 | User.new(@attr.merge(:password_confirmation => "invalid")). 76 | should_not be_valid 77 | end 78 | 79 | it "should reject short passwords" do 80 | short = "a" * 5 81 | hash = @attr.merge(:password => short, :password_confirmation => short) 82 | User.new(hash).should_not be_valid 83 | end 84 | 85 | end 86 | 87 | describe "password encryption" do 88 | 89 | before(:each) do 90 | @user = User.create!(@attr) 91 | end 92 | 93 | it "should have an encrypted password attribute" do 94 | @user.should respond_to(:encrypted_password) 95 | end 96 | 97 | it "should set the encrypted password attribute" do 98 | @user.encrypted_password.should_not be_blank 99 | end 100 | 101 | end 102 | 103 | end 104 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Tonton 2 | ========= 3 | 4 | This application was generated with the [rails_apps_composer](https://github.com/RailsApps/rails_apps_composer) gem 5 | provided by the [RailsApps Project](http://railsapps.github.io/). 6 | 7 | Diagnostics 8 | - 9 | 10 | This application was built with recipes that are known to work together. 11 | 12 | This application was built with preferences that are NOT known to work 13 | together. 14 | 15 | If the application doesn’t work as expected, please [report an issue](https://github.com/RailsApps/rails_apps_composer/issues) 16 | and include these diagnostics: 17 | 18 | We’d also like to know if you’ve found combinations of recipes or 19 | preferences that do work together. 20 | 21 | Recipes: 22 | 23 | * apps4 24 | * controllers 25 | * core 26 | * deployment 27 | * email 28 | * extras 29 | * frontend 30 | * gems 31 | * git 32 | * init 33 | * models 34 | * prelaunch 35 | * railsapps 36 | * readme 37 | * routes 38 | * saas 39 | * setup 40 | * testing 41 | * tests4 42 | * views 43 | 44 | Preferences: 45 | 46 | * git: true 47 | * apps4: none 48 | * dev_webserver: unicorn 49 | * prod_webserver: unicorn 50 | * database: postgresql 51 | * templates: haml 52 | * unit_test: rspec 53 | * integration: none 54 | * continuous_testing: guard 55 | * fixtures: factory_girl 56 | * frontend: bootstrap3 57 | * email: none 58 | * authentication: devise 59 | * devise_modules: default 60 | * authorization: cancan 61 | * form_builder: simple_form 62 | * starter_app: admin_app 63 | * rvmrc: false 64 | * quiet_assets: true 65 | * better_errors: true 66 | * pry: true 67 | * ban_spiders: true 68 | * github: true 69 | 70 | Ruby on Rails 71 | --- 72 | 73 | This application requires: 74 | 75 | - Ruby 76 | - Rails 77 | 78 | Learn more about [Installing Rails](http://railsapps.github.io/installing-rails.html). 79 | 80 | Database 81 | --- 82 | 83 | This application uses PostgreSQL with ActiveRecord. 84 | 85 | Development 86 | - 87 | 88 | - Template Engine: Haml 89 | - Testing Framework: RSpec and Factory Girl 90 | - Front-end Framework: Bootstrap 3.0 (Sass) 91 | - Form Builder: SimpleForm 92 | - Authentication: Devise 93 | - Authorization: CanCan 94 | - Admin: None 95 | 96 | 97 | 98 | 99 | 100 | 101 | delivery is disabled in development. 102 | 103 | Getting Started 104 | 105 | 106 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 107 | 108 | Documentation and Support 109 | 110 | 111 | This is the only documentation. 112 | 113 | #### Issues 114 | 115 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 116 | 117 | Similar Projects 118 | - 119 | 120 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 121 | 122 | Contributing 123 | -- 124 | 125 | If you make improvements to this application, please share with others. 126 | 127 | - Fork the project on GitHub. 128 | - Make your feature addition or bug fix. 129 | - Commit with Git. 130 | - Send the author a pull request. 131 | 132 | If you add functionality to this application, create an alternative 133 | implementation, or build an application that is similar, please contact 134 | me and I’ll add a note to the README so that others can find your work. 135 | 136 | Credits 137 | -- 138 | 139 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 140 | 141 | License 142 | -- 143 | 144 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 145 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Tonton::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both thread web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 18 | # Add `rack-cache` to your Gemfile before enabling this. 19 | # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. 20 | # config.action_dispatch.rack_cache = true 21 | 22 | # Disable Rails's static asset server (Apache or nginx will already do this). 23 | config.serve_static_assets = false 24 | 25 | # Compress JavaScripts and CSS. 26 | config.assets.js_compressor = :uglifier 27 | # config.assets.css_compressor = :sass 28 | 29 | # Do not fallback to assets pipeline if a precompiled asset is missed. 30 | config.assets.compile = false 31 | 32 | # Generate digests for assets URLs. 33 | config.assets.digest = true 34 | 35 | # Version of your assets, change this if you want to expire all your assets. 36 | config.assets.version = '1.0' 37 | 38 | # Specifies the header that your server uses for sending files. 39 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 40 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 41 | 42 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 43 | # config.force_ssl = true 44 | 45 | # Set to :debug to see everything in the log. 46 | config.log_level = :info 47 | 48 | # Prepend all log lines with the following tags. 49 | # config.log_tags = [ :subdomain, :uuid ] 50 | 51 | # Use a different logger for distributed setups. 52 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 53 | 54 | # Use a different cache store in production. 55 | # config.cache_store = :mem_cache_store 56 | 57 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 58 | # config.action_controller.asset_host = "http://assets.example.com" 59 | 60 | # Precompile additional assets. 61 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 62 | # config.assets.precompile += %w( search.js ) 63 | 64 | # Ignore bad email addresses and do not raise email delivery errors. 65 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 66 | # config.action_mailer.raise_delivery_errors = false 67 | 68 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 69 | # the I18n.default_locale when a translation can not be found). 70 | config.i18n.fallbacks = true 71 | 72 | # Send deprecation notices to registered listeners. 73 | config.active_support.deprecation = :notify 74 | 75 | # Disable automatic flushing of the log to improve performance. 76 | # config.autoflush_log = false 77 | 78 | # Use default logging formatter so that PID and timestamp are not suppressed. 79 | config.log_formatter = ::Logger::Formatter.new 80 | end 81 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n 2 | 3 | en: 4 | devise: 5 | confirmations: 6 | confirmed: "Your account was successfully confirmed." 7 | send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes." 8 | 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." 9 | failure: 10 | already_authenticated: "You are already signed in." 11 | inactive: "Your account is not activated yet." 12 | invalid: "Invalid email or password." 13 | locked: "Your account is locked." 14 | last_attempt: "You have one more attempt before your account will be locked." 15 | not_found_in_database: "Invalid email or password." 16 | timeout: "Your session expired. Please sign in again to continue." 17 | unauthenticated: "You need to sign in or sign up before continuing." 18 | unconfirmed: "You have to confirm your account before continuing." 19 | mailer: 20 | confirmation_instructions: 21 | subject: "Confirmation instructions" 22 | reset_password_instructions: 23 | subject: "Reset password instructions" 24 | unlock_instructions: 25 | subject: "Unlock Instructions" 26 | omniauth_callbacks: 27 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"." 28 | success: "Successfully authenticated from %{kind} account." 29 | passwords: 30 | 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." 31 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." 32 | 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." 33 | updated: "Your password was changed successfully. You are now signed in." 34 | updated_not_active: "Your password was changed successfully." 35 | registrations: 36 | destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon." 37 | signed_up: "Welcome! You have signed up successfully." 38 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." 39 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." 40 | 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." 41 | 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." 42 | updated: "You updated your account successfully." 43 | sessions: 44 | signed_in: "Signed in successfully." 45 | signed_out: "Signed out successfully." 46 | unlocks: 47 | send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes." 48 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes." 49 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 50 | errors: 51 | messages: 52 | already_confirmed: "was already confirmed, please try signing in" 53 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 54 | expired: "has expired, please request a new one" 55 | not_found: "not found" 56 | not_locked: "was not locked" 57 | not_saved: 58 | one: "1 error prohibited this %{resource} from being saved:" 59 | other: "%{count} errors prohibited this %{resource} from being saved:" 60 | -------------------------------------------------------------------------------- /config/initializers/simple_form.rb: -------------------------------------------------------------------------------- 1 | # Use this setup block to configure all options available in SimpleForm. 2 | SimpleForm.setup do |config| 3 | # Wrappers are used by the form builder to generate a 4 | # complete input. You can remove any component from the 5 | # wrapper, change the order or even add your own to the 6 | # stack. The options given below are used to wrap the 7 | # whole input. 8 | config.wrappers :default, class: :input, 9 | hint_class: :field_with_hint, error_class: :field_with_errors do |b| 10 | ## Extensions enabled by default 11 | # Any of these extensions can be disabled for a 12 | # given input by passing: `f.input EXTENSION_NAME => false`. 13 | # You can make any of these extensions optional by 14 | # renaming `b.use` to `b.optional`. 15 | 16 | # Determines whether to use HTML5 (:email, :url, ...) 17 | # and required attributes 18 | b.use :html5 19 | 20 | # Calculates placeholders automatically from I18n 21 | # You can also pass a string as f.input placeholder: "Placeholder" 22 | b.use :placeholder 23 | 24 | ## Optional extensions 25 | # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup` 26 | # to the input. If so, they will retrieve the values from the model 27 | # if any exists. If you want to enable the lookup for any of those 28 | # extensions by default, you can change `b.optional` to `b.use`. 29 | 30 | # Calculates maxlength from length validations for string inputs 31 | b.optional :maxlength 32 | 33 | # Calculates pattern from format validations for string inputs 34 | b.optional :pattern 35 | 36 | # Calculates min and max from length validations for numeric inputs 37 | b.optional :min_max 38 | 39 | # Calculates readonly automatically from readonly attributes 40 | b.optional :readonly 41 | 42 | ## Inputs 43 | b.use :label_input 44 | b.use :hint, wrap_with: { tag: :span, class: :hint } 45 | b.use :error, wrap_with: { tag: :span, class: :error } 46 | end 47 | 48 | # The default wrapper to be used by the FormBuilder. 49 | config.default_wrapper = :default 50 | 51 | # Define the way to render check boxes / radio buttons with labels. 52 | # Defaults to :nested for bootstrap config. 53 | # inline: input + label 54 | # nested: label > input 55 | config.boolean_style = :nested 56 | 57 | # Default class for buttons 58 | config.button_class = 'btn' 59 | 60 | # Method used to tidy up errors. Specify any Rails Array method. 61 | # :first lists the first message for each field. 62 | # Use :to_sentence to list all errors for each field. 63 | # config.error_method = :first 64 | 65 | # Default tag used for error notification helper. 66 | config.error_notification_tag = :div 67 | 68 | # CSS class to add for error notification helper. 69 | config.error_notification_class = 'alert alert-error' 70 | 71 | # ID to add for error notification helper. 72 | # config.error_notification_id = nil 73 | 74 | # Series of attempts to detect a default label method for collection. 75 | # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] 76 | 77 | # Series of attempts to detect a default value method for collection. 78 | # config.collection_value_methods = [ :id, :to_s ] 79 | 80 | # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. 81 | # config.collection_wrapper_tag = nil 82 | 83 | # You can define the class to use on all collection wrappers. Defaulting to none. 84 | # config.collection_wrapper_class = nil 85 | 86 | # You can wrap each item in a collection of radio/check boxes with a tag, 87 | # defaulting to :span. Please note that when using :boolean_style = :nested, 88 | # SimpleForm will force this option to be a label. 89 | # config.item_wrapper_tag = :span 90 | 91 | # You can define a class to use in all item wrappers. Defaulting to none. 92 | # config.item_wrapper_class = nil 93 | 94 | # How the label text should be generated altogether with the required text. 95 | # config.label_text = lambda { |label, required| "#{required} #{label}" } 96 | 97 | # You can define the class to use on all labels. Default is nil. 98 | config.label_class = 'control-label' 99 | 100 | # You can define the class to use on all forms. Default is simple_form. 101 | # config.form_class = :simple_form 102 | 103 | # You can define which elements should obtain additional classes 104 | # config.generate_additional_classes_for = [:wrapper, :label, :input] 105 | 106 | # Whether attributes are required by default (or not). Default is true. 107 | # config.required_by_default = true 108 | 109 | # Tell browsers whether to use the native HTML5 validations (novalidate form option). 110 | # These validations are enabled in SimpleForm's internal config but disabled by default 111 | # in this configuration, which is recommended due to some quirks from different browsers. 112 | # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, 113 | # change this configuration to true. 114 | config.browser_validations = false 115 | 116 | # Collection of methods to detect if a file type was given. 117 | # config.file_methods = [ :mounted_as, :file?, :public_filename ] 118 | 119 | # Custom mappings for input types. This should be a hash containing a regexp 120 | # to match as key, and the input type that will be used when the field name 121 | # matches the regexp as value. 122 | # config.input_mappings = { /count/ => :integer } 123 | 124 | # Custom wrappers for input types. This should be a hash containing an input 125 | # type as key and the wrapper that will be used for all inputs with specified type. 126 | # config.wrapper_mappings = { string: :prepend } 127 | 128 | # Default priority for time_zone inputs. 129 | # config.time_zone_priority = nil 130 | 131 | # Default priority for country inputs. 132 | # config.country_priority = nil 133 | 134 | # When false, do not use translations for labels. 135 | # config.translate_labels = true 136 | 137 | # Automatically discover new inputs in Rails' autoload path. 138 | # config.inputs_discovery = true 139 | 140 | # Cache SimpleForm inputs discovery 141 | # config.cache_discovery = !Rails.env.development? 142 | 143 | # Default class for inputs 144 | # config.input_class = nil 145 | end 146 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actionmailer (4.0.2) 5 | actionpack (= 4.0.2) 6 | mail (~> 2.5.4) 7 | actionpack (4.0.2) 8 | activesupport (= 4.0.2) 9 | builder (~> 3.1.0) 10 | erubis (~> 2.7.0) 11 | rack (~> 1.5.2) 12 | rack-test (~> 0.6.2) 13 | activemodel (4.0.2) 14 | activesupport (= 4.0.2) 15 | builder (~> 3.1.0) 16 | activerecord (4.0.2) 17 | activemodel (= 4.0.2) 18 | activerecord-deprecated_finders (~> 1.0.2) 19 | activesupport (= 4.0.2) 20 | arel (~> 4.0.0) 21 | activerecord-deprecated_finders (1.0.3) 22 | activesupport (4.0.2) 23 | i18n (~> 0.6, >= 0.6.4) 24 | minitest (~> 4.2) 25 | multi_json (~> 1.3) 26 | thread_safe (~> 0.1) 27 | tzinfo (~> 0.3.37) 28 | addressable (2.3.6) 29 | arel (4.0.2) 30 | bcrypt (3.1.7) 31 | better_errors (1.1.0) 32 | coderay (>= 1.0.0) 33 | erubis (>= 2.6.6) 34 | binding_of_caller (0.7.2) 35 | debug_inspector (>= 0.0.1) 36 | bootstrap-sass (3.1.1.1) 37 | sass (~> 3.2) 38 | builder (3.1.4) 39 | cancan (1.6.10) 40 | celluloid (0.15.2) 41 | timers (~> 1.1.0) 42 | celluloid-io (0.15.0) 43 | celluloid (>= 0.15.0) 44 | nio4r (>= 0.5.0) 45 | coderay (1.1.0) 46 | coffee-rails (4.0.1) 47 | coffee-script (>= 2.2.0) 48 | railties (>= 4.0.0, < 5.0) 49 | coffee-script (2.2.0) 50 | coffee-script-source 51 | execjs 52 | coffee-script-source (1.7.0) 53 | database_cleaner (1.0.1) 54 | debug_inspector (0.0.2) 55 | devise (3.2.4) 56 | bcrypt (~> 3.0) 57 | orm_adapter (~> 0.1) 58 | railties (>= 3.2.6, < 5) 59 | thread_safe (~> 0.1) 60 | warden (~> 1.2.3) 61 | diff-lcs (1.2.5) 62 | email_spec (1.5.0) 63 | launchy (~> 2.1) 64 | mail (~> 2.2) 65 | erubis (2.7.0) 66 | execjs (2.0.2) 67 | factory_girl (4.4.0) 68 | activesupport (>= 3.0.0) 69 | factory_girl_rails (4.4.1) 70 | factory_girl (~> 4.4.0) 71 | railties (>= 3.0.0) 72 | ffi (1.9.3) 73 | formatador (0.2.4) 74 | guard (2.6.0) 75 | formatador (>= 0.2.4) 76 | listen (~> 2.7) 77 | lumberjack (~> 1.0) 78 | pry (>= 0.9.12) 79 | thor (>= 0.18.1) 80 | guard-bundler (2.0.0) 81 | bundler (~> 1.0) 82 | guard (~> 2.2) 83 | guard-rails (0.5.0) 84 | guard (>= 2.0.0) 85 | guard-rspec (4.2.8) 86 | guard (~> 2.1) 87 | rspec (>= 2.14, < 4.0) 88 | haml (4.1.0.beta.1) 89 | tilt 90 | haml-rails (0.5.3) 91 | actionpack (>= 4.0.1) 92 | activesupport (>= 4.0.1) 93 | haml (>= 3.1, < 5.0) 94 | railties (>= 4.0.1) 95 | hike (1.2.3) 96 | hpricot (0.8.6) 97 | html2haml (1.0.1) 98 | erubis (~> 2.7.0) 99 | haml (>= 4.0.0.rc.1) 100 | hpricot (~> 0.8.6) 101 | ruby_parser (~> 3.1.1) 102 | hub (1.12.0) 103 | i18n (0.6.9) 104 | interception (0.5) 105 | jbuilder (1.5.3) 106 | activesupport (>= 3.0.0) 107 | multi_json (>= 1.2.0) 108 | jquery-rails (3.1.0) 109 | railties (>= 3.0, < 5.0) 110 | thor (>= 0.14, < 2.0) 111 | json (1.8.1) 112 | kgio (2.9.2) 113 | launchy (2.4.2) 114 | addressable (~> 2.3) 115 | listen (2.7.1) 116 | celluloid (>= 0.15.2) 117 | celluloid-io (>= 0.15.0) 118 | rb-fsevent (>= 0.9.3) 119 | rb-inotify (>= 0.9) 120 | lumberjack (1.0.5) 121 | mail (2.5.4) 122 | mime-types (~> 1.16) 123 | treetop (~> 1.4.8) 124 | method_source (0.8.2) 125 | mime-types (1.25.1) 126 | minitest (4.7.5) 127 | multi_json (1.9.2) 128 | nio4r (1.0.0) 129 | orm_adapter (0.5.0) 130 | pg (0.17.1) 131 | polyglot (0.3.4) 132 | pry (0.9.12.6) 133 | coderay (~> 1.0) 134 | method_source (~> 0.8) 135 | slop (~> 3.4) 136 | pry-rails (0.3.2) 137 | pry (>= 0.9.10) 138 | pry-rescue (1.4.1) 139 | interception (>= 0.5) 140 | pry 141 | quiet_assets (1.0.2) 142 | railties (>= 3.1, < 5.0) 143 | rack (1.5.2) 144 | rack-test (0.6.2) 145 | rack (>= 1.0) 146 | rails (4.0.2) 147 | actionmailer (= 4.0.2) 148 | actionpack (= 4.0.2) 149 | activerecord (= 4.0.2) 150 | activesupport (= 4.0.2) 151 | bundler (>= 1.3.0, < 2.0) 152 | railties (= 4.0.2) 153 | sprockets-rails (~> 2.0.0) 154 | rails_layout (1.0.14) 155 | railties (4.0.2) 156 | actionpack (= 4.0.2) 157 | activesupport (= 4.0.2) 158 | rake (>= 0.8.7) 159 | thor (>= 0.18.1, < 2.0) 160 | raindrops (0.13.0) 161 | rake (10.3.1) 162 | rb-fchange (0.0.6) 163 | ffi 164 | rb-fsevent (0.9.4) 165 | rb-inotify (0.9.3) 166 | ffi (>= 0.5.0) 167 | rolify (3.4.0) 168 | rspec (2.14.1) 169 | rspec-core (~> 2.14.0) 170 | rspec-expectations (~> 2.14.0) 171 | rspec-mocks (~> 2.14.0) 172 | rspec-core (2.14.8) 173 | rspec-expectations (2.14.5) 174 | diff-lcs (>= 1.1.3, < 2.0) 175 | rspec-mocks (2.14.6) 176 | rspec-rails (2.14.2) 177 | actionpack (>= 3.0) 178 | activemodel (>= 3.0) 179 | activesupport (>= 3.0) 180 | railties (>= 3.0) 181 | rspec-core (~> 2.14.0) 182 | rspec-expectations (~> 2.14.0) 183 | rspec-mocks (~> 2.14.0) 184 | ruby_parser (3.1.3) 185 | sexp_processor (~> 4.1) 186 | sass (3.2.19) 187 | sass-rails (4.0.3) 188 | railties (>= 4.0.0, < 5.0) 189 | sass (~> 3.2.0) 190 | sprockets (~> 2.8, <= 2.11.0) 191 | sprockets-rails (~> 2.0) 192 | sexp_processor (4.4.3) 193 | simple_form (3.0.2) 194 | actionpack (~> 4.0) 195 | activemodel (~> 4.0) 196 | slop (3.5.0) 197 | sprockets (2.11.0) 198 | hike (~> 1.2) 199 | multi_json (~> 1.0) 200 | rack (~> 1.0) 201 | tilt (~> 1.1, != 1.3.0) 202 | sprockets-rails (2.0.1) 203 | actionpack (>= 3.0) 204 | activesupport (>= 3.0) 205 | sprockets (~> 2.8) 206 | thor (0.19.1) 207 | thread_safe (0.3.3) 208 | tilt (1.4.1) 209 | timers (1.1.0) 210 | treetop (1.4.15) 211 | polyglot 212 | polyglot (>= 0.3.1) 213 | turbolinks (2.2.2) 214 | coffee-rails 215 | tzinfo (0.3.39) 216 | uglifier (2.5.0) 217 | execjs (>= 0.3.0) 218 | json (>= 1.8.0) 219 | unicorn (4.8.2) 220 | kgio (~> 2.6) 221 | rack 222 | raindrops (~> 0.7) 223 | unicorn-rails (2.0.0) 224 | rack 225 | unicorn 226 | warden (1.2.3) 227 | rack (>= 1.0) 228 | 229 | PLATFORMS 230 | ruby 231 | 232 | DEPENDENCIES 233 | better_errors 234 | binding_of_caller 235 | bootstrap-sass 236 | cancan 237 | coffee-rails (~> 4.0.0) 238 | database_cleaner (= 1.0.1) 239 | devise 240 | email_spec 241 | factory_girl_rails 242 | guard-bundler 243 | guard-rails 244 | guard-rspec 245 | haml-rails 246 | html2haml 247 | hub 248 | jbuilder (~> 1.2) 249 | jquery-rails 250 | pg 251 | pry-rails 252 | pry-rescue 253 | quiet_assets 254 | rails (= 4.0.2) 255 | rails_layout 256 | rb-fchange 257 | rb-fsevent 258 | rb-inotify 259 | rolify 260 | rspec-rails 261 | sass-rails (~> 4.0.0) 262 | simple_form 263 | turbolinks 264 | uglifier (>= 1.3.0) 265 | unicorn 266 | unicorn-rails 267 | -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # Use this hook to configure devise mailer, warden hooks and so forth. 2 | # Many of these configuration options can be set straight in your model. 3 | Devise.setup do |config| 4 | # The secret key used by Devise. Devise uses this key to generate 5 | # random tokens. Changing this key will render invalid all existing 6 | # confirmation, reset password and unlock tokens in the database. 7 | # config.secret_key = 'b77595832f474020a71677be5e636c7f617acba34aafba56195ccbc2fb6ae597a90c30f3ce564e15965aa3b6294d55dad7fcb2c1f9f8eae198c1d64c02589c89' 8 | 9 | # ==> Mailer Configuration 10 | # Configure the e-mail address which will be shown in Devise::Mailer, 11 | # note that it will be overwritten if you use your own mailer class 12 | # with default "from" parameter. 13 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' 14 | 15 | # Configure the class responsible to send e-mails. 16 | # config.mailer = 'Devise::Mailer' 17 | 18 | # ==> ORM configuration 19 | # Load and configure the ORM. Supports :active_record (default) and 20 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 21 | # available as additional gems. 22 | require 'devise/orm/active_record' 23 | 24 | # ==> Configuration for any authentication mechanism 25 | # Configure which keys are used when authenticating a user. The default is 26 | # just :email. You can configure it to use [:username, :subdomain], so for 27 | # authenticating a user, both parameters are required. Remember that those 28 | # parameters are used only when authenticating and not when retrieving from 29 | # session. If you need permissions, you should implement that in a before filter. 30 | # You can also supply a hash where the value is a boolean determining whether 31 | # or not authentication should be aborted when the value is not present. 32 | # config.authentication_keys = [ :email ] 33 | 34 | # Configure parameters from the request object used for authentication. Each entry 35 | # given should be a request method and it will automatically be passed to the 36 | # find_for_authentication method and considered in your model lookup. For instance, 37 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 38 | # The same considerations mentioned for authentication_keys also apply to request_keys. 39 | # config.request_keys = [] 40 | 41 | # Configure which authentication keys should be case-insensitive. 42 | # These keys will be downcased upon creating or modifying a user and when used 43 | # to authenticate or find a user. Default is :email. 44 | config.case_insensitive_keys = [ :email ] 45 | 46 | # Configure which authentication keys should have whitespace stripped. 47 | # These keys will have whitespace before and after removed upon creating or 48 | # modifying a user and when used to authenticate or find a user. Default is :email. 49 | config.strip_whitespace_keys = [ :email ] 50 | 51 | # Tell if authentication through request.params is enabled. True by default. 52 | # It can be set to an array that will enable params authentication only for the 53 | # given strategies, for example, `config.params_authenticatable = [:database]` will 54 | # enable it only for database (email + password) authentication. 55 | # config.params_authenticatable = true 56 | 57 | # Tell if authentication through HTTP Auth is enabled. False by default. 58 | # It can be set to an array that will enable http authentication only for the 59 | # given strategies, for example, `config.http_authenticatable = [:database]` will 60 | # enable it only for database authentication. The supported strategies are: 61 | # :database = Support basic authentication with authentication key + password 62 | # config.http_authenticatable = false 63 | 64 | # If http headers should be returned for AJAX requests. True by default. 65 | # config.http_authenticatable_on_xhr = true 66 | 67 | # The realm used in Http Basic Authentication. 'Application' by default. 68 | # config.http_authentication_realm = 'Application' 69 | 70 | # It will change confirmation, password recovery and other workflows 71 | # to behave the same regardless if the e-mail provided was right or wrong. 72 | # Does not affect registerable. 73 | # config.paranoid = true 74 | 75 | # By default Devise will store the user in session. You can skip storage for 76 | # particular strategies by setting this option. 77 | # Notice that if you are skipping storage for all authentication paths, you 78 | # may want to disable generating routes to Devise's sessions controller by 79 | # passing skip: :sessions to `devise_for` in your config/routes.rb 80 | config.skip_session_storage = [:http_auth] 81 | 82 | # By default, Devise cleans up the CSRF token on authentication to 83 | # avoid CSRF token fixation attacks. This means that, when using AJAX 84 | # requests for sign in and sign up, you need to get a new CSRF token 85 | # from the server. You can disable this option at your own risk. 86 | # config.clean_up_csrf_token_on_authentication = true 87 | 88 | # ==> Configuration for :database_authenticatable 89 | # For bcrypt, this is the cost for hashing the password and defaults to 10. If 90 | # using other encryptors, it sets how many times you want the password re-encrypted. 91 | # 92 | # Limiting the stretches to just one in testing will increase the performance of 93 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 94 | # a value less than 10 in other environments. Note that, for bcrypt (the default 95 | # encryptor), the cost increases exponentially with the number of stretches (e.g. 96 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 97 | config.stretches = Rails.env.test? ? 1 : 10 98 | 99 | # Setup a pepper to generate the encrypted password. 100 | # config.pepper = 'a7ec38c18f374488ae899e6b020c767fe99114ee9973eeb472bee8b8c373633da526e4f30be4ec90d74e5d6b9c279ad88d819a0cadaa1d7c17d7f370f5eec6e6' 101 | 102 | # ==> Configuration for :confirmable 103 | # A period that the user is allowed to access the website even without 104 | # confirming their account. For instance, if set to 2.days, the user will be 105 | # able to access the website for two days without confirming their account, 106 | # access will be blocked just in the third day. Default is 0.days, meaning 107 | # the user cannot access the website without confirming their account. 108 | # config.allow_unconfirmed_access_for = 2.days 109 | 110 | # A period that the user is allowed to confirm their account before their 111 | # token becomes invalid. For example, if set to 3.days, the user can confirm 112 | # their account within 3 days after the mail was sent, but on the fourth day 113 | # their account can't be confirmed with the token any more. 114 | # Default is nil, meaning there is no restriction on how long a user can take 115 | # before confirming their account. 116 | # config.confirm_within = 3.days 117 | 118 | # If true, requires any email changes to be confirmed (exactly the same way as 119 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 120 | # db field (see migrations). Until confirmed, new email is stored in 121 | # unconfirmed_email column, and copied to email column on successful confirmation. 122 | config.reconfirmable = true 123 | 124 | # Defines which key will be used when confirming an account 125 | # config.confirmation_keys = [ :email ] 126 | 127 | # ==> Configuration for :rememberable 128 | # The time the user will be remembered without asking for credentials again. 129 | # config.remember_for = 2.weeks 130 | 131 | # If true, extends the user's remember period when remembered via cookie. 132 | # config.extend_remember_period = false 133 | 134 | # Options to be passed to the created cookie. For instance, you can set 135 | # secure: true in order to force SSL only cookies. 136 | # config.rememberable_options = {} 137 | 138 | # ==> Configuration for :validatable 139 | # Range for password length. 140 | config.password_length = 8..128 141 | 142 | # Email regex used to validate email formats. It simply asserts that 143 | # one (and only one) @ exists in the given string. This is mainly 144 | # to give user feedback and not to assert the e-mail validity. 145 | # config.email_regexp = /\A[^@]+@[^@]+\z/ 146 | 147 | # ==> Configuration for :timeoutable 148 | # The time you want to timeout the user session without activity. After this 149 | # time the user will be asked for credentials again. Default is 30 minutes. 150 | # config.timeout_in = 30.minutes 151 | 152 | # If true, expires auth token on session timeout. 153 | # config.expire_auth_token_on_timeout = false 154 | 155 | # ==> Configuration for :lockable 156 | # Defines which strategy will be used to lock an account. 157 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 158 | # :none = No lock strategy. You should handle locking by yourself. 159 | # config.lock_strategy = :failed_attempts 160 | 161 | # Defines which key will be used when locking and unlocking an account 162 | # config.unlock_keys = [ :email ] 163 | 164 | # Defines which strategy will be used to unlock an account. 165 | # :email = Sends an unlock link to the user email 166 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 167 | # :both = Enables both strategies 168 | # :none = No unlock strategy. You should handle unlocking by yourself. 169 | # config.unlock_strategy = :both 170 | 171 | # Number of authentication tries before locking an account if lock_strategy 172 | # is failed attempts. 173 | # config.maximum_attempts = 20 174 | 175 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 176 | # config.unlock_in = 1.hour 177 | 178 | # Warn on the last attempt before the account is locked. 179 | # config.last_attempt_warning = false 180 | 181 | # ==> Configuration for :recoverable 182 | # 183 | # Defines which key will be used when recovering the password for an account 184 | # config.reset_password_keys = [ :email ] 185 | 186 | # Time interval you can reset your password with a reset password key. 187 | # Don't put a too small interval or your users won't have the time to 188 | # change their passwords. 189 | config.reset_password_within = 6.hours 190 | 191 | # ==> Configuration for :encryptable 192 | # Allow you to use another encryption algorithm besides bcrypt (default). You can use 193 | # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, 194 | # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) 195 | # and :restful_authentication_sha1 (then you should set stretches to 10, and copy 196 | # REST_AUTH_SITE_KEY to pepper). 197 | # 198 | # Require the `devise-encryptable` gem when using anything other than bcrypt 199 | # config.encryptor = :sha512 200 | 201 | # ==> Scopes configuration 202 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 203 | # "users/sessions/new". It's turned off by default because it's slower if you 204 | # are using only default views. 205 | # config.scoped_views = false 206 | 207 | # Configure the default scope given to Warden. By default it's the first 208 | # devise role declared in your routes (usually :user). 209 | # config.default_scope = :user 210 | 211 | # Set this configuration to false if you want /users/sign_out to sign out 212 | # only the current scope. By default, Devise signs out all scopes. 213 | # config.sign_out_all_scopes = true 214 | 215 | # ==> Navigation configuration 216 | # Lists the formats that should be treated as navigational. Formats like 217 | # :html, should redirect to the sign in page when the user does not have 218 | # access, but formats like :xml or :json, should return 401. 219 | # 220 | # If you have any extra navigational formats, like :iphone or :mobile, you 221 | # should add them to the navigational formats lists. 222 | # 223 | # The "*/*" below is required to match Internet Explorer requests. 224 | # config.navigational_formats = ['*/*', :html] 225 | 226 | # The default HTTP method used to sign out a resource. Default is :delete. 227 | config.sign_out_via = :delete 228 | 229 | # ==> OmniAuth 230 | # Add a new OmniAuth provider. Check the wiki for more information on setting 231 | # up on your models and hooks. 232 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 233 | 234 | # ==> Warden configuration 235 | # If you want to use other strategies, that are not supported by Devise, or 236 | # change the failure app, you can configure them inside the config.warden block. 237 | # 238 | # config.warden do |manager| 239 | # manager.intercept_401 = false 240 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 241 | # end 242 | 243 | # ==> Mountable engine configurations 244 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 245 | # is mountable, there are some extra configurations to be taken into account. 246 | # The following options are available, assuming the engine is mounted as: 247 | # 248 | # mount MyEngine, at: '/my_engine' 249 | # 250 | # The router that invoked `devise_for`, in the example above, would be: 251 | # config.router_name = :my_engine 252 | # 253 | # When using omniauth, Devise cannot automatically set Omniauth path, 254 | # so you need to do it manually. For the users scope, it would be: 255 | # config.omniauth_path_prefix = '/my_engine/users/auth' 256 | end 257 | --------------------------------------------------------------------------------