Esempio n. 1
0
File: cf.go Progetto: nota-ja/cli
func main() {
	defer handlePanics()

	deps := setupDependencies()
	defer deps.configRepo.Close()

	cmdFactory := command_factory.NewFactory(deps.termUI, deps.configRepo, deps.manifestRepo, deps.apiRepoLocator)
	requirementsFactory := requirements.NewFactory(deps.termUI, deps.configRepo, deps.apiRepoLocator)
	cmdRunner := command_runner.NewRunner(cmdFactory, requirementsFactory)

	app.NewApp(cmdRunner, cmdFactory.CommandMetadatas()...).Run(os.Args)

	gateways := gatewaySliceFromMap(deps.gateways)
	net.NewWarningsCollector(deps.termUI, gateways...).PrintWarnings()
}
Esempio n. 2
0
	. "testhelpers/matchers"
	testnet "testhelpers/net"
	testterm "testhelpers/terminal"
)

var _ = Describe("WarningsCollector", func() {
	var (
		ui *testterm.FakeUI
	)

	BeforeEach(func() {
		ui = new(testterm.FakeUI)
	})

	It("prints warnings in all warning producers", func() {
		warning_producer_one := testnet.NewWarningProducer([]string{"Hello", "Darling"})
		warning_producer_two := testnet.NewWarningProducer([]string{"Goodbye", "Sweetie"})
		warning_producer_three := testnet.NewWarningProducer(nil)
		warnings_collector := net.NewWarningsCollector(ui, warning_producer_one, warning_producer_two, warning_producer_three)

		warnings_collector.PrintWarnings()

		Expect(ui.WarnOutputs).To(ContainSubstrings(
			[]string{"Hello"},
			[]string{"Darling"},
			[]string{"Goodbye"},
			[]string{"Sweetie"},
		))
	})
})