Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A simple Ruby Gem to bootstrap dependencies for setting up and maintaining a local Jekyll environment in sync with GitHub Pages

License

NotificationsYou must be signed in to change notification settings

siteleaf/pages-gem

 
 

Repository files navigation

A simple Ruby Gem to bootstrap dependencies for setting up and maintaining a local Jekyll environment in sync with GitHub Pages.

Gem VersionBuild Status

Usage

One may opt for the conventional approach of using the pages-gem or the containerized approach in which a Docker container is used to provide an environment with most dependencies pre-installed.

Conventional

Important: Make sure you have Bundler > v1.14 by runninggem update bundler in your terminal before following the next steps.

  1. Add the following to your project's Gemfile:  
gem'github-pages',group::jekyll_plugins
  1. Runbundle install

Note: You are not required to install Jekyll separately. Once thegithub-pages gem is installed, you can build your site usingjekyll build, or preview your site usingjekyll serve. For more information about installing Jekyll locally, please seethe GitHub Help docs on the matter.

Docker

Provided that Docker is installed, one may avoid the setup of additional tools within the environment by simply spawning a Docker container.

  1. Runmake image from the root of the pages-gem directory to build an image which will be tagged asgh-pages
  • Alternatively usemake image_alpine for a smalleralpine-based image
  1. Start an instance of the server by running either:
  • SITE=PATH_TO_YOUR_PROJECT make server from the root of thegh-pages repository (where the Makefile resides) or
  • SITE=PATH_TO_YOUR_PROJECT docker run --rm -p 4000:4000 -v `realpath ${SITE}`:/src/site gh-pages from any directory or
  • github-pages $PATH_TO_YOUR_PROJECT from any directory whenfunc.sh has been sourced into your terminal session or
  • github-pages from the directory of the Jekyll site to be previewed whenfunc.sh has been sourced into your terminal session.

Note: thegithub-pages function may be enabled by sourcing func.sh. This can be done by appending

source$PATH_TO_THIS_DIRECTORY/contrib/func.sh

to the scripts that load on initiation of a terminal session (usually~/.bashrc on bash or~/.zshrc on zsh).:

Running ofgithub-pages inside a directory of a Jekyll site spawns aserver on port 4000. One may explicitly provide a path to a Jekyll site and a port by runninggithub-pages $PATH $PORT. This approach is provided as a user-friendlier alternative to themake server ordocker run invocations mentioned as the first options in step 2.

The ordering of the arguments for thegithub-pages function is based on the assumption that it is more likely to need to specify a custom path rather than a custom port.

Command line usage

The GitHub Pages gem also comes with several command-line tools, contained within thegithub-pages command.

List dependency versions

$bundleexec github-pages versions+---------------------------+---------+| Gem                       | Version |+---------------------------+---------+| jekyll                    | x.x.x   || kramdown                  | x.x.x   || liquid                    | x.x.x   || ....                      | ....    |+---------------------------+---------+

Note, you can also pass the--gemfile flag to get the dependencies listed in a valid Gemfile dependency format. You can also see a list of the live dependency versions atpages.github.com/versions.

Health check

Checks your GitHub Pages site for common DNS configuration issues.

$github-pages health-checkChecking domain foo.invalid...Uh oh. Looks like something's fishy: A record points to deprecated IP address

See theGitHub Pages Health Check documentation for more information.

Bypassing the plugin whitelist

If you'd like to run a Jekyll plugin locally that's not whitelisted for use on GitHub Pages, you can do so by prefixing thejekyll build orjekyll serve command withDISABLE_WHITELIST=true. This will allow your site to use any plugin listed in your site'sgems configuration flag. Please note, however, this option is only available when previewing your Jekyll site locally.

Updating

To update to the latest version of Jekyll and associated dependencies, simply rungem update github-pages, or if you've installed via Bundler,bundle update github-pages.

Project Goals

The goal of the GitHub Pages gem is to help GitHub Pages users bootstrap and maintain a Jekyll build environment that most closely matches the GitHub pages build environment. The GitHub Pages gem relies on explicit requirements shared between both users' computers and the build servers to ensure that the result of a user's local build is consistently also the result of the server's build.

Additional tools, such as tools that integrate with the GitHub API to make managing GitHub Pages sites easier are not the primary goal, but may be within the project's scope.

What's versioned

The GitHub Pages gem seeks to version two aspects of the build environment:

1. Ruby

The version of Ruby with which Jekyll is executed. Although Jekyll itself may be compatible with prior or future versions of Ruby, different execution environments yield different results. Ruby 1.8.7 parses YAML differently than 1.9.3, for example, and Kramdown has trouble processingmailto links prior to 1.9.3. In order to ensure that building locally consistently results in the same build as what appears when published, it's essential that Ruby itself is versioned along side the Gem, despite no known incompatibilities.

2. Dependencies

This includes Markdown processors, and any other Jekyll dependency for which version incongruency may produce unexpected results. Traditionally, Maruku, Kramdown, RedCloth, liquid, rdiscount, and redcarpet have been strictly maintained due to known breaking changes.

Changelog

Seeall releases.

Releasing

To release a new version of this gem, runscript/release from themaster branch.

License

Distributed under theMIT License.

About

A simple Ruby Gem to bootstrap dependencies for setting up and maintaining a local Jekyll environment in sync with GitHub Pages

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby89.8%
  • Shell6.9%
  • Makefile2.1%
  • Dockerfile1.2%

[8]ページ先頭

©2009-2025 Movatter.jp