Skip to content

Commit

Permalink
appease rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
DirtyF committed Jan 14, 2017
1 parent 39b7af3 commit 6f8bf2e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion rake/docs.rake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace :docs do
desc "Release #{docs_name} v#{version}"
task :release => :build do
unless `git branch` =~ /^\* master$/
unless `git branch` =~ %r!^\* master$!
puts "You must be on the master branch to release!"
exit!
end
Expand Down
2 changes: 1 addition & 1 deletion rake/release.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

desc "Release #{name} v#{version}"
task :release => :build do
unless `git branch` =~ /^\* master$/
unless `git branch` =~ %r!^\* master$!
puts "You must be on the master branch to release!"
exit!
end
Expand Down
26 changes: 13 additions & 13 deletions rake/site.rake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace :site do
require "jekyll"

browser_launched = false
Jekyll::Hooks.register :site, :post_write do |site|
Jekyll::Hooks.register :site, :post_write do |_site|
next if browser_launched
browser_launched = true
Jekyll.logger.info "Opening in browser..."
Expand All @@ -26,7 +26,7 @@ namespace :site do
"source" => File.expand_path(docs_folder),
"destination" => File.expand_path("#{docs_folder}/_site"),
"watch" => true,
"serving" => true
"serving" => true,
}
Jekyll::Commands::Build.process(options)
Jekyll::Commands::Serve.process(options)
Expand All @@ -38,7 +38,7 @@ namespace :site do
Jekyll::Commands::Build.process({
"profile" => true,
"source" => File.expand_path(docs_folder),
"destination" => File.expand_path("#{docs_folder}/_site")
"destination" => File.expand_path("#{docs_folder}/_site"),
})
end
task :build => :generate
Expand All @@ -48,7 +48,7 @@ namespace :site do
Dir.chdir("#{docs_folder}/_sass") do
sh 'curl "https://necolas.github.io/normalize.css/latest/normalize.css" -o "normalize.scss"'
sh 'sass "normalize.scss":"_normalize.scss" --style compressed'
rm ['normalize.scss', Dir.glob('*.map')].flatten
rm ["normalize.scss", Dir.glob("*.map")].flatten
end
end

Expand All @@ -60,40 +60,40 @@ namespace :site do

desc "Create a nicely formatted history page for the jekyll site based on the repo history."
task :history do
siteify_file('History.markdown', { "title" => "History" })
siteify_file("History.markdown", { "title" => "History" })
end

desc "Copy the Code of Conduct"
task :conduct do
front_matter = {
"redirect_from" => "/conduct/index.html",
"editable" => false
"editable" => false,
}
siteify_file('CONDUCT.markdown', front_matter)
siteify_file("CONDUCT.markdown", front_matter)
end

desc "Copy the contributing file"
task :contributing do
siteify_file('.github/CONTRIBUTING.markdown', "title" => "Contributing")
siteify_file(".github/CONTRIBUTING.markdown", "title" => "Contributing")
end

desc "Write the site latest_version.txt file"
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

namespace :releases do
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
today = Time.new.strftime('%Y-%m-%d')
today = Time.new.strftime("%Y-%m-%d")
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|
post.puts("---")
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("version: #{release}")
post.puts("categories: [release]")
Expand Down

0 comments on commit 6f8bf2e

Please sign in to comment.