Example #1
0
	Short: "Primary command for project - set up gobot Furby interaction",
	Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:

Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("furbyBot called")

		gbot := gobot.NewGobot()
		api.NewAPI(gbot).Start()

		r := raspi.NewRaspiAdaptor("raspi")
		audioAdaptor := audio.NewAudioAdaptor("sound")
		jenkinsAdaptor := jenkinsconnect.NewJenkinsconnectAdaptor("jenkins")

		// Set up asynchronous channel - if we get more than 3 sounds being played in a row, something's up
		csoundFiles := make(chan string, 3)
		furby := furby.NewFurbyDriver(r, "furby", "16", csoundFiles)
		audioDriver := audio.NewAudioDriver(audioAdaptor, "sounds", csoundFiles)
		jenkinsDriver := jenkinsconnect.NewJenkinsconnectDriver(jenkinsAdaptor, "jenkins-command")

		screen := i2c.NewGroveLcdDriver(r, "screen")
		work := func() {

			screen.Clear()
			screen.Home()
			furby.On()

			screen.SetRGB(255, 255, 255)
// listenJenkinsCmd represents the listenJenkins command
var listenJenkinsCmd = &cobra.Command{
	Use:   "listenJenkins",
	Short: "Sets up endpoint Jenkins can use to notify job results",
	Long: `Sets up an http endpoint on localhost:3000.  That endpoint includes a command 'parseResult', which will receive a data payload, determine the outcome of the Jenkins job, and fire off handlers for appropriate robot notifications.
	
	For this incarnation, we'll be driving the Furby, as well as updating an LCD, all by invoking Go interfaces provided by other packages, brought together via Gobot

`,
	Run: func(cmd *cobra.Command, args []string) {
		gbot := gobot.NewGobot()
		api.NewAPI(gbot).Start()

		r := raspi.NewRaspiAdaptor("raspi")
		jenkinsConnect := jenkinsconnect.NewJenkinsconnectAdaptor("jenkins")

		jenkinsDriver := jenkinsconnect.NewJenkinsconnectDriver(jenkinsConnect, "jenkins-command")

		work := func() {
			gobot.On(jenkinsDriver.Event("jobResult"), func(data interface{}) {
				jobResult := data.(jenkinsconnect.JobOutcome)
				switch jobResult.State {
				case jenkinsconnect.SUCCESS:
				}

			})

		}

		robot := gobot.NewRobot("furbyBot",