Merge pull request #5765 from jekyll/bump-rubocop

Merge pull request 5765
This commit is contained in:
jekyllbot 2017-01-15 03:47:05 -05:00 committed by GitHub
commit 057365a578
6 changed files with 21 additions and 18 deletions

View File

@ -22,6 +22,8 @@ Metrics/BlockLength:
Exclude: Exclude:
- test/**/*.rb - test/**/*.rb
- lib/jekyll/configuration.rb - lib/jekyll/configuration.rb
- rake/*.rake
- jekyll.gemspec
Metrics/ClassLength: Metrics/ClassLength:
Exclude: Exclude:
- !ruby/regexp /features\/.*.rb$/ - !ruby/regexp /features\/.*.rb$/
@ -32,6 +34,8 @@ Metrics/CyclomaticComplexity:
Metrics/LineLength: Metrics/LineLength:
Exclude: Exclude:
- !ruby/regexp /features\/.*.rb/ - !ruby/regexp /features\/.*.rb/
- Rakefile
- rake/*.rake
Max: 90 Max: 90
Severity: warning Severity: warning
Metrics/MethodLength: Metrics/MethodLength:

View File

@ -25,7 +25,7 @@ group :test do
gem "nokogiri" gem "nokogiri"
gem "rspec" gem "rspec"
gem "rspec-mocks" gem "rspec-mocks"
gem "rubocop", "~> 0.44.1" gem "rubocop", "~> 0.46"
gem "test-theme", :path => File.expand_path("./test/fixtures/test-theme", File.dirname(__FILE__)) gem "test-theme", :path => File.expand_path("./test/fixtures/test-theme", File.dirname(__FILE__))
gem "jruby-openssl" if RUBY_ENGINE == "jruby" gem "jruby-openssl" if RUBY_ENGINE == "jruby"

View File

@ -7,7 +7,7 @@
namespace :docs do namespace :docs do
desc "Release #{docs_name} v#{version}" desc "Release #{docs_name} v#{version}"
task :release => :build do task :release => :build do
unless `git branch` =~ /^\* master$/ unless `git branch` =~ %r!^\* master$!
puts "You must be on the master branch to release!" puts "You must be on the master branch to release!"
exit! exit!
end end

View File

@ -6,7 +6,7 @@
desc "Release #{name} v#{version}" desc "Release #{name} v#{version}"
task :release => :build do task :release => :build do
unless `git branch` =~ /^\* master$/ unless `git branch` =~ %r!^\* master$!
puts "You must be on the master branch to release!" puts "You must be on the master branch to release!"
exit! exit!
end end

View File

@ -13,7 +13,7 @@ namespace :site do
require "jekyll" require "jekyll"
browser_launched = false browser_launched = false
Jekyll::Hooks.register :site, :post_write do |site| Jekyll::Hooks.register :site, :post_write do |_site|
next if browser_launched next if browser_launched
browser_launched = true browser_launched = true
Jekyll.logger.info "Opening in browser..." Jekyll.logger.info "Opening in browser..."
@ -26,7 +26,7 @@ namespace :site do
"source" => File.expand_path(docs_folder), "source" => File.expand_path(docs_folder),
"destination" => File.expand_path("#{docs_folder}/_site"), "destination" => File.expand_path("#{docs_folder}/_site"),
"watch" => true, "watch" => true,
"serving" => true "serving" => true,
} }
Jekyll::Commands::Build.process(options) Jekyll::Commands::Build.process(options)
Jekyll::Commands::Serve.process(options) Jekyll::Commands::Serve.process(options)
@ -38,7 +38,7 @@ namespace :site do
Jekyll::Commands::Build.process({ Jekyll::Commands::Build.process({
"profile" => true, "profile" => true,
"source" => File.expand_path(docs_folder), "source" => File.expand_path(docs_folder),
"destination" => File.expand_path("#{docs_folder}/_site") "destination" => File.expand_path("#{docs_folder}/_site"),
}) })
end end
task :build => :generate task :build => :generate
@ -48,7 +48,7 @@ namespace :site do
Dir.chdir("#{docs_folder}/_sass") do Dir.chdir("#{docs_folder}/_sass") do
sh 'curl "https://necolas.github.io/normalize.css/latest/normalize.css" -o "normalize.scss"' sh 'curl "https://necolas.github.io/normalize.css/latest/normalize.css" -o "normalize.scss"'
sh 'sass "normalize.scss":"_normalize.scss" --style compressed' sh 'sass "normalize.scss":"_normalize.scss" --style compressed'
rm ['normalize.scss', Dir.glob('*.map')].flatten rm ["normalize.scss", Dir.glob("*.map")].flatten
end end
end end
@ -60,40 +60,40 @@ namespace :site do
desc "Create a nicely formatted history page for the jekyll site based on the repo history." desc "Create a nicely formatted history page for the jekyll site based on the repo history."
task :history do task :history do
siteify_file('History.markdown', { "title" => "History" }) siteify_file("History.markdown", { "title" => "History" })
end end
desc "Copy the Code of Conduct" desc "Copy the Code of Conduct"
task :conduct do task :conduct do
front_matter = { front_matter = {
"redirect_from" => "/conduct/index.html", "redirect_from" => "/conduct/index.html",
"editable" => false "editable" => false,
} }
siteify_file('CONDUCT.markdown', front_matter) siteify_file("CONDUCT.markdown", front_matter)
end end
desc "Copy the contributing file" desc "Copy the contributing file"
task :contributing do task :contributing do
siteify_file('.github/CONTRIBUTING.markdown', "title" => "Contributing") siteify_file(".github/CONTRIBUTING.markdown", "title" => "Contributing")
end end
desc "Write the site latest_version.txt file" desc "Write the site latest_version.txt file"
task :version_file do task :version_file do
File.open("#{docs_folder}/latest_version.txt", 'wb') { |f| f.puts(version) } unless version =~ /(beta|rc|alpha)/i File.open("#{docs_folder}/latest_version.txt", "wb") { |f| f.puts(version) } unless version =~ %r!(beta|rc|alpha)!i
end end
namespace :releases do namespace :releases do
desc "Create new release post" desc "Create new release post"
task :new, :version do |t, args| task :new, :version do |_t, args|
raise "Specify a version: rake site:releases:new['1.2.3']" unless args.version raise "Specify a version: rake site:releases:new['1.2.3']" unless args.version
today = Time.new.strftime('%Y-%m-%d') today = Time.new.strftime("%Y-%m-%d")
release = args.version.to_s release = args.version.to_s
filename = "#{docs_folder}/_posts/#{today}-jekyll-#{release.split('.').join('-')}-released.markdown" filename = "#{docs_folder}/_posts/#{today}-jekyll-#{release.split(".").join("-")}-released.markdown"
File.open(filename, "wb") do |post| File.open(filename, "wb") do |post|
post.puts("---") post.puts("---")
post.puts("title: 'Jekyll #{release} Released'") post.puts("title: 'Jekyll #{release} Released'")
post.puts("date: #{Time.new.strftime('%Y-%m-%d %H:%M:%S %z')}") post.puts("date: #{Time.new.strftime("%Y-%m-%d %H:%M:%S %z")}")
post.puts("author: ") post.puts("author: ")
post.puts("version: #{release}") post.puts("version: #{release}")
post.puts("categories: [release]") post.puts("categories: [release]")

View File

@ -2,7 +2,6 @@ module Jekyll
class Dummy < Generator class Dummy < Generator
priority :high priority :high
def generate(site) def generate(site) end
end
end end
end end