Module: Ruflet::CLI::BuildCommand

Includes:
FlutterSdk
Included in:
Ruflet::CLI
Defined in:
lib/ruflet/cli/build_command.rb

Constant Summary

Constants included from FlutterSdk

FlutterSdk::DEFAULT_FLUTTER_CHANNEL, FlutterSdk::RELEASES_BASE

Instance Method Summary collapse

Methods included from FlutterSdk

#ensure_flutter!

Instance Method Details

#command_build(args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ruflet/cli/build_command.rb', line 11

def command_build(args)
  platform = (args.shift || "").downcase
  if platform.empty?
    warn "Usage: ruflet build <apk|ios|aab|web|macos|windows|linux>"
    return 1
  end

  flutter_cmd = flutter_build_command(platform)
  unless flutter_cmd
    warn "Unsupported build target: #{platform}"
    return 1
  end

  client_dir = detect_flutter_client_dir
  unless client_dir
    warn "Could not find Flutter client directory."
    warn "Set RUFLET_CLIENT_DIR or place client at ./ruflet_client"
    return 1
  end

  tools = ensure_flutter!("build", client_dir: client_dir)
  ok = prepare_flutter_client(client_dir, tools: tools)
  return 1 unless ok

  ok = system(tools[:env], tools[:flutter], *flutter_cmd, *args, chdir: client_dir)
  ok ? 0 : 1
end