Sha256: 000e080959c66183c3e751abfe0b2029167ff4b826d1eccb72edf368001d50a0

Contents?: true

Size: 871 Bytes

Versions: 6

Compression:

Stored size: 871 Bytes

Contents

require "thor"

module Boty
  class CLI < Thor
    include Thor::Actions
    class_option :verbose, type: :boolean, default: true, aliases: "-v"

    attr_reader :bot_name, :company, :api_key

    source_root File.expand_path("../../../template", __FILE__)

    desc "new [BOT_NAME]",
         "Creates a BOT_NAME dir with your new bot structure."
    def new(bot_name)
      @bot_name = bot_name
      acquire_bot_info
      directory "project", bot_name, verbose: verbose
      after_create
    end

    private

    def verbose
      options[:verbose]
    end

    def acquire_bot_info
      @company = ask("What is your Slack company name?") || "acme"
      @api_key = ask("What is the #{@bot_name} api key?") || "omg-lol-bbq"
    end

    def after_create
      inside @bot_name do
        run "chmod +x bot"
        run "bundle install"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
boty-0.2.0 lib/boty/cli.rb
boty-0.1.2 lib/boty/cli.rb
boty-0.1.1 lib/boty/cli.rb
boty-0.1.0 lib/boty/cli.rb
boty-0.0.17.1 lib/boty/cli.rb
boty-0.0.17 lib/boty/cli.rb