move more deprecated methods to compat folder

This commit is contained in:
Xu Cheng 2015-11-16 23:18:31 +08:00
parent baf3ca09b2
commit d108bf0a55
7 changed files with 51 additions and 34 deletions

View File

@ -7,3 +7,6 @@ require "compat/md5"
require "compat/requirements" require "compat/requirements"
require "compat/version" require "compat/version"
require "compat/download_strategy" require "compat/download_strategy"
require "compat/keg"
require "compat/pathname"
require "compat/dependency_collector"

View File

@ -0,0 +1,25 @@
module DependencyCollectorCompat
def parse_symbol_spec(spec, tags)
case spec
when :clt
when :autoconf, :automake, :bsdmake, :libtool
autotools_dep(spec, tags)
when :cairo, :fontconfig, :freetype, :libpng, :pixman
Dependency.new(spec.to_s, tags)
when :libltdl
tags << :run
Dependency.new("libtool", tags)
else
super(spec, tags)
end
end
end
class DependencyCollector
prepend DependencyCollectorCompat
def autotools_dep(spec, tags)
tags << :build unless tags.include? :run
Dependency.new(spec.to_s, tags)
end
end

View File

@ -0,0 +1,6 @@
class Keg
def fname
opoo "Keg#fname is a deprecated alias for Keg#name and will be removed soon"
name
end
end

View File

@ -0,0 +1,17 @@
class Pathname
def cp(dst)
opoo "Pathname#cp is deprecated, use FileUtils.cp"
if file?
FileUtils.cp to_s, dst
else
FileUtils.cp_r to_s, dst
end
dst
end
def chmod_R(perms)
opoo "Pathname#chmod_R is deprecated, use FileUtils.chmod_R"
require "fileutils"
FileUtils.chmod_R perms, to_s
end
end

View File

@ -116,14 +116,6 @@ class DependencyCollector
when :emacs then EmacsRequirement.new(tags) when :emacs then EmacsRequirement.new(tags)
# Tiger's ld is too old to properly link some software # Tiger's ld is too old to properly link some software
when :ld64 then LD64Dependency.new if MacOS.version < :leopard when :ld64 then LD64Dependency.new if MacOS.version < :leopard
when :clt # deprecated
when :autoconf, :automake, :bsdmake, :libtool # deprecated
autotools_dep(spec, tags)
when :cairo, :fontconfig, :freetype, :libpng, :pixman # deprecated
Dependency.new(spec.to_s, tags)
when :libltdl # deprecated
tags << :run
Dependency.new("libtool", tags)
when :python2 when :python2
PythonRequirement.new(tags) PythonRequirement.new(tags)
else else
@ -139,11 +131,6 @@ class DependencyCollector
end end
end end
def autotools_dep(spec, tags)
tags << :build unless tags.include? :run
Dependency.new(spec.to_s, tags)
end
def ant_dep(spec, tags) def ant_dep(spec, tags)
if MacOS.version >= :mavericks if MacOS.version >= :mavericks
Dependency.new(spec.to_s, tags) Dependency.new(spec.to_s, tags)

View File

@ -135,16 +135,6 @@ class Pathname
end end
private :default_stat private :default_stat
# @private
def cp(dst)
opoo "Pathname#cp is deprecated, use FileUtils.cp"
if file?
FileUtils.cp to_s, dst
else
FileUtils.cp_r to_s, dst
end
dst
end
# @private # @private
def cp_path_sub(pattern, replacement) def cp_path_sub(pattern, replacement)
@ -198,12 +188,6 @@ class Pathname
false false
end end
# @private
def chmod_R(perms)
opoo "Pathname#chmod_R is deprecated, use FileUtils.chmod_R"
require "fileutils"
FileUtils.chmod_R perms, to_s
end
# @private # @private
def version def version

View File

@ -103,11 +103,6 @@ class Keg
@opt_record = HOMEBREW_PREFIX.join("opt", name) @opt_record = HOMEBREW_PREFIX.join("opt", name)
end end
def fname
opoo "Keg#fname is a deprecated alias for Keg#name and will be removed soon"
name
end
def to_s def to_s
path.to_s path.to_s
end end