bin/balboa in balboa-0.1.1 vs bin/balboa in balboa-0.1.2

- old
+ new

@@ -1,30 +1,26 @@ #!/usr/bin/env ruby # frozen_string_literal: true require_relative '../lib/balboa' -command = ARGV.shift || 'make_punch' +command = ARGV.shift || :help app = Balboa::CLI::Application.new(command) options = Balboa::CLI::Options.parse(ARGV) -crawler = Balboa::Interactor::CapybaraInteractor.new(options) +raw_interactor = Balboa::Interactor::CapybaraInteractor.new -crawler_last_punch = Balboa::Interactor::Command::LastPunchCommand.new -crawler_make_punch = Balboa::Interactor::Command::MakePunchCommand.new(options) -crawler_login = Balboa::Interactor::Command::LoginCommand.new(options) +Balboa::Interactor::InteractorBuilder.create(raw_interactor, options) -crawler.add_command :last_punch, crawler_last_punch -crawler.add_command :make_punch, crawler_make_punch -crawler.add_command :login, crawler_login +interactor = Balboa::Interactor::InteractorWrapper.new(raw_interactor) -interactor = Balboa::Interactor::InteractorWrapper.new(crawler) - -app_last_punch = Balboa::CLI::Command::LastPunchCommand.new(interactor) -app_make_punch = Balboa::CLI::Command::MakePunchCommand.new(interactor, options['holidays']) +app_last = Balboa::CLI::Command::LastCommand.new(interactor) +app_punch = Balboa::CLI::Command::PunchCommand.new(interactor, options['holidays']) +app_help = Balboa::CLI::Command::HelpCommand.new app_star_wars = Balboa::CLI::Command::StarWarsCommand.new -app.add_command :last_punch, app_last_punch -app.add_command :make_punch, app_make_punch -app.add_command :star_wars, app_star_wars +app.add_command(:last, app_last) +app.add_command(:punch, app_punch) +app.add_command(:help, app_help) +app.add_command(:star_wars, app_star_wars) -puts app.execute +app.execute