Sha256: e03026dc47fa2a7289f0cdb5846875839b6cd5fb9a68ab35eba5c416f4f28764

Contents?: true

Size: 872 Bytes

Versions: 6

Compression:

Stored size: 872 Bytes

Contents

command 'export' do |c|
  c.syntax = 'brief export PATH [OPTIONS]'
  c.description = 'export the briefcase found in PATH'

  c.option '--output PATH', String, 'Save the output to the specified path'
  c.option '--app APP', String, 'Use the specified app to get our models etc'
  c.option '--config PATH', String, 'Use the specified config file'

  c.action do |args, options|
    root = Pathname(args.first || Brief.pwd)

    o = {
      root: root
    }

    o[:app] = options.app if options.app
    o[:config_path] = options.config if options.config

    briefcase = Brief::Briefcase.new(o)

    export = briefcase.as_full_export.to_json

    if options.output
      output = Pathname(options.output)
      output = output.join(briefcase.slug + ".json") if output.directory?
      output.open("w+") {|fh| fh.write(export) }
    else
      puts export
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
brief-1.9.0 lib/brief/cli/export.rb
brief-1.8.12 lib/brief/cli/export.rb
brief-1.8.11 lib/brief/cli/export.rb
brief-1.8.10 lib/brief/cli/export.rb
brief-1.8.9 lib/brief/cli/export.rb
brief-1.8.8 lib/brief/cli/export.rb