Skip to content

Commit 708ab60

Browse files
DirtyFjekyllbot
authored andcommitted
Inherit Jekyll's rubocop config for consistency (#52)
Merge pull request 52
1 parent 5df72c5 commit 708ab60

22 files changed

+260
-247
lines changed

.rubocop.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
inherit_gem:
2+
jekyll: .rubocop.yml
3+
4+
Metrics/LineLength:
5+
Exclude:
6+
- spec/**/*
7+
- jekyll-compose.gemspec
8+
9+
Metrics/BlockLength:
10+
Exclude:
11+
- spec/**/*
12+
13+
Style/IndentHeredoc:
14+
Exclude:
15+
- spec/**/*

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source 'https://rubygems.org'
1+
source "https://rubygems.org"
22
gemspec
33

44
gem "jekyll", ENV["JEKYLL_VERSION"] ? "~> #{ENV["JEKYLL_VERSION"]}" : ">= 2.5.0"

jekyll-compose.gemspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# coding: utf-8
22
lib = File.expand_path('lib', __dir__)
33
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4-
require 'jekyll-compose/version'
4+
require "jekyll-compose/version"
55

66
Gem::Specification.new do |spec|
77
spec.name = "jekyll-compose"
88
spec.version = Jekyll::Compose::VERSION
99
spec.authors = ["Parker Moore"]
1010
spec.email = ["[email protected]"]
11-
spec.summary = %q{Streamline your writing in Jekyll with these commands.}
12-
spec.description = %q{Streamline your writing in Jekyll with these commands.}
11+
spec.summary = "Streamline your writing in Jekyll with these commands."
12+
spec.description = "Streamline your writing in Jekyll with these commands."
1313
spec.homepage = "https://github.com/jekyll/jekyll-compose"
1414
spec.license = "MIT"
1515

16-
spec.files = `git ls-files -z`.split("\x0").grep(%r{(bin|lib)/})
17-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16+
spec.files = `git ls-files -z`.split("\x0").grep(%r!(bin|lib)/!)
17+
spec.executables = spec.files.grep(%r!^bin/!) { |f| File.basename(f) }
1818
spec.require_paths = ["lib"]
1919

2020
spec.add_dependency "jekyll", ">= 3.0.0"

lib/jekyll-compose.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
module Jekyll
99
module Compose
10-
DEFAULT_TYPE = "md"
11-
DEFAULT_LAYOUT = "post"
12-
DEFAULT_LAYOUT_PAGE = "page"
10+
DEFAULT_TYPE = "md".freeze
11+
DEFAULT_LAYOUT = "post".freeze
12+
DEFAULT_LAYOUT_PAGE = "page".freeze
1313
end
1414
end
1515

lib/jekyll-compose/arg_parser.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def initialize(args, options)
77
end
88

99
def validate!
10-
raise ArgumentError.new('You must specify a name.') if args.empty?
10+
raise ArgumentError, "You must specify a name." if args.empty?
1111
end
1212

1313
def type
@@ -19,14 +19,14 @@ def layout
1919
end
2020

2121
def title
22-
args.join ' '
22+
args.join " "
2323
end
2424

2525
def force?
2626
!!options["force"]
2727
end
2828

2929
def source
30-
config['source'].gsub(/^#{Regexp.quote(Dir.pwd)}/, '')
30+
config["source"].gsub(%r!^#{Regexp.quote(Dir.pwd)}!, "")
3131
end
3232
end

lib/jekyll-compose/file_creator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def create!
1717
private
1818

1919
def validate_should_write!
20-
raise ArgumentError.new("A #{file.resource_type} already exists at #{file_path}") if File.exist?(file_path) and !force
20+
raise ArgumentError, "A #{file.resource_type} already exists at #{file_path}" if File.exist?(file_path) && !force
2121
end
2222

2323
def ensure_directory_exists
@@ -34,7 +34,7 @@ def write_file
3434
end
3535

3636
def file_path
37-
return file.path if root.nil? or root.empty?
37+
return file.path if root.nil? || root.empty?
3838
return File.join(root, file.path)
3939
end
4040
end

lib/jekyll-compose/file_info.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def file_name
1111

1212
def content
1313
front_matter = YAML.dump({
14-
'layout' => params.layout,
15-
'title' => params.title,
14+
"layout" => params.layout,
15+
"title" => params.title,
1616
})
1717

1818
front_matter + "---\n"

lib/jekyll-compose/file_mover.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def initialize(movement, root = nil)
88
end
99

1010
def resource_type
11-
'file'
11+
"file"
1212
end
1313

1414
def move
@@ -18,7 +18,7 @@ def move
1818
end
1919

2020
def validate_source
21-
raise ArgumentError.new("There was no #{resource_type} found at '#{from}'.") unless File.exist? from
21+
raise ArgumentError, "There was no #{resource_type} found at '#{from}'." unless File.exist? from
2222
end
2323

2424
def ensure_directory_exists
@@ -41,7 +41,7 @@ def to
4141
end
4242

4343
def file_path(path)
44-
return path if root.nil? or root.empty?
44+
return path if root.nil? || root.empty?
4545
return File.join(root, path)
4646
end
4747
end

lib/jekyll-compose/movement_arg_parser.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ def initialize(args, options)
99
end
1010

1111
def validate!
12-
raise ArgumentError.new("You must specify a #{resource_type} path.") if args.empty?
12+
raise ArgumentError, "You must specify a #{resource_type} path." if args.empty?
1313
end
1414

1515
def path
16-
args.join ' '
16+
args.join " "
1717
end
1818

1919
def source
20-
source = config['source'].gsub(/^#{Regexp.quote(Dir.pwd)}/, '')
20+
source = config["source"].gsub(%r!^#{Regexp.quote(Dir.pwd)}!, "")
2121
end
2222
end
2323
end

lib/jekyll-compose/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Jekyll
22
module Compose
3-
VERSION = "0.5.0"
3+
VERSION = "0.5.0".freeze
44
end
55
end

0 commit comments

Comments
 (0)