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 19 | # 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.option 'no_history', '--no_history', '-n', 'Built site will have no commit history' c.action do |args, | Jekyll::Commands::GhDeploy.process(args, ) end end end | 
.process(args, options = {}) ⇒ Object
| 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # File 'lib/jekyll/commands/ghdeploy.rb', line 21 def process(args, = {}) config = YAML.load_file('_config.yml') if args.empty? && config['repository'].empty? raise ArgumentError, 'You must specify a repository.' elsif args.empty? repo = config['repository'] else repo = args[0] end if ['no_history'] && ['docs'] raise Error, 'Options -d and -n cannot work together.' end site = JekyllGhDeploy::Site.new(repo, ) at_exit do site.clean end site.deploy end |