Class: Tweezer::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/tweezer/cli.rb

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



6
7
8
9
10
11
12
13
14
15
# 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

Instance Method Details

#add(name) ⇒ Object



23
24
25
26
# File 'lib/tweezer/cli.rb', line 23

def add(name)
  @gemfile.add_gem(name, **gem_opts)
  @gemfile.save!
end

#alter(name) ⇒ Object



36
37
38
39
# File 'lib/tweezer/cli.rb', line 36

def alter(name)
  @gemfile.alter_gem(name, **gem_opts)
  @gemfile.save!
end