diff --git a/.github/CONTRIBUTING.markdown b/.github/CONTRIBUTING.markdown index ce1a10eb..c563e2d6 100644 --- a/.github/CONTRIBUTING.markdown +++ b/.github/CONTRIBUTING.markdown @@ -1,5 +1,4 @@ -Contribute -========== +# Contributing So you've got an awesome idea to throw into Jekyll. Great! Please keep the following in mind: diff --git a/CONDUCT.markdown b/CONDUCT.markdown index a0f06de7..8425dfc7 100644 --- a/CONDUCT.markdown +++ b/CONDUCT.markdown @@ -1,4 +1,4 @@ -# Contributor Code of Conduct +# Code of Conduct As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who diff --git a/Rakefile b/Rakefile index e3f99c41..d4365723 100644 --- a/Rakefile +++ b/Rakefile @@ -87,6 +87,30 @@ def converted_history(markdown) normalize_bullets(markdown))))) end +def siteify_file(file, front_matter = {}) + abort "You seem to have misplaced your #{file} file. I can haz?" unless File.exists?(file) + title = File.read(file).match(/\A# (.*)$/)[1] + slug = File.basename(file, ".markdown").downcase + front_matter = front_matter.merge({ + "title" => title, + "layout" => "docs", + "permalink" => "/docs/#{slug}/", + "note" => "This file is autogenerated. Edit /#{file} instead." + }) + contents = "#{front_matter.to_yaml}---\n\n#{content_for(file)}" + File.write("site/_docs/#{slug}.md", contents) +end + +def content_for(file) + contents = File.read(file) + case file + when "History.markdown" + converted_history(contents) + else + contents.gsub!(/\A# .*\n\n?/, "") + end +end + ############################################################################# # # Standard tasks diff --git a/rake/site.rake b/rake/site.rake index 08ad12b3..3bff7a16 100644 --- a/rake/site.rake +++ b/rake/site.rake @@ -5,7 +5,7 @@ ############################################################################# namespace :site do - task :generated_pages => [:history, :version_file, :conduct] + task :generated_pages => [:history, :version_file, :conduct, :contributing] desc "Generate and view the site locally" task :preview => :generated_pages do @@ -103,41 +103,21 @@ namespace :site do desc "Create a nicely formatted history page for the jekyll site based on the repo history." task :history do - if File.exist?("History.markdown") - history_file = File.read("History.markdown") - front_matter = { - "layout" => "docs", - "title" => "History", - "permalink" => "/docs/history/" - } - Dir.chdir('site/_docs/') do - File.open("history.md", "w") do |file| - file.write("#{front_matter.to_yaml}---\n\n") - file.write(converted_history(history_file)) - end - end - else - abort "You seem to have misplaced your History.markdown file. I can haz?" - end + siteify_file('History.markdown') end desc "Copy the Code of Conduct" task :conduct do - code_of_conduct = File.read("CONDUCT.markdown") - header, _, body = code_of_conduct.partition("\n\n") front_matter = { - "layout" => "docs", - "title" => header.sub('# Contributor ', ''), - "permalink" => "/docs/conduct/", "redirect_from" => "/conduct/index.html", "editable" => false } - Dir.chdir('site/_docs') do - File.open("conduct.md", "w") do |file| - file.write("#{front_matter.to_yaml}---\n\n") - file.write(body) - end - end + siteify_file('CONDUCT.markdown', front_matter) + end + + desc "Copy the contributing file" + task :contributing do + siteify_file('.github/CONTRIBUTING.markdown') end desc "Write the site latest_version.txt file" diff --git a/site/_docs/conduct.md b/site/_docs/conduct.md index d25c32c9..b5420b47 100644 --- a/site/_docs/conduct.md +++ b/site/_docs/conduct.md @@ -1,9 +1,10 @@ --- -layout: docs -title: Code of Conduct -permalink: "/docs/conduct/" redirect_from: "/conduct/index.html" editable: false +title: Code of Conduct +layout: docs +permalink: "/docs/conduct/" +note: This file is autogenerated. Edit /CONDUCT.markdown instead. --- As contributors and maintainers of this project, and in the interest of diff --git a/site/_docs/contributing.md b/site/_docs/contributing.md index a5654bdd..51942fab 100644 --- a/site/_docs/contributing.md +++ b/site/_docs/contributing.md @@ -1,7 +1,8 @@ --- -layout: docs title: Contributing -permalink: /docs/contributing/ +layout: docs +permalink: "/docs/contributing/" +note: This file is autogenerated. Edit /.github/CONTRIBUTING.markdown instead. --- So you've got an awesome idea to throw into Jekyll. Great! Please keep the @@ -27,38 +28,29 @@ following in mind: change is to review, the more likely it will be merged. * When submitting a pull request, please make judicious use of the pull request body. A description of what changes were made, the motivations behind the - changes, and [any tasks completed or left to complete](http://git.io/gfm-tasks) + changes and [any tasks completed or left to complete](http://git.io/gfm-tasks) will also speed up review time. -
- If you’re creating a small fix or patch to an existing feature, just - a simple test will do. -
-$ script/bootstrap
$ script/cibuild
$ script/test test/blah_test.rb
$ script/cucumber features/blah.feature
- Both using and hacking on Jekyll should be fun, simple, and easy, so if for - some reason you find it’s a pain, please create an issue on - GitHub describing your experience so we can make it better. -
-