Sha256: 2160b88c4d663a6a2a569f9043fcff04917033135994562942584d33c6193287

Contents?: true

Size: 456 Bytes

Versions: 2

Compression:

Stored size: 456 Bytes

Contents

require 'thor'
require 'random_gem'

module RandomGem
  class CLI < Thor
    include Thor::Actions
    desc "add", "add a gem to your Gemfile randomly"

    def add
      gem = RandomGem.pick
      gem_name = gem["name"]

      File.open("Gemfile", "a") do |file|
        file.puts("gem '#{gem_name}'")
      end

      puts "Yes! Gem '#{gem_name}' has been added to your Gemfile. For more information, see #{gem["documentation_uri"]}."
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
random_gem-0.1.1 lib/random_gem/cli.rb
random_gem-0.1.0 lib/random_gem/cli.rb