Class: RandomGem::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/random_gem/cli.rb

Instance Method Summary collapse

Instance Method Details

#addObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/random_gem/cli.rb', line 9

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