homebrew-cask-versions/lib/cask/cli/create.rb
phinze fed2824c7f add bona fide brew cask create command
the create command opens up an editor with template to get started

remove --create override flag from `brew cask edit`

hopefully this will be more straightforward for contributors

refs #306
2013-05-11 19:24:17 -05:00

34 lines
670 B
Ruby

module Cask::CLI::Create
def self.run(*arguments)
cask_name, *_ = *arguments
cask_path = Cask.path(cask_name)
if cask_path.exist?
raise CaskAlreadyCreatedError.new cask_name
end
File.open(cask_path, 'w') do |f|
f.write template(cask_name)
end
exec_editor cask_path
end
def self.template(cask_name);
cask_class = cask_name.split('-').map(&:capitalize).join
<<-EOS.undent
class #{cask_class} < Cask
url ''
homepage ''
version ''
sha1 ''
link :app, ''
end
EOS
end
def self.help
"creates a cask of the given name and opens it in an editor"
end
end