diff options
author | Asutosh Palai <asupalai@gmail.com> | 2016-05-30 13:13:22 +0530 |
---|---|---|
committer | Asutosh Palai <asupalai@gmail.com> | 2016-05-30 13:13:22 +0530 |
commit | b44cb31c89fe77084923f83bdcc3d88b452f1e6a (patch) | |
tree | 7736d04c3669bc191d4aacc038f9297e4908c759 | |
parent | 98ac13665be713123d72d3bb23150b80cda5e0e3 (diff) | |
download | bundler-b44cb31c89fe77084923f83bdcc3d88b452f1e6a.tar.gz |
changed all source opts calls to func call
-rw-r--r-- | lib/bundler/source.rb | 2 | ||||
-rw-r--r-- | lib/bundler/source/git.rb | 6 | ||||
-rw-r--r-- | lib/bundler/source/rubygems.rb | 17 |
3 files changed, 12 insertions, 13 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index 8a1340972e..9831d31455 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -22,7 +22,7 @@ module Bundler def version_message(spec) message = "#{spec.name} #{spec.version}" - if !@options[:plugin] && Bundler.locked_gems + if !for_plugin? && Bundler.locked_gems locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name } locked_spec_version = locked_spec.version if locked_spec if locked_spec_version && spec.version != locked_spec_version diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index c142d1c559..fcc1d182ea 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -87,7 +87,7 @@ module Bundler @install_path ||= begin git_scope = "#{base_name}-#{shortref_for_path(revision)}" - if @options[:plugin] + if for_plugin? path = Plugin.root.join("bundler", "gems", git_scope) else path = Bundler.install_path.join(git_scope) @@ -174,7 +174,7 @@ module Bundler serialize_gemspecs_in(install_path) @copied = true end - generate_bin(spec) unless @options[:plugin] + generate_bin(spec) unless for_plugin? requires_checkout? ? spec.post_install_message : nil end @@ -205,7 +205,7 @@ module Bundler @cache_path ||= begin git_scope = "#{base_name}-#{uri_hash}" - if @options[:plugin] + if for_plugin? Plugin.cache.join("bundler", "git", git_scope) elsif Bundler.requires_sudo? Bundler.user_bundle_path.join("cache/git", git_scope) diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 0b5327ee12..097e625978 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -22,8 +22,7 @@ module Bundler @allow_remote = false @allow_cached = false @caches = [*Bundler.rubygems.gem_cache] - @caches << Bundler.app_cache unless options[:plugin] # To use this class for installing plugins - @caches << Bundler::Plugin.cache if options[:plugin] + @caches << (options[:plugin] ? Bundler::Plugin.cache : Bundler.app_cache) Array(options["remotes"] || []).reverse_each {|r| add_remote(r) } end @@ -125,7 +124,7 @@ module Bundler Bundler.ui.confirm message path = cached_gem(spec) - if @options[:plugin] + if for_plugin? install_path = Bundler::Plugin.root bin_path = install_path.join("bin") elsif Bundler.requires_sudo? @@ -150,7 +149,7 @@ module Bundler spec.full_gem_path = installed_spec.full_gem_path # SUDO HAX - if !@options[:plugin] && Bundler.requires_sudo? + if !for_plugin? && Bundler.requires_sudo? Bundler.rubygems.repository_subdirectories.each do |name| src = File.join(install_path, name, "*") dst = File.join(Bundler.rubygems.gem_dir, name) @@ -179,7 +178,7 @@ module Bundler spec.post_install_message ensure - Bundler.rm_rf(install_path) if !@options[:plugin] && Bundler.requires_sudo? + Bundler.rm_rf(install_path) if !for_plugin? && Bundler.requires_sudo? end def cache(spec, custom_path = nil) @@ -321,7 +320,7 @@ module Bundler @cached_specs ||= begin idx = installed_specs.dup - path = @options[:plugin] ? Bundler::Plugin.cache : Bundler.app_cache + path = for_plugin? ? Bundler::Plugin.cache : Bundler.app_cache Dir["#{path}/*.gem"].each do |gemfile| next if gemfile =~ /^bundler\-[\d\.]+?\.gem/ s ||= Bundler.rubygems.spec_from_gem(gemfile) @@ -407,7 +406,7 @@ module Bundler uri = spec.remote.uri spec.fetch_platform - if @options[:plugin] + if for_plugin? download_path = Bundler::Plugin.root gem_path = "#{download_path}/cache/#{spec.full_name}.gem" else @@ -420,7 +419,7 @@ module Bundler end Bundler.rubygems.download_gem(spec, uri, download_path) - if !@options[:plugin] && Bundler.requires_sudo? + if !for_plugin? && Bundler.requires_sudo? SharedHelpers.filesystem_access("#{Bundler.rubygems.gem_dir}/cache") do |p| Bundler.mkdir_p(p) end @@ -429,7 +428,7 @@ module Bundler gem_path ensure - Bundler.rm_rf(download_path) if !@options[:plugin] && Bundler.requires_sudo? + Bundler.rm_rf(download_path) if !for_plugin? && Bundler.requires_sudo? end def builtin_gem?(spec) |