Class: Jekyll::Commands::GhDeploy
- Inherits:
-
Command
- Object
- Command
- Jekyll::Commands::GhDeploy
- Defined in:
- lib/jekyll/commands/ghdeploy.rb
Class Method Summary collapse
Class Method Details
.init_with_program(prog) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jekyll/commands/ghdeploy.rb', line 6 def init_with_program(prog) prog.command(:ghdeploy) do |c| c.syntax 'deploy REPOSITORY' c.description 'Deploys your site to your gh-pages branch' c.option 'docs', '--docs', '-d', 'Built site is stored into docs directory' c.option 'message', '--message MESSAGE', '-m MESSAGE', 'Specify a commit message' c.action do |args, | Jekyll::Commands::GhDeploy.process(args, ) end end end |
.process(args, options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jekyll/commands/ghdeploy.rb', line 20 def process(args, = {}) config = YAML.load_file('_config.yml') if args.empty? && config['repository'].blank? raise ArgumentError, 'You must specify a repository.' elsif args.empty? repo = config['repository'] else repo = args[0] end site = JekyllGhDeploy::Site.new(repo, ) at_exit do site.clean end site.deploy # site.build end |