Class: Bundler::CLI::Install
- Inherits:
-
Object
- Object
- Bundler::CLI::Install
- Defined in:
- lib/bundler/cli/install.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ Install
constructor
A new instance of Install.
- #run ⇒ Object
Constructor Details
#initialize(options) ⇒ Install
Returns a new instance of Install.
4 5 6 |
# File 'lib/bundler/cli/install.rb', line 4 def initialize() @options = .dup end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/bundler/cli/install.rb', line 3 def @options end |
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/bundler/cli/install.rb', line 8 def run warn_if_root if [:without] [:without] = [:without].map{|g| g.tr(' ', ':') } end ENV['RB_USER_INSTALL'] = '1' if Bundler::FREEBSD # Just disable color in deployment mode Bundler.ui.shell = Thor::Shell::Basic.new if [:deployment] if ([:path] || [:deployment]) && [:system] Bundler.ui.error "You have specified both a path to install your gems to, \n" \ "as well as --system. Please choose." exit 1 end if (["trust-policy"]) unless (Bundler.rubygems.security_policies.keys.include?(["trust-policy"])) Bundler.ui.error "Rubygems doesn't know about trust policy '#{["trust-policy"]}'. " \ "The known policies are: #{Bundler.rubygems.security_policies.keys.join(', ')}." exit 1 end Bundler.settings["trust-policy"] = ["trust-policy"] else Bundler.settings["trust-policy"] = nil if Bundler.settings["trust-policy"] end if [:deployment] || [:frozen] unless Bundler.default_lockfile.exist? flag = [:deployment] ? '--deployment' : '--frozen' raise ProductionError, "The #{flag} flag requires a Gemfile.lock. Please make " \ "sure you have checked your Gemfile.lock into version control " \ "before deploying." end if Bundler.root.join("vendor/cache").exist? [:local] = true end Bundler.settings[:frozen] = '1' end # When install is called with --no-deployment, disable deployment mode if [:deployment] == false Bundler.settings.delete(:frozen) [:system] = true end Bundler.settings[:path] = nil if [:system] Bundler.settings[:path] = "vendor/bundle" if [:deployment] Bundler.settings[:path] = ["path"] if ["path"] Bundler.settings[:path] ||= "bundle" if ["standalone"] Bundler.settings[:bin] = ["binstubs"] if ["binstubs"] Bundler.settings[:bin] = nil if ["binstubs"] && ["binstubs"].empty? Bundler.settings[:shebang] = ["shebang"] if ["shebang"] Bundler.settings[:jobs] = ["jobs"] if ["jobs"] Bundler.settings[:no_prune] = true if ["no-prune"] Bundler.settings[:no_install] = true if ["no-install"] Bundler.settings[:clean] = ["clean"] if ["clean"] Bundler.settings.without = [:without] Bundler.ui.level = "warn" if [:quiet] Bundler::Fetcher.disable_endpoint = ["full-index"] Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? '1' : nil # rubygems plugins sometimes hook into the gem install process Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins) definition = Bundler.definition definition.validate_ruby! Installer.install(Bundler.root, definition, ) Bundler.load.cache if Bundler.root.join("vendor/cache").exist? && !["no-cache"] && !Bundler.settings[:frozen] if Bundler.settings[:path] absolute_path = File.(Bundler.settings[:path]) relative_path = absolute_path.sub(File.('.'), '.') Bundler.ui.confirm "Your bundle is complete!" Bundler.ui.confirm "It was installed into #{relative_path}" else Bundler.ui.confirm "Your bundle is complete!" Bundler.ui.confirm "Use `bundle show [gemname]` to see where a bundled gem is installed." end Installer..to_a.each do |name, msg| Bundler.ui.confirm "Post-install message from #{name}:" Bundler.ui.info msg end if Bundler.settings[:clean] && Bundler.settings[:path] require "bundler/cli/clean" Bundler::CLI::Clean.new().run end rescue GemNotFound, VersionConflict => e if [:local] && Bundler.app_cache.exist? Bundler.ui.warn "Some gems seem to be missing from your vendor/cache directory." end if Bundler.definition.rubygems_remotes.empty? Bundler.ui.warn <<-WARN, :wrap => true Your Gemfile has no gem server sources. If you need gems that are \ not already on your machine, add a line like this to your Gemfile: source 'https://rubygems.org' WARN end raise e end |