Skip to content

Commit

Permalink
using rubocop-config-umbrellio
Browse files Browse the repository at this point in the history
  • Loading branch information
JelF committed Jul 30, 2017
1 parent a7db3f7 commit aa27292
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 74 deletions.
6 changes: 3 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inherit_gem:
rubocop-config-umbrellio: lib/rubocop.yml

AllCops:
Exclude:
- bin/**/*
TargetRubyVersion: 2.3

Style/Documentation:
Enabled: false
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source "https://rubygems.org"

# Specify your gem's dependencies in lamian.gemspec
gemspec
30 changes: 15 additions & 15 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'yard'
require 'pathname'
require 'launchy'
require 'uri'
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop/rake_task"
require "yard"
require "pathname"
require "launchy"
require "uri"

ROOT = Pathname.new(__FILE__).join('..')
ROOT = Pathname.new(__FILE__).join("..")

RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new(:lint)

YARD::Rake::YardocTask.new(:doc) do |t|
t.files = Dir[ROOT.join('lib/**/*.rb')]
t.files = Dir[ROOT.join("lib/**/*.rb")]
t.options = %w[--private]
end

def open_in_browser(path)
Launchy.open(URI.join('file:///', path.to_s))
Launchy.open(URI.join("file:///", path.to_s))
end

namespace :doc do
desc 'open doc'
desc "open doc"
task open: :doc do
open_in_browser ROOT.join('doc/frames.html')
open_in_browser ROOT.join("doc/frames.html")
end

desc 'checks doc coverage'
desc "checks doc coverage"
task coverage: :doc do
# ideally you've already generated the database to .load it
# if not, have this task depend on the docs task.
Expand All @@ -39,10 +39,10 @@ namespace :doc do
end

next if objs.empty?
puts 'No documentation found for:'
puts "No documentation found for:"
objs.each { |x| puts "\t#{x}" }

raise '100% document coverage required'
raise "100% document coverage required"
end
end

Expand Down
42 changes: 21 additions & 21 deletions lamian.gemspec
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# coding: utf-8
# frozen_string_literal: true

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

Gem::Specification.new do |spec|
spec.name = 'lamian'
spec.name = "lamian"
spec.version = Lamian::VERSION
spec.authors = ['JelF']
spec.email = ['[email protected]']
spec.authors = ["JelF"]
spec.email = ["[email protected]"]

spec.summary = 'Add logs to your error messages'
spec.summary = "Add logs to your error messages"
spec.description =
'Add logs to your error messages, using exception_notifier or smth like it'
spec.homepage = 'https://github.com/JelF/lamian'
"Add logs to your error messages, using exception_notifier or smth like it"
spec.homepage = "https://github.com/JelF/lamian"

spec.files = Dir['lib/**/*']
spec.require_paths = ['lib']
spec.files = Dir["lib/**/*"]
spec.require_paths = ["lib"]

spec.add_dependency 'rails', '>= 4.2'
spec.add_dependency 'exception_notification'
spec.add_dependency "rails", ">= 4.2"
spec.add_dependency "exception_notification"

spec.add_development_dependency 'bundler', '~> 1.12'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rubocop', '~> 0.49'
spec.add_development_dependency 'pry', '~> 0.10'
spec.add_development_dependency 'coveralls', '~> 0.8'
spec.add_development_dependency 'yard', '~> 0.9'
spec.add_development_dependency 'launchy', '~> 2.4.3'
spec.add_development_dependency 'json', '>= 2.1.0'
spec.add_development_dependency "bundler", "~> 1.12"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rubocop-config-umbrellio", "= 0.49.1.4"
spec.add_development_dependency "pry", "~> 0.10"
spec.add_development_dependency "coveralls", "~> 0.8"
spec.add_development_dependency "yard", "~> 0.9"
spec.add_development_dependency "launchy", "~> 2.4.3"
spec.add_development_dependency "json", ">= 2.1.0"
end
12 changes: 6 additions & 6 deletions lib/lamian.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
# It is designed to work in pair with `exception_notification` gem inside
# rails aplications
module Lamian
autoload :VERSION, 'lamian/version'
autoload :Config, 'lamian/config'
autoload :Logger, 'lamian/logger'
autoload :LoggerExtension, 'lamian/logger_extension'
autoload :Middleware, 'lamian/middleware'
autoload :VERSION, "lamian/version"
autoload :Config, "lamian/config"
autoload :Logger, "lamian/logger"
autoload :LoggerExtension, "lamian/logger_extension"
autoload :Middleware, "lamian/middleware"

require 'lamian/engine'
require "lamian/engine"

class << self
# Yields curent configuration if block given
Expand Down
2 changes: 1 addition & 1 deletion lib/lamian/config.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'logger'
require "logger"

module Lamian
# General lamian configuration class
Expand Down
10 changes: 5 additions & 5 deletions lib/lamian/engine.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require 'rails'
require 'exception_notification'
require 'exception_notification/rails'
require "rails"
require "exception_notification"
require "exception_notification/rails"

module Lamian
# Rails engine, which injects middleware and appends
Expand All @@ -12,9 +12,9 @@ module Lamian
class Engine < ::Rails::Engine
config.app_middleware.insert_before(
ExceptionNotification::Rack,
::Lamian::Middleware
::Lamian::Middleware,
)

paths['app/views'] << 'lib/lamian/rails_views'
paths["app/views"] << "lib/lamian/rails_views"
end
end
4 changes: 2 additions & 2 deletions lib/lamian/logger.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'logger'
require "logger"

module Lamian
# @api private
Expand Down Expand Up @@ -69,7 +69,7 @@ def dump(format: nil)
def apply_format!(format, string)
return unless format
return unless string
string.gsub!(/\[\d{1,2}m/, '')
string.gsub!(/\[\d{1,2}m/, "")
end

# Pushes new logdev in the start of #run call
Expand Down
2 changes: 1 addition & 1 deletion lib/lamian/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ module Lamian
# According to this, it is enought to specify '~> a.b'
# if private API was not used and to specify '~> a.b.c' if it was

VERSION = '1.0.0alpha'
VERSION = "1.0.0alpha"
end
8 changes: 4 additions & 4 deletions spec/lamian/logger_spec.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# frozen_string_literal: true

describe Lamian::Logger do
describe '#dump', :cool_loggers do
specify 'with #run' do
describe "#dump", :cool_loggers do
specify "with #run" do
Lamian.run do
generic_logger.info "it's alive"
expect(Lamian.dump).to eq "it's alive\n"
expect(Lamian.dump).to eq "it's alive\n"
end
end

it 'supports #log' do
it "supports #log" do
Lamian.run do
generic_logger.log 0, "it's alive"
expect(Lamian.dump).to eq "it's alive\n"
end
end

specify 'without #run' do
specify "without #run" do
generic_logger.info "it's alive"
expect { Lamian.dump }.not_to raise_error
expect(Lamian.dump).to be_nil
Expand Down
6 changes: 3 additions & 3 deletions spec/lamian/middleware_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
let(:app) { double(:app) }
let(:env) { double(:env) }

it 'behaves like middleware' do
it "behaves like middleware" do
expect(app).to receive(:call).with(env)
described_class.new(app).call(env)
end

it 'starts lamian for app', :cool_loggers do
it "starts lamian for app", :cool_loggers do
expect(app).to receive(:call) do
generic_logger.info 'test'
generic_logger.info "test"
expect(Lamian.dump).to eq "test\n"
end

Expand Down
6 changes: 3 additions & 3 deletions spec/lamian_spec.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# frozen_string_literal: true

describe Lamian do
it 'has a version number' do
it "has a version number" do
expect(Lamian::VERSION).not_to be nil
end

specify '.dump', :cool_loggers do
specify ".dump", :cool_loggers do
Lamian.run do
generic_logger.info '[23mNice, lol[0m'
generic_logger.info "[23mNice, lol[0m"
expect(Lamian.dump).to eq "[23mNice, lol[0m\n"
expect(Lamian.dump(format: :text)).to eq "Nice, lol\n"
end
Expand Down
18 changes: 9 additions & 9 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# frozen_string_literal: true

require 'bundler/setup'
require 'logger'
require 'pry'
require "bundler/setup"
require "logger"
require "pry"

require 'coveralls'
require "coveralls"
Coveralls.wear!

require 'lamian'
require "lamian"

shared_context 'cool loggers', :cool_loggers do
shared_context "cool loggers", :cool_loggers do
let(:generic_logger_buffer) { StringIO.new }
let(:generic_logger) { Logger.new(generic_logger_buffer) }

let(:cool_formatter) do
->(_severity, _date, _progname, message) { "#{message}\n" }
-> (_severity, _date, _progname, message) { "#{message}\n" }
end

before('extend generic_logger') { Lamian.extend_logger(generic_logger) }
before("extend generic_logger") { Lamian.extend_logger(generic_logger) }

before('stub formatter') do
before("stub formatter") do
allow(Lamian.config).to receive(:formatter).and_return(cool_formatter)
generic_logger.formatter = cool_formatter
end
Expand Down

0 comments on commit aa27292

Please sign in to comment.