aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli
diff options
context:
space:
mode:
authorMarkus Reiter2017-05-19 21:20:51 +0200
committerMarkus Reiter2017-05-22 02:51:16 +0200
commit8248345a9a735aa9ee0421413166e9733bff277d (patch)
treeb8ad36e1e25d5b089ccf2d6edb06a2118515c7b6 /Library/Homebrew/cask/lib/hbc/cli
parentb7347dcc445fe1b3a61a79152c09c0d52fc4ea28 (diff)
downloadbrew-8248345a9a735aa9ee0421413166e9733bff277d.tar.bz2
Refactor `CLI::Create`.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/create.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/create.rb b/Library/Homebrew/cask/lib/hbc/cli/create.rb
index 5e143d085..39b9bcda7 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/create.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/create.rb
@@ -2,7 +2,11 @@ module Hbc
class CLI
class Create < Base
def self.run(*args)
- cask_tokens = cask_tokens_from(args)
+ new(*args).run
+ end
+
+ def run
+ cask_tokens = self.class.cask_tokens_from(@args)
raise CaskUnspecifiedError if cask_tokens.empty?
cask_token = cask_tokens.first.sub(/\.rb$/i, "")
cask_path = CaskLoader.path(cask_token)
@@ -11,7 +15,7 @@ module Hbc
raise CaskAlreadyCreatedError, cask_token if cask_path.exist?
File.open(cask_path, "w") do |f|
- f.write template(cask_token)
+ f.write self.class.template(cask_token)
end
exec_editor cask_path