зеркало из https://github.com/github/pages-gem.git
Roll back remote themes for gem-based themes
This commit is contained in:
Родитель
17e1f803e6
Коммит
0a269c2c70
|
@ -159,12 +159,7 @@ module GitHubPages
|
|||
|
||||
# If the user has set a 'theme', then see if we can automatically use remote theme instead.
|
||||
def migrate_theme_to_remote_theme(config)
|
||||
return unless config["theme"]
|
||||
return unless GitHubPages::Plugins::THEMES_TO_CONVERT_TO_REMOTE_THEMES.key?(config["theme"])
|
||||
|
||||
theme_name = config.delete("theme")
|
||||
config["remote_theme"] ||= GitHubPages::Plugins::THEMES_TO_CONVERT_TO_REMOTE_THEMES[theme_name]
|
||||
config["plugins"] = Array(config["plugins"]).concat(["jekyll-remote-theme"]).uniq
|
||||
# This functionality has been rolled back due to complications with jekyll-remote-theme.
|
||||
end
|
||||
|
||||
# If the user's 'exclude' config is the default, also exclude the CNAME
|
||||
|
|
|
@ -49,6 +49,20 @@ module GitHubPages
|
|||
# Themes
|
||||
THEMES = {
|
||||
"minima" => "2.5.1",
|
||||
"jekyll-swiss" => "1.0.0",
|
||||
"jekyll-theme-primer" => "0.6.0",
|
||||
"jekyll-theme-architect" => "0.2.0",
|
||||
"jekyll-theme-cayman" => "0.2.0",
|
||||
"jekyll-theme-dinky" => "0.2.0",
|
||||
"jekyll-theme-hacker" => "0.2.0",
|
||||
"jekyll-theme-leap-day" => "0.2.0",
|
||||
"jekyll-theme-merlot" => "0.2.0",
|
||||
"jekyll-theme-midnight" => "0.2.0",
|
||||
"jekyll-theme-minimal" => "0.2.0",
|
||||
"jekyll-theme-modernist" => "0.2.0",
|
||||
"jekyll-theme-slate" => "0.2.0",
|
||||
"jekyll-theme-tactile" => "0.2.0",
|
||||
"jekyll-theme-time-machine" => "0.2.0",
|
||||
}.freeze
|
||||
|
||||
# Themes to convert to remote themes
|
||||
|
|
|
@ -20,7 +20,6 @@ describe(GitHubPages::Configuration) do
|
|||
ENV.delete("DISABLE_WHITELIST")
|
||||
ENV["JEKYLL_ENV"] = "test"
|
||||
ENV["PAGES_REPO_NWO"] = "github/pages-gem"
|
||||
stub_request_for_remote_theme(:repo => "pages-themes/primer", :revision => "v0.6.0", :filename => "primer-0.6.0.zip")
|
||||
end
|
||||
|
||||
context "#effective_config" do
|
||||
|
@ -104,10 +103,9 @@ describe(GitHubPages::Configuration) do
|
|||
context "themes" do
|
||||
context "with no theme set" do
|
||||
it "sets the theme" do
|
||||
expect(effective_config["plugins"]).to include("jekyll-remote-theme")
|
||||
expect(site.theme).to_not be_nil
|
||||
expect(site.theme).to be_a(Jekyll::Theme)
|
||||
expect(site.theme.name).to eql("primer")
|
||||
expect(site.theme.name).to eql("jekyll-theme-primer")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -120,16 +118,10 @@ describe(GitHubPages::Configuration) do
|
|||
)
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
stub_request_for_remote_theme(:repo => "pages-themes/merlot", :revision => "v0.2.0", :filename => "merlot-0.2.0.zip")
|
||||
end
|
||||
|
||||
it "respects the theme" do
|
||||
expect(configuration["theme"]).to be_nil
|
||||
expect(configuration["remote_theme"]).to eq(GitHubPages::Plugins::THEMES_TO_CONVERT_TO_REMOTE_THEMES["jekyll-theme-merlot"])
|
||||
expect(site.theme).to_not be_nil
|
||||
expect(site.theme).to be_a(Jekyll::Theme)
|
||||
expect(site.theme.name).to eql("merlot")
|
||||
expect(site.theme.name).to eql("jekyll-theme-merlot")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -144,6 +136,10 @@ describe(GitHubPages::Configuration) do
|
|||
end
|
||||
end
|
||||
|
||||
it "plugins don't include jekyll remote theme" do
|
||||
expect(effective_config["plugins"]).to_not include("jekyll-remote-theme")
|
||||
end
|
||||
|
||||
context "with a remote theme" do
|
||||
let(:test_config) do
|
||||
{
|
||||
|
@ -156,7 +152,6 @@ describe(GitHubPages::Configuration) do
|
|||
end
|
||||
|
||||
it "plugins include jekyll remote theme" do
|
||||
stub_request_for_remote_theme(:repo => "foo/bar", :revision => "HEAD", :filename => "primer-0.6.0.zip")
|
||||
expect(effective_config["plugins"]).to include("jekyll-remote-theme")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -258,7 +258,7 @@ RSpec.describe "Pages Gem Integration spec" do
|
|||
|
||||
context "jekyll-theme-primer" do
|
||||
it "sets the theme" do
|
||||
expect(contents).to match("Theme: primer")
|
||||
expect(contents).to match("Theme: jekyll-theme-primer")
|
||||
end
|
||||
|
||||
it "uses the theme" do
|
||||
|
|
|
@ -29,15 +29,6 @@ def tmp_dir
|
|||
File.expand_path "../tmp", __dir__
|
||||
end
|
||||
|
||||
def support_dir
|
||||
File.expand_path "support", __dir__
|
||||
end
|
||||
|
||||
def stub_request_for_remote_theme(repo:, revision:, filename:)
|
||||
stub_request(:get, "https://codeload.github.com/#{repo}/zip/#{revision}").
|
||||
to_return(:status => 200, :body => File.binread(File.join(support_dir, filename)), :headers => {"Content-Type" => "archive/zip"})
|
||||
end
|
||||
|
||||
RSpec::Matchers.define :be_an_existing_file do
|
||||
match { |path| File.exist?(path) }
|
||||
end
|
||||
|
|
Двоичные данные
spec/support/merlot-0.2.0.zip
Двоичные данные
spec/support/merlot-0.2.0.zip
Двоичный файл не отображается.
Двоичные данные
spec/support/primer-0.6.0.zip
Двоичные данные
spec/support/primer-0.6.0.zip
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче