From 013e2f159d583cf635448e6cdf8fc050d572b7a1 Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Thu, 19 May 2016 20:32:56 -0500 Subject: [PATCH 01/10] Rubocop fixes for test/test_url.rb --- .rubocop.yml | 1 - test/test_url.rb | 46 ++++++++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ac3c8300..020e4f92 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -84,7 +84,6 @@ AllCops: - test/test_static_file.rb - test/test_tags.rb - test/test_theme.rb - - test/test_url.rb - test/test_utils.rb - bin/**/* - benchmark/**/* diff --git a/test/test_url.rb b/test/test_url.rb index 99ee5e61..fc9a46eb 100644 --- a/test/test_url.rb +++ b/test/test_url.rb @@ -1,8 +1,7 @@ -require 'helper' +require "helper" class TestURL < JekyllUnitTest context "The URL class" do - should "throw an exception if neither permalink or template is specified" do assert_raises ArgumentError do URL.new(:placeholders => {}) @@ -11,46 +10,46 @@ class TestURL < JekyllUnitTest should "replace placeholders in templates" do assert_equal "/foo/bar", URL.new( - :template => "/:x/:y", - :placeholders => {:x => "foo", :y => "bar"} + :template => "/:x/:y", + :placeholders => { :x => "foo", :y => "bar" } ).to_s end should "handle multiple of the same key in the template" do - assert_equal '/foo/bar/foo/', URL.new( - :template => "/:x/:y/:x/", - :placeholders => {:x => "foo", :y => "bar"} + assert_equal "/foo/bar/foo/", URL.new( + :template => "/:x/:y/:x/", + :placeholders => { :x => "foo", :y => "bar" } ).to_s end should "use permalink if given" do assert_equal "/le/perma/link", URL.new( - :template => "/:x/:y", - :placeholders => {:x => "foo", :y => "bar"}, - :permalink => "/le/perma/link" + :template => "/:x/:y", + :placeholders => { :x => "foo", :y => "bar" }, + :permalink => "/le/perma/link" ).to_s end should "replace placeholders in permalinks" do assert_equal "/foo/bar", URL.new( - :template => "/baz", - :permalink => "/:x/:y", - :placeholders => {:x => "foo", :y => "bar"} + :template => "/baz", + :permalink => "/:x/:y", + :placeholders => { :x => "foo", :y => "bar" } ).to_s end should "handle multiple of the same key in the permalink" do - assert_equal '/foo/bar/foo/', URL.new( - :template => "/baz", - :permalink => "/:x/:y/:x/", - :placeholders => {:x => "foo", :y => "bar"} + assert_equal "/foo/bar/foo/", URL.new( + :template => "/baz", + :permalink => "/:x/:y/:x/", + :placeholders => { :x => "foo", :y => "bar" } ).to_s end should "handle nil values for keys in the template" do - assert_equal '/foo/bar/', URL.new( - :template => "/:x/:y/:z/", - :placeholders => {:x => "foo", :y => "bar", :z => nil} + assert_equal "/foo/bar/", URL.new( + :template => "/:x/:y/:z/", + :placeholders => { :x => "foo", :y => "bar", :z => nil } ).to_s end @@ -60,17 +59,16 @@ class TestURL < JekyllUnitTest "methods" => { "output" => true } - }, + } }) site.read matching_doc = site.collections["methods"].docs.find do |doc| doc.relative_path == "_methods/escape-+ #%20[].md" end - assert_equal '/methods/escape-+-20/escape-20.html', URL.new( - :template => '/methods/:title/:name:output_ext', + assert_equal "/methods/escape-+-20/escape-20.html", URL.new( + :template => "/methods/:title/:name:output_ext", :placeholders => matching_doc.url_placeholders ).to_s end - end end From 1380836a4bf5a3e8be8eb2ddf74318718f3979d2 Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Thu, 19 May 2016 20:36:07 -0500 Subject: [PATCH 02/10] Rubocop fixes for test/test_theme.rb --- .rubocop.yml | 1 - test/test_theme.rb | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 020e4f92..47ad2353 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -83,7 +83,6 @@ AllCops: - test/test_site.rb - test/test_static_file.rb - test/test_tags.rb - - test/test_theme.rb - test/test_utils.rb - bin/**/* - benchmark/**/* diff --git a/test/test_theme.rb b/test/test_theme.rb index 9767946e..a448ce30 100644 --- a/test/test_theme.rb +++ b/test/test_theme.rb @@ -1,14 +1,14 @@ -require 'helper' +require "helper" class TestTheme < JekyllUnitTest def setup - @theme = Theme.new('test-theme') + @theme = Theme.new("test-theme") @expected_root = File.expand_path "./fixtures/test-theme", File.dirname(__FILE__) end context "initializing" do should "normalize the theme name" do - theme = Theme.new(' Test-Theme ') + theme = Theme.new(" Test-Theme ") assert_equal "test-theme", theme.name end @@ -28,7 +28,8 @@ class TestTheme < JekyllUnitTest should "add itself to sass's load path" do @theme.configure_sass - assert Sass.load_paths.include?(@theme.sass_path), "Sass load paths should include the theme sass dir" + message = "Sass load paths should include the theme sass dir" + assert Sass.load_paths.include?(@theme.sass_path), message end end From 16c1146b4f55f2047367a28946b02015adca3e6e Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Thu, 19 May 2016 20:48:30 -0500 Subject: [PATCH 03/10] Rubocop fixes for test/test_static_file.rb --- .rubocop.yml | 1 - test/test_static_file.rb | 42 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 47ad2353..24816dc7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -81,7 +81,6 @@ AllCops: - test/test_related_posts.rb - test/test_sass.rb - test/test_site.rb - - test/test_static_file.rb - test/test_tags.rb - test/test_utils.rb - bin/**/* diff --git a/test/test_static_file.rb b/test/test_static_file.rb index 85512ab4..b705ff05 100644 --- a/test/test_static_file.rb +++ b/test/test_static_file.rb @@ -1,4 +1,4 @@ -require 'helper' +require "helper" class TestStaticFile < JekyllUnitTest def make_dummy_file(filename) @@ -6,7 +6,8 @@ class TestStaticFile < JekyllUnitTest end def modify_dummy_file(filename) - offset = "some content".size + string = "some content" + offset = string.size File.write(source_dir(filename), "more content", offset) end @@ -18,13 +19,13 @@ class TestStaticFile < JekyllUnitTest StaticFile.new(@site, base, dir, name) end - def setup_static_file_with_collection(base, dir, name, label, metadata) - site = fixture_site('collections' => {label => metadata}) - StaticFile.new(site, base, dir, name, site.collections[label]) + def setup_static_file_with_collection(base, dir, name, metadata) + site = fixture_site("collections" => { "foo" => metadata }) + StaticFile.new(site, base, dir, name, site.collections["foo"]) end def setup_static_file_with_defaults(base, dir, name, defaults) - site = fixture_site('defaults' => defaults) + site = fixture_site("defaults" => defaults) StaticFile.new(site, base, dir, name) end @@ -62,17 +63,16 @@ class TestStaticFile < JekyllUnitTest end should "have a destination relative directory with a collection" do - static_file = setup_static_file_with_collection( - "root", "_foo/dir/subdir", "file.html", "foo", {"output" => true}) + static_file = setup_static_file_with_collection("root", "_foo/dir/subdir", + "file.html", { "output" => true }) assert_equal :foo, static_file.type assert_equal "/foo/dir/subdir/file.html", static_file.url assert_equal "/foo/dir/subdir", static_file.destination_rel_dir end - should "use its collection's permalink template for the destination relative directory" do - static_file = setup_static_file_with_collection( - "root", "_foo/dir/subdir", "file.html", "foo", - {"output" => true, "permalink" => "/:path/"}) + should "use its collection's permalink template for destination relative directory" do + static_file = setup_static_file_with_collection("root", "_foo/dir/subdir", + "file.html", { "output" => true, "permalink" => "/:path/" }) assert_equal :foo, static_file.type assert_equal "/dir/subdir/file.html", static_file.url assert_equal "/dir/subdir", static_file.destination_rel_dir @@ -86,13 +86,13 @@ class TestStaticFile < JekyllUnitTest should "use the _config.yml defaults to determine writability" do defaults = [{ - "scope" => {"path" => "private"}, - "values" => {"published" => false} + "scope" => { "path" => "private" }, + "values" => { "published" => false } }] - static_file = setup_static_file_with_defaults( - "root", "private/dir/subdir", "file.html", defaults) + static_file = setup_static_file_with_defaults("root", "private/dir/subdir", + "file.html", defaults) assert(!static_file.write?, - "static_file.write? should return false when _config.yml sets " + + "static_file.write? should return false when _config.yml sets " \ "`published: false`") end @@ -116,15 +116,15 @@ class TestStaticFile < JekyllUnitTest assert @static_file.write?, "always true, with current implementation" end - should "be able to write itself to the desitination direcotry" do + should "be able to write itself to the desitination directory" do assert @static_file.write(dest_dir) end should "be able to convert to liquid" do expected = { - "extname" => ".txt", - "modified_time" => @static_file.modified_time, - "path" => "/static_file.txt", + "extname" => ".txt", + "modified_time" => @static_file.modified_time, + "path" => "/static_file.txt" } assert_equal expected, @static_file.to_liquid end From a9f110b861bed10cc3f01e145956aa6343e00d0a Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Thu, 19 May 2016 20:51:58 -0500 Subject: [PATCH 04/10] Rubocop fixes for test/test_sass.rb --- .rubocop.yml | 1 - test/test_sass.rb | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 24816dc7..9680ee72 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -79,7 +79,6 @@ AllCops: - test/test_page.rb - test/test_regenerator.rb - test/test_related_posts.rb - - test/test_sass.rb - test/test_site.rb - test/test_tags.rb - test/test_utils.rb diff --git a/test/test_sass.rb b/test/test_sass.rb index 153c339a..f5241790 100644 --- a/test/test_sass.rb +++ b/test/test_sass.rb @@ -1,10 +1,10 @@ -require 'helper' +require "helper" class TestSass < JekyllUnitTest context "importing partials" do setup do @site = Jekyll::Site.new(Jekyll.configuration({ - "source" => source_dir, + "source" => source_dir, "destination" => dest_dir })) @site.process @@ -16,11 +16,13 @@ class TestSass < JekyllUnitTest end should "register the SCSS converter" do - assert !!@site.find_converter_instance(Jekyll::Converters::Scss), "SCSS converter implementation should exist." + message = "SCSS converter implementation should exist." + assert !!@site.find_converter_instance(Jekyll::Converters::Scss), message end should "register the Sass converter" do - assert !!@site.find_converter_instance(Jekyll::Converters::Sass), "Sass converter implementation should exist." + message = "Sass converter implementation should exist." + assert !!@site.find_converter_instance(Jekyll::Converters::Sass), message end end end From 8f07affe2ad162ea72c7074c627223c53dad925e Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Thu, 19 May 2016 20:55:44 -0500 Subject: [PATCH 05/10] Rubocop fixes for test/test_related_posts.rb --- .rubocop.yml | 1 - test/test_related_posts.rb | 13 ++++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 9680ee72..9aeca702 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -78,7 +78,6 @@ AllCops: - test/test_liquid_renderer.rb - test/test_page.rb - test/test_regenerator.rb - - test/test_related_posts.rb - test/test_site.rb - test/test_tags.rb - test/test_utils.rb diff --git a/test/test_related_posts.rb b/test/test_related_posts.rb index cd114c04..cda18dfc 100644 --- a/test/test_related_posts.rb +++ b/test/test_related_posts.rb @@ -1,4 +1,4 @@ -require 'helper' +require "helper" class TestRelatedPosts < JekyllUnitTest context "building related posts without lsi" do @@ -33,26 +33,29 @@ class TestRelatedPosts < JekyllUnitTest @site.reset @site.read - require 'classifier-reborn' + require "classifier-reborn" Jekyll::RelatedPosts.lsi = nil end should "index Jekyll::Post objects" do @site.posts.docs = @site.posts.docs.first(1) - expect_any_instance_of(::ClassifierReborn::LSI).to receive(:add_item).with(kind_of(Jekyll::Document)) + expect_any_instance_of(::ClassifierReborn::LSI).to \ + receive(:add_item).with(kind_of(Jekyll::Document)) Jekyll::RelatedPosts.new(@site.posts.last).build_index end should "find related Jekyll::Post objects, given a Jekyll::Post object" do post = @site.posts.last allow_any_instance_of(::ClassifierReborn::LSI).to receive(:build_index) - expect_any_instance_of(::ClassifierReborn::LSI).to receive(:find_related).with(post, 11).and_return(@site.posts[-1..-9]) + expect_any_instance_of(::ClassifierReborn::LSI).to \ + receive(:find_related).with(post, 11).and_return(@site.posts[-1..-9]) Jekyll::RelatedPosts.new(post).build end should "use lsi for the related posts" do - allow_any_instance_of(::ClassifierReborn::LSI).to receive(:find_related).and_return(@site.posts[-1..-9]) + allow_any_instance_of(::ClassifierReborn::LSI).to \ + receive(:find_related).and_return(@site.posts[-1..-9]) allow_any_instance_of(::ClassifierReborn::LSI).to receive(:build_index) assert_equal @site.posts[-1..-9], Jekyll::RelatedPosts.new(@site.posts.last).build From e85f2a0ee9be3cfe7805976541280c4b93d97a1c Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Thu, 19 May 2016 20:58:09 -0500 Subject: [PATCH 06/10] Rubocop fixes for lib/jekyll/version.rb --- .rubocop.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 9aeca702..0e65424c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -65,7 +65,6 @@ AllCops: - lib/jekyll/utils/ansi.rb - lib/jekyll/utils/platforms.rb - lib/jekyll/utils.rb - - lib/jekyll/version.rb - lib/jekyll.rb - features/step_definitions.rb - features/support/formatter.rb From d743c8035793ea0ddf87e4849a617db179da6fc9 Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Thu, 19 May 2016 21:06:35 -0500 Subject: [PATCH 07/10] Rubocop fixes for lib/jekyll/utils/ansi.rb --- .rubocop.yml | 1 - lib/jekyll/utils/ansi.rb | 18 +++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0e65424c..56b29b9c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -62,7 +62,6 @@ AllCops: - lib/jekyll/tags/post_url.rb - lib/jekyll/theme.rb - lib/jekyll/url.rb - - lib/jekyll/utils/ansi.rb - lib/jekyll/utils/platforms.rb - lib/jekyll/utils.rb - lib/jekyll.rb diff --git a/lib/jekyll/utils/ansi.rb b/lib/jekyll/utils/ansi.rb index 933b4323..715cb277 100644 --- a/lib/jekyll/utils/ansi.rb +++ b/lib/jekyll/utils/ansi.rb @@ -8,17 +8,17 @@ module Jekyll extend self ESCAPE = format("%c", 27) - MATCH = /#{ESCAPE}\[(?:\d+)(?:;\d+)*(j|k|m|s|u|A|B|G)|\e\(B\e\[m/ix.freeze + MATCH = /#{ESCAPE}\[(?:\d+)(?:;\d+)*(j|k|m|s|u|A|B|G)|\e\(B\e\[m/ix COLORS = { - :red => 31, - :green => 32, - :black => 30, + :red => 31, + :green => 32, + :black => 30, :magenta => 35, - :yellow => 33, - :white => 37, - :blue => 34, - :cyan => 36 - } + :yellow => 33, + :white => 37, + :blue => 34, + :cyan => 36 + }.freeze # Strip ANSI from the current string. It also strips cursor stuff, # well some of it, and it also strips some other stuff that a lot of From 281a873c7156f9700c3c143e8deba37c0f528d49 Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Thu, 19 May 2016 21:07:44 -0500 Subject: [PATCH 08/10] lib/jekyll/utils/platforms.rb didn't have any rubocop errors --- .rubocop.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 56b29b9c..4189be7b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -62,7 +62,6 @@ AllCops: - lib/jekyll/tags/post_url.rb - lib/jekyll/theme.rb - lib/jekyll/url.rb - - lib/jekyll/utils/platforms.rb - lib/jekyll/utils.rb - lib/jekyll.rb - features/step_definitions.rb From 6db52725288b35bedb6a4442b9f1c2c13e28aae3 Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Fri, 20 May 2016 20:36:49 -0500 Subject: [PATCH 09/10] Splitting args onto own lines in test/test_static_file.rb For functions where the character limit was exceeded and line wrapping was needed, this commit just splits each arg into it's own line. --- test/test_static_file.rb | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/test/test_static_file.rb b/test/test_static_file.rb index b705ff05..7019a107 100644 --- a/test/test_static_file.rb +++ b/test/test_static_file.rb @@ -63,16 +63,24 @@ class TestStaticFile < JekyllUnitTest end should "have a destination relative directory with a collection" do - static_file = setup_static_file_with_collection("root", "_foo/dir/subdir", - "file.html", { "output" => true }) + static_file = setup_static_file_with_collection( + "root", + "_foo/dir/subdir", + "file.html", + { "output" => true } + ) assert_equal :foo, static_file.type assert_equal "/foo/dir/subdir/file.html", static_file.url assert_equal "/foo/dir/subdir", static_file.destination_rel_dir end should "use its collection's permalink template for destination relative directory" do - static_file = setup_static_file_with_collection("root", "_foo/dir/subdir", - "file.html", { "output" => true, "permalink" => "/:path/" }) + static_file = setup_static_file_with_collection( + "root", + "_foo/dir/subdir", + "file.html", + { "output" => true, "permalink" => "/:path/" } + ) assert_equal :foo, static_file.type assert_equal "/dir/subdir/file.html", static_file.url assert_equal "/dir/subdir", static_file.destination_rel_dir @@ -89,8 +97,12 @@ class TestStaticFile < JekyllUnitTest "scope" => { "path" => "private" }, "values" => { "published" => false } }] - static_file = setup_static_file_with_defaults("root", "private/dir/subdir", - "file.html", defaults) + static_file = setup_static_file_with_defaults( + "root", + "private/dir/subdir", + "file.html", + defaults + ) assert(!static_file.write?, "static_file.write? should return false when _config.yml sets " \ "`published: false`") From dbda462c2f001f0d69e581f3c4664696b43e96ba Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Fri, 20 May 2016 21:51:16 -0500 Subject: [PATCH 10/10] Adding double quotes & freeze back to version after rebase --- lib/jekyll/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/version.rb b/lib/jekyll/version.rb index e482bd23..a8d86cb3 100644 --- a/lib/jekyll/version.rb +++ b/lib/jekyll/version.rb @@ -1,3 +1,3 @@ module Jekyll - VERSION = '3.2.0.pre.beta1' + VERSION = "3.2.0.pre.beta1".freeze end