aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2013-02-17 22:52:39 -0600
committerJack Nagel2013-02-18 12:13:34 -0600
commit5a34e80675c6406d66569affc4732e2dc5f3b605 (patch)
tree1933839d1bbf3ee3dec2a62f71916c672ec9b2c6
parentee25d02d54aeb4c3a0c75b4cdee276706f610576 (diff)
downloadhomebrew-5a34e80675c6406d66569affc4732e2dc5f3b605.tar.bz2
Don't use deprecated form of attr
The form "attr :name, true" is deprecated and causes Ruby to emit a warning in verbose mode. Using attr_{reader,writer,accessor} is more clear anyway, so do so.
-rw-r--r--Library/Homebrew/cmd/audit.rb4
-rw-r--r--Library/Homebrew/cmd/create.rb8
-rw-r--r--Library/Homebrew/exceptions.rb22
-rw-r--r--Library/Homebrew/formula_installer.rb9
4 files changed, 15 insertions, 28 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index c8ebad17a..f880db36b 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -73,9 +73,7 @@ class FormulaText
end
class FormulaAuditor
- attr :f
- attr :text
- attr :problems, true
+ attr_reader :f, :text, :problems
BUILD_TIME_DEPS = %W[
autoconf
diff --git a/Library/Homebrew/cmd/create.rb b/Library/Homebrew/cmd/create.rb
index 5565cfb11..9f215a0f2 100644
--- a/Library/Homebrew/cmd/create.rb
+++ b/Library/Homebrew/cmd/create.rb
@@ -71,12 +71,8 @@ module Homebrew extend self
end
class FormulaCreator
- attr :url
- attr :sha1
- attr :name, true
- attr :version, true
- attr :path, true
- attr :mode, true
+ attr_reader :url, :sha1
+ attr_accessor :name, :version, :path, :mode
def url= url
@url = url
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index 1326a017b..43075003a 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -3,7 +3,7 @@ class FormulaUnspecifiedError < UsageError; end
class KegUnspecifiedError < UsageError; end
class MultipleVersionsInstalledError < RuntimeError
- attr :name
+ attr_reader :name
def initialize name
@name = name
@@ -14,7 +14,7 @@ end
class NotAKegError < RuntimeError; end
class NoSuchKegError < RuntimeError
- attr :name
+ attr_reader :name
def initialize name
@name = name
@@ -23,8 +23,8 @@ class NoSuchKegError < RuntimeError
end
class FormulaUnavailableError < RuntimeError
- attr :name
- attr :dependent, true
+ attr_reader :name
+ attr_accessor :dependent
def dependent_s
"(dependency of #{dependent})" if dependent and dependent != name
@@ -59,7 +59,7 @@ end
module Homebrew
class InstallationError < RuntimeError
- attr :formula
+ attr_reader :formula
def initialize formula, message=""
super message
@@ -87,7 +87,7 @@ class UnsatisfiedDependencyError < Homebrew::InstallationError
end
class UnsatisfiedRequirements < Homebrew::InstallationError
- attr :reqs
+ attr_reader :reqs
def initialize formula, reqs
@reqs = reqs
@@ -99,9 +99,7 @@ class UnsatisfiedRequirements < Homebrew::InstallationError
end
class BuildError < Homebrew::InstallationError
- attr :exit_status
- attr :command
- attr :env
+ attr_reader :exit_status, :command, :env
def initialize formula, cmd, args, es
@command = cmd
@@ -159,10 +157,8 @@ end
# raised by Pathname#verify_checksum when verification fails
class ChecksumMismatchError < RuntimeError
- attr :advice, true
- attr :expected
- attr :actual
- attr :hash_type
+ attr_accessor :advice
+ attr_reader :expected, :actual, :hash_type
def initialize expected, actual
@expected = expected
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 1008bc2e6..8dbd318a9 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -6,12 +6,9 @@ require 'bottles'
require 'caveats'
class FormulaInstaller
- attr :f
- attr :tab, true
- attr :options, true
- attr :show_summary_heading, true
- attr :ignore_deps, true
- attr :show_header, true
+ attr_reader :f
+ attr_accessor :tab, :options, :ignore_deps
+ attr_accessor :show_summary_heading, :show_header
def initialize ff
@f = ff