diff options
| author | Markus Reiter | 2017-05-19 21:20:51 +0200 |
|---|---|---|
| committer | Markus Reiter | 2017-05-22 02:51:16 +0200 |
| commit | 8248345a9a735aa9ee0421413166e9733bff277d (patch) | |
| tree | b8ad36e1e25d5b089ccf2d6edb06a2118515c7b6 /Library/Homebrew/cask/lib/hbc/cli | |
| parent | b7347dcc445fe1b3a61a79152c09c0d52fc4ea28 (diff) | |
| download | brew-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.rb | 8 |
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 |
