aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli/create.rb
diff options
context:
space:
mode:
authorMarkus Reiter2016-09-24 13:52:43 +0200
committerMarkus Reiter2016-09-24 16:00:58 +0200
commitb86c8efb79b3ed835d552c4d7416640ef10caf21 (patch)
tree7e1edc8a8f339e4d2781f43576d40c9c79aebcdc /Library/Homebrew/cask/lib/hbc/cli/create.rb
parent687f0fcf721c8e36f32570ed72d0988a6eaf986f (diff)
downloadbrew-b86c8efb79b3ed835d552c4d7416640ef10caf21.tar.bz2
Cask: Use nested classes and modules.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli/create.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/create.rb58
1 files changed, 31 insertions, 27 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/create.rb b/Library/Homebrew/cask/lib/hbc/cli/create.rb
index 3c1ac76ed..14860942f 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/create.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/create.rb
@@ -1,37 +1,41 @@
-class Hbc::CLI::Create < Hbc::CLI::Base
- def self.run(*args)
- cask_tokens = cask_tokens_from(args)
- raise Hbc::CaskUnspecifiedError if cask_tokens.empty?
- cask_token = cask_tokens.first.sub(%r{\.rb$}i, "")
- cask_path = Hbc.path(cask_token)
- odebug "Creating Cask #{cask_token}"
+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(%r{\.rb$}i, "")
+ cask_path = Hbc.path(cask_token)
+ odebug "Creating Cask #{cask_token}"
- raise Hbc::CaskAlreadyCreatedError, cask_token if cask_path.exist?
+ raise CaskAlreadyCreatedError, cask_token if cask_path.exist?
- File.open(cask_path, "w") do |f|
- f.write template(cask_token)
- end
+ File.open(cask_path, "w") do |f|
+ f.write template(cask_token)
+ end
- exec_editor cask_path
- end
+ exec_editor cask_path
+ end
- def self.template(cask_token)
- <<-EOS.undent
- cask '#{cask_token}' do
- version ''
- sha256 ''
+ def self.template(cask_token)
+ <<-EOS.undent
+ cask '#{cask_token}' do
+ version ''
+ sha256 ''
- url 'https://'
- name ''
- homepage ''
- license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder
+ url 'https://'
+ name ''
+ homepage ''
+ license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder
- app ''
+ app ''
+ end
+ EOS
end
- EOS
- end
- def self.help
- "creates the given Cask and opens it in an editor"
+ def self.help
+ "creates the given Cask and opens it in an editor"
+ end
+ end
end
end