diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5f644c5..338ba9e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,9 +1,9 @@ module ApplicationHelper def page_title(title) if title.present? - "#{title} - #{APP_CONFIG['page_title']}" + "#{title} - #{APP_CONFIG["page_title"]}" else - APP_CONFIG['page_title'] + APP_CONFIG["page_title"] end end end diff --git a/app/helpers/photos_helper.rb b/app/helpers/photos_helper.rb index 7fce6d2..1950b43 100644 --- a/app/helpers/photos_helper.rb +++ b/app/helpers/photos_helper.rb @@ -1,5 +1,5 @@ module PhotosHelper def link_to_photo(photo) - link_to '', photo.image.url, rel: 'photos', class: 'fancy', data: { id: photo.id } + link_to "", photo.image.url, rel: "photos", class: "fancy", data: { id: photo.id } end end diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index 53f097d..ad40afa 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -1,8 +1,8 @@ class Notifier < ActionMailer::Base - default from: 'enquiries@danbarberphoto.com' + default from: "enquiries@danbarberphoto.com" def contact_notification(sender) @sender = sender - mail(to: 'enquiries@danbarberphoto.com', from: sender.email, subject: sender.subject) + mail(to: "enquiries@danbarberphoto.com", from: sender.email, subject: sender.subject) end end diff --git a/config/application.rb b/config/application.rb index 9389a77..1968de7 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,6 @@ -require File.expand_path('../boot', __FILE__) +require File.expand_path("../boot", __FILE__) -require 'rails/all' +require "rails/all" if defined?(Bundler) # If you precompile assets before deploying to production, use this line @@ -27,10 +27,10 @@ module DanBarberPhoto # 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)' + # 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.load_path += Dir[Rails.root.join("my", "locales", "*.{rb,yml}").to_s] config.i18n.enforce_available_locales = true config.i18n.default_locale = :en @@ -46,7 +46,7 @@ module DanBarberPhoto config.assets.precompile += %w(favicon.ico fancybox/sprite.png fancybox/loading.gif fancybox/blank.gif fancybox/overlay.png) # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' + config.assets.version = "1.0" # Prefer SASS syntax for stylesheets config.sass.preferred_syntax = :sass @@ -54,7 +54,7 @@ module DanBarberPhoto # Configure factories config.generators do |g| g.test_framework :rspec, fixture: true - g.fixture_replacement :factory_girl, dir: 'spec/factories' + g.fixture_replacement :factory_girl, dir: "spec/factories" end end end diff --git a/config/boot.rb b/config/boot.rb index 4489e58..5ac12b9 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,6 +1,6 @@ -require 'rubygems' +require "rubygems" # Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require "bundler/setup" if File.exists?(ENV["BUNDLE_GEMFILE"]) diff --git a/config/environment.rb b/config/environment.rb index 9087dc3..7d17cb3 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the rails application -require File.expand_path('../application', __FILE__) +require File.expand_path("../application", __FILE__) # Initialize the rails application DanBarberPhoto::Application.initialize! diff --git a/config/environments/production.rb b/config/environments/production.rb index 146ab36..3fa6430 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -66,12 +66,12 @@ DanBarberPhoto::Application.configure do # Settings for Sendgrid Free on Heroku ActionMailer::Base.smtp_settings = { - address: 'smtp.sendgrid.net', - port: '587', + address: "smtp.sendgrid.net", + port: "587", authentication: :plain, - user_name: ENV['SENDGRID_USERNAME'], - password: ENV['SENDGRID_PASSWORD'], - domain: 'heroku.com' + user_name: ENV["SENDGRID_USERNAME"], + password: ENV["SENDGRID_PASSWORD"], + domain: "heroku.com" } ActionMailer::Base.delivery_method = :smtp diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 0874f2c..ac8af40 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,7 +1,7 @@ # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' +Rails.application.config.assets.version = "1.0" # Add additional assets to the asset load path # Rails.application.config.assets.paths << Emoji.images_path diff --git a/config/initializers/dragonfly.rb b/config/initializers/dragonfly.rb index 4f3c0dd..9a57b10 100644 --- a/config/initializers/dragonfly.rb +++ b/config/initializers/dragonfly.rb @@ -1,4 +1,4 @@ -require 'dragonfly' +require "dragonfly" # Configure Dragonfly.app.configure do @@ -11,33 +11,61 @@ Dragonfly.app.configure do if Rails.env.in?(%w(development production)) datastore :s3, - bucket_name: ENV['AWS_BUCKET'], - access_key_id: ENV['AWS_KEY'], - secret_access_key: ENV['AWS_SECRET'], - region: 'eu-west-1' + bucket_name: ENV["AWS_BUCKET"], + access_key_id: ENV["AWS_KEY"], + secret_access_key: ENV["AWS_SECRET"], + region: "eu-west-1" else datastore :file, - root_path: Rails.root.join('public/system/dragonfly', Rails.env), - server_root: Rails.root.join('public') + root_path: Rails.root.join("public/system/dragonfly", Rails.env), + server_root: Rails.root.join("public") end - processor :preview do |content| content.process! :thumb, '600x600' end + processor :preview do |content| + content.process! :thumb, "600x600" + end - processor :admin do |content| content.process! :thumb, '140x140#' end + processor :admin do |content| + content.process! :thumb, "140x140#" + end - processor :size17 do |content| content.process! :thumb, '476x476#' end - processor :size11 do |content| content.process! :thumb, '308x308#' end - processor :size8 do |content| content.process! :thumb, '224x224#' end - processor :size5 do |content| content.process! :thumb, '140x140#' end - processor :size3 do |content| content.process! :thumb, '84x84#' end - processor :size2 do |content| content.process! :thumb, '56x56#' end + processor :size17 do |content| + content.process! :thumb, "476x476#" + end + processor :size11 do |content| + content.process! :thumb, "308x308#" + end + processor :size8 do |content| + content.process! :thumb, "224x224#" + end + processor :size5 do |content| + content.process! :thumb, "140x140#" + end + processor :size3 do |content| + content.process! :thumb, "84x84#" + end + processor :size2 do |content| + content.process! :thumb, "56x56#" + end - processor :size17x2 do |content| content.process! :thumb, '952x952#' end - processor :size11x2 do |content| content.process! :thumb, '616x616#' end - processor :size8x2 do |content| content.process! :thumb, '448x448#' end - processor :size5x2 do |content| content.process! :thumb, '280x280#' end - processor :size3x2 do |content| content.process! :thumb, '168x168#' end - processor :size2x2 do |content| content.process! :thumb, '112x112#' end + processor :size17x2 do |content| + content.process! :thumb, "952x952#" + end + processor :size11x2 do |content| + content.process! :thumb, "616x616#" + end + processor :size8x2 do |content| + content.process! :thumb, "448x448#" + end + processor :size5x2 do |content| + content.process! :thumb, "280x280#" + end + processor :size3x2 do |content| + content.process! :thumb, "168x168#" + end + processor :size2x2 do |content| + content.process! :thumb, "112x112#" + end end # Logger diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 9e8b013..63baac3 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -3,8 +3,8 @@ # 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.plural /^(ox)$/i, "\1en" +# inflect.singular /^(ox)en/i, "\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 2eaad7f..5ad1bba 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -DanBarberPhoto::Application.config.session_store :cookie_store, key: '_danbarberphoto_session' +DanBarberPhoto::Application.config.session_store :cookie_store, key: "_danbarberphoto_session" # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index 6986de9..f53076d 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -55,7 +55,7 @@ SimpleForm.setup do |config| config.boolean_style = :nested # Default class for buttons - config.button_class = 'btn' + config.button_class = "btn" # Method used to tidy up errors. Specify any Rails Array method. # :first lists the first message for each field. @@ -66,7 +66,7 @@ SimpleForm.setup do |config| config.error_notification_tag = :div # CSS class to add for error notification helper. - config.error_notification_class = 'alert alert-error' + config.error_notification_class = "alert alert-error" # ID to add for error notification helper. # config.error_notification_id = nil @@ -95,7 +95,7 @@ SimpleForm.setup do |config| # config.label_text = lambda { |label, required| "#{required} #{label}" } # You can define the class to use on all labels. Default is nil. - config.label_class = 'control-label' + config.label_class = "control-label" # You can define the class to use on all forms. Default is simple_form. # config.form_class = :simple_form diff --git a/config/puma.rb b/config/puma.rb index 2e49738..acfe68f 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,18 +1,18 @@ -workers Integer(ENV['PUMA_WORKERS'] || 3) -threads Integer(ENV['MIN_THREADS'] || 1), Integer(ENV['MAX_THREADS'] || 16) +workers Integer(ENV["PUMA_WORKERS"] || 3) +threads Integer(ENV["MIN_THREADS"] || 1), Integer(ENV["MAX_THREADS"] || 16) preload_app! rackup DefaultRackup -port ENV['PORT'] || 3000 -environment ENV['RACK_ENV'] || 'development' +port ENV["PORT"] || 3000 +environment ENV["RACK_ENV"] || "development" on_worker_boot do # worker specific setup ActiveSupport.on_load(:active_record) do config = ActiveRecord::Base.configurations[Rails.env] || Rails.application.config.database_configuration[Rails.env] - config['pool'] = ENV['MAX_THREADS'] || 16 + config["pool"] = ENV["MAX_THREADS"] || 16 ActiveRecord::Base.establish_connection(config) end end diff --git a/db/migrate/20101006095457_create_photos.rb b/db/migrate/20101006095457_create_photos.rb index f1b02ac..da140d0 100644 --- a/db/migrate/20101006095457_create_photos.rb +++ b/db/migrate/20101006095457_create_photos.rb @@ -2,9 +2,9 @@ class CreatePhotos < ActiveRecord::Migration def self.up create_table :photos do |t| t.integer :category_id - + t.string :flickr_url - + t.string :photo_file_name t.string :photo_content_type t.integer :photo_file_size diff --git a/db/migrate/20101008101157_add_photo_to_category.rb b/db/migrate/20101008101157_add_photo_to_category.rb index 0bbb3cc..832daa4 100644 --- a/db/migrate/20101008101157_add_photo_to_category.rb +++ b/db/migrate/20101008101157_add_photo_to_category.rb @@ -1,9 +1,9 @@ class AddPhotoToCategory < ActiveRecord::Migration def self.up - add_column :categories, :photo_id, :integer + add_column :categories, :photo_id, :integer end def self.down - remove_column :categories, :photo_id + remove_column :categories, :photo_id end end diff --git a/db/migrate/20101008103053_add_details_to_photo.rb b/db/migrate/20101008103053_add_details_to_photo.rb index d68bba0..f8e44b1 100644 --- a/db/migrate/20101008103053_add_details_to_photo.rb +++ b/db/migrate/20101008103053_add_details_to_photo.rb @@ -1,11 +1,11 @@ class AddDetailsToPhoto < ActiveRecord::Migration def self.up - add_column :photos, :title, :string - add_column :photos, :description, :text + add_column :photos, :title, :string + add_column :photos, :description, :text end def self.down - remove_column :photos, :title - remove_column :photos, :description + remove_column :photos, :title + remove_column :photos, :description end end diff --git a/db/migrate/20101008122736_add_sort_orders.rb b/db/migrate/20101008122736_add_sort_orders.rb index 7b5325f..bab57e1 100644 --- a/db/migrate/20101008122736_add_sort_orders.rb +++ b/db/migrate/20101008122736_add_sort_orders.rb @@ -5,7 +5,7 @@ class AddSortOrders < ActiveRecord::Migration end def self.down - remove_column :photos, :sort - remove_column :categories, :sort + remove_column :photos, :sort + remove_column :categories, :sort end end diff --git a/db/migrate/20101011133558_create_admin_users.rb b/db/migrate/20101011133558_create_admin_users.rb index d436022..dc885ec 100644 --- a/db/migrate/20101011133558_create_admin_users.rb +++ b/db/migrate/20101011133558_create_admin_users.rb @@ -1,5 +1,4 @@ class CreateAdminUsers < ActiveRecord::Migration - def self.up create_table :admin_users do |t| t.string :first_name, default: "", null: false @@ -18,5 +17,4 @@ class CreateAdminUsers < ActiveRecord::Migration def self.down drop_table :admin_users end - end diff --git a/db/migrate/20101013165208_photo_showcase.rb b/db/migrate/20101013165208_photo_showcase.rb index ed30e2b..62ebf30 100644 --- a/db/migrate/20101013165208_photo_showcase.rb +++ b/db/migrate/20101013165208_photo_showcase.rb @@ -1,9 +1,9 @@ class PhotoShowcase < ActiveRecord::Migration def self.up - add_column :photos, :featured, :boolean, default: false + add_column :photos, :featured, :boolean, default: false end def self.down - remove_column :photos, :featured + remove_column :photos, :featured end end diff --git a/db/migrate/20101215172105_add_taken_date_to_photo.rb b/db/migrate/20101215172105_add_taken_date_to_photo.rb index 603d2cd..265132a 100644 --- a/db/migrate/20101215172105_add_taken_date_to_photo.rb +++ b/db/migrate/20101215172105_add_taken_date_to_photo.rb @@ -1,6 +1,6 @@ class AddTakenDateToPhoto < ActiveRecord::Migration def self.up - add_column :photos, :taken_at, :datetime + add_column :photos, :taken_at, :datetime end def self.down diff --git a/db/migrate/20111030164012_create_devise_admin_users.rb b/db/migrate/20111030164012_create_devise_admin_users.rb index e00f3e8..e8617d9 100644 --- a/db/migrate/20111030164012_create_devise_admin_users.rb +++ b/db/migrate/20111030164012_create_devise_admin_users.rb @@ -23,11 +23,11 @@ class CreateDeviseAdminUsers < ActiveRecord::Migration t.string :confirmation_token t.datetime :confirmed_at t.datetime :confirmation_sent_at - t.string :unconfirmed_email # Only if using reconfirmable + t.string :unconfirmed_email # 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.integer :failed_attempts, default: 0 + t.string :unlock_token t.datetime :locked_at t.timestamps diff --git a/db/migrate/20150827205816_add_index_to_categories_photos.rb b/db/migrate/20150827205816_add_index_to_categories_photos.rb index 1d36db8..3cd18c6 100644 --- a/db/migrate/20150827205816_add_index_to_categories_photos.rb +++ b/db/migrate/20150827205816_add_index_to_categories_photos.rb @@ -1,5 +1,5 @@ class AddIndexToCategoriesPhotos < ActiveRecord::Migration def change - add_index :categories_photos, [:category_id, :photo_id], unique: true + add_index :categories_photos, %i[category_id photo_id], unique: true end end diff --git a/db/migrate/20151022110802_remove_devise_admin_users.rb b/db/migrate/20151022110802_remove_devise_admin_users.rb index 5c392e0..1650e9e 100644 --- a/db/migrate/20151022110802_remove_devise_admin_users.rb +++ b/db/migrate/20151022110802_remove_devise_admin_users.rb @@ -27,11 +27,11 @@ class RemoveDeviseAdminUsers < ActiveRecord::Migration t.string :confirmation_token t.datetime :confirmed_at t.datetime :confirmation_sent_at - t.string :unconfirmed_email # Only if using reconfirmable + t.string :unconfirmed_email # 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.integer :failed_attempts, default: 0 + t.string :unlock_token t.datetime :locked_at t.timestamps diff --git a/db/seeds.rb b/db/seeds.rb index 4b46ca3..01d1163 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -3,5 +3,5 @@ # # Examples: # -# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) -# Mayor.create(name: 'Daley', city: cities.first) +# cities = City.create([{ name: "Chicago" }, { name: "Copenhagen" }]) +# Mayor.create(name: "Daley", city: cities.first) diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb index 9132346..e261113 100644 --- a/spec/models/contact_spec.rb +++ b/spec/models/contact_spec.rb @@ -5,8 +5,8 @@ describe Contact do it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_presence_of(:message) } - it { is_expected.to allow_value('test@test.com').for(:email) } - it { is_expected.not_to allow_value('test@test').for(:email) } + it { is_expected.to allow_value("test@test.com").for(:email) } + it { is_expected.not_to allow_value("test@test").for(:email) } let(:contact) { build(:contact) } end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 71dabae..da1a843 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,12 +1,12 @@ -# 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 'capybara/rspec' -require 'capybara/poltergeist' +# 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 "capybara/rspec" +require "capybara/poltergeist" # For code coverage -require 'simplecov' +require "simplecov" SimpleCov.start # Use Poltergeist @@ -14,7 +14,7 @@ Capybara.javascript_driver = :poltergeist # 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 } +Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } RSpec.configure do |config| # ## Mock Framework @@ -29,10 +29,10 @@ RSpec.configure do |config| config.include FactoryBot::Syntax::Methods config.include Ajax, type: :feature - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + # 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 + # 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 = false @@ -46,7 +46,7 @@ RSpec.configure do |config| # 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.order = "random" config.before(:suite) do DatabaseCleaner.clean_with(:truncation) diff --git a/spec/support/ajax.rb b/spec/support/ajax.rb index 87c0816..338c7f9 100644 --- a/spec/support/ajax.rb +++ b/spec/support/ajax.rb @@ -2,7 +2,7 @@ module Ajax def wait_for_ajax Timeout.timeout(Capybara.default_max_wait_time) do loop do - active = page.evaluate_script('jQuery.active') + active = page.evaluate_script("jQuery.active") break if active == 0 end end