Sha256: ac379de2e72c5caf09fc5bf527878646d00c0016e4bf45773814cfb1d57a1251

Contents?: true

Size: 1.1 KB

Versions: 17

Compression:

Stored size: 1.1 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'

require 'safe_yaml'
SafeYAML::OPTIONS[:default_mode] = :safe

# Borrowing from "whiches" gem ...
cmd  = 'knife'
exes = []
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
  exts.each { |ext|
    exe = File.join(path, "#{cmd}#{ext}")
    exes << exe if File.executable? exe
  }
end
path = if exes.size > 0
         File.dirname(exes[0])
       else
         File.dirname(__FILE__)
       end

$:.unshift(File.expand_path(File.join(path, "..", "lib")))
require 'chef/application/knife'
require 'chef/knife/bootstrap'

# If it is translate,upload we will let the uploader do the heavy lifting
verb = 'upload'
me   = 'chop' # File.basename(__FILE__)
act  = false
ARGV.each{|w|
  if w.match(%r(^--action$))
    act = true
  else
    case w
      when 'upload'
        verb = w
      when 'translate'
        verb = w
      else
        if act
          aw = w.split(%r([:,]))
          verb = aw[0] if aw
        end
    end
  end
}
ARGV.unshift verb unless ARGV[0] == verb
ARGV.unshift me
Chef::Application::Knife.new.run

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
knife-chop-0.12.18 bin/chop
knife-chop-0.12.17 bin/chop
knife-chop-0.12.03 bin/chop
knife-chop-0.11.12 bin/chop
knife-chop-0.9.5 bin/chop
knife-chop-0.9.4 bin/chop
knife-chop-0.9.2 bin/chop
knife-chop-0.9.1 bin/chop
knife-chop-0.9.0 bin/chop
knife-chop-0.8.3 bin/chop
knife-chop-0.8.2 bin/chop
knife-chop-0.8.0 bin/chop
knife-chop-0.7.8 bin/chop
knife-chop-0.7.2 bin/chop
knife-chop-0.7.1 bin/chop
knife-chop-0.7.0 bin/chop
knife-chop-0.6.7 bin/chop