Class: RepoTender::CLI::Daemon::Install
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- RepoTender::CLI::Daemon::Install
- Includes:
- Helpers, GlobalOptions
- Defined in:
- lib/repo_tender/cli/daemon.rb
Instance Method Summary collapse
Methods included from GlobalOptions
Methods included from Helpers
build_plist, fail_with, format_failure, make_agent, plist_path
Instance Method Details
#call(plain: nil, json: nil, no_color: nil, quiet: nil) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/repo_tender/cli/daemon.rb', line 101 def call(plain: nil, json: nil, no_color: nil, quiet: nil, **) paths = CLI.make_paths paths.ensure! config = Config::Store.load(paths.config_file).success mode = UI::Mode.resolve( flags: {plain: plain, json: json, no_color: no_color, quiet: quiet}, env: CLI.env, out: out ) pastel = Pastel.new(enabled: mode.color) label = Launchd::Agent::DEFAULT_LABEL pp = plist_path(paths, label) resolve = Resolve.detect(repo_root: Dir.pwd) xml = build_plist(resolve: resolve, config: config, paths: paths, label: label) FileUtils.mkdir_p(File.dirname(pp)) File.write(pp, xml) agent = make_agent result = agent.install(pp) if result.failure? return fail_with(self, "bootstrap failed: #{format_failure(result.failure)}") end out.puts pastel.green("installed: #{pp}") CLI.record_outcome(Outcome.new(exit_code: 0)) end |