Skip to content

Commit

Permalink
code style updates
Browse files Browse the repository at this point in the history
  • Loading branch information
0exp committed May 31, 2019
1 parent 67e9fe0 commit df78b8a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
20 changes: 10 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop'
require 'rubocop-rspec'
require 'rubocop-performance'
require 'rubocop/rake_task'
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop"
require "rubocop-rspec"
require "rubocop-performance"
require "rubocop/rake_task"

RuboCop::RakeTask.new(:rubocop) do |t|
config_path = File.expand_path(File.join('.rubocop.yml'), __dir__)
config_path = File.expand_path(File.join(".rubocop.yml"), __dir__)

t.options = ['--config', config_path]
t.requires << 'rubocop-rspec'
t.requires << 'rubocop-performance'
t.options = ["--config", config_path]
t.requires << "rubocop-rspec"
t.requires << "rubocop-performance"
end

RSpec::Core::RakeTask.new(:rspec)
Expand Down
2 changes: 1 addition & 1 deletion hourly_logger_rotator.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

lib = File.expand_path("../lib", __FILE__)
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "hourly_logger_rotator/version"

Expand Down
11 changes: 6 additions & 5 deletions lib/hourly_logger_rotator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ def hourly_mixin
return @mixin if defined?(@mixin)

mixin_name = "HourlyLoggerRotator::Patch::Ruby_#{RUBY_VERSION.split('.').first(2).join('_')}"
@mixin = begin
Module.const_get(mixin_name)
rescue NameError
nil
end
@mixin =
begin
Module.const_get(mixin_name)
rescue NameError
nil
end
end

def unsupported_warning
Expand Down
2 changes: 1 addition & 1 deletion spec/supported_versions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
HourlyLoggerRotator.default_rotation_period = "hourly"
Timecop.freeze("2000.01.01 12:30")

log_dir = Pathname.new(File.expand_path("../../log", __FILE__))
log_dir = Pathname.new(File.expand_path("../log", __dir__))
Dir.mkdir(log_dir) unless File.exist?(log_dir)
system("rm #{log_dir}/test_hourly_rotation.log* 2> /dev/null")

Expand Down

0 comments on commit df78b8a

Please sign in to comment.