diff options
| author | Xu Cheng | 2015-11-16 23:18:31 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-11-17 18:52:00 +0800 |
| commit | d108bf0a55446df39592604bbfefa641d9c0e734 (patch) | |
| tree | eee1d5deaaa88fc4e42959ccfc6b9f061abd62be /Library/Homebrew/compat | |
| parent | baf3ca09b2ec7e1e2803f62e02c0f75ba972275b (diff) | |
| download | brew-d108bf0a55446df39592604bbfefa641d9c0e734.tar.bz2 | |
move more deprecated methods to compat folder
Diffstat (limited to 'Library/Homebrew/compat')
| -rw-r--r-- | Library/Homebrew/compat/dependency_collector.rb | 25 | ||||
| -rw-r--r-- | Library/Homebrew/compat/keg.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/compat/pathname.rb | 17 |
3 files changed, 48 insertions, 0 deletions
diff --git a/Library/Homebrew/compat/dependency_collector.rb b/Library/Homebrew/compat/dependency_collector.rb new file mode 100644 index 000000000..516c55b56 --- /dev/null +++ b/Library/Homebrew/compat/dependency_collector.rb @@ -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 diff --git a/Library/Homebrew/compat/keg.rb b/Library/Homebrew/compat/keg.rb new file mode 100644 index 000000000..015e6ae1f --- /dev/null +++ b/Library/Homebrew/compat/keg.rb @@ -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 diff --git a/Library/Homebrew/compat/pathname.rb b/Library/Homebrew/compat/pathname.rb new file mode 100644 index 000000000..7248525e5 --- /dev/null +++ b/Library/Homebrew/compat/pathname.rb @@ -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 |
