Sha256: c4b2b56b485bfd44cc1401710b0ca4293996a7b597ec6f82b27ff5c50971c438

Contents?: true

Size: 874 Bytes

Versions: 1

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

module JekyllPush
  #
  #
  class Command < Jekyll::Command
    class << self
      def init_with_program(prog)
        prog.command(:push) do |c|
          c.syntax 'push [args]'
          c.description 'pushes compiled site to specified github branch'
          c.action do |args, _options|
            raise Error::MissingBranch, "You must specify a target branch name after 'jekyll push'." if args.empty?

            site   = JekyllPush::Site.new
            branch = JekyllPush::Branch.new args.first

            warn Rainbow('Warning: Building the site without a baseurl is not recommended if using GitHub pages.').yellow if site.baseurl.empty? && branch.target == 'gh-pages'

            site.rebuild
            branch.push site.dir

            puts Rainbow("\nDone ✓").green
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll_push-0.1.0 lib/jekyll_push/command.rb