Skip to content

Commit

Permalink
Merge pull request #8404 from reitermarkus/missing-methods
Browse files Browse the repository at this point in the history
Fix missing methods in cask DSL.
  • Loading branch information
reitermarkus committed Aug 19, 2020
2 parents 85c0612 + 77d25da commit b623d87
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Library/Homebrew/cask/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ def auto_updates(auto_updates = nil)
end
end

def respond_to_missing?(*)
super
end

def method_missing(method, *)
if method
Utils.method_missing_message(method, token)
Expand All @@ -291,10 +295,6 @@ def method_missing(method, *)
end
end

def respond_to_missing?(*)
super || true
end

def appdir
cask.config.appdir
end
Expand Down
8 changes: 4 additions & 4 deletions Library/Homebrew/cask/dsl/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def system_command(executable, **options)
@command.run!(executable, **options)
end

def respond_to_missing?(*)
super
end

def method_missing(method, *)
if method
underscored_class = self.class.name.gsub(/([[:lower:]])([[:upper:]][[:lower:]])/, '\1_\2').downcase
Expand All @@ -28,10 +32,6 @@ def method_missing(method, *)
super
end
end

def respond_to_missing?(*)
super || true
end
end
end
end
9 changes: 4 additions & 5 deletions Library/Homebrew/cask/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,11 @@ def self.error_message_with_suggestions
end

def self.method_missing_message(method, token, section = nil)
poo = []
poo << "Unexpected method '#{method}' called"
poo << "during #{section}" if section
poo << "on Cask #{token}."
message = +"Unexpected method '#{method}' called "
message << "during #{section} " if section
message << "on Cask #{token}."

opoo("#{poo.join(" ")}\n#{error_message_with_suggestions}")
opoo "#{message}\n#{error_message_with_suggestions}"
end
end
end

0 comments on commit b623d87

Please sign in to comment.