lib/travis/cli.rb in travis-1.6.18.travis.596.5 vs lib/travis/cli.rb in travis-1.6.18.travis.604.5
- old
+ new
@@ -22,10 +22,11 @@
autoload :Command, 'travis/cli/command'
autoload :Console, 'travis/cli/console'
autoload :Disable, 'travis/cli/disable'
autoload :Enable, 'travis/cli/enable'
autoload :Encrypt, 'travis/cli/encrypt'
+ autoload :EncryptFile, 'travis/cli/encrypt_file'
autoload :Endpoint, 'travis/cli/endpoint'
autoload :Env, 'travis/cli/env'
autoload :Help, 'travis/cli/help'
autoload :History, 'travis/cli/history'
autoload :Init, 'travis/cli/init'
@@ -63,11 +64,11 @@
command.execute
end
def command(name)
const_name = command_name(name)
- constant = CLI.const_get(const_name) if const_name =~ /^[A-Z][a-z]+$/ and const_defined? const_name
+ constant = CLI.const_get(const_name) if const_name =~ /^[A-Z][A-Za-z]+$/ and const_defined? const_name
if command? constant
constant
else
$stderr.puts "unknown command #{name}"
exit 1
@@ -106,10 +107,10 @@
def command_name(name)
case name
when nil, '-h', '-?' then 'Help'
when '-v' then 'Version'
when /^--/ then command_name(name[2..-1])
- else name.to_s.capitalize
+ else name.split('-').map(&:capitalize).join
end
end
# can't use flatten as it will flatten hashes
def preparse(unparsed, args = [], opts = {})