Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/github/pages-gem
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/github-pages/configuration.rb
#	lib/github-pages/version.rb
  • Loading branch information
sskylar committed Dec 9, 2016
2 parents 818cf28 + e52b82c commit fedacba
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 67 deletions.
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
--color
--format progress
--profile
1 change: 1 addition & 0 deletions github-pages.gemspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true
require File.expand_path("../lib/github-pages/dependencies", __FILE__)
require File.expand_path("../lib/github-pages/plugins", __FILE__)
require File.expand_path("../lib/github-pages/version", __FILE__)

Gem::Specification.new do |s|
Expand Down
1 change: 1 addition & 0 deletions lib/github-pages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# Top-level namespace for all GitHub Pages-related concerns.
module GitHubPages
autoload :Plugins, "github-pages/plugins"
autoload :Configuration, "github-pages/configuration"
autoload :Dependencies, "github-pages/dependencies"
autoload :VERSION, "github-pages/version"
Expand Down
39 changes: 9 additions & 30 deletions lib/github-pages/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,20 @@
require "securerandom"

module GitHubPages
#
# Sets and manages Jekyll configuration defaults and overrides
class Configuration
# Plugins which are activated by default
DEFAULT_PLUGINS = %w(
jekyll-coffeescript
jekyll-gist
jekyll-paginate
jekyll-relative-links
).freeze

# Plugins allowed by GitHub Pages
PLUGIN_WHITELIST = %w(
jekyll-coffeescript
jekyll-feed
jekyll-gist
jekyll-mentions
jekyll-paginate
jekyll-redirect-from
jekyll-seo-tag
jekyll-sitemap
jekyll-avatar
jekyll-relative-links
jemoji
).freeze

# Plugins only allowed locally
DEVELOPMENT_PLUGINS = %w(
jekyll-admin
).freeze
# Backward compatability of constants
DEFAULT_PLUGINS = GitHubPages::Plugins::DEFAULT_PLUGINS
PLUGIN_WHITELIST = GitHubPages::Plugins::PLUGIN_WHITELIST
DEVELOPMENT_PLUGINS = GitHubPages::Plugins::DEVELOPMENT_PLUGINS
THEMES = GitHubPages::Plugins::THEMES

# Default, user overwritable options
DEFAULTS = {
"jailed" => false,
"gems" => DEFAULT_PLUGINS,
"gems" => GitHubPages::Plugins::DEFAULT_PLUGINS,
"future" => true,
"theme" => "jekyll-theme-primer",
"kramdown" => {
"input" => "GFM",
"hard_wrap" => false
Expand Down Expand Up @@ -64,7 +43,7 @@ class Configuration
"safe" => true,
"plugins" => SecureRandom.hex,
"plugins_dir" => SecureRandom.hex,
"whitelist" => PLUGIN_WHITELIST,
"whitelist" => GitHubPages::Plugins::PLUGIN_WHITELIST,
"highlighter" => "rouge",
"kramdown" => {
"template" => "",
Expand Down
38 changes: 19 additions & 19 deletions lib/github-pages/dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,24 @@ class Dependencies
"github-pages-health-check" => "1.2.0",

# Plugins
"jemoji" => "0.7.0",
"jekyll-mentions" => "1.2.0",
"jekyll-redirect-from" => "0.11.0",
"jekyll-sitemap" => "0.12.0",
"jekyll-feed" => "0.8.0",
"jekyll-gist" => "1.4.0",
"jekyll-paginate" => "1.1.0",
"jekyll-coffeescript" => "1.0.1",
"jekyll-seo-tag" => "2.1.0",
"jekyll-github-metadata" => "2.2.0",
"jekyll-avatar" => "0.4.2",
"jekyll-relative-links" => "0.2.1",
"jekyll-redirect-from" => "0.11.0",
"jekyll-sitemap" => "0.12.0",
"jekyll-feed" => "0.8.0",
"jekyll-gist" => "1.4.0",
"jekyll-paginate" => "1.1.0",
"jekyll-coffeescript" => "1.0.1",
"jekyll-seo-tag" => "2.1.0",
"jekyll-github-metadata" => "2.2.0",
"jekyll-avatar" => "0.4.2",

# Plugins to match GitHub.com Markdown
"jemoji" => "0.7.0",
"jekyll-mentions" => "1.2.0",
"jekyll-relative-links" => "0.2.1",
"jekyll-optional-front-matter" => "0.1.2",
"jekyll-readme-index" => "0.0.2",
"jekyll-default-layout" => "0.1.4",
"jekyll-titles-from-headings" => "0.1.2",

# Pin listen because it's broken on 2.1 & that's what we recommend.
# https://github.com/guard/listen/pull/371
Expand All @@ -40,17 +46,11 @@ class Dependencies
"activesupport" => "4.2.7"
}.freeze

# Themes
THEMES = {
"minima" => "2.0.0",
"jekyll-swiss" => "0.4.0"
}.freeze

# Jekyll and related dependency versions as used by GitHub Pages.
# For more information see:
# https://help.github.com/articles/using-jekyll-with-pages
def self.gems
VERSIONS.merge(THEMES)
VERSIONS.merge(GitHubPages::Plugins::THEMES)
end

# Versions used by GitHub Pages, including github-pages gem and ruby version
Expand Down
50 changes: 50 additions & 0 deletions lib/github-pages/plugins.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# frozen_string_literal: true
module GitHubPages
# Manages the constants the govern what plugins are allows on GitHub Pages
class Plugins
# Plugins which are activated by default
DEFAULT_PLUGINS = %w(
jekyll-coffeescript
jekyll-gist
jekyll-github-metadata
jekyll-paginate
jekyll-relative-links
jekyll-optional-front-matter
jekyll-readme-index
jekyll-default-layout
jekyll-titles-from-headings
).freeze

# Plugins allowed by GitHub Pages
PLUGIN_WHITELIST = %w(
jekyll-coffeescript
jekyll-feed
jekyll-gist
jekyll-github-metadata
jekyll-paginate
jekyll-redirect-from
jekyll-seo-tag
jekyll-sitemap
jekyll-avatar
jemoji
jekyll-mentions
jekyll-relative-links
jekyll-optional-front-matter
jekyll-readme-index
jekyll-default-layout
jekyll-titles-from-headings
).freeze

# Plugins only allowed locally
DEVELOPMENT_PLUGINS = %w(
jekyll-admin
).freeze

# Themes
THEMES = {
"minima" => "2.0.0",
"jekyll-swiss" => "0.4.0",
"jekyll-theme-primer" => "0.1.1"
}.freeze
end
end
2 changes: 1 addition & 1 deletion lib/github-pages/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module GitHubPages
VERSION = 106
VERSION = 107
.to_s + '-siteleaf'.freeze
end
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,6 @@
end

context "plugins" do
context "whitelists all default plugins" do
GitHubPages::Configuration::DEFAULT_PLUGINS.each do |plugin|
it "whitelists the #{plugin} plugin" do
expect(GitHubPages::Configuration::PLUGIN_WHITELIST).to include(plugin)
end
end
end

context "versions all whitelisted plugins" do
GitHubPages::Configuration::PLUGIN_WHITELIST.each do |plugin|
it "versions the #{plugin} plugin" do
expect(GitHubPages::Dependencies::VERSIONS.keys).to include(plugin)
end
end
end

context "in development" do
before { ENV["JEKYLL_ENV"] = "development" }

Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions spec/github-pages/plugins_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true
require "spec_helper"

describe(GitHubPages::Plugins) do
context "whitelists all default plugins" do
GitHubPages::Plugins::DEFAULT_PLUGINS.each do |plugin|
it "whitelists the #{plugin} plugin" do
expect(GitHubPages::Plugins::PLUGIN_WHITELIST).to include(plugin)
end
end
end

context "versions all whitelisted plugins" do
GitHubPages::Plugins::PLUGIN_WHITELIST.each do |plugin|
it "versions the #{plugin} plugin" do
expect(GitHubPages::Dependencies::VERSIONS.keys).to include(plugin)
end
end
end
end

0 comments on commit fedacba

Please sign in to comment.