summaryrefslogtreecommitdiff
path: root/lib/bundler/cli/check.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/cli/check.rb')
-rw-r--r--lib/bundler/cli/check.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/bundler/cli/check.rb b/lib/bundler/cli/check.rb
index 057a7e5695..493eb3ec6a 100644
--- a/lib/bundler/cli/check.rb
+++ b/lib/bundler/cli/check.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Check
attr_reader :options
@@ -8,16 +9,15 @@ module Bundler
end
def run
- if options[:path]
- Bundler.settings[:path] = File.expand_path(options[:path])
- Bundler.settings[:disable_shared_gems] = true
- end
+ Bundler.settings.set_command_option_if_given :path, options[:path]
+
+ definition = Bundler.definition
+ definition.validate_runtime!
begin
- definition = Bundler.definition
- definition.validate_runtime!
+ definition.check!
not_installed = definition.missing_specs
- rescue GemNotFound, VersionConflict
+ rescue GemNotFound, GitError, SolveFailure
Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
Bundler.ui.warn "Install missing gems with `bundle install`."
exit 1
@@ -28,11 +28,11 @@ module Bundler
not_installed.each {|s| Bundler.ui.error " * #{s.name} (#{s.version})" }
Bundler.ui.warn "Install missing gems with `bundle install`"
exit 1
- elsif !Bundler.default_lockfile.file? && Bundler.settings[:frozen]
- Bundler.ui.error "This bundle has been frozen, but there is no #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} present"
+ elsif !Bundler.default_lockfile.file? && Bundler.frozen_bundle?
+ Bundler.ui.error "This bundle has been frozen, but there is no #{SharedHelpers.relative_lockfile_path} present"
exit 1
else
- Bundler.load.lock(:preserve_unknown_sections => true) unless options[:"dry-run"]
+ definition.lock(true) unless options[:"dry-run"]
Bundler.ui.info "The Gemfile's dependencies are satisfied"
end
end