From 2a2326aea3875e8820b26a227ff60937b07b7689 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sat, 27 Feb 2016 14:06:11 -0500 Subject: [PATCH 1/7] better file copying --- CONDUCT.markdown | 2 +- History.markdown | 2 ++ Rakefile | 19 +++++++++++++++++++ rake/site.rake | 36 ++++++++---------------------------- site/_docs/conduct.md | 7 ++++--- site/_docs/history.md | 3 ++- 6 files changed, 36 insertions(+), 33 deletions(-) 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/History.markdown b/History.markdown index 95b6930d..e40f097e 100644 --- a/History.markdown +++ b/History.markdown @@ -1,3 +1,5 @@ +# History + ## HEAD ### Development Fixes diff --git a/Rakefile b/Rakefile index e3f99c41..38a111cc 100644 --- a/Rakefile +++ b/Rakefile @@ -87,6 +87,25 @@ 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) + contents = File.read(file) + title = contents.match(/\A# (.*)$/)[1] + output_file = file.sub(/\.markdown\z/, ".md").downcase + slug = File.basename(output_file, ".md") + default_frontmatter = { + "title" => title, + "layout" => "docs", + "permalink" => "/docs/#{slug}/", + "note" => "This file is autogenerated. Edit /#{file} instead." + } + front_matter = front_matter.merge(default_frontmatter) + contents.gsub!(/\A# #{title}\n\n?/, "") + contents = converted_history(contents) if output_file == "history.md" + contents = "#{front_matter.to_yaml}---\n\n#{contents}" + File.write("site/_docs/#{output_file}", contents) +end + ############################################################################# # # Standard tasks diff --git a/rake/site.rake b/rake/site.rake index 08ad12b3..4efed685 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('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..6995b911 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: Contributor 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/history.md b/site/_docs/history.md index b98ea83e..12da9d24 100644 --- a/site/_docs/history.md +++ b/site/_docs/history.md @@ -1,7 +1,8 @@ --- -layout: docs title: History +layout: docs permalink: "/docs/history/" +note: This file is autogenerated. Edit /History.markdown instead. --- ## 3.1.2 / 2016-02-19 From 61567f430e9e57f175f8b82b1c26603ea9478709 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sat, 27 Feb 2016 14:10:15 -0500 Subject: [PATCH 2/7] update contributing title --- CONTRIBUTING.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CONTRIBUTING.markdown b/CONTRIBUTING.markdown index ce1a10eb..c563e2d6 100644 --- a/CONTRIBUTING.markdown +++ b/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: From c6790bd8c9149d09ecc289dd4ac273cf562e23a2 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sat, 27 Feb 2016 14:19:06 -0500 Subject: [PATCH 3/7] pass default front matter directly to the merge --- Rakefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 38a111cc..6b70c955 100644 --- a/Rakefile +++ b/Rakefile @@ -93,13 +93,12 @@ def siteify_file(file, front_matter = {}) title = contents.match(/\A# (.*)$/)[1] output_file = file.sub(/\.markdown\z/, ".md").downcase slug = File.basename(output_file, ".md") - default_frontmatter = { + front_matter = front_matter.merge({ "title" => title, "layout" => "docs", "permalink" => "/docs/#{slug}/", "note" => "This file is autogenerated. Edit /#{file} instead." - } - front_matter = front_matter.merge(default_frontmatter) + }) contents.gsub!(/\A# #{title}\n\n?/, "") contents = converted_history(contents) if output_file == "history.md" contents = "#{front_matter.to_yaml}---\n\n#{contents}" From 7e21d2a98f608e1caaed18402e6305c259510128 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Tue, 1 Mar 2016 15:51:17 -0500 Subject: [PATCH 4/7] add content_for method --- Rakefile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Rakefile b/Rakefile index 6b70c955..aee5747e 100644 --- a/Rakefile +++ b/Rakefile @@ -89,22 +89,29 @@ end def siteify_file(file, front_matter = {}) abort "You seem to have misplaced your #{file} file. I can haz?" unless File.exists?(file) - contents = File.read(file) - title = contents.match(/\A# (.*)$/)[1] - output_file = file.sub(/\.markdown\z/, ".md").downcase - slug = File.basename(output_file, ".md") + title = File.read(file).match(/\A# (.*)$/)[1] + output_file = file.sub(/\.markdown\z/, ".md").downcase + slug = File.basename(output_file, ".md") front_matter = front_matter.merge({ "title" => title, "layout" => "docs", "permalink" => "/docs/#{slug}/", "note" => "This file is autogenerated. Edit /#{file} instead." }) - contents.gsub!(/\A# #{title}\n\n?/, "") - contents = converted_history(contents) if output_file == "history.md" - contents = "#{front_matter.to_yaml}---\n\n#{contents}" + contents = "#{front_matter.to_yaml}---\n\n#{content_for(file)}" File.write("site/_docs/#{output_file}", 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 From 059d7d2997aae2a78d9f90aeae2f479c38a3bfa0 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Wed, 2 Mar 2016 13:38:54 -0500 Subject: [PATCH 5/7] Properly case History.markdown --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index aee5747e..b86891f0 100644 --- a/Rakefile +++ b/Rakefile @@ -105,7 +105,7 @@ end def content_for(file) contents = File.read(file) case file - when "HISTORY.markdown" + when "History.markdown" converted_history(contents) else contents.gsub!(/\A# .*\n\n?/, "") From 301fe59dc698be282f1b6255b1e5af09cc113bcd Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Wed, 2 Mar 2016 13:46:54 -0500 Subject: [PATCH 6/7] update siteify_file to work with .github folder --- Rakefile | 7 +++--- rake/site.rake | 2 +- site/_docs/conduct.md | 2 +- site/_docs/contributing.md | 50 ++++++++++++++------------------------ 4 files changed, 23 insertions(+), 38 deletions(-) diff --git a/Rakefile b/Rakefile index b86891f0..d4365723 100644 --- a/Rakefile +++ b/Rakefile @@ -89,9 +89,8 @@ 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] - output_file = file.sub(/\.markdown\z/, ".md").downcase - slug = File.basename(output_file, ".md") + title = File.read(file).match(/\A# (.*)$/)[1] + slug = File.basename(file, ".markdown").downcase front_matter = front_matter.merge({ "title" => title, "layout" => "docs", @@ -99,7 +98,7 @@ def siteify_file(file, front_matter = {}) "note" => "This file is autogenerated. Edit /#{file} instead." }) contents = "#{front_matter.to_yaml}---\n\n#{content_for(file)}" - File.write("site/_docs/#{output_file}", contents) + File.write("site/_docs/#{slug}.md", contents) end def content_for(file) diff --git a/rake/site.rake b/rake/site.rake index 4efed685..3bff7a16 100644 --- a/rake/site.rake +++ b/rake/site.rake @@ -117,7 +117,7 @@ namespace :site do desc "Copy the contributing file" task :contributing do - siteify_file('CONTRIBUTING.markdown') + 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 6995b911..b5420b47 100644 --- a/site/_docs/conduct.md +++ b/site/_docs/conduct.md @@ -1,7 +1,7 @@ --- redirect_from: "/conduct/index.html" editable: false -title: Contributor Code of Conduct +title: Code of Conduct layout: docs permalink: "/docs/conduct/" note: This file is autogenerated. Edit /CONDUCT.markdown instead. 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. -
-
Contributions will not be accepted without tests
-

- If you’re creating a small fix or patch to an existing feature, just - a simple test will do. -

-
- - Test Dependencies ----------------- To run the test suite and build the gem you'll need to install Jekyll's -dependencies. Simply run this command to get all set up: +dependencies. Simply run this command to get all setup: -
$ script/bootstrap
+ $ script/bootstrap Before you start, run the tests and make sure that they pass (to confirm your environment is configured properly): -
$ script/cibuild
+ $ script/cibuild If you are only updating a file in `test/`, you can use the command: -
$ script/test test/blah_test.rb
+ $ script/test test/blah_test.rb If you are only updating a `.feature` file, you can use the command: -
$ script/cucumber features/blah.feature
+ $ script/cucumber features/blah.feature Both `script/test` and `script/cucumber` can be run without arguments to run its entire respective suite. @@ -68,7 +60,7 @@ Workflow Here's the most direct way to get your work merged into the project: -* Fork the project. +* [Fork](https://github.com/jekyll/jekyll/fork) the project. * Clone down your fork ( `git clone git@github.com:[username]/jekyll.git` ). * Create a topic branch to contain your change ( `git checkout -b my_awesome_feature` ). * Hack away, add tests. Not necessarily in that order. @@ -86,18 +78,19 @@ open-sourced our docs and we welcome any pull requests if you find it lacking. You can find the documentation for jekyllrb.com in the -[site]({{ site.repository }}/tree/master/site) directory of +[site](https://github.com/jekyll/jekyll/tree/master/site) directory of Jekyll's repo on GitHub.com. All documentation pull requests should be directed at `master`. Pull requests directed at another branch will not be accepted. -The [Jekyll wiki]({{ site.repository }}/wiki) on GitHub +The [Jekyll wiki](https://github.com/jekyll/jekyll/wiki) on GitHub can be freely updated without a pull request as all GitHub users have access. -If you want to add your plugin to the [list of plugins](/docs/plugins/#available-plugins), -please submit a pull request modifying the [plugins page source -file]({{ site.repository }}/blob/master/site/_docs/plugins.md) by adding a +If you want to add your plugin to the +[list of plugins](http://jekyllrb.com/docs/plugins/#available-plugins), +please submit a pull request modifying the +[plugins page source file](site/_docs/plugins.md) by adding a link to your plugin under the proper subheading depending upon its type. Gotchas @@ -113,12 +106,5 @@ Gotchas Finally... ---------- -
-
Let us know what could be better!
-

- 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. -

-
+Thanks! Hacking on Jekyll should be fun. If you find any of this hard to figure +out, let us know so we can improve our process or documentation! From 6262a59be87a5cd9892bede1b30e1661fec4b95f Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 2 Mar 2016 20:05:10 -0800 Subject: [PATCH 7/7] Remove header from History.markdown --- History.markdown | 2 -- 1 file changed, 2 deletions(-) diff --git a/History.markdown b/History.markdown index 7902e446..ea0f5e7e 100644 --- a/History.markdown +++ b/History.markdown @@ -1,5 +1,3 @@ -# History - ## HEAD ### Minor Enhancements