Sha256: 88ccc32b7487791de2caa8eecddf9bc99831642abe4b7cdf7a59c8616f5c97dd

Contents?: true

Size: 1.05 KB

Versions: 12

Compression:

Stored size: 1.05 KB

Contents

module Fastlane
  module Actions
    # will make sure a gem is installed. If it's not an appropriate error message is shown
    # this will *not* 'require' the gem
    def self.verify_gem!(gem_name)
      begin
        Gem::Specification.find_by_name(gem_name)
        # We don't import this by default, as it's not always the same
        # also e.g. cocoapods is just required and not imported
      rescue Gem::LoadError
        print_gem_error "Could not find gem '#{gem_name}'"
        print_gem_error ""
        print_gem_error "If you installed fastlane using `sudo gem install fastlane` run"
        print_gem_error "`sudo gem install #{gem_name}` to install the missing gem"
        print_gem_error ""
        print_gem_error "If you use a Gemfile add this to your Gemfile:"
        print_gem_error "gem '#{gem_name}'"
        print_gem_error "and run `bundle install`"

        raise "You have to install the `#{gem_name}`".red unless Helper.is_test?
      end
      true
    end

    def self.print_gem_error(str)
      Helper.log.error str.red
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fastlane-1.61.0 lib/fastlane/helper/gem_helper.rb
fastlane-1.60.0 lib/fastlane/helper/gem_helper.rb
fastlane-1.59.0 lib/fastlane/helper/gem_helper.rb
fastlane-1.58.0 lib/fastlane/helper/gem_helper.rb
fastlane-1.57.0 lib/fastlane/helper/gem_helper.rb
fastlane-1.56.0 lib/fastlane/helper/gem_helper.rb
fastlane-1.55.0 lib/fastlane/helper/gem_helper.rb
fastlane-1.54.0 lib/fastlane/helper/gem_helper.rb
fastlane-1.53.0 lib/fastlane/helper/gem_helper.rb
fastlane-1.52.0 lib/fastlane/helper/gem_helper.rb
fastlane-1.51.0 lib/fastlane/helper/gem_helper.rb
fastlane-1.50.0 lib/fastlane/helper/gem_helper.rb