summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Sasse <esasse@gmail.com>2015-07-23 22:11:44 -0300
committerErick Sasse <esasse@gmail.com>2015-07-23 22:11:44 -0300
commit7adb0a487f3cf1fd9a573fa1e15ec2e025dee893 (patch)
tree641ecbf98e22fbc6e8a92d1f6f117bf05a2bb17f
parent4d6c32be29d745fadef04380758b6f68817fbb33 (diff)
downloadbundler-7adb0a487f3cf1fd9a573fa1e15ec2e025dee893.tar.gz
Fix Style/Alias
-rw-r--r--.rubocop_todo.yml5
-rw-r--r--lib/bundler/dep_proxy.rb2
-rw-r--r--lib/bundler/index.rb2
-rw-r--r--lib/bundler/retry.rb2
-rw-r--r--lib/bundler/rubygems_ext.rb4
-rw-r--r--lib/bundler/rubygems_integration.rb4
-rw-r--r--lib/bundler/runtime.rb2
-rw-r--r--lib/bundler/settings.rb2
-rw-r--r--lib/bundler/source/git.rb4
-rw-r--r--lib/bundler/source/path.rb2
-rw-r--r--lib/bundler/source/rubygems.rb2
-rw-r--r--spec/support/builders.rb2
-rw-r--r--spec/support/helpers.rb2
-rw-r--r--spec/support/indexes.rb2
-rw-r--r--spec/support/matchers.rb2
-rw-r--r--spec/support/path.rb2
16 files changed, 18 insertions, 23 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index ab75eace17..5c75718ca6 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -57,11 +57,6 @@ Metrics/PerceivedComplexity:
Style/AccessorMethodName:
Enabled: false
-# Offense count: 18
-# Cop supports --auto-correct.
-Style/Alias:
- Enabled: false
-
# Offense count: 3
# Cop supports --auto-correct.
Style/AlignArray:
diff --git a/lib/bundler/dep_proxy.rb b/lib/bundler/dep_proxy.rb
index 47de296810..f65e01d173 100644
--- a/lib/bundler/dep_proxy.rb
+++ b/lib/bundler/dep_proxy.rb
@@ -14,7 +14,7 @@ module Bundler
dep == o.dep && __platform == o.__platform
end
- alias eql? ==
+ alias_method :eql?, :==
def type
@dep.type
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb
index 3468aa7514..6c4ed3996c 100644
--- a/lib/bundler/index.rb
+++ b/lib/bundler/index.rb
@@ -81,7 +81,7 @@ module Bundler
end
end
- alias [] search
+ alias_method :[], :search
def <<(spec)
@specs[spec.name]["#{spec.version}-#{spec.platform}"] = spec
diff --git a/lib/bundler/retry.rb b/lib/bundler/retry.rb
index 55e579571b..7f6da8a58e 100644
--- a/lib/bundler/retry.rb
+++ b/lib/bundler/retry.rb
@@ -30,7 +30,7 @@ module Bundler
end
@result
end
- alias :attempts :attempt
+ alias_method :attempts, :attempt
private
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index b0ea9301ad..eddd1fa191 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -107,7 +107,7 @@ module Gem
class Dependency
attr_accessor :source, :groups
- alias eql? ==
+ alias_method :eql?, :==
def encode_with(coder)
to_yaml_properties.each do |ivar|
@@ -158,7 +158,7 @@ module Gem
end
undef_method :eql? if method_defined? :eql?
- alias eql? ==
+ alias_method :eql?, :==
end
end
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 3d9ee2986e..5ce80d7a78 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -255,8 +255,8 @@ module Bundler
# Disable rubygems' gem activation system
::Kernel.class_eval do
if private_method_defined?(:gem_original_require)
- alias rubygems_require require
- alias require gem_original_require
+ alias_method :rubygems_require, :require
+ alias_method :require, :gem_original_require
end
undef gem
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 5c06685c97..497f3b77bc 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -100,7 +100,7 @@ module Bundler
end
end
- alias gems specs
+ alias_method :gems, :specs
def cache(custom_path = nil)
cache_path = Bundler.app_cache(custom_path)
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 898817c963..c675089a5a 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -31,7 +31,7 @@ module Bundler
set_key(key, value, @local_config, local_config_file)
end
- alias :set_local :[]=
+ alias_method :set_local, :[]=
def delete(key)
@local_config.delete(key_for(key))
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index 59ec639879..7c0abc5637 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -54,7 +54,7 @@ module Bundler
submodules == o.submodules
end
- alias == eql?
+ alias_method :==, :eql?
def to_s
at = if local?
@@ -87,7 +87,7 @@ module Bundler
end
end
- alias :path :install_path
+ alias_method :path, :install_path
def extension_dir_name
"#{base_name}-#{shortref_for_path(revision)}"
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 4cd7361d5b..b42d172cce 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -62,7 +62,7 @@ module Bundler
version == o.version
end
- alias == eql?
+ alias_method :==, :eql?
def name
File.basename(expanded_path.to_s)
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index f282edfd96..d15362b9aa 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -41,7 +41,7 @@ module Bundler
o.is_a?(Rubygems) && o.credless_remotes == credless_remotes
end
- alias == eql?
+ alias_method :==, :eql?
def include?(o)
o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty?
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index c9159e6493..ca26655ff4 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -432,7 +432,7 @@ module Spec
@spec.add_runtime_dependency(name, requirements)
end
- alias dep runtime
+ alias_method :dep, :runtime
end
class LibBuilder
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 1fbdb902d9..de6fb54327 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -197,7 +197,7 @@ module Spec
end
end
- alias install_gem install_gems
+ alias_method :install_gem, :install_gems
def with_gem_path_as(path)
gem_home, gem_path = ENV["GEM_HOME"], ENV["GEM_PATH"]
diff --git a/spec/support/indexes.rb b/spec/support/indexes.rb
index 119197d45a..dff5138733 100644
--- a/spec/support/indexes.rb
+++ b/spec/support/indexes.rb
@@ -10,7 +10,7 @@ module Spec
@platforms.concat args.map {|p| Gem::Platform.new(p) }
end
- alias platforms platform
+ alias_method :platforms, :platform
def resolve
@platforms ||= ["ruby"]
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb
index 5d5e4a0572..d41ac964f5 100644
--- a/spec/support/matchers.rb
+++ b/spec/support/matchers.rb
@@ -40,7 +40,7 @@ module Spec
end
end
- alias should_be_available should_be_installed
+ alias_method :should_be_available, :should_be_installed
def should_not_be_installed(*names)
opts = names.last.is_a?(Hash) ? names.pop : {}
diff --git a/spec/support/path.rb b/spec/support/path.rb
index 21d95a6064..42eb9f7364 100644
--- a/spec/support/path.rb
+++ b/spec/support/path.rb
@@ -24,7 +24,7 @@ module Spec
root.join(*path)
end
- alias bundled_app1 bundled_app
+ alias_method :bundled_app1, :bundled_app
def bundled_app2(*path)
root = tmp.join("bundled_app2")