Skip to content

Commit

Permalink
rubocop: fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
ayastreb committed Jun 17, 2016
1 parent e9fed13 commit 8b57c5e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
1 change: 0 additions & 1 deletion .rubocop.yml
Expand Up @@ -4,7 +4,6 @@ AllCops:
Include:
- lib/**/*.rb
Exclude:
- lib/jekyll/collection.rb
- lib/jekyll/configuration.rb
- lib/jekyll/convertible.rb
- lib/jekyll/document.rb
Expand Down
34 changes: 22 additions & 12 deletions lib/jekyll/collection.rb
Expand Up @@ -57,18 +57,9 @@ def read
full_path = collection_dir(file_path)
next if File.directory?(full_path)
if Utils.has_yaml_header? full_path
doc = Jekyll::Document.new(full_path, { :site => site, :collection => self })
doc.read
if site.publisher.publish?(doc) || !write?
docs << doc
else
Jekyll.logger.debug "Skipped From Publishing:", doc.relative_path
end
read_docs(full_path)
else
relative_dir = Jekyll.sanitized_path(relative_directory,
File.dirname(file_path)).chomp("/.")
files << StaticFile.new(site, site.source, relative_dir,
File.basename(full_path), self)
read_files(file_path, full_path)
end
end
docs.sort!
Expand Down Expand Up @@ -164,7 +155,7 @@ def inspect
#
# Returns a sanitized version of the label.
def sanitize_label(label)
label.gsub(/[^a-z0-9_\-\.]/i, "")
label.gsub(%r![^a-z0-9_\-\.]!i, "")
end

# Produce a representation of this Collection for use in Liquid.
Expand Down Expand Up @@ -204,5 +195,24 @@ def extract_metadata
{}
end
end

private
def read_docs(full_path)
doc = Jekyll::Document.new(full_path, { :site => site, :collection => self })
doc.read
if site.publisher.publish?(doc) || !write?
docs << doc
else
Jekyll.logger.debug "Skipped From Publishing:", doc.relative_path
end
end

private
def read_files(file_path, full_path)
relative_dir = Jekyll.sanitized_path(relative_directory,
File.dirname(file_path)).chomp("/.")
files << StaticFile.new(site, site.source, relative_dir,
File.basename(full_path), self)
end
end
end

0 comments on commit 8b57c5e

Please sign in to comment.