From ce7e307cba3f0dbebe6e5b03dd1ca6d631d18409 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 16 Jan 2013 21:17:21 -0500 Subject: [PATCH 01/21] Scaffold site, based on @mojombo's site (with permission). --- lib/site_template/_config.yml | 2 + lib/site_template/_layouts/default.html | 38 +++++ lib/site_template/_layouts/post.html | 15 ++ lib/site_template/_posts/.gitkeep | 0 lib/site_template/css/screen.css | 197 ++++++++++++++++++++++++ lib/site_template/css/syntax.css | 60 ++++++++ lib/site_template/images/.gitkeep | 0 lib/site_template/images/rss.png | Bin 0 -> 5069 bytes lib/site_template/index.html | 13 ++ 9 files changed, 325 insertions(+) create mode 100644 lib/site_template/_config.yml create mode 100644 lib/site_template/_layouts/default.html create mode 100644 lib/site_template/_layouts/post.html create mode 100644 lib/site_template/_posts/.gitkeep create mode 100644 lib/site_template/css/screen.css create mode 100644 lib/site_template/css/syntax.css create mode 100644 lib/site_template/images/.gitkeep create mode 100644 lib/site_template/images/rss.png create mode 100644 lib/site_template/index.html diff --git a/lib/site_template/_config.yml b/lib/site_template/_config.yml new file mode 100644 index 00000000..6d67c09e --- /dev/null +++ b/lib/site_template/_config.yml @@ -0,0 +1,2 @@ +markdown: rdiscount +pygments: true diff --git a/lib/site_template/_layouts/default.html b/lib/site_template/_layouts/default.html new file mode 100644 index 00000000..9fc00095 --- /dev/null +++ b/lib/site_template/_layouts/default.html @@ -0,0 +1,38 @@ + + + + + {{ page.title }} + + + + + + +
+
+ Your Name + home +
+ + {{ content }} + + +
+ Fork me on GitHub + + diff --git a/lib/site_template/_layouts/post.html b/lib/site_template/_layouts/post.html new file mode 100644 index 00000000..0938f453 --- /dev/null +++ b/lib/site_template/_layouts/post.html @@ -0,0 +1,15 @@ +--- +layout: default +--- +
+{{ content }} +
+ + \ No newline at end of file diff --git a/lib/site_template/_posts/.gitkeep b/lib/site_template/_posts/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/lib/site_template/css/screen.css b/lib/site_template/css/screen.css new file mode 100644 index 00000000..c13b61a6 --- /dev/null +++ b/lib/site_template/css/screen.css @@ -0,0 +1,197 @@ +/*****************************************************************************/ +/* +/* Common +/* +/*****************************************************************************/ + +/* Global Reset */ + +* { + margin: 0; + padding: 0; +} + +html, body { + height: 100%; +} + +body { + background-color: white; + font: 13.34px helvetica, arial, clean, sans-serif; + *font-size: small; + text-align: center; +} + +h1, h2, h3, h4, h5, h6 { + font-size: 100%; +} + +h1 { + margin-bottom: 1em; +} + +p { + margin: 1em 0; +} + +a { + color: #00a; +} + +a:hover { + color: black; +} + +a:visited { + color: #a0a; +} + +table { + font-size: inherit; + font: 100%; +} + +/*****************************************************************************/ +/* +/* Home +/* +/*****************************************************************************/ + +ul.posts { + list-style-type: none; + margin-bottom: 2em; +} + + ul.posts li { + line-height: 1.75em; + } + + ul.posts span { + color: #aaa; + font-family: Monaco, "Courier New", monospace; + font-size: 80%; + } + +/*****************************************************************************/ +/* +/* Site +/* +/*****************************************************************************/ + +.site { + font-size: 110%; + text-align: justify; + width: 42em; + margin: 3em auto 2em auto; + line-height: 1.5em; +} + +.title { + color: #a00; + font-weight: bold; + margin-bottom: 2em; +} + + .site .title a { + color: #a00; + text-decoration: none; + } + + .site .title a:hover { + color: black; + } + + .site .title a.extra { + color: #aaa; + text-decoration: none; + margin-left: 1em; + } + + .site .title a.extra:hover { + color: black; + } + + .site .meta { + color: #aaa; + } + + .site .footer { + font-size: 80%; + color: #666; + border-top: 4px solid #eee; + margin-top: 2em; + overflow: hidden; + } + + .site .footer .contact { + float: left; + margin-right: 3em; + } + + .site .footer .contact a { + color: #8085C1; + } + + .site .footer .rss { + margin-top: 1.1em; + margin-right: -.2em; + float: right; + } + + .site .footer .rss img { + border: 0; + } + +/*****************************************************************************/ +/* +/* Posts +/* +/*****************************************************************************/ + +#post { + +} + + /* standard */ + + #post pre { + border: 1px solid #ddd; + background-color: #eef; + padding: 0 .4em; + } + + #post ul, + #post ol { + margin-left: 1.35em; + } + + #post code { + border: 1px solid #ddd; + background-color: #eef; + font-size: 85%; + padding: 0 .2em; + } + + #post pre code { + border: none; + } + + /* terminal */ + + #post pre.terminal { + border: 1px solid black; + background-color: #333; + color: white; + } + + #post pre.terminal code { + background-color: #333; + } + +#related { + margin-top: 2em; +} + + #related h2 { + margin-bottom: 1em; + } \ No newline at end of file diff --git a/lib/site_template/css/syntax.css b/lib/site_template/css/syntax.css new file mode 100644 index 00000000..2774b764 --- /dev/null +++ b/lib/site_template/css/syntax.css @@ -0,0 +1,60 @@ +.highlight { background: #ffffff; } +.highlight .c { color: #999988; font-style: italic } /* Comment */ +.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ +.highlight .k { font-weight: bold } /* Keyword */ +.highlight .o { font-weight: bold } /* Operator */ +.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */ +.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ +.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ +.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #aa0000 } /* Generic.Error */ +.highlight .gh { color: #999999 } /* Generic.Heading */ +.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ +.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #555555 } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #aaaaaa } /* Generic.Subheading */ +.highlight .gt { color: #aa0000 } /* Generic.Traceback */ +.highlight .kc { font-weight: bold } /* Keyword.Constant */ +.highlight .kd { font-weight: bold } /* Keyword.Declaration */ +.highlight .kp { font-weight: bold } /* Keyword.Pseudo */ +.highlight .kr { font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */ +.highlight .m { color: #009999 } /* Literal.Number */ +.highlight .s { color: #d14 } /* Literal.String */ +.highlight .na { color: #008080 } /* Name.Attribute */ +.highlight .nb { color: #0086B3 } /* Name.Builtin */ +.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */ +.highlight .no { color: #008080 } /* Name.Constant */ +.highlight .ni { color: #800080 } /* Name.Entity */ +.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */ +.highlight .nn { color: #555555 } /* Name.Namespace */ +.highlight .nt { color: #000080 } /* Name.Tag */ +.highlight .nv { color: #008080 } /* Name.Variable */ +.highlight .ow { font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mf { color: #009999 } /* Literal.Number.Float */ +.highlight .mh { color: #009999 } /* Literal.Number.Hex */ +.highlight .mi { color: #009999 } /* Literal.Number.Integer */ +.highlight .mo { color: #009999 } /* Literal.Number.Oct */ +.highlight .sb { color: #d14 } /* Literal.String.Backtick */ +.highlight .sc { color: #d14 } /* Literal.String.Char */ +.highlight .sd { color: #d14 } /* Literal.String.Doc */ +.highlight .s2 { color: #d14 } /* Literal.String.Double */ +.highlight .se { color: #d14 } /* Literal.String.Escape */ +.highlight .sh { color: #d14 } /* Literal.String.Heredoc */ +.highlight .si { color: #d14 } /* Literal.String.Interpol */ +.highlight .sx { color: #d14 } /* Literal.String.Other */ +.highlight .sr { color: #009926 } /* Literal.String.Regex */ +.highlight .s1 { color: #d14 } /* Literal.String.Single */ +.highlight .ss { color: #990073 } /* Literal.String.Symbol */ +.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */ +.highlight .vc { color: #008080 } /* Name.Variable.Class */ +.highlight .vg { color: #008080 } /* Name.Variable.Global */ +.highlight .vi { color: #008080 } /* Name.Variable.Instance */ +.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */ diff --git a/lib/site_template/images/.gitkeep b/lib/site_template/images/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/lib/site_template/images/rss.png b/lib/site_template/images/rss.png new file mode 100644 index 0000000000000000000000000000000000000000..d6ecb16f4ecb3c8a0cb3752c2e447e622e458d91 GIT binary patch literal 5069 zcmV;;6Ef_HP)0000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU_Z%IT!RCwCdS_zC@)pWO zk1@8v7%;}Qp#}$VLSyRYj;kq*ll%NeNU9AyHCdD58X= z2?5O3u;X~eGu~&$v%dY^<($+1Kj*$TZ)V=$Nd;1Kedqbkyu1A8Ki~iT-~XRWl~UyQ zc4OrCd9xOBlG2+rKjd?qD~dmq(dq5~ZoRQNQY0kQ_x-S134>7TQG8Cu!^SPka$Lva z4yBG|af^S-Fs%6u2OEWu6-Dxg4(48cseE8>R2b)xPdP{Le;xyXCxUOh1aI$k&)tw% zzcJI+m2{ZvxGF^wI2#YPR-AR$!O(`*` zf~Tlc0E7}U2Z2ga8Iejp$d6Ww1s0xmj(zo)+t**%mPsWO3CD3bIPR3zizq4+I{x81 z$M5@lck;lpbGkB}UQi5!sUWKO_)v<`4j+^$%A|%ViG9Nrj)f}y7dTDn;VH)S(BLYD z-@reJA9JWLAPnvWw!wMaCDaK+HnJ}_e7GEKzB2t6xApWaYD=eGuZ45=Y1V_+ON0;o z_tT^If2*fEShBXWI#DT)lw=UWv*G4wF@=LTz8I4_%y1a!bNoarb zubeD#n@|fUouJpjsRlZ+(FWys0P%p%ljwLHio$s?7zcO5R}6ryq(+^jQo$uUUMOc~ zYHIj{0dS?A5{ZJBjFw-}oBH78$(LUkp30ZXr6`J;`@X8^ZJ?|}9*Ht`T2q!~s zGZJGO>=6)FXcd*lMS3t&55oYUhJI$)k4(d+{vD1(#lNs=8mXT*?M?iVsydbGP>WY3 zz2~1A85k(!3t<@6-9K%8B%(^GF!{nWy~{l!MQNzSY!b&A*vAP^w$fB9a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4iH&7an-)sGsMS-3kRV z#g>L_Sk=&r{>sD@kHb=XJzmn%%+t^j;JU?)r3M9C^;())6rKz(D1|*%x-5zIt&_cWY~_S*dNJkZs#eB@>H#dk3!j>ev&ZdgJ~6bsg!R zHo{8Whq_LnF-G(``2BRS$qB&{Y#hiFYD^+GO(F`H)EFaGy^CWi{ld$M@B}+ zc7LdT^G3&^U0GT1T*x+-ZLwNYzrIWwug2C&v&NRKiegdZ6Qt8&kcQ1 zsfa@04B46E{cFX_HN8uhFJIEvyQrtVy&W9iX!^YGrG;TwE|>H9{K)vk(CFyoi6dn2 zpmlPXRLW9_nf85lFV*R`SD46@IyzO);@0-AMO_`eU0ofWotaFgktk1Ly+*0@eZNwv zz!-9c!c?(XC|BSwA`)im$!Gjxrq1jfU~eaECzO5MEH*WVx& zLcl!udJBR8j_V8UpY2 +

Blog Posts

+
    + {% for post in site.posts %} +
  • {{ post.date | date_to_string }} » {{ post.title }}
  • + {% endfor %} +
+ \ No newline at end of file From 272dd5ef351fe340b4d75ce9569096a15f197eb2 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 16 Jan 2013 21:17:43 -0500 Subject: [PATCH 02/21] Added the NewCommand class --- lib/jekyll/commands/new.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/jekyll/commands/new.rb diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb new file mode 100644 index 00000000..9b7e930e --- /dev/null +++ b/lib/jekyll/commands/new.rb @@ -0,0 +1,31 @@ +require 'yaml' + +module Jekyll + class NewCommand < Command + + def self.process(args) + path = File.expand_path(args.join(" "), Dir.pwd) + template_site = File.expand_path("../../site_template", File.dirname(__FILE__)) + FileUtils.mkdir_p path + FileUtils.cp_r Dir["#{template_site}/*"], path + File.open(File.expand_path(self.initialized_post_name, path), "w") do |f| + content = [ + { "layout" => "post", "title" => "Welcome to Jekyll!", "date" => Time.now.strftime('%Y-%m-%d %H:%M:%S'), "categories" => %w(jekyll update) }.to_yaml + "---", + "You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes!", + "To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext.", + "Check out the [Jeyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].", + "[jekyll-gh]: https://github.com/mojombo/github\n[jekyll]: http://jekyllrb.com" + ] + f.write(content.join("#{$/*2}")) + end + puts "New jekyll site installed in #{path}." + end + + # Internal: Gets the filename of the sample post to be created + # + # Returns the filename of the sample post, as a String + def self.initialized_post_name + "_posts/#{Time.now.strftime('%Y-%m-%d')}-welcome-to-jekyll.markdown" + end + end +end \ No newline at end of file From 2bc04e4a6022d3012c4b1d480b3d7860723b44a2 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 16 Jan 2013 21:19:02 -0500 Subject: [PATCH 03/21] Added the site_template files to the gemspec manifest. --- jekyll.gemspec | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jekyll.gemspec b/jekyll.gemspec index 86cbd1e8..7d162fcb 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -109,6 +109,15 @@ Gem::Specification.new do |s| lib/jekyll/tags/highlight.rb lib/jekyll/tags/include.rb lib/jekyll/tags/post_url.rb + lib/site_template/_config.yml + lib/site_template/_layouts/default.html + lib/site_template/_layouts/post.html + lib/site_template/_posts/.gitkeep + lib/site_template/css/screen.css + lib/site_template/css/syntax.css + lib/site_template/images/.gitkeep + lib/site_template/images/rss.png + lib/site_template/index.html test/fixtures/broken_front_matter1.erb test/fixtures/broken_front_matter2.erb test/fixtures/broken_front_matter3.erb From f3856a444a70dd78d3419b1a49dd82b280b365ac Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 16 Jan 2013 21:19:15 -0500 Subject: [PATCH 04/21] Added command to primary binary. --- bin/jekyll | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/jekyll b/bin/jekyll index 0034f75e..3db3f672 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -17,6 +17,15 @@ global_option '--safe', 'Safe mode (defaults to false)' global_option '--plugins', 'Plugins directory (defaults to ./_plugins)' global_option '--layouts', 'Layouts directory (defaults to ./_layouts)' +command :new do |c| + c.syntax = 'jekyll new PATH' + c.description = 'Creates a new Jekyll site scaffold in PATH' + + c.action do |args, options| + Jekyll::NewCommand.process(args) + end +end + command :build do |c| c.syntax = 'jekyll build [options]' c.description = 'Build your site with the option of auto-renegeration' From a8671ed52b116d6f7bd489d2ee34204d32296d7e Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 27 Jan 2013 23:17:45 +0100 Subject: [PATCH 05/21] Using modularized commands (Jekyll::Commands) as per @tombell's latest PR merge --- bin/jekyll | 2 +- lib/jekyll/commands/new.rb | 46 ++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index 3db3f672..6c3577c5 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -22,7 +22,7 @@ command :new do |c| c.description = 'Creates a new Jekyll site scaffold in PATH' c.action do |args, options| - Jekyll::NewCommand.process(args) + Jekyll::Commands::New.process(args) end end diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index 9b7e930e..51152429 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -1,31 +1,33 @@ require 'yaml' module Jekyll - class NewCommand < Command + module Commands + class New < Command - def self.process(args) - path = File.expand_path(args.join(" "), Dir.pwd) - template_site = File.expand_path("../../site_template", File.dirname(__FILE__)) - FileUtils.mkdir_p path - FileUtils.cp_r Dir["#{template_site}/*"], path - File.open(File.expand_path(self.initialized_post_name, path), "w") do |f| - content = [ - { "layout" => "post", "title" => "Welcome to Jekyll!", "date" => Time.now.strftime('%Y-%m-%d %H:%M:%S'), "categories" => %w(jekyll update) }.to_yaml + "---", - "You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes!", - "To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext.", - "Check out the [Jeyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].", - "[jekyll-gh]: https://github.com/mojombo/github\n[jekyll]: http://jekyllrb.com" - ] - f.write(content.join("#{$/*2}")) + def self.process(args) + path = File.expand_path(args.join(" "), Dir.pwd) + template_site = File.expand_path("../../site_template", File.dirname(__FILE__)) + FileUtils.mkdir_p path + FileUtils.cp_r Dir["#{template_site}/*"], path + File.open(File.expand_path(self.initialized_post_name, path), "w") do |f| + content = [ + { "layout" => "post", "title" => "Welcome to Jekyll!", "date" => Time.now.strftime('%Y-%m-%d %H:%M:%S'), "categories" => %w(jekyll update) }.to_yaml + "---", + "You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes!", + "To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext.", + "Check out the [Jeyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].", + "[jekyll-gh]: https://github.com/mojombo/github\n[jekyll]: http://jekyllrb.com" + ] + f.write(content.join("#{$/*2}")) + end + puts "New jekyll site installed in #{path}." end - puts "New jekyll site installed in #{path}." - end - # Internal: Gets the filename of the sample post to be created - # - # Returns the filename of the sample post, as a String - def self.initialized_post_name - "_posts/#{Time.now.strftime('%Y-%m-%d')}-welcome-to-jekyll.markdown" + # Internal: Gets the filename of the sample post to be created + # + # Returns the filename of the sample post, as a String + def self.initialized_post_name + "_posts/#{Time.now.strftime('%Y-%m-%d')}-welcome-to-jekyll.markdown" + end end end end \ No newline at end of file From ac691a14655157836bd98a1a4e4ba4d3e147d074 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 27 Jan 2013 23:21:02 +0100 Subject: [PATCH 06/21] removed related posts segment of scaffold site. --- lib/site_template/_layouts/post.html | 9 --------- lib/site_template/css/screen.css | 8 -------- 2 files changed, 17 deletions(-) diff --git a/lib/site_template/_layouts/post.html b/lib/site_template/_layouts/post.html index 0938f453..0b28e6bd 100644 --- a/lib/site_template/_layouts/post.html +++ b/lib/site_template/_layouts/post.html @@ -4,12 +4,3 @@ layout: default
{{ content }}
- - \ No newline at end of file diff --git a/lib/site_template/css/screen.css b/lib/site_template/css/screen.css index c13b61a6..7a230ede 100644 --- a/lib/site_template/css/screen.css +++ b/lib/site_template/css/screen.css @@ -187,11 +187,3 @@ ul.posts { #post pre.terminal code { background-color: #333; } - -#related { - margin-top: 2em; -} - - #related h2 { - margin-bottom: 1em; - } \ No newline at end of file From a68b67c65ed071dc7f1e5b8a1d108bcfe47bb3c3 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 27 Jan 2013 23:21:31 +0100 Subject: [PATCH 07/21] Added newline to New command for stylistic congruence. --- lib/jekyll/commands/new.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index 51152429..6f9f9da8 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -30,4 +30,4 @@ module Jekyll end end end -end \ No newline at end of file +end From bf78fe9b754109a96b709dccf5b2790bea1c9498 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 27 Jan 2013 23:23:53 +0100 Subject: [PATCH 08/21] Move post scaffold content to a separate method. --- lib/jekyll/commands/new.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index 6f9f9da8..def9a380 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -10,18 +10,21 @@ module Jekyll FileUtils.mkdir_p path FileUtils.cp_r Dir["#{template_site}/*"], path File.open(File.expand_path(self.initialized_post_name, path), "w") do |f| - content = [ - { "layout" => "post", "title" => "Welcome to Jekyll!", "date" => Time.now.strftime('%Y-%m-%d %H:%M:%S'), "categories" => %w(jekyll update) }.to_yaml + "---", - "You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes!", - "To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext.", - "Check out the [Jeyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].", - "[jekyll-gh]: https://github.com/mojombo/github\n[jekyll]: http://jekyllrb.com" - ] - f.write(content.join("#{$/*2}")) + f.write(self.scaffold_post_content) end puts "New jekyll site installed in #{path}." end - + + def self.scaffold_post_content + [ + { "layout" => "post", "title" => "Welcome to Jekyll!", "date" => Time.now.strftime('%Y-%m-%d %H:%M:%S'), "categories" => %w(jekyll update) }.to_yaml + "---", + "You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes!", + "To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext.", + "Check out the [Jeyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].", + "[jekyll-gh]: https://github.com/mojombo/github\n[jekyll]: http://jekyllrb.com" + ].join("#{$/*2}") + end + # Internal: Gets the filename of the sample post to be created # # Returns the filename of the sample post, as a String From 704307d7fef9a0c5e9000e73c73499fc2f755a51 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 27 Jan 2013 23:30:32 +0100 Subject: [PATCH 09/21] Added very basic code snippet example to sample post --- lib/jekyll/commands/new.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index def9a380..51b3dbb1 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -20,6 +20,16 @@ module Jekyll { "layout" => "post", "title" => "Welcome to Jekyll!", "date" => Time.now.strftime('%Y-%m-%d %H:%M:%S'), "categories" => %w(jekyll update) }.to_yaml + "---", "You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes!", "To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext.", + "Jekyll also offers powerful support for code snippets:", + [ + "{% highlight ruby %}", + "def print_hi(name)", + ' puts "Hi, #{name}"', + "end", + "print_hi('Tom')" + "#=> prints 'Hi, Tom' to STDOUT." + "{% endhighlight %}" + ].join("#{$/}"), "Check out the [Jeyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].", "[jekyll-gh]: https://github.com/mojombo/github\n[jekyll]: http://jekyllrb.com" ].join("#{$/*2}") From cff4ec72eabd27b9696cd65c74baecbd9a4b43d9 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 30 Jan 2013 21:05:52 +0100 Subject: [PATCH 10/21] Using .erb file for the new post --- lib/jekyll/commands/new.rb | 26 +++++-------------- .../0000-00-00-sample_post.markdown.erb | 24 +++++++++++++++++ 2 files changed, 30 insertions(+), 20 deletions(-) create mode 100644 lib/site_template/_posts/0000-00-00-sample_post.markdown.erb diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index 51b3dbb1..be0f17c2 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -1,4 +1,5 @@ require 'yaml' +require 'erb' module Jekyll module Commands @@ -8,31 +9,16 @@ module Jekyll path = File.expand_path(args.join(" "), Dir.pwd) template_site = File.expand_path("../../site_template", File.dirname(__FILE__)) FileUtils.mkdir_p path - FileUtils.cp_r Dir["#{template_site}/*"], path + sample_files = Dir["#{template_site}/**/*"].reject {|f| File.extname(f) == ".erb"} + FileUtils.cp_r sample_files, path File.open(File.expand_path(self.initialized_post_name, path), "w") do |f| - f.write(self.scaffold_post_content) + f.write(self.scaffold_post_content(template_site)) end puts "New jekyll site installed in #{path}." end - def self.scaffold_post_content - [ - { "layout" => "post", "title" => "Welcome to Jekyll!", "date" => Time.now.strftime('%Y-%m-%d %H:%M:%S'), "categories" => %w(jekyll update) }.to_yaml + "---", - "You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes!", - "To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext.", - "Jekyll also offers powerful support for code snippets:", - [ - "{% highlight ruby %}", - "def print_hi(name)", - ' puts "Hi, #{name}"', - "end", - "print_hi('Tom')" - "#=> prints 'Hi, Tom' to STDOUT." - "{% endhighlight %}" - ].join("#{$/}"), - "Check out the [Jeyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].", - "[jekyll-gh]: https://github.com/mojombo/github\n[jekyll]: http://jekyllrb.com" - ].join("#{$/*2}") + def self.scaffold_post_content(template_site) + ERB.new(File.read(File.expand_path("_posts/0000-00-00-sample_post.markdown.erb", template_site))).result end # Internal: Gets the filename of the sample post to be created diff --git a/lib/site_template/_posts/0000-00-00-sample_post.markdown.erb b/lib/site_template/_posts/0000-00-00-sample_post.markdown.erb new file mode 100644 index 00000000..95833798 --- /dev/null +++ b/lib/site_template/_posts/0000-00-00-sample_post.markdown.erb @@ -0,0 +1,24 @@ +--- +layout: post +title: "Welcome to Jekyll!" +date: <%= Time.now.strftime('%Y-%m-%d %H:%M:%S') %> +categories: jekyll update +--- + +You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes! +To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext. + +Jekyll also offers powerful support for code snippets: + +{% highlight ruby %} +def print_hi(name) + puts "Hi, #{name}" +end +print_hi('Tom') +#=> prints 'Hi, Tom' to STDOUT. +{% endhighlight %} + +Check out the [Jeyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh]. + +[jekyll-gh]: https://github.com/mojombo/github +[jekyll]: http://jekyllrb.com From 149b95d76750b1d57e6e4737c9cc98e5572b8252 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 28 Feb 2013 22:17:24 +0100 Subject: [PATCH 11/21] Typos in sample post. --- lib/site_template/_posts/0000-00-00-sample_post.markdown.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/site_template/_posts/0000-00-00-sample_post.markdown.erb b/lib/site_template/_posts/0000-00-00-sample_post.markdown.erb index 95833798..c500b41a 100644 --- a/lib/site_template/_posts/0000-00-00-sample_post.markdown.erb +++ b/lib/site_template/_posts/0000-00-00-sample_post.markdown.erb @@ -18,7 +18,7 @@ print_hi('Tom') #=> prints 'Hi, Tom' to STDOUT. {% endhighlight %} -Check out the [Jeyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh]. +Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh]. -[jekyll-gh]: https://github.com/mojombo/github +[jekyll-gh]: https://github.com/mojombo/jekyll [jekyll]: http://jekyllrb.com From 7258b10f88bdb9b1f72b9ef2012601ba07d75eb1 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 28 Feb 2013 22:19:38 +0100 Subject: [PATCH 12/21] We don't need YAML in the new command. --- lib/jekyll/commands/new.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index be0f17c2..c87aebcb 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -1,4 +1,3 @@ -require 'yaml' require 'erb' module Jekyll From b71ec624f84659ac48fc9b0604215d2a449797e1 Mon Sep 17 00:00:00 2001 From: Jonathan Roes Date: Tue, 12 Mar 2013 00:47:42 -0400 Subject: [PATCH 13/21] Add commands/new and scaffold post to gemspec so they get copied over. --- jekyll.gemspec | 5 +++-- lib/site_template/_posts/.gitkeep | 0 2 files changed, 3 insertions(+), 2 deletions(-) delete mode 100644 lib/site_template/_posts/.gitkeep diff --git a/jekyll.gemspec b/jekyll.gemspec index 7d162fcb..8291d9ae 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -48,7 +48,7 @@ Gem::Specification.new do |s| s.add_development_dependency('sequel', "~> 3.42") s.add_development_dependency('htmlentities', "~> 4.3") s.add_development_dependency('hpricot', "~> 0.8") - + # = MANIFEST = s.files = %w[ .travis.yml @@ -75,6 +75,7 @@ Gem::Specification.new do |s| lib/jekyll/command.rb lib/jekyll/commands/build.rb lib/jekyll/commands/migrate.rb + lib/jekyll/commands/new.rb lib/jekyll/commands/serve.rb lib/jekyll/converter.rb lib/jekyll/converters/identity.rb @@ -112,7 +113,7 @@ Gem::Specification.new do |s| lib/site_template/_config.yml lib/site_template/_layouts/default.html lib/site_template/_layouts/post.html - lib/site_template/_posts/.gitkeep + lib/site_template/_posts/0000-00-00-sample_post.markdown.erb lib/site_template/css/screen.css lib/site_template/css/syntax.css lib/site_template/images/.gitkeep diff --git a/lib/site_template/_posts/.gitkeep b/lib/site_template/_posts/.gitkeep deleted file mode 100644 index e69de29b..00000000 From 7a86d901f1bf1927ddbf84a4f4e5be258a189011 Mon Sep 17 00:00:00 2001 From: Jonathan Roes Date: Tue, 12 Mar 2013 00:48:22 -0400 Subject: [PATCH 14/21] Refactor Commands::New a bit and remove scaffold post once copied. --- lib/jekyll/commands/new.rb | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index c87aebcb..dc71545f 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -3,21 +3,21 @@ require 'erb' module Jekyll module Commands class New < Command - + def self.process(args) - path = File.expand_path(args.join(" "), Dir.pwd) - template_site = File.expand_path("../../site_template", File.dirname(__FILE__)) - FileUtils.mkdir_p path - sample_files = Dir["#{template_site}/**/*"].reject {|f| File.extname(f) == ".erb"} - FileUtils.cp_r sample_files, path - File.open(File.expand_path(self.initialized_post_name, path), "w") do |f| + new_blog_path = File.expand_path(args.join(" "), Dir.pwd) + FileUtils.mkdir_p new_blog_path + + create_sample_files! new_blog_path + + File.open(File.expand_path(self.initialized_post_name, new_blog_path), "w") do |f| f.write(self.scaffold_post_content(template_site)) end - puts "New jekyll site installed in #{path}." + puts "New jekyll site installed in #{new_blog_path}." end def self.scaffold_post_content(template_site) - ERB.new(File.read(File.expand_path("_posts/0000-00-00-sample_post.markdown.erb", template_site))).result + ERB.new(File.read(File.expand_path(scaffold_path, template_site))).result end # Internal: Gets the filename of the sample post to be created @@ -26,6 +26,25 @@ module Jekyll def self.initialized_post_name "_posts/#{Time.now.strftime('%Y-%m-%d')}-welcome-to-jekyll.markdown" end + + private + + def self.create_sample_files!(path) + FileUtils.cp_r sample_files, path + FileUtils.rm File.expand_path(scaffold_path, path) + end + + def self.sample_files + Dir.glob("#{template_site}/**/*") + end + + def self.template_site + File.expand_path("../../site_template", File.dirname(__FILE__)) + end + + def self.scaffold_path + "_posts/0000-00-00-sample_post.markdown.erb" + end end end end From b306835ce05c76fbcbda6d993d6a6f98c856d6f2 Mon Sep 17 00:00:00 2001 From: Daniel Grieve Date: Tue, 12 Mar 2013 19:37:27 +0100 Subject: [PATCH 15/21] Add tests for 'new' command. --- test/test_new_command.rb | 104 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 test/test_new_command.rb diff --git a/test/test_new_command.rb b/test/test_new_command.rb new file mode 100644 index 00000000..2532bea8 --- /dev/null +++ b/test/test_new_command.rb @@ -0,0 +1,104 @@ +require 'helper' +require 'jekyll/commands/new' + +class TestNewCommand < Test::Unit::TestCase + def dir_contents(path) + Dir["#{path}/**/*"].each do |file| + file.gsub! path, '' + end + end + + def site_template + File.expand_path("../lib/site_template", File.dirname(__FILE__)) + end + + context 'when args contains a path' do + setup do + @path = 'new-site' + @args = [@path] + @full_path = File.expand_path(@path, Dir.pwd) + end + + teardown do + FileUtils.rm_r @full_path + end + + should 'create a new directory' do + assert !File.exists?(@full_path) + capture_stdout { Jekyll::Commands::New.process(@args) } + assert File.exists?(@full_path) + end + + should 'display a success message' do + output = capture_stdout { Jekyll::Commands::New.process(@args) } + success_message = "New jekyll site installed in #{@full_path}.\n" + assert_equal success_message, output + end + + should 'copy the static files in site template to the new directory' do + static_template_files = dir_contents(site_template).reject do |f| + File.extname(f) == '.erb' + end + + capture_stdout { Jekyll::Commands::New.process(@args) } + + new_site_files = dir_contents(@full_path).select do |f| + static_template_files.include? f + end + + assert_same_elements static_template_files, new_site_files + end + + should 'process any ERB files' do + erb_template_files = dir_contents(site_template).select do |f| + File.extname(f) == '.erb' + end + + stubbed_date = '2013-01-01' + stub.instance_of(Time).strftime { stubbed_date } + + erb_template_files.each do |f| + f.chomp! '.erb' + f.gsub! '0000-00-00', stubbed_date + end + + capture_stdout { Jekyll::Commands::New.process(@args) } + + new_site_files = dir_contents(@full_path).select do |f| + erb_template_files.include? f + end + + assert_same_elements erb_template_files, new_site_files + end + end + + context 'when multiple args are given' do + setup do + @site_name_with_spaces = 'new site name' + @multiple_args = @site_name_with_spaces.split + end + + teardown do + FileUtils.rm_r File.expand_path(@site_name_with_spaces, Dir.pwd) + end + + should 'create a new directory' do + assert !File.exists?(@site_name_with_spaces) + capture_stdout { Jekyll::Commands::New.process(@multiple_args) } + assert File.exists?(@site_name_with_spaces) + end + end + + context 'when no args are given' do + setup do + @empty_args = [] + end + + should 'raise an ArgumentError' do + exception = assert_raise ArgumentError do + Jekyll::Commands::New.process(@empty_args) + end + assert_equal 'You must specify a path.', exception.message + end + end +end From 099fcc27d6517310e957a30d7d3ed0a2778ced69 Mon Sep 17 00:00:00 2001 From: Daniel Grieve Date: Wed, 13 Mar 2013 19:21:11 +0000 Subject: [PATCH 16/21] raise ArgumentError if no args. rename sample post --- lib/jekyll/commands/new.rb | 30 +++++++++---------- ...0000-00-00-welcome-to-jekyll.markdown.erb} | 0 2 files changed, 15 insertions(+), 15 deletions(-) rename lib/site_template/_posts/{0000-00-00-sample_post.markdown.erb => 0000-00-00-welcome-to-jekyll.markdown.erb} (100%) diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index dc71545f..103a5950 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -3,8 +3,9 @@ require 'erb' module Jekyll module Commands class New < Command - def self.process(args) + raise ArgumentError.new('You must specify a path.') if args.empty? + new_blog_path = File.expand_path(args.join(" "), Dir.pwd) FileUtils.mkdir_p new_blog_path @@ -28,23 +29,22 @@ module Jekyll end private + def self.create_sample_files!(path) + FileUtils.cp_r sample_files, path + FileUtils.rm File.expand_path(scaffold_path, path) + end - def self.create_sample_files!(path) - FileUtils.cp_r sample_files, path - FileUtils.rm File.expand_path(scaffold_path, path) - end + def self.sample_files + Dir.glob("#{template_site}/**/*") + end - def self.sample_files - Dir.glob("#{template_site}/**/*") - end + def self.template_site + File.expand_path("../../site_template", File.dirname(__FILE__)) + end - def self.template_site - File.expand_path("../../site_template", File.dirname(__FILE__)) - end - - def self.scaffold_path - "_posts/0000-00-00-sample_post.markdown.erb" - end + def self.scaffold_path + "_posts/0000-00-00-welcome-to-jekyll.markdown.erb" + end end end end diff --git a/lib/site_template/_posts/0000-00-00-sample_post.markdown.erb b/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb similarity index 100% rename from lib/site_template/_posts/0000-00-00-sample_post.markdown.erb rename to lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb From 1ab83ff9e96b83566874a32fea52c9f5ba92e9be Mon Sep 17 00:00:00 2001 From: Daniel Grieve Date: Wed, 13 Mar 2013 19:55:15 +0000 Subject: [PATCH 17/21] fix test to highlight issue with FileUtils.cp_r --- test/test_new_command.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_new_command.rb b/test/test_new_command.rb index 2532bea8..739fcb13 100644 --- a/test/test_new_command.rb +++ b/test/test_new_command.rb @@ -42,8 +42,8 @@ class TestNewCommand < Test::Unit::TestCase capture_stdout { Jekyll::Commands::New.process(@args) } - new_site_files = dir_contents(@full_path).select do |f| - static_template_files.include? f + new_site_files = dir_contents(@full_path).reject do |f| + File.extname(f) == '.erb' end assert_same_elements static_template_files, new_site_files From 4be5dfdb9a5bcc2befaa057feb13988f909768ef Mon Sep 17 00:00:00 2001 From: Daniel Grieve Date: Wed, 13 Mar 2013 21:27:41 +0000 Subject: [PATCH 18/21] fix copying of site template files --- jekyll.gemspec | 2 +- lib/jekyll/commands/new.rb | 16 ++++++---------- test/test_new_command.rb | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 8291d9ae..0ebd7f67 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -113,7 +113,7 @@ Gem::Specification.new do |s| lib/site_template/_config.yml lib/site_template/_layouts/default.html lib/site_template/_layouts/post.html - lib/site_template/_posts/0000-00-00-sample_post.markdown.erb + lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb lib/site_template/css/screen.css lib/site_template/css/syntax.css lib/site_template/images/.gitkeep diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index 103a5950..e650dc52 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -9,16 +9,16 @@ module Jekyll new_blog_path = File.expand_path(args.join(" "), Dir.pwd) FileUtils.mkdir_p new_blog_path - create_sample_files! new_blog_path + create_sample_files new_blog_path File.open(File.expand_path(self.initialized_post_name, new_blog_path), "w") do |f| - f.write(self.scaffold_post_content(template_site)) + f.write(self.scaffold_post_content(site_template)) end puts "New jekyll site installed in #{new_blog_path}." end def self.scaffold_post_content(template_site) - ERB.new(File.read(File.expand_path(scaffold_path, template_site))).result + ERB.new(File.read(File.expand_path(scaffold_path, site_template))).result end # Internal: Gets the filename of the sample post to be created @@ -29,16 +29,12 @@ module Jekyll end private - def self.create_sample_files!(path) - FileUtils.cp_r sample_files, path + def self.create_sample_files(path) + FileUtils.cp_r site_template + '/.', path FileUtils.rm File.expand_path(scaffold_path, path) end - def self.sample_files - Dir.glob("#{template_site}/**/*") - end - - def self.template_site + def self.site_template File.expand_path("../../site_template", File.dirname(__FILE__)) end diff --git a/test/test_new_command.rb b/test/test_new_command.rb index 739fcb13..bc9e6585 100644 --- a/test/test_new_command.rb +++ b/test/test_new_command.rb @@ -43,7 +43,7 @@ class TestNewCommand < Test::Unit::TestCase capture_stdout { Jekyll::Commands::New.process(@args) } new_site_files = dir_contents(@full_path).reject do |f| - File.extname(f) == '.erb' + File.extname(f) == '.markdown' end assert_same_elements static_template_files, new_site_files From 5bcc2fd8f9a0690701d6c4b4eafaa5acca0b423a Mon Sep 17 00:00:00 2001 From: Daniel Grieve Date: Wed, 13 Mar 2013 21:57:08 +0000 Subject: [PATCH 19/21] update safe_yaml --- jekyll.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 0ebd7f67..a6efcd62 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('kramdown', "~> 0.13.4") s.add_runtime_dependency('pygments.rb', "~> 0.3.2") s.add_runtime_dependency('commander', "~> 4.1.3") - s.add_runtime_dependency('safe_yaml', "~> 0.4") + s.add_runtime_dependency('safe_yaml', "~> 0.7.0") s.add_development_dependency('rake', "~> 0.9") s.add_development_dependency('rdoc', "~> 3.11") From 9726bd625d3d7b6fb053966dc99cd97795f1e602 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 17 Mar 2013 15:46:46 +0100 Subject: [PATCH 20/21] Whitespace issue in bin/jekyll --- bin/jekyll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/jekyll b/bin/jekyll index 02c364cf..1dacb29b 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -16,7 +16,7 @@ global_option '-d', '--destination [DIR]', 'Destination directory (defaults to . global_option '--safe', 'Safe mode (defaults to false)' global_option '--plugins', 'Plugins directory (defaults to ./_plugins)' global_option '--layouts', 'Layouts directory (defaults to ./_layouts)' - + # Option names don't always directly match the configuration value we'd like. # This method will rename options to match what Jekyll configuration expects. # From a15e0c811b92bfd2c7966897e7c5ce550a05130a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 17 Mar 2013 15:47:26 +0100 Subject: [PATCH 21/21] Remove git poop. --- jekyll.gemspec | 6 ------ 1 file changed, 6 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index b3250899..c93639c5 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -70,11 +70,8 @@ Gem::Specification.new do |s| lib/jekyll.rb lib/jekyll/command.rb lib/jekyll/commands/build.rb -<<<<<<< HEAD lib/jekyll/commands/migrate.rb lib/jekyll/commands/new.rb -======= ->>>>>>> master lib/jekyll/commands/serve.rb lib/jekyll/converter.rb lib/jekyll/converters/identity.rb @@ -98,7 +95,6 @@ Gem::Specification.new do |s| lib/jekyll/tags/highlight.rb lib/jekyll/tags/include.rb lib/jekyll/tags/post_url.rb -<<<<<<< HEAD lib/site_template/_config.yml lib/site_template/_layouts/default.html lib/site_template/_layouts/post.html @@ -108,7 +104,6 @@ Gem::Specification.new do |s| lib/site_template/images/.gitkeep lib/site_template/images/rss.png lib/site_template/index.html -======= script/bootstrap site/.gitignore site/CNAME @@ -159,7 +154,6 @@ Gem::Specification.new do |s| site/img/tube1x.png site/index.html site/js/modernizr-2.5.3.min.js ->>>>>>> master test/fixtures/broken_front_matter1.erb test/fixtures/broken_front_matter2.erb test/fixtures/broken_front_matter3.erb