├── script ├── bootstrap ├── fmt └── cibuild ├── .gitmodules ├── .gitignore ├── .rubocop.yml ├── History.markdown ├── Gemfile ├── .travis.yml ├── jekyll-docs.gemspec ├── lib └── jekyll-docs.rb ├── LICENSE.txt ├── README.md └── Rakefile /script/bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | bundle install -j8 $@ 3 | bundle exec rake init 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "site"] 2 | path = site 3 | url = git://github.com/jekyll/jekyll.git 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | site/_site 2 | .bundle 3 | .sass-cache 4 | Gemfile.lock 5 | /site 6 | /jekyll 7 | /pkg 8 | -------------------------------------------------------------------------------- /script/fmt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Rubocop $(bundle exec rubocop --version)" 3 | bundle exec rubocop -S -D $@ 4 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_gem: 2 | jekyll: .rubocop.yml 3 | 4 | AllCops: 5 | TargetRubyVersion: 2.3 6 | Exclude: 7 | - jekyll/**/* 8 | - vendor/**/* 9 | - Rakefile 10 | -------------------------------------------------------------------------------- /script/cibuild: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -xe 4 | 5 | script/fmt 6 | 7 | # Does it launch?? 8 | bundle exec jekyll docs & 9 | PASSED="$?" 10 | PID="$!" 11 | 12 | sleep 5 13 | jobs 14 | kill -INT $PID 15 | 16 | exit $PASSED 17 | -------------------------------------------------------------------------------- /History.markdown: -------------------------------------------------------------------------------- 1 | ## HEAD 2 | 3 | * gemspec: spec.files should include `site/*` (#4) 4 | * Build site before packaging into gem (#11) 5 | 6 | ### Bug Fixes 7 | 8 | * fixes jekyll/jekyll-docs#18 - jekyll docs -P fails (#19) 9 | 10 | ### Development Fixes 11 | 12 | * add Rubocop for consistency (#16) 13 | * Allow FIX versions to be released, e.g. 3.6.1.1 for 3.6.1 docs (#21) 14 | * add Rubocop (#23) 15 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | gemspec 5 | 6 | gem "rubocop", "~> 0.55.0" 7 | 8 | gem "kramdown-parser-gfm" if ENV["JEKYLL_VERSION"].to_s.start_with?("3.9.") 9 | 10 | if Dir.exist? "jekyll/docs" 11 | require "yaml" 12 | config = YAML.load_file "jekyll/docs/_config.yml" 13 | 14 | gems = [] 15 | gems.concat config["gems"] if config.include? "gems" 16 | gems.concat config["plugins"] if config.include? "plugins" 17 | gems << "pygments.rb" if config["highlighter"] == "pygments" 18 | gems.each { |name| gem name } 19 | end 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | cache: bundler 3 | sudo: false 4 | rvm: 2.5 5 | env: 6 | global: 7 | - JEKYLL_VERSION=3.8.4 8 | before_script: bundle update 9 | script: script/cibuild 10 | notifications: 11 | irc: 12 | on_success: change 13 | on_failure: change 14 | channels: 15 | - irc.freenode.org#jekyll 16 | template: 17 | - "%{repository}#%{build_number} (%{branch}) %{message} %{build_url}" 18 | email: 19 | on_success: never 20 | on_failure: never 21 | slack: 22 | secure: dNdKk6nahNURIUbO3ULhA09/vTEQjK0fNbgjVjeYPEvROHgQBP1cIP3AJy8aWs8rl5Yyow4YGEilNRzKPz18AsFptVXofpwyqcBxaCfmHP809NX5PHBaadydveLm+TNVao2XeLXSWu+HUNAYO1AanCUbJSEyJTju347xCBGzESU= 23 | -------------------------------------------------------------------------------- /jekyll-docs.gemspec: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | jekyll_version = ENV.fetch("JEKYLL_VERSION") 4 | jekyll_docs_version = ENV.fetch("JEKYLL_DOCS_VERSION", jekyll_version) 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "jekyll-docs" 8 | spec.version = jekyll_docs_version 9 | spec.authors = ["Parker Moore"] 10 | spec.email = ["parkrmoore@gmail.com"] 11 | spec.summary = "Offline usage documentation for Jekyll." 12 | spec.homepage = "https://jekyllrb.com" 13 | spec.license = "MIT" 14 | 15 | spec.files = Dir["**/*"].grep(%r!^(lib|site)/!) 16 | spec.require_paths = ["lib"] 17 | 18 | spec.required_ruby_version = ">= 2.3.0" 19 | 20 | spec.add_dependency "jekyll", jekyll_version 21 | spec.add_development_dependency "rake", "~> 12.0" 22 | end 23 | -------------------------------------------------------------------------------- /lib/jekyll-docs.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "jekyll" 4 | 5 | module JekyllDocs 6 | class DocsCommand < Jekyll::Command 7 | class << self 8 | def init_with_program(prog) 9 | prog.command(:docs) do |cmd| 10 | cmd.description "Start a local server for the Jekyll documentation" 11 | cmd.syntax "docs [options]" 12 | cmd.alias :d 13 | 14 | cmd.option "port", "-P [PORT]", "--port [PORT]", "Port to listen on." 15 | 16 | cmd.action do |_, opts| 17 | JekyllDocs::DocsCommand.process(opts) 18 | end 19 | end 20 | end 21 | 22 | def process(opts) 23 | options = opts.merge({ 24 | "serving" => true, 25 | "watch" => false, 26 | "destination" => File.expand_path("../site", __dir__), 27 | "skip_initial_build" => true, 28 | }) 29 | Jekyll::Commands::Serve.process(options) 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-present Parker Moore and jekyll-docs contributors 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## jekyll-docs 2 | 3 | This gem is how we ship the docs on jekyllrb.com to users who want local, offline access to the docs. 4 | 5 | ### Installing 6 | 7 | Replace `` with the version of Jekyll you wish to use (e.g. `3.8.1`) and run: 8 | 9 | ``` 10 | gem install jekyll-docs -v 11 | ``` 12 | 13 | Or, add it to your `Gemfile`: 14 | 15 | ```ruby 16 | gem 'jekyll-docs', '' 17 | ``` 18 | 19 | Then, run `bundle install`. 20 | 21 | ### Usage 22 | 23 | :warning: You can not generate the documentation website in an existing Jekyll source folder. 24 | 25 | Once installed, you have to ensure you're using the same version of Jekyll and jekyll-docs: 26 | 27 | ```console 28 | $ jekyll __ docs 29 | $ # If you want Jekyll v3.8.1, you have to run: 30 | $ jekyll _3.8.1_ docs 31 | ``` 32 | :smile: 33 | 34 | ### Building 35 | 36 | ```console 37 | $ export JEKYLL_VERSION=3.8.1 # (or whatever) 38 | $ bundle install 39 | $ bundle exec rake build 40 | ``` 41 | 42 | Now you have it in `pkg/jekyll-docs-3.8.1.gem`. 43 | 44 | ### Releasing 45 | 46 | Ensure the tag for the version is available on the `jekyll/jekyll` repo in the form of `vVERSION`, e.g. `v3.8.1`. 47 | 48 | ```console 49 | $ export JEKYLL_VERSION=3.8.1 50 | $ script/bootstrap 51 | $ bundle exec rake release 52 | ``` 53 | 54 | Made a mistake? You can release another version of jekyll-docs by running 55 | the following: 56 | 57 | ```console 58 | $ export JEKYLL_VERSION=3.8.1 59 | $ export JEKYLL_DOCS_VERSION=${JEKYLL_VERSION}.1 # Increment .1 to .2 if this is your second fix, etc. 60 | $ script/bootstrap 61 | $ bundle exec rake release 62 | ``` 63 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | task :default => :init 4 | 5 | def name 6 | "jekyll-docs" 7 | end 8 | 9 | def gemspec_file 10 | "#{name}.gemspec" 11 | end 12 | 13 | def gem_file 14 | "#{name}-#{jekyll_docs_version}.gem" 15 | end 16 | 17 | def jekyll_version 18 | ENV.fetch("JEKYLL_VERSION") 19 | end 20 | 21 | def jekyll_docs_version 22 | ENV.fetch("JEKYLL_DOCS_VERSION", jekyll_version) 23 | end 24 | 25 | task :init do 26 | sh "git clone git://github.com/jekyll/jekyll.git jekyll" unless Dir.exist? "jekyll/.git" 27 | 28 | Dir.chdir("jekyll") do 29 | sh "git checkout master" 30 | sh "git pull origin master" 31 | sh "git pull origin --tags" 32 | sh "git checkout v#{jekyll_version}" 33 | end 34 | Bundler.with_clean_env { sh "bundle install" } 35 | 36 | rm_rf "site" 37 | sh "jekyll build -s jekyll/docs -d site" 38 | end 39 | 40 | task :teardown do 41 | rm_rf "site" 42 | rm_rf "jekyll" 43 | end 44 | 45 | ############################################################################# 46 | # 47 | # Packaging tasks 48 | # 49 | ############################################################################# 50 | 51 | desc "Release #{name} v#{jekyll_docs_version}" 52 | task :release => :build do 53 | unless `git branch`.match?(%r!^\* master$!) 54 | puts "You must be on the master branch to release!" 55 | exit! 56 | end 57 | unless `git diff`.empty? 58 | puts "We cannot proceed with uncommitted changes!" 59 | exit! 60 | end 61 | sh "gem push pkg/#{gem_file}" 62 | end 63 | 64 | desc "Build #{name} v#{jekyll_docs_version} into pkg/" 65 | task :build => :init do 66 | mkdir_p "pkg" 67 | sh "gem build #{gemspec_file}" 68 | sh "mv #{gem_file} pkg" 69 | end 70 | 71 | desc "Install #{name} v#{jekyll_docs_version} into your gem folder." 72 | task :install => :build do 73 | sh "gem install -l pkg/#{gem_file}" 74 | end 75 | --------------------------------------------------------------------------------