From ba48870eadd48cdd2e2981a5904e164e915b2320 Mon Sep 17 00:00:00 2001 From: Eric Theise Date: Thu, 10 Jan 2013 12:29:04 -0800 Subject: [PATCH 1/6] outputting full path when file does not parse --- lib/jekyll/convertible.rb | 4 ++-- test/test_convertible.rb | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index dab0545c..26f7a0c9 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -33,9 +33,9 @@ module Jekyll self.data = YAML.load($1) end rescue => e - puts "Error reading file #{name}: #{e.message}" + puts "Error reading file #{File.join(base,name)}: #{e.message}" rescue SyntaxError => e - puts "YAML Exception reading #{name}: #{e.message}" + puts "YAML Exception reading #{File.join(base,name)}: #{e.message}" end self.data ||= {} diff --git a/test/test_convertible.rb b/test/test_convertible.rb index b9a9e41c..3ad3c817 100644 --- a/test/test_convertible.rb +++ b/test/test_convertible.rb @@ -20,20 +20,26 @@ class TestConvertible < Test::Unit::TestCase end should "not parse if there is syntax error in front-matter" do + @name = 'broken_front_matter2.erb' out = capture_stdout do - ret = @convertible.read_yaml(@base, 'broken_front_matter2.erb') + ret = @convertible.read_yaml(@base, @name) assert_equal({}, ret) end assert_match(/YAML Exception|syntax error/, out) + assert_match(/#{@base}/, out) + assert_match(/#{@name}/, out) end if RUBY_VERSION >= '1.9.2' should "not parse if there is encoding error in file" do + @name = 'broken_front_matter3.erb' out = capture_stdout do - ret = @convertible.read_yaml(@base, 'broken_front_matter3.erb') + ret = @convertible.read_yaml(@base, @name) assert_equal({}, ret) end assert_match(/invalid byte sequence in UTF-8/, out) + assert_match(/#{@base}/, out) + assert_match(/#{@name}/, out) end end end From 3e7f00ae1967c9f342e4b0c81707c1ab857f52a6 Mon Sep 17 00:00:00 2001 From: Eric Theise Date: Thu, 10 Jan 2013 13:01:50 -0800 Subject: [PATCH 2/6] test the path, not the parts --- test/test_convertible.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/test_convertible.rb b/test/test_convertible.rb index 3ad3c817..80353a9d 100644 --- a/test/test_convertible.rb +++ b/test/test_convertible.rb @@ -26,8 +26,7 @@ class TestConvertible < Test::Unit::TestCase assert_equal({}, ret) end assert_match(/YAML Exception|syntax error/, out) - assert_match(/#{@base}/, out) - assert_match(/#{@name}/, out) + assert_match(/#{File.join(@base,@name)}/, out) end if RUBY_VERSION >= '1.9.2' @@ -38,8 +37,7 @@ class TestConvertible < Test::Unit::TestCase assert_equal({}, ret) end assert_match(/invalid byte sequence in UTF-8/, out) - assert_match(/#{@base}/, out) - assert_match(/#{@name}/, out) + assert_match(/#{File.join(@base,@name)}/, out) end end end From cf42c566308c3473f0188e2f28e1250f1bb657a2 Mon Sep 17 00:00:00 2001 From: Eric Theise Date: Thu, 10 Jan 2013 14:07:10 -0800 Subject: [PATCH 3/6] stick to good coding standards --- test/test_convertible.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_convertible.rb b/test/test_convertible.rb index 80353a9d..b5afa86f 100644 --- a/test/test_convertible.rb +++ b/test/test_convertible.rb @@ -26,7 +26,7 @@ class TestConvertible < Test::Unit::TestCase assert_equal({}, ret) end assert_match(/YAML Exception|syntax error/, out) - assert_match(/#{File.join(@base,@name)}/, out) + assert_match(/#{File.join(@base, @name)}/, out) end if RUBY_VERSION >= '1.9.2' @@ -37,7 +37,7 @@ class TestConvertible < Test::Unit::TestCase assert_equal({}, ret) end assert_match(/invalid byte sequence in UTF-8/, out) - assert_match(/#{File.join(@base,@name)}/, out) + assert_match(/#{File.join(@base, @name)}/, out) end end end From a5c908ac3f3d55bf6ed25695831f9e5affbde0c4 Mon Sep 17 00:00:00 2001 From: Eric Theise Date: Thu, 10 Jan 2013 14:13:11 -0800 Subject: [PATCH 4/6] no good reason for making 'name' an instance variable --- test/test_convertible.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test_convertible.rb b/test/test_convertible.rb index b5afa86f..82e4d27f 100644 --- a/test/test_convertible.rb +++ b/test/test_convertible.rb @@ -20,24 +20,24 @@ class TestConvertible < Test::Unit::TestCase end should "not parse if there is syntax error in front-matter" do - @name = 'broken_front_matter2.erb' + name = 'broken_front_matter2.erb' out = capture_stdout do - ret = @convertible.read_yaml(@base, @name) + ret = @convertible.read_yaml(@base, name) assert_equal({}, ret) end assert_match(/YAML Exception|syntax error/, out) - assert_match(/#{File.join(@base, @name)}/, out) + assert_match(/#{File.join(@base, name)}/, out) end if RUBY_VERSION >= '1.9.2' should "not parse if there is encoding error in file" do - @name = 'broken_front_matter3.erb' + name = 'broken_front_matter3.erb' out = capture_stdout do - ret = @convertible.read_yaml(@base, @name) + ret = @convertible.read_yaml(@base, name) assert_equal({}, ret) end assert_match(/invalid byte sequence in UTF-8/, out) - assert_match(/#{File.join(@base, @name)}/, out) + assert_match(/#{File.join(@base, name)}/, out) end end end From 7782e0b1a10a4719721df92ce413143e47353735 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 10 Jan 2013 21:44:08 -0600 Subject: [PATCH 5/6] Add a CONTRIBUTING file This uses the content of the 'Contribute' wiki page. --- CONTRIBUTING.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..fa6fb807 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,45 @@ +Contribute +========== + +So you've got an awesome idea to throw into Jekyll. Great! Please keep the following in mind: + +* **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. Please stay in the confines of the current test suite and use [Shoulda](http://github.com/thoughtbot/shoulda/tree/master) and [RR](http://github.com/btakita/rr/tree/master). +* If it's a brand new feature, make sure to create a new [Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps where appropriate. Also, whipping up some documentation in your fork's wiki would be appreciated, and once merged it will be transferred over to the main wiki. + +Test Dependencies +----------------- + +To run the test suite and build the gem you'll need to install Jekyll's dependencies. Jekyll uses Bundler, so a quick run of the bundle command and you're all set! + + $ bundle + +Before you start, run the tests and make sure that they pass (to confirm your environment is configured properly): + + $ rake test + $ rake features + +Workflow +-------- + +Here's the most direct way to get your work merged into the project: +* Fork the project +* Clone down your fork ( `git clone git://github.com//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. +* Make sure everything still passes by running `rake` +* If necessary, rebase your commits into logical chunks, without errors +* Push the branch up ( `git push origin my_awesome_feature` ) +* Create an issue with a description and link to your branch + +Gotchas +------- + +* If you want to bump the gem version, please put that in a separate commit. This way, the maintainers can control when the gem gets released. +* Try to keep your patch(es) based from the latest commit on mojombo/jekyll. The easier it is to apply your work, the less work the maintainers have to do, which is always a good thing. +* Please don't tag your GitHub issue with [fix], [feature], etc. The maintainers actively read the issues and will label it once they come across it. + +Finally... +---------- + +Thanks! Hacking on Jekyll should be fun, and if for some reason it's a pain to do let us know so we can fix it. From 6253f79de2ebebb5bfc8bf70f05ed92b570b0417 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 10 Jan 2013 22:11:13 -0800 Subject: [PATCH 6/6] Added space between arguments in Convertible errors --- lib/jekyll/convertible.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 26f7a0c9..e71fe1bf 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -33,9 +33,9 @@ module Jekyll self.data = YAML.load($1) end rescue => e - puts "Error reading file #{File.join(base,name)}: #{e.message}" + puts "Error reading file #{File.join(base, name)}: #{e.message}" rescue SyntaxError => e - puts "YAML Exception reading #{File.join(base,name)}: #{e.message}" + puts "YAML Exception reading #{File.join(base, name)}: #{e.message}" end self.data ||= {}