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 rubocop to script/cibuild #44

Merged
merged 2 commits into from
May 3, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--color
--require spec_helper
--order random
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ Metrics/LineLength:
Exclude:
- spec/**/*
- jekyll-mentions.gemspec

Metrics/BlockLength:
Exclude:
- spec/**/*
18 changes: 0 additions & 18 deletions Rakefile

This file was deleted.

3 changes: 1 addition & 2 deletions jekyll-mentions.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Gem::Specification.new do |s|
s.add_dependency "html-pipeline", "~> 2.3"
s.add_dependency "activesupport", "~> 4.0"

s.add_development_dependency "rake"
s.add_development_dependency "rdoc"
s.add_development_dependency "rspec", "~> 3.0"
s.add_development_dependency "rubocop", "~> 0.48"
end
5 changes: 3 additions & 2 deletions lib/jekyll-mentions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def mentionify(doc)
doc.output = filter_with_mention(src).call(doc.output)[:output].to_s
end
end
# rubocop:enable Metrics/AbcSize

# Public: Create or fetch the filter for the given {{src}} base URL.
#
Expand All @@ -30,7 +31,7 @@ def mentionify(doc)
# Returns an HTML::Pipeline instance for the given base URL.
def filter_with_mention(src)
filters[src] ||= HTML::Pipeline.new([
HTML::Pipeline::MentionFilter
HTML::Pipeline::MentionFilter,
], { :base_url => src, :username_pattern => mention_username_pattern })
end

Expand Down Expand Up @@ -97,6 +98,6 @@ def default_mention_base
end
end

Jekyll::Hooks.register [:pages, :documents], :post_render do |doc|
Jekyll::Hooks.register %i[pages documents], :post_render do |doc|
Jekyll::Mentions.mentionify(doc) if Jekyll::Mentions.mentionable?(doc)
end
4 changes: 3 additions & 1 deletion script/cibuild
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#! /bin/sh

bundle exec rspec --color $@
bundle exec rspec
bundle exec rubocop -S -D
gem build jekyll-mentions.gemspec
6 changes: 2 additions & 4 deletions spec/mentions_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require "spec_helper"

RSpec.describe(Jekyll::Mentions) do
Jekyll.logger.log_level = :error

Expand All @@ -9,7 +7,7 @@
"skip_config_files" => false,
"collections" => { "docs" => { "output" => true } },
"source" => fixtures_dir,
"destination" => fixtures_dir("_site")
"destination" => fixtures_dir("_site"),
}))
end
let(:mentions) { described_class }
Expand Down Expand Up @@ -83,7 +81,7 @@ def para(content)
let(:mentions_src) { "http://mine.club" }
let(:config_overrides) do
{
"jekyll-mentions" => { "base_url" => mentions_src }
"jekyll-mentions" => { "base_url" => mentions_src },
}
end

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def fixtures_dir(*paths)
end

def find_by_title(docs, title)
docs.find { |d| d.title == title }
docs.find { |d| d.data["title"] == title }
end

# rspec-expectations config goes here. You can use an alternate
Expand Down