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

Use default Rake tasks and scripts #55

Merged
merged 3 commits into from
Feb 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/vendor/gems
.bundle
bin
/*.gem
Gemfile.lock
/tmp
/vendor/gems
bin
Gemfile.lock
pkg/*.gem
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
inherit_gem:
jekyll: .rubocop.yml

AllCops:
TargetRubyVersion: 2.2
Exclude:
- vendor/**/*

Metrics/LineLength:
Exclude:
- spec/**/*
Expand Down
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

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

task :default => :spec
3 changes: 2 additions & 1 deletion jekyll-mentions.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ Gem::Specification.new do |s|

s.homepage = "https://github.com/jekyll/jekyll-mentions"
s.licenses = ["MIT"]
s.files = [ "lib/jekyll-mentions.rb" ]
s.files = ["lib/jekyll-mentions.rb"]

s.add_dependency "activesupport", "~> 4.0"
s.add_dependency "html-pipeline", "~> 2.3"
s.add_dependency "jekyll", "~> 3.0"

s.add_development_dependency "rake", "~> 12.0"
s.add_development_dependency "rspec", "~> 3.0"
s.add_development_dependency "rubocop", "0.51"
end
2 changes: 1 addition & 1 deletion lib/jekyll-mentions/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module JekyllMentions
VERSION = "1.2.0"
VERSION = "1.2.0".freeze
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be necessary because of frozen_string_literal: true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but Rubcop complains for older Rubies and we don't want to target Ruby 2.3+ for now 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let's ignore this cop. This is nonsensical.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's what Jekyll does, so 🤷‍♂️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, we should fix that in Jekyll's config.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By adding an explicit freeze call, the constant is guaranteed frozen on all supported Rubies instead of just 2.3+.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So let’s drop the magic comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) why is this bothering you so much..?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m grumpy 😜
You’re right; it doesn’t matter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry @pathawks , I promise we'll get rid of all those useless .freeze at the end of march when we stop supporting EOL rubies :)

end
8 changes: 5 additions & 3 deletions script/cibuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#! /bin/sh

bundle exec rspec
bundle exec rubocop -S -D
gem build jekyll-mentions.gemspec
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not want to test that dependencies resolve and that the Gem builds?

Copy link
Member

@DirtyF DirtyF Feb 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do, default bundler rake task bundle exec rake build should take care of that.

set -e

script/test
script/fmt
bundle exec rake build
10 changes: 10 additions & 0 deletions script/fmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

echo "Rubocop $(bundle exec rubocop --version)"
bundle exec rubocop -D -E $@
success=$?
if ((success != 0)); then
echo -e "\nTry running \`script/fmt -a\` to automatically fix errors"
fi
exit $success
7 changes: 7 additions & 0 deletions script/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
# Tag and push a release.

set -e

script/cibuild
bundle exec rake release
4 changes: 4 additions & 0 deletions script/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -ex

bundle exec rspec "$@"
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require File.expand_path("../lib/jekyll-mentions.rb", __dir__)

RSpec.configure do |config|
Expand Down