aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli/edit.rb
diff options
context:
space:
mode:
authorGautham Goli2017-10-21 01:39:04 +0530
committerGautham Goli2017-10-21 01:48:00 +0530
commitbdc7eba4b3459ea0f6fefb5a829da649134d7f8d (patch)
treef95203c5920ac4210033c77ce5d64cac39da0732 /Library/Homebrew/cask/lib/hbc/cli/edit.rb
parent7fa51f71f1a8a21b905bafc1fb4106f0222d654f (diff)
parentc4e8c7906d12399b34188cd3395b8f9d30dc89b3 (diff)
downloadbrew-bdc7eba4b3459ea0f6fefb5a829da649134d7f8d.tar.bz2
Merge branch 'master' into audit_line_rubocop_part_4_rebase_attempt_1
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli/edit.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/edit.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/edit.rb b/Library/Homebrew/cask/lib/hbc/cli/edit.rb
index 8bce81c52..693edcd51 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/edit.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/edit.rb
@@ -8,9 +8,6 @@ module Hbc
end
def run
- cask = casks.first
- cask_path = cask.sourcefile_path
- odebug "Opening editor for Cask #{cask.token}"
exec_editor cask_path
rescue CaskUnavailableError => e
reason = e.reason.empty? ? "" : "#{e.reason} "
@@ -18,6 +15,14 @@ module Hbc
raise e.class.new(e.token, reason)
end
+ def cask_path
+ casks.first.sourcefile_path
+ rescue CaskInvalidError
+ path = CaskLoader.path(args.first)
+ return path if path.file?
+ raise
+ end
+
def self.help
"edits the given Cask"
end