Rename Cask::CLI to Cask::Cmd.

This commit is contained in:
Mike McQuaid 2018-09-04 08:45:48 +01:00
parent 1d86d7a7c7
commit 1ae2326984
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
47 changed files with 81 additions and 81 deletions

View File

@ -31,7 +31,7 @@ require "cask/cmd/internal_help"
require "cask/cmd/internal_stanza" require "cask/cmd/internal_stanza"
module Hbc module Hbc
class CLI class Cmd
ALIASES = { ALIASES = {
"ls" => "list", "ls" => "list",
"homepage" => "home", "homepage" => "home",
@ -232,10 +232,10 @@ module Hbc
end end
def usage def usage
max_command_len = CLI.commands.map(&:length).max max_command_len = Cmd.commands.map(&:length).max
puts "Commands:\n\n" puts "Commands:\n\n"
CLI.command_classes.each do |klass| Cmd.command_classes.each do |klass|
next unless klass.visible next unless klass.visible
puts " #{klass.command_name.ljust(max_command_len)} #{_help_for(klass)}" puts " #{klass.command_name.ljust(max_command_len)} #{_help_for(klass)}"
end end

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Version < AbstractCommand class Version < AbstractCommand
def self.command_name def self.command_name
"--#{super}" "--#{super}"

View File

@ -2,7 +2,7 @@ require_relative "options"
require "search" require "search"
module Hbc module Hbc
class CLI class Cmd
class AbstractCommand class AbstractCommand
include Options include Options
include Homebrew::Search include Homebrew::Search

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class AbstractInternalCommand < AbstractCommand class AbstractInternalCommand < AbstractCommand
def self.command_name def self.command_name
super.sub(/^internal_/i, "_") super.sub(/^internal_/i, "_")

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Audit < AbstractCommand class Audit < AbstractCommand
option "--download", :download, false option "--download", :download, false
option "--token-conflicts", :token_conflicts, false option "--token-conflicts", :token_conflicts, false

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Cat < AbstractCommand class Cat < AbstractCommand
def initialize(*) def initialize(*)
super super

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Create < AbstractCommand class Create < AbstractCommand
def initialize(*) def initialize(*)
super super

View File

@ -2,7 +2,7 @@ require "system_config"
require "cask/checkable" require "cask/checkable"
module Hbc module Hbc
class CLI class Cmd
class Doctor < AbstractCommand class Doctor < AbstractCommand
include Checkable include Checkable

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Edit < AbstractCommand class Edit < AbstractCommand
def initialize(*) def initialize(*)
super super

View File

@ -1,7 +1,7 @@
require "cask/download" require "cask/download"
module Hbc module Hbc
class CLI class Cmd
class Fetch < AbstractCommand class Fetch < AbstractCommand
option "--force", :force, false option "--force", :force, false

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Home < AbstractCommand class Home < AbstractCommand
def run def run
if casks.none? if casks.none?

View File

@ -1,7 +1,7 @@
require "json" require "json"
module Hbc module Hbc
class CLI class Cmd
class Info < AbstractCommand class Info < AbstractCommand
option "--json=VERSION", :json option "--json=VERSION", :json

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Install < AbstractCommand class Install < AbstractCommand
option "--force", :force, false option "--force", :force, false
option "--skip-cask-deps", :skip_cask_deps, false option "--skip-cask-deps", :skip_cask_deps, false

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class InternalHelp < AbstractInternalCommand class InternalHelp < AbstractInternalCommand
def initialize(*) def initialize(*)
super super
@ -8,9 +8,9 @@ module Hbc
end end
def run def run
max_command_len = CLI.commands.map(&:length).max max_command_len = Cmd.commands.map(&:length).max
puts "Unstable Internal-use Commands:\n\n" puts "Unstable Internal-use Commands:\n\n"
CLI.command_classes.each do |klass| Cmd.command_classes.each do |klass|
next if klass.visible next if klass.visible
puts " #{klass.command_name.ljust(max_command_len)} #{self.class.help_for(klass)}" puts " #{klass.command_name.ljust(max_command_len)} #{self.class.help_for(klass)}"
end end

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class InternalStanza < AbstractInternalCommand class InternalStanza < AbstractInternalCommand
# Syntax # Syntax
# #

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class List < AbstractCommand class List < AbstractCommand
option "-1", :one, false option "-1", :one, false
option "--versions", :versions, false option "--versions", :versions, false

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
module Options module Options
def self.included(klass) def self.included(klass)
klass.extend(ClassMethods) klass.extend(ClassMethods)

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Outdated < AbstractCommand class Outdated < AbstractCommand
option "--greedy", :greedy, false option "--greedy", :greedy, false
option "--quiet", :quiet, false option "--quiet", :quiet, false

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Reinstall < Install class Reinstall < Install
def run def run
casks.each do |cask| casks.each do |cask|

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Style < AbstractCommand class Style < AbstractCommand
def self.help def self.help
"checks Cask style using RuboCop" "checks Cask style using RuboCop"

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Uninstall < AbstractCommand class Uninstall < AbstractCommand
option "--force", :force, false option "--force", :force, false

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Upgrade < AbstractCommand class Upgrade < AbstractCommand
option "--greedy", :greedy, false option "--greedy", :greedy, false
option "--quiet", :quiet, false option "--quiet", :quiet, false

View File

@ -1,5 +1,5 @@
module Hbc module Hbc
class CLI class Cmd
class Zap < AbstractCommand class Zap < AbstractCommand
option "--force", :force, false option "--force", :force, false

View File

@ -4,6 +4,6 @@ module Homebrew
module_function module_function
def cask def cask
Hbc::CLI.run(*ARGV) Hbc::Cmd.run(*ARGV)
end end
end end

View File

@ -4,7 +4,7 @@ require "cleanup"
using CleanupRefinement using CleanupRefinement
module Hbc module Hbc
class CLI class Cmd
class Cleanup < AbstractCommand class Cleanup < AbstractCommand
OUTDATED_DAYS = 10 OUTDATED_DAYS = 10
OUTDATED_TIMESTAMP = Time.now - (60 * 60 * 24 * OUTDATED_DAYS) OUTDATED_TIMESTAMP = Time.now - (60 * 60 * 24 * OUTDATED_DAYS)

View File

@ -2,7 +2,7 @@ require "cask/cmd/abstract_command"
require "cmd/search" require "cmd/search"
module Hbc module Hbc
class CLI class Cmd
module Compat module Compat
class Search < AbstractCommand class Search < AbstractCommand
def run def run

View File

@ -1,4 +1,4 @@
describe Hbc::CLI::Version, :cask do describe Hbc::Cmd::Version, :cask do
describe "::run" do describe "::run" do
it "outputs the current Homebrew Cask version" do it "outputs the current Homebrew Cask version" do
expect { described_class.run } expect { described_class.run }

View File

@ -1,6 +1,6 @@
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Audit, :cask do describe Hbc::Cmd::Audit, :cask do
let(:cask) { Hbc::Cask.new(nil) } let(:cask) { Hbc::Cask.new(nil) }
it_behaves_like "a command that handles invalid options" it_behaves_like "a command that handles invalid options"

View File

@ -1,7 +1,7 @@
require_relative "shared_examples/requires_cask_token" require_relative "shared_examples/requires_cask_token"
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Cat, :cask do describe Hbc::Cmd::Cat, :cask do
it_behaves_like "a command that requires a Cask token" it_behaves_like "a command that requires a Cask token"
it_behaves_like "a command that handles invalid options" it_behaves_like "a command that handles invalid options"

View File

@ -1,7 +1,7 @@
require_relative "shared_examples/requires_cask_token" require_relative "shared_examples/requires_cask_token"
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Create, :cask do describe Hbc::Cmd::Create, :cask do
around do |example| around do |example|
begin begin
example.run example.run

View File

@ -1,17 +1,17 @@
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Doctor, :cask do describe Hbc::Cmd::Doctor, :cask do
it_behaves_like "a command that handles invalid options" it_behaves_like "a command that handles invalid options"
it "displays some nice info about the environment" do it "displays some nice info about the environment" do
expect { expect {
Hbc::CLI::Doctor.run Hbc::Cmd::Doctor.run
}.to output(/\A==> Homebrew Cask Version/).to_stdout }.to output(/\A==> Homebrew Cask Version/).to_stdout
end end
it "raises an exception when arguments are given" do it "raises an exception when arguments are given" do
expect { expect {
Hbc::CLI::Doctor.run("argument") Hbc::Cmd::Doctor.run("argument")
}.to raise_error(ArgumentError) }.to raise_error(ArgumentError)
end end
end end

View File

@ -1,7 +1,7 @@
require_relative "shared_examples/requires_cask_token" require_relative "shared_examples/requires_cask_token"
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Edit, :cask do describe Hbc::Cmd::Edit, :cask do
before do before do
allow_any_instance_of(described_class).to receive(:exec_editor) allow_any_instance_of(described_class).to receive(:exec_editor)
end end

View File

@ -1,7 +1,7 @@
require_relative "shared_examples/requires_cask_token" require_relative "shared_examples/requires_cask_token"
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Fetch, :cask do describe Hbc::Cmd::Fetch, :cask do
let(:local_transmission) { let(:local_transmission) {
Hbc::CaskLoader.load(cask_path("local-transmission")) Hbc::CaskLoader.load(cask_path("local-transmission"))
} }

View File

@ -1,6 +1,6 @@
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Home, :cask do describe Hbc::Cmd::Home, :cask do
before do before do
allow(described_class).to receive(:open_url) allow(described_class).to receive(:open_url)
end end

View File

@ -1,7 +1,7 @@
require_relative "shared_examples/requires_cask_token" require_relative "shared_examples/requires_cask_token"
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Info, :cask do describe Hbc::Cmd::Info, :cask do
it_behaves_like "a command that requires a Cask token" it_behaves_like "a command that requires a Cask token"
it_behaves_like "a command that handles invalid options" it_behaves_like "a command that handles invalid options"

View File

@ -1,7 +1,7 @@
require_relative "shared_examples/requires_cask_token" require_relative "shared_examples/requires_cask_token"
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Install, :cask do describe Hbc::Cmd::Install, :cask do
it_behaves_like "a command that requires a Cask token" it_behaves_like "a command that requires a Cask token"
it_behaves_like "a command that handles invalid options" it_behaves_like "a command that handles invalid options"

View File

@ -1,4 +1,4 @@
describe Hbc::CLI::InternalStanza, :cask do describe Hbc::Cmd::InternalStanza, :cask do
it "shows stanza of the Specified Cask" do it "shows stanza of the Specified Cask" do
command = described_class.new("homepage", "local-caffeine") command = described_class.new("homepage", "local-caffeine")
expect { expect {

View File

@ -1,6 +1,6 @@
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::List, :cask do describe Hbc::Cmd::List, :cask do
it_behaves_like "a command that handles invalid options" it_behaves_like "a command that handles invalid options"
it "lists the installed Casks in a pretty fashion" do it "lists the installed Casks in a pretty fashion" do

View File

@ -1,4 +1,4 @@
describe Hbc::CLI, :cask do describe Hbc::Cmd, :cask do
it "supports setting the appdir" do it "supports setting the appdir" do
allow(Hbc::Config.global).to receive(:appdir).and_call_original allow(Hbc::Config.global).to receive(:appdir).and_call_original

View File

@ -1,6 +1,6 @@
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Outdated, :cask do describe Hbc::Cmd::Outdated, :cask do
let(:installed) do let(:installed) do
[ [
Hbc::CaskLoader.load(cask_path("basic-cask")), Hbc::CaskLoader.load(cask_path("basic-cask")),

View File

@ -9,7 +9,7 @@ describe Hbc::Quarantine, :cask do
describe "by default" do describe "by default" do
it "quarantines a nice fresh Cask" do it "quarantines a nice fresh Cask" do
Hbc::CLI::Install.run("local-transmission") Hbc::Cmd::Install.run("local-transmission")
expect( expect(
Hbc::CaskLoader.load(cask_path("local-transmission")), Hbc::CaskLoader.load(cask_path("local-transmission")),
@ -21,7 +21,7 @@ describe Hbc::Quarantine, :cask do
end end
it "quarantines Cask fetches" do it "quarantines Cask fetches" do
Hbc::CLI::Fetch.run("local-transmission") Hbc::Cmd::Fetch.run("local-transmission")
local_transmission = Hbc::CaskLoader.load(cask_path("local-transmission")) local_transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))
cached_location = Hbc::Download.new(local_transmission, force: false, quarantine: false).perform cached_location = Hbc::Download.new(local_transmission, force: false, quarantine: false).perform
@ -29,7 +29,7 @@ describe Hbc::Quarantine, :cask do
end end
it "quarantines Cask audits" do it "quarantines Cask audits" do
Hbc::CLI::Audit.run("local-transmission", "--download") Hbc::Cmd::Audit.run("local-transmission", "--download")
local_transmission = Hbc::CaskLoader.load(cask_path("local-transmission")) local_transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))
cached_location = Hbc::Download.new(local_transmission, force: false, quarantine: false).perform cached_location = Hbc::Download.new(local_transmission, force: false, quarantine: false).perform
@ -38,7 +38,7 @@ describe Hbc::Quarantine, :cask do
end end
it "quarantines dmg-based Casks" do it "quarantines dmg-based Casks" do
Hbc::CLI::Install.run("container-dmg") Hbc::Cmd::Install.run("container-dmg")
expect( expect(
Hbc::CaskLoader.load(cask_path("container-dmg")), Hbc::CaskLoader.load(cask_path("container-dmg")),
@ -48,7 +48,7 @@ describe Hbc::Quarantine, :cask do
end end
it "quarantines tar-gz-based Casks" do it "quarantines tar-gz-based Casks" do
Hbc::CLI::Install.run("container-tar-gz") Hbc::Cmd::Install.run("container-tar-gz")
expect( expect(
Hbc::CaskLoader.load(cask_path("container-tar-gz")), Hbc::CaskLoader.load(cask_path("container-tar-gz")),
@ -58,7 +58,7 @@ describe Hbc::Quarantine, :cask do
end end
it "quarantines xar-based Casks" do it "quarantines xar-based Casks" do
Hbc::CLI::Install.run("container-xar") Hbc::Cmd::Install.run("container-xar")
expect( expect(
Hbc::CaskLoader.load(cask_path("container-xar")), Hbc::CaskLoader.load(cask_path("container-xar")),
@ -68,7 +68,7 @@ describe Hbc::Quarantine, :cask do
end end
it "quarantines pure bzip2-based Casks" do it "quarantines pure bzip2-based Casks" do
Hbc::CLI::Install.run("container-bzip2") Hbc::Cmd::Install.run("container-bzip2")
expect( expect(
Hbc::CaskLoader.load(cask_path("container-bzip2")), Hbc::CaskLoader.load(cask_path("container-bzip2")),
@ -78,7 +78,7 @@ describe Hbc::Quarantine, :cask do
end end
it "quarantines pure gzip-based Casks" do it "quarantines pure gzip-based Casks" do
Hbc::CLI::Install.run("container-gzip") Hbc::Cmd::Install.run("container-gzip")
expect( expect(
Hbc::CaskLoader.load(cask_path("container-gzip")), Hbc::CaskLoader.load(cask_path("container-gzip")),
@ -88,7 +88,7 @@ describe Hbc::Quarantine, :cask do
end end
it "quarantines the pkg in naked-pkg-based Casks" do it "quarantines the pkg in naked-pkg-based Casks" do
Hbc::CLI::Install.run("container-pkg") Hbc::Cmd::Install.run("container-pkg")
naked_pkg = Hbc::CaskLoader.load(cask_path("container-pkg")) naked_pkg = Hbc::CaskLoader.load(cask_path("container-pkg"))
@ -100,7 +100,7 @@ describe Hbc::Quarantine, :cask do
end end
it "quarantines a nested container" do it "quarantines a nested container" do
Hbc::CLI::Install.run("nested-app") Hbc::Cmd::Install.run("nested-app")
expect( expect(
Hbc::CaskLoader.load(cask_path("nested-app")), Hbc::CaskLoader.load(cask_path("nested-app")),
@ -112,7 +112,7 @@ describe Hbc::Quarantine, :cask do
describe "when disabled" do describe "when disabled" do
it "does not quarantine even a nice, fresh Cask" do it "does not quarantine even a nice, fresh Cask" do
Hbc::CLI::Install.run("local-transmission", "--no-quarantine") Hbc::Cmd::Install.run("local-transmission", "--no-quarantine")
expect( expect(
Hbc::CaskLoader.load(cask_path("local-transmission")), Hbc::CaskLoader.load(cask_path("local-transmission")),
@ -122,7 +122,7 @@ describe Hbc::Quarantine, :cask do
end end
it "does not quarantine Cask fetches" do it "does not quarantine Cask fetches" do
Hbc::CLI::Fetch.run("local-transmission", "--no-quarantine") Hbc::Cmd::Fetch.run("local-transmission", "--no-quarantine")
local_transmission = Hbc::CaskLoader.load(cask_path("local-transmission")) local_transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))
cached_location = Hbc::Download.new(local_transmission, force: false, quarantine: false).perform cached_location = Hbc::Download.new(local_transmission, force: false, quarantine: false).perform
@ -130,7 +130,7 @@ describe Hbc::Quarantine, :cask do
end end
it "does not quarantine dmg-based Casks" do it "does not quarantine dmg-based Casks" do
Hbc::CLI::Install.run("container-dmg", "--no-quarantine") Hbc::Cmd::Install.run("container-dmg", "--no-quarantine")
expect( expect(
Hbc::CaskLoader.load(cask_path("container-dmg")), Hbc::CaskLoader.load(cask_path("container-dmg")),
@ -140,7 +140,7 @@ describe Hbc::Quarantine, :cask do
end end
it "does not quarantine tar-gz-based Casks" do it "does not quarantine tar-gz-based Casks" do
Hbc::CLI::Install.run("container-tar-gz", "--no-quarantine") Hbc::Cmd::Install.run("container-tar-gz", "--no-quarantine")
expect( expect(
Hbc::CaskLoader.load(cask_path("container-tar-gz")), Hbc::CaskLoader.load(cask_path("container-tar-gz")),
@ -150,7 +150,7 @@ describe Hbc::Quarantine, :cask do
end end
it "does not quarantine xar-based Casks" do it "does not quarantine xar-based Casks" do
Hbc::CLI::Install.run("container-xar", "--no-quarantine") Hbc::Cmd::Install.run("container-xar", "--no-quarantine")
expect( expect(
Hbc::CaskLoader.load(cask_path("container-xar")), Hbc::CaskLoader.load(cask_path("container-xar")),
@ -160,7 +160,7 @@ describe Hbc::Quarantine, :cask do
end end
it "does not quarantine pure bzip2-based Casks" do it "does not quarantine pure bzip2-based Casks" do
Hbc::CLI::Install.run("container-bzip2", "--no-quarantine") Hbc::Cmd::Install.run("container-bzip2", "--no-quarantine")
expect( expect(
Hbc::CaskLoader.load(cask_path("container-bzip2")), Hbc::CaskLoader.load(cask_path("container-bzip2")),
@ -170,7 +170,7 @@ describe Hbc::Quarantine, :cask do
end end
it "does not quarantine pure gzip-based Casks" do it "does not quarantine pure gzip-based Casks" do
Hbc::CLI::Install.run("container-gzip", "--no-quarantine") Hbc::Cmd::Install.run("container-gzip", "--no-quarantine")
expect( expect(
Hbc::CaskLoader.load(cask_path("container-gzip")), Hbc::CaskLoader.load(cask_path("container-gzip")),
@ -180,7 +180,7 @@ describe Hbc::Quarantine, :cask do
end end
it "does not quarantine the pkg in naked-pkg-based Casks" do it "does not quarantine the pkg in naked-pkg-based Casks" do
Hbc::CLI::Install.run("container-pkg", "--no-quarantine") Hbc::Cmd::Install.run("container-pkg", "--no-quarantine")
naked_pkg = Hbc::CaskLoader.load(cask_path("container-pkg")) naked_pkg = Hbc::CaskLoader.load(cask_path("container-pkg"))
@ -192,7 +192,7 @@ describe Hbc::Quarantine, :cask do
end end
it "does not quarantine a nested container" do it "does not quarantine a nested container" do
Hbc::CLI::Install.run("nested-app", "--no-quarantine") Hbc::Cmd::Install.run("nested-app", "--no-quarantine")
expect( expect(
Hbc::CaskLoader.load(cask_path("nested-app")), Hbc::CaskLoader.load(cask_path("nested-app")),
@ -202,7 +202,7 @@ describe Hbc::Quarantine, :cask do
end end
it "does not quarantine Cask audits" do it "does not quarantine Cask audits" do
Hbc::CLI::Audit.run("local-transmission", "--download", "--no-quarantine") Hbc::Cmd::Audit.run("local-transmission", "--download", "--no-quarantine")
local_transmission = Hbc::CaskLoader.load(cask_path("local-transmission")) local_transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))
cached_location = Hbc::Download.new(local_transmission, force: false, quarantine: false).perform cached_location = Hbc::Download.new(local_transmission, force: false, quarantine: false).perform

View File

@ -1,6 +1,6 @@
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Reinstall, :cask do describe Hbc::Cmd::Reinstall, :cask do
it_behaves_like "a command that handles invalid options" it_behaves_like "a command that handles invalid options"
it "displays the reinstallation progress" do it "displays the reinstallation progress" do
@ -22,23 +22,23 @@ describe Hbc::CLI::Reinstall, :cask do
EOS EOS
expect { expect {
Hbc::CLI::Reinstall.run("local-caffeine") Hbc::Cmd::Reinstall.run("local-caffeine")
}.to output(output).to_stdout }.to output(output).to_stdout
end end
it "allows reinstalling a Cask" do it "allows reinstalling a Cask" do
Hbc::CLI::Install.run("local-transmission") Hbc::Cmd::Install.run("local-transmission")
expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed
Hbc::CLI::Reinstall.run("local-transmission") Hbc::Cmd::Reinstall.run("local-transmission")
expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed
end end
it "allows reinstalling a non installed Cask" do it "allows reinstalling a non installed Cask" do
expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).not_to be_installed expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).not_to be_installed
Hbc::CLI::Reinstall.run("local-transmission") Hbc::Cmd::Reinstall.run("local-transmission")
expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed
end end
end end

View File

@ -3,7 +3,7 @@ require "rubygems"
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Style, :cask do describe Hbc::Cmd::Style, :cask do
let(:args) { [] } let(:args) { [] }
let(:cli) { described_class.new(*args) } let(:cli) { described_class.new(*args) }

View File

@ -1,7 +1,7 @@
require_relative "shared_examples/requires_cask_token" require_relative "shared_examples/requires_cask_token"
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Uninstall, :cask do describe Hbc::Cmd::Uninstall, :cask do
it_behaves_like "a command that requires a Cask token" it_behaves_like "a command that requires a Cask token"
it_behaves_like "a command that handles invalid options" it_behaves_like "a command that handles invalid options"

View File

@ -1,6 +1,6 @@
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Upgrade, :cask do describe Hbc::Cmd::Upgrade, :cask do
it_behaves_like "a command that handles invalid options" it_behaves_like "a command that handles invalid options"
context "successful upgrade" do context "successful upgrade" do
@ -14,7 +14,7 @@ describe Hbc::CLI::Upgrade, :cask do
} }
before do before do
installed.each { |cask| Hbc::CLI::Install.run(cask) } installed.each { |cask| Hbc::Cmd::Install.run(cask) }
allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) allow_any_instance_of(described_class).to receive(:verbose?).and_return(true)
end end
@ -177,7 +177,7 @@ describe Hbc::CLI::Upgrade, :cask do
} }
before do before do
installed.each { |cask| Hbc::CLI::Install.run(cask) } installed.each { |cask| Hbc::Cmd::Install.run(cask) }
allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) allow_any_instance_of(described_class).to receive(:verbose?).and_return(true)
end end

View File

@ -1,7 +1,7 @@
require_relative "shared_examples/requires_cask_token" require_relative "shared_examples/requires_cask_token"
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
describe Hbc::CLI::Zap, :cask do describe Hbc::Cmd::Zap, :cask do
it_behaves_like "a command that requires a Cask token" it_behaves_like "a command that requires a Cask token"
it_behaves_like "a command that handles invalid options" it_behaves_like "a command that handles invalid options"

View File

@ -1,4 +1,4 @@
describe Hbc::CLI, :cask do describe Hbc::Cmd, :cask do
it "lists the taps for Casks that show up in two taps" do it "lists the taps for Casks that show up in two taps" do
listing = described_class.nice_listing(%w[ listing = described_class.nice_listing(%w[
homebrew/cask/adium homebrew/cask/adium
@ -28,13 +28,13 @@ describe Hbc::CLI, :cask do
context "when no option is specified" do context "when no option is specified" do
it "--binaries is true by default" do it "--binaries is true by default" do
command = Hbc::CLI::Install.new("some-cask") command = Hbc::Cmd::Install.new("some-cask")
expect(command.binaries?).to be true expect(command.binaries?).to be true
end end
end end
context "::run" do context "::run" do
let(:noop_command) { double("CLI::Noop") } let(:noop_command) { double("Cmd::Noop") }
before do before do
allow(described_class).to receive(:lookup_command).with("noop").and_return(noop_command) allow(described_class).to receive(:lookup_command).with("noop").and_return(noop_command)
@ -42,7 +42,7 @@ describe Hbc::CLI, :cask do
end end
it "passes `--version` along to the subcommand" do it "passes `--version` along to the subcommand" do
version_command = double("CLI::Version") version_command = double("Cmd::Version")
allow(described_class).to receive(:lookup_command).with("--version").and_return(version_command) allow(described_class).to receive(:lookup_command).with("--version").and_return(version_command)
expect(described_class).to receive(:run_command).with(version_command) expect(described_class).to receive(:run_command).with(version_command)
described_class.run("--version") described_class.run("--version")