class FPM::Scriptable::Util

Public Class Methods

banner() click to toggle source
get_args() click to toggle source
# File lib/fpm/scriptable/util.rb, line 19
def self.get_args
  args = Hash.new
  cur_argv = String.new

  if ARGV.length > 0
    ARGV.each do |x|
      if x =~ /^-/
        cur_argv = x.sub(/^-+/,'')
        if cur_argv != ''
          args[cur_argv.to_sym] = ''
        end
      else
        if cur_argv != ''
          if args[cur_argv.to_sym].instance_of? Array
            args[cur_argv.to_sym].push x
          else
            if args[cur_argv.to_sym] != ''
              cur_value = args[cur_argv.to_sym]
              args[cur_argv.to_sym] = Array.new
              args[cur_argv.to_sym].push cur_value
              args[cur_argv.to_sym].push x
            else
              args[cur_argv.to_sym] = x
            end
          end

        end
      end
    end
  end
  args
end
usage() click to toggle source
# File lib/fpm/scriptable/util.rb, line 52
      def self.usage
        usage = <<EOF
Usage:
  #{$0} OPTIONS

  Options:
    --help                  Display this help screen
    --quiet                 Messages are not displayed to the console
    --nocolor               Turn off colors in console output
    --log_level <lvl>       Log level (info, debug, error)
    --logfile <file>        Log to file
    --nobanner              Do not show the banner

    --script <file>         Script to build

EOF
        usage
      end