Sha256: 836c59e426bc606a3898716e9bd3bb4c5042d36e097106fe86c6b1920adb5a2d

Contents?: true

Size: 722 Bytes

Versions: 2

Compression:

Stored size: 722 Bytes

Contents

class Pups::Cli

  def self.usage
    puts "Usage: pups FILE or pups --stdin"
    exit 1
  end
  def self.run(args)
    if args.length != 1
      usage
    end

    Pups.log.info("Loading #{args[0]}")
    if args[0] == "--stdin"
      conf = STDIN.readlines.join
      split = conf.split("_FILE_SEPERATOR_")

      conf = nil
      split.each do |data|
        current = YAML.load(data.strip)
        if conf
          conf = Pups::MergeCommand.deep_merge(conf, current, :merge_arrays)
        else
          conf = current
        end
      end

      config = Pups::Config.new(conf)
    else
      config = Pups::Config.load_file(args[0])
    end
    config.run

  ensure
    Pups::ExecCommand.terminate_async
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pups-1.0.1 lib/pups/cli.rb
pups-1.0.0 lib/pups/cli.rb