Class: Everywhere::Commands::PlatformBuild
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- Everywhere::Commands::PlatformBuild
- Defined in:
- lib/everywhere/commands/platform/build.rb
Overview
every platform build — hosted build (Model B): snapshot the source, upload
it straight to storage, submit a build for the configured targets, then tail
logs and pull the finished artifacts. No local toolchain needed.
Instance Method Summary collapse
Instance Method Details
#call(root: ".", url: nil, target: nil, channel: "direct", ruby: nil, output: nil, wait: true, download: true) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/everywhere/commands/platform/build.rb', line 31 def call(root: ".", url: nil, target: nil, channel: "direct", ruby: nil, output: nil, wait: true, download: true, **) root_path = File.(root) config = Everywhere::Config.load(root_path) base = Everywhere::Platform::Client.base_url(url) creds = Everywhere::Platform::Credentials.load.for(base) UI.die!("not logged in to #{base} — run `every platform login`") unless creds client = Everywhere::Platform::Client.new(base, token: creds["token"]) framework = config.remote? ? nil : Everywhere::Framework.detect(root_path) targets = resolve_targets(target, config) ruby ||= config.build_ruby || "4.0.6" Dir.mktmpdir("every-snapshot") do |tmp| signed_id = snapshot_and_upload(client, root_path, tmp) manifest = Everywhere::Receipt.new( root: root_path, config: config, framework: framework, ruby: ruby, target: targets.first, channel: channel ).manifest build = submit(client, targets, channel, signed_id, manifest) UI.success("submitted #{UI.bold(build["id"])} for #{targets.map { |t| UI.target_label(t) }.join(", ")}") if (build_url = build["url"] || "#{client.base_url}/builds/#{build["id"]}") UI.substep("watch it live → #{UI.cyan(build_url)}") end return unless wait # Set expectations before the quiet part: a hosted macOS runner is not # instant, and knowing that up front is the difference between "slow" # and "broken". UI.substep(UI.dim("hosted macOS runners usually start within a few minutes")) final = poll_and_tail(client, build["id"]) report(client, final, output || File.join(root_path, "dist"), download) end rescue Everywhere::Error => e UI.die!(e.) end |