diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 910c70613..ba2e44d10 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -223,15 +223,6 @@ Layout/SpaceInsideBlockBraces: - 'test/lib/generators/devise_token_auth/install_generator_test.rb' -# Offense count: 5 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: space, no_space -Layout/SpaceInsideStringInterpolation: - Exclude: - - 'lib/devise_token_auth/controllers/helpers.rb' - - 'lib/generators/devise_token_auth/install_generator.rb' - # Offense count: 4 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. diff --git a/lib/devise_token_auth/controllers/helpers.rb b/lib/devise_token_auth/controllers/helpers.rb index 3f96880e1..3cc61801b 100644 --- a/lib/devise_token_auth/controllers/helpers.rb +++ b/lib/devise_token_auth/controllers/helpers.rb @@ -27,7 +27,7 @@ module ClassMethods # current_blogger :user # Preferably returns a User if one is signed in # def devise_token_auth_group(group_name, opts={}) - mappings = "[#{ opts[:contains].map { |m| ":#{m}" }.join(',') }]" + mappings = "[#{opts[:contains].map { |m| ":#{m}" }.join(',')}]" class_eval <<-METHODS, __FILE__, __LINE__ + 1 def authenticate_#{group_name}!(favourite=nil, opts={}) diff --git a/lib/generators/devise_token_auth/install_generator.rb b/lib/generators/devise_token_auth/install_generator.rb index 878f1062d..73ec06e1f 100644 --- a/lib/generators/devise_token_auth/install_generator.rb +++ b/lib/generators/devise_token_auth/install_generator.rb @@ -12,24 +12,24 @@ def create_initializer_file end def copy_migrations - if self.class.migration_exists?('db/migrate', "devise_token_auth_create_#{ user_class.underscore }") - say_status('skipped', "Migration 'devise_token_auth_create_#{ user_class.underscore }' already exists") + if self.class.migration_exists?('db/migrate', "devise_token_auth_create_#{user_class.underscore}") + say_status('skipped', "Migration 'devise_token_auth_create_#{user_class.underscore}' already exists") else migration_template( 'devise_token_auth_create_users.rb.erb', - "db/migrate/devise_token_auth_create_#{ user_class.pluralize.underscore }.rb" + "db/migrate/devise_token_auth_create_#{user_class.pluralize.underscore}.rb" ) end end def create_user_model - fname = "app/models/#{ user_class.underscore }.rb" + fname = "app/models/#{user_class.underscore}.rb" unless File.exist?(File.join(destination_root, fname)) template('user.rb.erb', fname) else inclusion = 'include DeviseTokenAuth::Concerns::User' unless parse_file_for_line(fname, inclusion) - + active_record_needle = (Rails::VERSION::MAJOR == 5) ? 'ApplicationRecord' : 'ActiveRecord::Base' inject_into_file fname, after: "class #{user_class} < #{active_record_needle}\n" do <<-'RUBY' # Include default devise modules.