Sha256: 9ed8e81dd791fcf321abdc8760ed7a4e36df2542b3a584e0efdbc624a35dc98e

Contents?: true

Size: 1.46 KB

Versions: 8

Compression:

Stored size: 1.46 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.bjn.io/profile/account'
exit 1

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bourdain-1.6.3 bin/tony
bourdain-1.6.2 bin/tony
bourdain-1.6.1 bin/tony
bourdain-1.6.0 bin/tony
bourdain-1.5.1 bin/tony
bourdain-1.5.0 bin/tony
bourdain-1.4.1 bin/tony
bourdain-1.4.0 bin/tony