Sha256: 4e23736af365c02ef8771e08c18fde94213ea2d6220340cf54d9f88d5859a488

Contents?: true

Size: 1.09 KB

Versions: 11

Compression:

Stored size: 1.09 KB

Contents

# this file gets loaded in the CLI context, not the Rails boot context

require "thor"
require "bard/config"
require "bard/command"
require "term/ansicolor"

module Bard
  class CLI < Thor
    include Term::ANSIColor

    class_option :verbose, type: :boolean, aliases: :v

    {
      data: "Data",
      stage: "Stage",
      deploy: "Deploy",
      ci: "CI",
      master_key: "MasterKey",
      setup: "Setup",
      run: "Run",
      open: "Open",
      ssh: "SSH",
      install: "Install",
      provision: "Provision",
      ping: "Ping",
      hurt: "Hurt",
      vim: "Vim",
    }.each do |command, klass|
      require "bard/cli/#{command}"
      include const_get(klass)
    end

    def self.exit_on_failure? = true

    private

    def config
      @config ||= Bard::Config.new(project_name, path: "bard.rb")
    end

    def project_name
      @project_name ||= File.expand_path(".").split("/").last
    end

    def run!(...)
      Bard::Command.run!(...)
    rescue Bard::Command::Error => e
      puts red("!!! ") + "Running command failed: #{yellow(e.message)}"
      exit 1
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
bard-1.2.0 lib/bard/cli.rb
bard-1.1.2 lib/bard/cli.rb
bard-1.1.1 lib/bard/cli.rb
bard-1.1.0 lib/bard/cli.rb
bard-1.0.8 lib/bard/cli.rb
bard-1.0.7 lib/bard/cli.rb
bard-1.0.6 lib/bard/cli.rb
bard-1.0.5 lib/bard/cli.rb
bard-1.0.4 lib/bard/cli.rb
bard-1.0.3 lib/bard/cli.rb
bard-1.0.2 lib/bard/cli.rb