func init() {
	options := executors.ExecutorOptions{
		DefaultBuildsDir: "builds",
		SharedBuildsDir:  true,
		Shell: common.ShellScriptInfo{
			Shell: common.GetDefaultShell(),
			Type:  common.LoginShell,
		},
		ShowHostname: false,
	}

	create := func() common.Executor {
		return &ShellExecutor{
			AbstractExecutor: executors.AbstractExecutor{
				ExecutorOptions: options,
			},
		}
	}

	common.RegisterExecutor("shell", common.ExecutorFactory{
		Create: create,
		Features: common.FeaturesInfo{
			Variables: true,
		},
	})
}
func init() {
	options := executors.ExecutorOptions{
		DefaultBuildsDir: "builds",
		DefaultCacheDir:  "cache",
		SharedBuildsDir:  true,
		Shell: common.ShellScriptInfo{
			Shell: common.GetDefaultShell(),
			Type:  common.LoginShell,
		},
		ShowHostname: false,
	}

	creator := func() common.Executor {
		return &ShellExecutor{
			AbstractExecutor: executors.AbstractExecutor{
				ExecutorOptions: options,
			},
		}
	}

	featuresUpdater := func(features *common.FeaturesInfo) {
		features.Variables = true
	}

	common.RegisterExecutor("shell", executors.DefaultExecutorProvider{
		Creator:         creator,
		FeaturesUpdater: featuresUpdater,
	})
}
func init() {
	common.RegisterExecutor("shell", func() common.Executor {
		return &ShellExecutor{
			AbstractExecutor: executors.AbstractExecutor{
				DefaultBuildsDir: "tmp/builds",
				SharedBuildsDir:  true,
				DefaultShell:     common.GetDefaultShell(),
				ShellType:        common.LoginShell,
				ShowHostname:     false,
			},
		}
	})
}
func init() {
	common.RegisterCommand(cli.Command{
		Name:   "run-single",
		Usage:  "start single runner",
		Action: runSingle,
		Flags: []cli.Flag{
			cli.StringFlag{
				Name:   "token",
				Value:  "",
				Usage:  "Runner token",
				EnvVar: "RUNNER_TOKEN",
			},
			cli.StringFlag{
				Name:   "url",
				Value:  "",
				Usage:  "Runner URL",
				EnvVar: "CI_SERVER_URL",
			},
			cli.StringFlag{
				Name:   "executor",
				Value:  "shell",
				Usage:  "Executor",
				EnvVar: "RUNNER_EXECUTOR",
			},
			cli.StringFlag{
				Name:   "shell",
				Value:  common.GetDefaultShell(),
				Usage:  "Shell to use for run the script",
				EnvVar: "RUNNER_SHELL",
			},
			cli.StringFlag{
				Name:   "addr",
				Value:  "",
				Usage:  "Hello World Server",
				EnvVar: "",
			},
			cli.StringFlag{
				Name:   "heroku-url",
				Value:  "",
				Usage:  "Current application address",
				EnvVar: "HEROKU_URL",
			},
			cli.StringFlag{
				Name:   "builds-dir",
				Value:  "",
				Usage:  "Custom builds directory",
				EnvVar: "RUNNER_BUILDS_DIR",
			},
		},
	})
}
func init() {
	// Look for self
	runnerCommand, err := exec.LookPath(os.Args[0])
	if err != nil {
		logrus.Warningln(err)
	}

	options := executors.ExecutorOptions{
		DefaultBuildsDir: "$PWD/builds",
		DefaultCacheDir:  "$PWD/cache",
		SharedBuildsDir:  true,
		Shell: common.ShellScriptInfo{
			Shell:         common.GetDefaultShell(),
			Type:          common.LoginShell,
			RunnerCommand: runnerCommand,
		},
		ShowHostname: false,
	}

	creator := func() common.Executor {
		return &ShellExecutor{
			AbstractExecutor: executors.AbstractExecutor{
				ExecutorOptions: options,
			},
		}
	}

	featuresUpdater := func(features *common.FeaturesInfo) {
		features.Variables = true
	}

	common.RegisterExecutor("shell", executors.DefaultExecutorProvider{
		Creator:         creator,
		FeaturesUpdater: featuresUpdater,
	})
}