Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add frozen_string_literal pragma to ruby files #1157

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'bundler/setup'
rescue LoadError
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/devise_token_auth/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
class ApplicationController < DeviseController
include DeviseTokenAuth::Concerns::SetUserByToken
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/devise_token_auth/concerns/resource_finder.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth::Concerns::ResourceFinder
extend ActiveSupport::Concern
include DeviseTokenAuth::Controllers::Helpers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth::Concerns::SetUserByToken
extend ActiveSupport::Concern
include DeviseTokenAuth::Concerns::ResourceFinder
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/devise_token_auth/confirmations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
class ConfirmationsController < DeviseTokenAuth::ApplicationController
def show
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
class OmniauthCallbacksController < DeviseTokenAuth::ApplicationController

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/devise_token_auth/passwords_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
class PasswordsController < DeviseTokenAuth::ApplicationController
before_action :set_user_by_token, :only => [:update]
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/devise_token_auth/registrations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
class RegistrationsController < DeviseTokenAuth::ApplicationController
before_action :set_user_by_token, only: [:destroy, :update]
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/devise_token_auth/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# see http://www.emilsoman.com/blog/2013/05/18/building-a-tested/
module DeviseTokenAuth
class SessionsController < DeviseTokenAuth::ApplicationController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
class TokenValidationsController < DeviseTokenAuth::ApplicationController
skip_before_action :assert_is_devise_resource!, :only => [:validate_token]
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/devise_token_auth/unlocks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
class UnlocksController < DeviseTokenAuth::ApplicationController
skip_after_action :update_auth_header, :only => [:create, :show]
Expand Down
2 changes: 2 additions & 0 deletions app/models/devise_token_auth/concerns/user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'bcrypt'

module DeviseTokenAuth::Concerns::User
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth::Concerns::UserOmniauthCallbacks
extend ActiveSupport::Concern

Expand Down
4 changes: 3 additions & 1 deletion app/validators/email_validator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class EmailValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
Expand All @@ -18,4 +20,4 @@ def email_invalid_message

message
end
end
end
2 changes: 2 additions & 0 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# 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|
Expand Down
2 changes: 2 additions & 0 deletions lib/devise_token_auth.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "devise"
require "devise_token_auth/engine"
require "devise_token_auth/controllers/helpers"
Expand Down
2 changes: 2 additions & 0 deletions lib/devise_token_auth/controllers/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
module Controllers
module Helpers
Expand Down
2 changes: 2 additions & 0 deletions lib/devise_token_auth/controllers/url_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
module Controllers
module UrlHelpers
Expand Down
2 changes: 2 additions & 0 deletions lib/devise_token_auth/engine.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'devise_token_auth/rails/routes'

module DeviseTokenAuth
Expand Down
2 changes: 2 additions & 0 deletions lib/devise_token_auth/errors.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
module Errors
class NoResourceDefinedError < StandardError ; end
Expand Down
2 changes: 2 additions & 0 deletions lib/devise_token_auth/rails/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionDispatch::Routing
class Mapper
def mount_devise_token_auth_for(resource, opts)
Expand Down
2 changes: 2 additions & 0 deletions lib/devise_token_auth/url.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth::Url

def self.generate(url, params = {})
Expand Down
2 changes: 2 additions & 0 deletions lib/devise_token_auth/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
VERSION = '0.1.43'
end
2 changes: 2 additions & 0 deletions lib/generators/devise_token_auth/install_generator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
class InstallGenerator < Rails::Generators::Base
include Rails::Generators::Migration
Expand Down
2 changes: 2 additions & 0 deletions lib/generators/devise_token_auth/install_views_generator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module DeviseTokenAuth
class InstallViewsGenerator < Rails::Generators::Base
source_root File.expand_path('../../../../app/views/devise/mailer', __FILE__)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

DeviseTokenAuth.setup do |config|
# By default the authorization headers will change after each request. The
# client is responsible for keeping track of the changing tokens. Change
Expand Down
1 change: 1 addition & 0 deletions lib/generators/devise_token_auth/templates/user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true

class <%= user_class %> < ActiveRecord::Base
# Include default devise modules. Others available are:
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/devise_token_auth_tasks.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# desc "Explaining what the task does"
# task :devise_token_auth do
# # Task goes here
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

class Custom::ConfirmationsControllerTest < ActionController::TestCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

class Custom::OmniauthCallbacksControllerTest < ActionDispatch::IntegrationTest
Expand Down
2 changes: 2 additions & 0 deletions test/controllers/custom/custom_passwords_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

class Custom::PasswordsControllerTest < ActionController::TestCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

class Custom::RegistrationsControllerTest < ActionDispatch::IntegrationTest
Expand Down
2 changes: 2 additions & 0 deletions test/controllers/custom/custom_sessions_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

class Custom::SessionsControllerTest < ActionController::TestCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

class Custom::TokenValidationsControllerTest < ActionDispatch::IntegrationTest
Expand Down
2 changes: 2 additions & 0 deletions test/controllers/demo_group_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
2 changes: 2 additions & 0 deletions test/controllers/demo_mang_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
2 changes: 2 additions & 0 deletions test/controllers/demo_user_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'
# was the web request successful?
# was the user redirected to the right page?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
2 changes: 2 additions & 0 deletions test/controllers/devise_token_auth/unlocks_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
2 changes: 2 additions & 0 deletions test/controllers/overrides/confirmations_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
2 changes: 2 additions & 0 deletions test/controllers/overrides/passwords_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
2 changes: 2 additions & 0 deletions test/controllers/overrides/registrations_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
2 changes: 2 additions & 0 deletions test/controllers/overrides/sessions_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test_helper'

# was the web request successful?
Expand Down
2 changes: 2 additions & 0 deletions test/dummy/Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# 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.

Expand Down
2 changes: 2 additions & 0 deletions test/dummy/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
include DeviseTokenAuth::Concerns::SetUserByToken

Expand Down
2 changes: 2 additions & 0 deletions test/dummy/app/controllers/auth_origin_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AuthOriginController < ApplicationController
def redirected
head :ok
Expand Down
2 changes: 2 additions & 0 deletions test/dummy/app/controllers/custom/confirmations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Custom::ConfirmationsController < DeviseTokenAuth::ConfirmationsController

def show
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Custom::OmniauthCallbacksController < DeviseTokenAuth::OmniauthCallbacksController
def omniauth_success
super do |resource|
Expand Down
2 changes: 2 additions & 0 deletions test/dummy/app/controllers/custom/passwords_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Custom::PasswordsController < DeviseTokenAuth::PasswordsController

def create
Expand Down
2 changes: 2 additions & 0 deletions test/dummy/app/controllers/custom/registrations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Custom::RegistrationsController < DeviseTokenAuth::RegistrationsController

def create
Expand Down
2 changes: 2 additions & 0 deletions test/dummy/app/controllers/custom/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Custom::SessionsController < DeviseTokenAuth::SessionsController

def create
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Custom::TokenValidationsController < DeviseTokenAuth::TokenValidationsController

def validate_token
Expand Down
2 changes: 2 additions & 0 deletions test/dummy/app/controllers/demo_group_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class DemoGroupController < ApplicationController
devise_token_auth_group :member, contains: [:user, :mang]
before_action :authenticate_member!
Expand Down
2 changes: 2 additions & 0 deletions test/dummy/app/controllers/demo_mang_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class DemoMangController < ApplicationController
before_action :authenticate_mang!

Expand Down
2 changes: 2 additions & 0 deletions test/dummy/app/controllers/demo_user_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class DemoUserController < ApplicationController
before_action :authenticate_user!

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Overrides
class ConfirmationsController < DeviseTokenAuth::ConfirmationsController
def show
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Overrides
class OmniauthCallbacksController < DeviseTokenAuth::OmniauthCallbacksController
DEFAULT_NICKNAME = "stimpy"
Expand Down
2 changes: 2 additions & 0 deletions test/dummy/app/controllers/overrides/passwords_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Overrides
class PasswordsController < DeviseTokenAuth::PasswordsController
OVERRIDE_PROOF = "(^^,)"
Expand Down
Loading