require 'buffet'
require 'optparse'

module Buffet
  class CLI
    def initialize args
      opts = OptionParser.new do |opts|
        opts.banner = "Usage: buffet [options] [spec-files]"

        opts.on('-c', '--config CONFIG',
                'Use the specified CONFIG file') do |config_file|
          Settings.settings_file = File.expand_path(config_file)
        end

        opts.on('-p', '--project PROJECT',
                'Use the specified PROJECT name') do |project_name|
          Settings.project_name = project_name
        end

        opts.on('-l', '--log LOGFILE',
                'Write to log to LOGFILE, instead of default buffet.log') do |log|
          Settings.log_file = log
        end
      end.parse!(args)

      specs = Buffet.extract_specs_from(opts.empty? ? 'spec' : opts)

      runner = Runner.new
      runner.run specs

      exit 1 if runner.failures?
    end
  end
end

require 'buffet'
require 'optparse'

module Buffet
  class CLI
    def initialize args
      opts = OptionParser.new do |opts|
        opts.banner = "Usage: buffet [options] [spec-files]"

        opts.on('-c', '--config CONFIG',
                'Use the specified CONFIG file') do |config_file|
          Settings.settings_file = File.expand_path(config_file)
        end

        opts.on('-p', '--project PROJECT',
                'Use the specified PROJECT name') do |project_name|
          Settings.project_name = project_name
        end

        opts.on('-l', '--log LOGFILE',
                'Write to log to LOGFILE, instead of default buffet.log') do |log|
          Settings.log_file = log
        end
      end.parse!(args)

      specs = Buffet.extract_specs_from(opts.empty? ? ['spec'] : opts)

      runner = Runner.new
      runner.run specs

      exit 1 if runner.failures?
    end
  end
end

Fix Ruby 1.9 compatibility issue in options passing
Fix Ruby 1.9 compatibility issue in options passing

Wrap "spec" in an array so that Ruby 1.9 doesn't freak out when we call
`#each` on it.

Related story:
  http://www.pivotaltracker.com/story/show/32230263 (fixed)
  ("Fix Ruby 1.9 compatibility issue in options passing")

Change-Id: I90e26c7469e9042913feffdeb897375a9cc30534
Reviewed-on: https://gerrit.causes.com/9315
Reviewed-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
Tested-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
