Sha256: 37f83849dd0fe4a3e9c008bdec0df36d851515766daec3b062da98e78302969a

Contents?: true

Size: 1.47 KB

Versions: 14

Compression:

Stored size: 1.47 KB

Contents

#!/usr/bin/env ruby
require 'trollop'
require 'bourdain'

argv = ARGV.empty? ? [ '--help' ] : ARGV

commands            = Bourdain::Registry.specs('command')
command_position    = commands.map { |c| argv.index c[:name].to_s }.compact.shift
command_position    = argv.length if command_position.nil?
argv_before_command = argv.slice(0, command_position)

Trollop::options(argv_before_command) do
  version Bourdain::VERSION
  banner Bourdain::ART + "\n\n" + <<-EOS.gsub(/^    /, '')
    #{Bourdain::SUMMARY}

    Usage: tony [<options>] <command>

    Commands:
    #{Bourdain::Registry.details('command') * "\n    "}

    Options:
  EOS
end

command = argv.shift
Trollop::die 'No <command> provided' if command.nil?
Trollop::die 'Invalid <command> provided' if command_position.nil?

bin_dir = File.dirname(File.expand_path(__FILE__))
executable = File.join bin_dir, "tony-#{command}"
Trollop::die 'Invalid <command> provided' unless File.exists? executable

log = Bourdain::Logger.new

exec(executable, *argv) if File.exists? Bourdain::CONFIG

log.info <<-EOLOG.gsub(/^  /, '').strip
  Hey, looks like you've never run Bourdain before.

  Before I we can get started, you'll need to create a config file for Bourdain
  at #{Bourdain::CONFIG}. It should look something like this:
EOLOG
puts
log.warn <<-EOLOG.gsub(/^  /, '').strip
  {
    "gitlab": {
      "token": "your_gitlab_token"
    }
  }
EOLOG
puts
log.info 'You can find your GitLab token here: http://git.bluejeansnet.com/profile/account'
exit 1

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
bourdain-1.3.3 bin/tony
bourdain-1.3.2 bin/tony
bourdain-1.3.1 bin/tony
bourdain-1.3.0 bin/tony
bourdain-1.2.22 bin/tony
bourdain-1.2.21 bin/tony
bourdain-1.2.20 bin/tony
bourdain-1.2.19 bin/tony
bourdain-1.2.18 bin/tony
bourdain-1.2.17 bin/tony
bourdain-1.2.16 bin/tony
bourdain-1.2.15 bin/tony
bourdain-1.2.14 bin/tony
bourdain-1.2.13 bin/tony