summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAsutosh Palai <asupalai@gmail.com>2016-06-06 12:40:55 +0530
committerAsutosh Palai <asupalai@gmail.com>2016-06-06 12:41:06 +0530
commit008722762079ecc00470a577fc3d4a9416b39506 (patch)
treee422518a4723bc3088b5761f56b83fa1a0433fdf /lib
parentcb7286d8815d774fdabcae91e5f987260d9871e0 (diff)
downloadbundler-008722762079ecc00470a577fc3d4a9416b39506.tar.gz
Fixed the issues raised in comments
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli/install.rb34
-rw-r--r--lib/bundler/plugin.rb18
-rw-r--r--lib/bundler/plugin/api.rb2
-rw-r--r--lib/bundler/plugin/dsl.rb4
-rw-r--r--lib/bundler/plugin/installer.rb8
5 files changed, 36 insertions, 30 deletions
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index a0197fc6f8..810eb9234c 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -185,19 +185,27 @@ module Bundler
end
def normalize_settings
- Bundler.settings[:path] = nil if options[:system]
- Bundler.settings[:path] = "vendor/bundle" if options[:deployment]
- Bundler.settings[:path] = options["path"] if options["path"]
- Bundler.settings[:path] ||= "bundle" if options["standalone"]
- Bundler.settings[:bin] = options["binstubs"] if options["binstubs"]
- Bundler.settings[:bin] = nil if options["binstubs"] && options["binstubs"].empty?
- Bundler.settings[:shebang] = options["shebang"] if options["shebang"]
- Bundler.settings[:jobs] = options["jobs"] if options["jobs"]
- Bundler.settings[:no_prune] = true if options["no-prune"]
- Bundler.settings[:no_install] = true if options["no-install"]
- Bundler.settings[:clean] = options["clean"] if options["clean"]
- Bundler.settings.without = options[:without]
- Bundler.settings.with = options[:with]
+ Bundler.settings[:path] = nil if options[:system]
+ Bundler.settings[:path] = "vendor/bundle" if options[:deployment]
+ Bundler.settings[:path] = options["path"] if options["path"]
+ Bundler.settings[:path] ||= "bundle" if options["standalone"]
+
+ Bundler.settings[:bin] = options["binstubs"] if options["binstubs"]
+ Bundler.settings[:bin] = nil if options["binstubs"] && options["binstubs"].empty?
+
+ Bundler.settings[:shebang] = options["shebang"] if options["shebang"]
+
+ Bundler.settings[:jobs] = options["jobs"] if options["jobs"]
+
+ Bundler.settings[:no_prune] = true if options["no-prune"]
+
+ Bundler.settings[:no_install] = true if options["no-install"]
+
+ Bundler.settings[:clean] = options["clean"] if options["clean"]
+
+ Bundler.settings.without = options[:without]
+ Bundler.settings.with = options[:with]
+
Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? true : nil
end
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index 978f4a57a4..caf8b5b800 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -2,13 +2,13 @@
module Bundler
module Plugin
- autoload :Api, "bundler/plugin/api"
- autoload :Dsl, "bundler/plugin/dsl"
+ autoload :API, "bundler/plugin/api"
+ autoload :DSL, "bundler/plugin/dsl"
autoload :Index, "bundler/plugin/index"
autoload :Installer, "bundler/plugin/installer"
autoload :SourceList, "bundler/plugin/source_list"
- PLUGIN_FILE_NAME = "plugin.rb".freeze
+ PLUGIN_FILE_NAME = "plugins.rb".freeze
@commands = {}
@@ -37,7 +37,7 @@ module Bundler
#
# @param [Pathname] gemfile path
def eval_gemfile(gemfile)
- definition = Dsl.evaluate(gemfile, nil, {})
+ definition = DSL.evaluate(gemfile, nil, {})
return unless definition.dependencies.any?
plugins = Installer.new.install_definition(definition)
@@ -65,7 +65,7 @@ module Bundler
@cache ||= root.join("cache")
end
- # To be called via the Api to register to handle a command
+ # To be called via the API to register to handle a command
def add_command(command, cls)
@commands[command] = cls
end
@@ -89,16 +89,16 @@ module Bundler
# Checks if the gem is good to be a plugin
#
- # At present it only checks whether it contains plugin.rb file
+ # At present it only checks whether it contains plugins.rb file
#
# @param [Pathname] plugin_path the path plugin is installed at
- # @raise [Error] if plugin.rb file is not found
+ # @raise [Error] if plugins.rb file is not found
def validate_plugin!(plugin_path)
plugin_file = plugin_path.join(PLUGIN_FILE_NAME)
raise "#{PLUGIN_FILE_NAME} was not found in the plugin!" unless plugin_file.file?
end
- # Runs the plugin.rb file in an isolated namespace, records the plugin
+ # Runs the plugins.rb file in an isolated namespace, records the plugin
# actions it registers for and then passes the data to index to be stored.
#
# @param [String] name the name of the plugin
@@ -115,7 +115,7 @@ module Bundler
@commands = commands
end
- # Executes the plugin.rb file
+ # Executes the plugins.rb file
#
# @param [String] name of the plugin
def load_plugin(name)
diff --git a/lib/bundler/plugin/api.rb b/lib/bundler/plugin/api.rb
index ea9ff1ea12..4771c26121 100644
--- a/lib/bundler/plugin/api.rb
+++ b/lib/bundler/plugin/api.rb
@@ -21,7 +21,7 @@ module Bundler
# To use it without inheriting, you will have to create an object of this
# to use the functions (except for declaration functions like command, source,
# and hooks).
- class Plugin::Api
+ class Plugin::API
# The plugins should declare that they handle a command through this helper.
#
# @param [String] command being handled by them
diff --git a/lib/bundler/plugin/dsl.rb b/lib/bundler/plugin/dsl.rb
index 89d9140aed..dc1eb538d5 100644
--- a/lib/bundler/plugin/dsl.rb
+++ b/lib/bundler/plugin/dsl.rb
@@ -2,7 +2,7 @@
module Bundler
# Dsl to parse the Gemfile looking for plugins to install
- class Plugin::Dsl < Bundler::Dsl
+ class Plugin::DSL < Bundler::Dsl
alias_method :_gem, :gem # To use for plugin installation as gem
# So that we don't have to override all there methods to dummy ones
@@ -20,7 +20,7 @@ module Bundler
end
def method_missing(name, *args)
- # Dummy evaluation
+ super unless Bundler::Dsl.instance_methods.include? name
end
end
end
diff --git a/lib/bundler/plugin/installer.rb b/lib/bundler/plugin/installer.rb
index d4de0be502..38ca58ba09 100644
--- a/lib/bundler/plugin/installer.rb
+++ b/lib/bundler/plugin/installer.rb
@@ -34,7 +34,7 @@ module Bundler
definition.resolve_remotely!
specs = definition.specs
- paths = install_from_spec specs
+ paths = install_from_specs specs
paths.select {|name, _| plugins.include? name }
end
@@ -74,7 +74,7 @@ module Bundler
idx = rg_source.specs
specs = Resolver.resolve(deps_proxies, idx).materialize([dep])
- paths = install_from_spec specs
+ paths = install_from_specs specs
paths[name]
end
@@ -85,12 +85,10 @@ module Bundler
# @param specs to install
#
# @return [Hash] map of names to path where the plugin was installed
- def install_from_spec(specs)
+ def install_from_specs(specs)
paths = {}
specs.each do |spec|
- next if spec.name == "bundler"
-
spec.source.install spec
paths[spec.name] = spec.full_gem_path