Sha256: af0bae27c5191733a12ad080d5792400e54cc5bb18e6bfe5ffcb22e9c57e9663

Contents?: true

Size: 817 Bytes

Versions: 1

Compression:

Stored size: 817 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

    desc "version", "bundled_gems version"
    def version
      puts ::BundledGem::VERSION
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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