blob: 3e2b9c19112d3718b98e41d0263c164abc2ba9bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
module Hbc
class CLI
class Create < Base
def self.run(*args)
cask_tokens = cask_tokens_from(args)
raise CaskUnspecifiedError if cask_tokens.empty?
cask_token = cask_tokens.first.sub(/\.rb$/i, "")
cask_path = Hbc.path(cask_token)
odebug "Creating Cask #{cask_token}"
raise CaskAlreadyCreatedError, cask_token if cask_path.exist?
File.open(cask_path, "w") do |f|
f.write template(cask_token)
end
exec_editor cask_path
end
def self.template(cask_token)
<<-EOS.undent
cask '#{cask_token}' do
version ''
sha256 ''
url 'https://'
name ''
homepage ''
app ''
end
EOS
end
def self.help
"creates the given Cask and opens it in an editor"
end
end
end
end
|