update siteify_file to work with .github folder

This commit is contained in:
Ben Balter 2016-03-02 13:46:54 -05:00
parent 1853f6a210
commit 301fe59dc6
4 changed files with 23 additions and 38 deletions

View File

@ -89,9 +89,8 @@ end
def siteify_file(file, front_matter = {}) def siteify_file(file, front_matter = {})
abort "You seem to have misplaced your #{file} file. I can haz?" unless File.exists?(file) abort "You seem to have misplaced your #{file} file. I can haz?" unless File.exists?(file)
title = File.read(file).match(/\A# (.*)$/)[1] title = File.read(file).match(/\A# (.*)$/)[1]
output_file = file.sub(/\.markdown\z/, ".md").downcase slug = File.basename(file, ".markdown").downcase
slug = File.basename(output_file, ".md")
front_matter = front_matter.merge({ front_matter = front_matter.merge({
"title" => title, "title" => title,
"layout" => "docs", "layout" => "docs",
@ -99,7 +98,7 @@ def siteify_file(file, front_matter = {})
"note" => "This file is autogenerated. Edit /#{file} instead." "note" => "This file is autogenerated. Edit /#{file} instead."
}) })
contents = "#{front_matter.to_yaml}---\n\n#{content_for(file)}" 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 end
def content_for(file) def content_for(file)

View File

@ -117,7 +117,7 @@ namespace :site do
desc "Copy the contributing file" desc "Copy the contributing file"
task :contributing do task :contributing do
siteify_file('CONTRIBUTING.markdown') siteify_file('.github/CONTRIBUTING.markdown')
end end
desc "Write the site latest_version.txt file" desc "Write the site latest_version.txt file"

View File

@ -1,7 +1,7 @@
--- ---
redirect_from: "/conduct/index.html" redirect_from: "/conduct/index.html"
editable: false editable: false
title: Contributor Code of Conduct title: Code of Conduct
layout: docs layout: docs
permalink: "/docs/conduct/" permalink: "/docs/conduct/"
note: This file is autogenerated. Edit /CONDUCT.markdown instead. note: This file is autogenerated. Edit /CONDUCT.markdown instead.

View File

@ -1,7 +1,8 @@
--- ---
layout: docs
title: Contributing 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 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. change is to review, the more likely it will be merged.
* When submitting a pull request, please make judicious use of the pull request * 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 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. will also speed up review time.
<div class="note warning">
<h5>Contributions will not be accepted without tests</h5>
<p>
If youre creating a small fix or patch to an existing feature, just
a simple test will do.
</p>
</div>
Test Dependencies Test Dependencies
----------------- -----------------
To run the test suite and build the gem you'll need to install Jekyll's 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:
<figure class="highlight"><pre><code>$ script/bootstrap</code></pre></figure> $ script/bootstrap
Before you start, run the tests and make sure that they pass (to confirm your Before you start, run the tests and make sure that they pass (to confirm your
environment is configured properly): environment is configured properly):
<figure class="highlight"><pre><code>$ script/cibuild</code></pre></figure> $ script/cibuild
If you are only updating a file in `test/`, you can use the command: If you are only updating a file in `test/`, you can use the command:
<figure class="highlight"><pre><code>$ script/test test/blah_test.rb</code></pre></figure> $ script/test test/blah_test.rb
If you are only updating a `.feature` file, you can use the command: If you are only updating a `.feature` file, you can use the command:
<figure class="highlight"><pre><code>$ script/cucumber features/blah.feature</code></pre></figure> $ script/cucumber features/blah.feature
Both `script/test` and `script/cucumber` can be run without arguments to Both `script/test` and `script/cucumber` can be run without arguments to
run its entire respective suite. run its entire respective suite.
@ -68,7 +60,7 @@ Workflow
Here's the most direct way to get your work merged into the project: 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` ). * 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` ). * Create a topic branch to contain your change ( `git checkout -b my_awesome_feature` ).
* Hack away, add tests. Not necessarily in that order. * 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. lacking.
You can find the documentation for jekyllrb.com in the 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. Jekyll's repo on GitHub.com.
All documentation pull requests should be directed at `master`. Pull All documentation pull requests should be directed at `master`. Pull
requests directed at another branch will not be accepted. 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. 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), If you want to add your plugin to the
please submit a pull request modifying the [plugins page source [list of plugins](http://jekyllrb.com/docs/plugins/#available-plugins),
file]({{ site.repository }}/blob/master/site/_docs/plugins.md) by adding a 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. link to your plugin under the proper subheading depending upon its type.
Gotchas Gotchas
@ -113,12 +106,5 @@ Gotchas
Finally... Finally...
---------- ----------
<div class="note"> Thanks! Hacking on Jekyll should be fun. If you find any of this hard to figure
<h5>Let us know what could be better!</h5> out, let us know so we can improve our process or documentation!
<p>
Both using and hacking on Jekyll should be fun, simple, and easy, so if for
some reason you find its a pain, please <a
href="{{ site.repository }}/issues/new">create an issue</a> on
GitHub describing your experience so we can make it better.
</p>
</div>