class BundledGem::Cli
bundled_gem CLI class powered by thor
Public Instance Methods
install(*bundled_gems)
click to toggle source
# File lib/bundled_gem/cli.rb, line 11 def install(*bundled_gems) abort "Please specify at least one gem name (e.g. gem build GEMNAME)" if bundled_gems.empty? reader = LockfileReader.new(lockfile: options[:lockfile]) bundled_gems.each do |bundled_gem| if reader.gem_listed?(bundled_gem) version = reader.get_version(bundled_gem) command = "gem install #{bundled_gem} --version #{version}" IO.popen(command) do |f| while line = f.gets puts line end end else warn "`#{bundled_gem}` is not listed in Gemfile.lock." end end end
list()
click to toggle source
# File lib/bundled_gem/cli.rb, line 34 def list puts "Gems included in `#{options[:lockfile]}`:" LockfileReader.new(lockfile: options[:lockfile]).lockfile_specs.each do |spec| puts " * #{spec.name}, #{spec.version}" end end
version()
click to toggle source
# File lib/bundled_gem/cli.rb, line 42 def version puts ::BundledGem::VERSION end