class Tweezer::CLI

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/tweezer/cli.rb, line 6
def initialize(*)
  super

  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
  if custom_gemfile && !custom_gemfile.empty?
    ENV['BUNDLE_GEMFILE'] = File.expand_path(custom_gemfile)
  end

  @gemfile = Tweezer::Gemfile.load
end

Public Instance Methods

add(name) click to toggle source
# File lib/tweezer/cli.rb, line 23
def add(name)
  @gemfile.add_gem(name, **gem_opts)
  @gemfile.save!
end
alter(name) click to toggle source
# File lib/tweezer/cli.rb, line 36
def alter(name)
  @gemfile.alter_gem(name, **gem_opts)
  @gemfile.save!
end

Private Instance Methods

gem_opts() click to toggle source
# File lib/tweezer/cli.rb, line 43
def gem_opts
  @gem_opts ||= {
    groups: options[:groups] ? options[:groups].map(&:to_sym) : [],
    version: options[:version] || '',
    path: options[:path]
  }
end