Skip to content

Commit

Permalink
Fix Layout/SpaceInsideStringInterpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
dks17 committed Mar 25, 2018
1 parent ba24f73 commit f51c1a2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
9 changes: 0 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/devise_token_auth/controllers/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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={})
Expand Down
10 changes: 5 additions & 5 deletions lib/generators/devise_token_auth/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f51c1a2

Please sign in to comment.