Sha256: 080d308367e9c99d839aa23ecbb1db8ec989dca95c2b985b4e39cd3a17fc2d3f

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

require 'thor'

module BundledGem
  class Cli < Thor
    desc "install [BUNDLED_GEM]", "install [BUNDLED_GEM] from `Gemfile.lock`"
    def install(bundled_gem)
      reader = LockfileReader.new
      if reader.gem_listed?(bundled_gem)
        version = reader.get_version(bundled_gem)
        system "gem install #{bundled_gem} --version #{version}"
      else
        abort "`#{bundled_gem}` is not listed in Gemfile.lock." 
      end
    end

    desc "list", "bundle list without `bundle install`"
    def list
      puts "Gems included in `Gemfile.lock`:"
      LockfileReader.new.lockfile_specs.each do |s| 
        puts "  * #{s.name}, #{s.version}" 
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bundled_gems-0.0.3 lib/bundled_gem/cli.rb