Exemple #1
0
			})
		})

		Context("when the plugin's alias conflicts with other installed plugin", func() {
			It("fails if it shares a command name", func() {
				pluginsMap := make(map[string]pluginconfig.PluginMetadata)
				pluginsMap["AliasCollision"] = pluginconfig.PluginMetadata{
					Location: "location/to/config.exe",
					Commands: []plugin.Command{
						{
							Name:     "conflict-alias",
							HelpText: "Hi!",
						},
					},
				}
				pluginConfig.PluginsReturns(pluginsMap)

				runCommand(aliasConflicts, "-f")

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Alias `conflict-alias` is a command/alias in plugin 'AliasCollision'.  You could try uninstalling plugin 'AliasCollision' and then install this plugin in order to invoke the `conflict-alias` command.  However, you should first fully understand the impact of uninstalling the existing 'AliasCollision' plugin."},
					[]string{"FAILED"},
				))
			})

			It("fails if it shares a command alias", func() {
				pluginsMap := make(map[string]pluginconfig.PluginMetadata)
				pluginsMap["AliasCollision"] = pluginconfig.PluginMetadata{
					Location: "location/to/alias.exe",
					Commands: []plugin.Command{
						{
Exemple #2
0
				Commands: []plugin.Command{
					{
						Name:     "fakePluginCmd1",
						Alias:    "fpc1",
						HelpText: "help text here",
						UsageDetails: plugin.Usage{
							Usage: "Usage for fpc1",
							Options: map[string]string{
								"f": "test flag",
							},
						},
					},
				},
			}

			fakeConfig.PluginsReturns(m)
		})

		Context("command is a plugin command name", func() {
			It("prints the usage help for the command", func() {
				flagContext.Parse("fakePluginCmd1")
				cmd.Execute(flagContext)

				Expect(fakeUI.SayCallCount()).To(Equal(1))
				output, _ := fakeUI.SayArgsForCall(0)
				Expect(output).To(ContainSubstring("fakePluginCmd1"))
				Expect(output).To(ContainSubstring("help text here"))
				Expect(output).To(ContainSubstring("ALIAS"))
				Expect(output).To(ContainSubstring("fpc1"))
				Expect(output).To(ContainSubstring("USAGE"))
				Expect(output).To(ContainSubstring("Usage for fpc1"))
Exemple #3
0
		config = new(pluginconfigfakes.FakePluginConfiguration)

		rpc.DefaultServer = rpc.NewServer()
	})

	runCommand := func(args ...string) bool {
		return testcmd.RunCLICommand("plugins", args, requirementsFactory, updateCommandDependency, false, ui)
	}

	Context("If --checksum flag is provided", func() {
		It("computes and prints the sha1 checksum of the binary", func() {
			config.PluginsReturns(map[string]pluginconfig.PluginMetadata{
				"Test1": {
					Location: "../../../fixtures/plugins/test_1.go",
					Version:  plugin.VersionType{Major: 1, Minor: 2, Build: 3},
					Commands: []plugin.Command{
						{Name: "test_1_cmd1", HelpText: "help text for test_1_cmd1"},
					},
				},
			})

			runCommand("--checksum")

			Expect(ui.Outputs()).To(ContainSubstrings(
				[]string{"Plugin Name", "Version", "sha1", "Command Help"},
			))
		})
	})

	Context("when arguments are provided", func() {
		var cmd commandregistry.Command