Sha256: 297776a4853a786c5bfdb17c01518390c0db96eec80171126d99551d799de702

Contents?: true

Size: 715 Bytes

Versions: 4

Compression:

Stored size: 715 Bytes

Contents

command :publish do |c|
  c.syntax = 'brief publish PUBLISHER [options]'
  c.description = 'publish a brief file with whatever publisher template you want to use.'

  c.option '--from FILE', 'Specify a file to read from. Otherwise we use $EDITOR'

  c.action do |args, options|
    path = case
    when options.from
      Pathname(options.from)
    when (Pathname(args.last).exist? rescue false)
      Pathname(args.pop)
    end

    document   = Brief::Document.new(path: path)

    publisher = if path && path.exist? && args.empty?
      guess = path.basename.to_s.gsub(/\.\w+$/,'')

      Brief::Publisher.find(guess)
    else
      Brief::Publisher.find(args)
    end

    document.publish(publisher)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brief-0.0.5 lib/brief/cli/commands/publish.rb
brief-0.0.4 lib/brief/cli/commands/publish.rb
brief-0.0.3 lib/brief/cli/commands/publish.rb
brief-0.0.2 lib/brief/cli/commands/publish.rb