Skip to content

Commit a164d0e

Browse files
authored
update Rubocop and Travis config (#110)
Merge pull request 110
1 parent 7814bc6 commit a164d0e

File tree

12 files changed

+39
-11
lines changed

12 files changed

+39
-11
lines changed

.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
inherit_gem:
22
jekyll: .rubocop.yml
33

4+
Lint/ShadowingOuterLocalVariable:
5+
Exclude:
6+
- lib/jekyll-archives.rb
7+
48
Metrics/BlockLength:
59
Exclude:
610
- test/**/*.rb
711
Metrics/LineLength:
812
Exclude:
913
- test/**/*.rb
14+
- lib/jekyll-archives.rb
15+
- lib/jekyll-archives/archive.rb

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ sudo: false
66
before_install: gem update --system
77

88
rvm:
9-
- 2.3.3
10-
- 2.2.6
11-
- 2.1.9
9+
- 2.1
10+
- 2.2
11+
- 2.3
12+
- 2.4
1213

1314
env:
1415
- ""
@@ -18,5 +19,5 @@ env:
1819
matrix:
1920
include:
2021
- # GitHub Pages
21-
rvm: 2.3.3
22+
rvm: 2.4.0
2223
env: GH_PAGES=true

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source "https://rubygems.org"
24
gemspec
35

Rakefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# From jekyll/jekyll-mentions
24

35
require "rubygems"
@@ -6,8 +8,8 @@ require "bundler"
68
begin
79
Bundler.setup(:default, :development, :test)
810
rescue Bundler::BundlerError => e
9-
$stderr.puts e.message
10-
$stderr.puts "Run `bundle install` to install missing gems"
11+
warn e.message
12+
warn "Run `bundle install` to install missing gems"
1113
exit e.status_code
1214
end
1315

jekyll-archives.gemspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
lib = File.expand_path("lib", __dir__)
24
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
35
require "jekyll-archives/version"

lib/jekyll-archives.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "jekyll"
24

35
module Jekyll
@@ -81,7 +83,7 @@ def read_dates
8183
def enabled?(archive)
8284
@config["enabled"] == true || @config["enabled"] == "all" || if @config["enabled"].is_a? Array
8385
@config["enabled"].include? archive
84-
end
86+
end
8587
end
8688

8789
def tags
@@ -102,21 +104,21 @@ def years
102104
else
103105
@posts.each { |p| hash[p.date.strftime("%Y")] << p }
104106
end
105-
hash.values.each { |posts| posts.sort!.reverse! }
107+
hash.each_value { |posts| posts.sort!.reverse! }
106108
hash
107109
end
108110

109111
def months(year_posts)
110112
hash = Hash.new { |h, key| h[key] = [] }
111113
year_posts.each { |p| hash[p.date.strftime("%m")] << p }
112-
hash.values.each { |posts| posts.sort!.reverse! }
114+
hash.each_value { |posts| posts.sort!.reverse! }
113115
hash
114116
end
115117

116118
def days(month_posts)
117119
hash = Hash.new { |h, key| h[key] = [] }
118120
month_posts.each { |p| hash[p.date.strftime("%d")] << p }
119-
hash.values.each { |posts| posts.sort!.reverse! }
121+
hash.each_value { |posts| posts.sort!.reverse! }
120122
hash
121123
end
122124
end

lib/jekyll-archives/archive.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Jekyll
24
module Archives
35
class Archive < Jekyll::Page

lib/jekyll-archives/version.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Jekyll
24
module Archives
35
VERSION = "2.1.0".freeze

script/cibuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#! /bin/sh
22
set -e
33

4+
script/fmt
45
bundle exec rake test

script/fmt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#! /bin/sh
2+
set -e
3+
4+
bundle exec rubocop -S -D -E

0 commit comments

Comments
 (0)