Class: Bunto::Commands::Publish

Inherits:
Command
  • Object
show all
Defined in:
lib/bunto/commands/publish.rb

Class Method Summary collapse

Class Method Details

.init_with_program(prog) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/bunto/commands/publish.rb', line 4

def self.init_with_program(prog)
  prog.command(:publish) do |c|
    c.syntax 'publish DRAFT_PATH'
    c.description 'Moves a draft into the _posts directory and sets the date'

    c.option 'date', '-d DATE', '--date DATE', 'Specify the post date'

    c.action do |args, options|
      Bunto::Commands::Publish.process(args, options)
    end
  end
end

.process(args = [], options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/bunto/commands/publish.rb', line 17

def self.process(args = [], options = {})
  params = PublishArgParser.new args, options
  params.validate!

  movement = DraftMovementInfo.new params

  mover = DraftMover.new movement
  mover.move
end