Sha256: 096270cee44de9200b7a13180a101453521cef7ad82402d9e5f8258a1720391c

Contents?: true

Size: 883 Bytes

Versions: 5

Compression:

Stored size: 883 Bytes

Contents

module Bundler
  class CLI::Lock
    attr_reader :options

    def initialize(options)
      @options = options
    end

    def run
      unless Bundler.default_gemfile
        Bundler.ui.error "Unable to find a Gemfile to lock"
        exit 1
      end

      print = options[:print]
      ui = Bundler.ui
      Bundler.ui = UI::Silent.new if print

      gems = options[:update]

      if gems && !gems.empty?
        definition = Bundler.definition(:gems => gems)
      else
        definition = Bundler.definition(true)
      end

      definition.resolve_remotely! unless options[:local]

      if print
        puts definition.to_lock
      else
        file = options[:lockfile]
        file = file ? File.expand_path(file) : Bundler.default_lockfile
        puts "Writing lockfile to #{file}"
        definition.lock(file)
      end

      Bundler.ui = ui
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bundler-1.11.2 lib/bundler/cli/lock.rb
bundler-1.11.1 lib/bundler/cli/lock.rb
bundler-1.11.0 lib/bundler/cli/lock.rb
bundler-1.11.0.pre.2 lib/bundler/cli/lock.rb
bundler-1.11.0.pre.1 lib/bundler/cli/lock.rb