ruflet 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/ruflet +6 -0
- data/lib/ruflet/cli/build_command.rb +372 -0
- data/lib/ruflet/cli/extra_command.rb +146 -0
- data/lib/ruflet/cli/flutter_sdk.rb +359 -0
- data/lib/ruflet/cli/new_command.rb +221 -0
- data/lib/ruflet/cli/run_command.rb +699 -0
- data/lib/ruflet/cli/templates.rb +68 -0
- data/lib/ruflet/cli/update_command.rb +111 -0
- data/lib/ruflet/cli.rb +85 -0
- data/lib/ruflet/version.rb +1 -1
- data/lib/ruflet_cli.rb +3 -0
- metadata +31 -209
- data/lib/ruflet.rb +0 -40
- data/lib/ruflet_protocol/ruflet/protocol.rb +0 -62
- data/lib/ruflet_protocol.rb +0 -4
- data/lib/ruflet_ui/ruflet/app.rb +0 -27
- data/lib/ruflet_ui/ruflet/colors.rb +0 -234
- data/lib/ruflet_ui/ruflet/control.rb +0 -281
- data/lib/ruflet_ui/ruflet/dsl.rb +0 -291
- data/lib/ruflet_ui/ruflet/event.rb +0 -42
- data/lib/ruflet_ui/ruflet/events/gesture_events.rb +0 -552
- data/lib/ruflet_ui/ruflet/icon_data.rb +0 -62
- data/lib/ruflet_ui/ruflet/icons/cupertino/cupertino_icons.rb +0 -54
- data/lib/ruflet_ui/ruflet/icons/cupertino_icon_lookup.rb +0 -112
- data/lib/ruflet_ui/ruflet/icons/material_icon_lookup.rb +0 -112
- data/lib/ruflet_ui/ruflet/icons/material_icons.rb +0 -55
- data/lib/ruflet_ui/ruflet/page.rb +0 -1222
- data/lib/ruflet_ui/ruflet/types/geometry.rb +0 -65
- data/lib/ruflet_ui/ruflet/types/text_style.rb +0 -191
- data/lib/ruflet_ui/ruflet/ui/control_factory.rb +0 -53
- data/lib/ruflet_ui/ruflet/ui/control_methods.rb +0 -17
- data/lib/ruflet_ui/ruflet/ui/control_registry.rb +0 -33
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactionsheet_control.rb +0 -57
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactionsheetaction_control.rb +0 -58
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactivityindicator_control.rb +0 -57
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoalertdialog_control.rb +0 -39
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoappbar_control.rb +0 -44
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinobottomsheet_control.rb +0 -38
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinobutton_control.rb +0 -73
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocheckbox_control.rb +0 -70
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocontextmenu_control.rb +0 -34
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocontextmenuaction_control.rb +0 -36
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinodatepicker_control.rb +0 -67
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinodialogaction_control.rb +0 -35
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinofilledbutton_control.rb +0 -73
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinolisttile_control.rb +0 -67
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinonavigationbar_control.rb +0 -61
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinopicker_control.rb +0 -66
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoradio_control.rb +0 -66
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinosegmentedbutton_control.rb +0 -63
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoslider_control.rb +0 -64
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoslidingsegmentedbutton_control.rb +0 -60
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoswitch_control.rb +0 -73
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotextfield_control.rb +0 -159
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotimerpicker_control.rb +0 -61
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotintedbutton_control.rb +0 -73
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/ruflet_controls.rb +0 -89
- data/lib/ruflet_ui/ruflet/ui/controls/materials/alertdialog_control.rb +0 -58
- data/lib/ruflet_ui/ruflet/ui/controls/materials/appbar_control.rb +0 -53
- data/lib/ruflet_ui/ruflet/ui/controls/materials/audio_control.rb +0 -36
- data/lib/ruflet_ui/ruflet/ui/controls/materials/autocomplete_control.rb +0 -58
- data/lib/ruflet_ui/ruflet/ui/controls/materials/badge_control.rb +0 -31
- data/lib/ruflet_ui/ruflet/ui/controls/materials/banner_control.rb +0 -47
- data/lib/ruflet_ui/ruflet/ui/controls/materials/bottomappbar_control.rb +0 -62
- data/lib/ruflet_ui/ruflet/ui/controls/materials/bottomsheet_control.rb +0 -48
- data/lib/ruflet_ui/ruflet/ui/controls/materials/button_control.rb +0 -69
- data/lib/ruflet_ui/ruflet/ui/controls/materials/card_control.rb +0 -63
- data/lib/ruflet_ui/ruflet/ui/controls/materials/chart_controls.rb +0 -321
- data/lib/ruflet_ui/ruflet/ui/controls/materials/checkbox_control.rb +0 -76
- data/lib/ruflet_ui/ruflet/ui/controls/materials/chip_control.rb +0 -88
- data/lib/ruflet_ui/ruflet/ui/controls/materials/circleavatar_control.rb +0 -62
- data/lib/ruflet_ui/ruflet/ui/controls/materials/container_control.rb +0 -81
- data/lib/ruflet_ui/ruflet/ui/controls/materials/contextmenu_control.rb +0 -63
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datacell_control.rb +0 -38
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datacolumn_control.rb +0 -34
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datarow_control.rb +0 -35
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datatable_control.rb +0 -78
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datepicker_control.rb +0 -55
- data/lib/ruflet_ui/ruflet/ui/controls/materials/daterangepicker_control.rb +0 -57
- data/lib/ruflet_ui/ruflet/ui/controls/materials/divider_control.rb +0 -36
- data/lib/ruflet_ui/ruflet/ui/controls/materials/dropdown_control.rb +0 -99
- data/lib/ruflet_ui/ruflet/ui/controls/materials/dropdownm2_control.rb +0 -119
- data/lib/ruflet_ui/ruflet/ui/controls/materials/dropdownoption_control.rb +0 -35
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansionpanel_control.rb +0 -61
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansionpanellist_control.rb +0 -60
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansiontile_control.rb +0 -82
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledbutton_control.rb +0 -69
- data/lib/ruflet_ui/ruflet/ui/controls/materials/fillediconbutton_control.rb +0 -81
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledtonalbutton_control.rb +0 -69
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledtonaliconbutton_control.rb +0 -81
- data/lib/ruflet_ui/ruflet/ui/controls/materials/floatingactionbutton_control.rb +0 -73
- data/lib/ruflet_ui/ruflet/ui/controls/materials/iconbutton_control.rb +0 -81
- data/lib/ruflet_ui/ruflet/ui/controls/materials/listtile_control.rb +0 -87
- data/lib/ruflet_ui/ruflet/ui/controls/materials/menubar_control.rb +0 -33
- data/lib/ruflet_ui/ruflet/ui/controls/materials/menuitembutton_control.rb +0 -67
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationbar_control.rb +0 -67
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationbardestination_control.rb +0 -35
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationdrawer_control.rb +0 -41
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationdrawerdestination_control.rb +0 -34
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationrail_control.rb +0 -70
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationraildestination_control.rb +0 -36
- data/lib/ruflet_ui/ruflet/ui/controls/materials/option_control.rb +0 -35
- data/lib/ruflet_ui/ruflet/ui/controls/materials/outlinedbutton_control.rb +0 -66
- data/lib/ruflet_ui/ruflet/ui/controls/materials/outlinediconbutton_control.rb +0 -81
- data/lib/ruflet_ui/ruflet/ui/controls/materials/popupmenubutton_control.rb +0 -74
- data/lib/ruflet_ui/ruflet/ui/controls/materials/popupmenuitem_control.rb +0 -38
- data/lib/ruflet_ui/ruflet/ui/controls/materials/progressbar_control.rb +0 -64
- data/lib/ruflet_ui/ruflet/ui/controls/materials/progressring_control.rb +0 -65
- data/lib/ruflet_ui/ruflet/ui/controls/materials/radio_control.rb +0 -70
- data/lib/ruflet_ui/ruflet/ui/controls/materials/radiogroup_control.rb +0 -33
- data/lib/ruflet_ui/ruflet/ui/controls/materials/rangeslider_control.rb +0 -67
- data/lib/ruflet_ui/ruflet/ui/controls/materials/reorderablelistview_control.rb +0 -80
- data/lib/ruflet_ui/ruflet/ui/controls/materials/ruflet_controls.rb +0 -252
- data/lib/ruflet_ui/ruflet/ui/controls/materials/searchbar_control.rb +0 -94
- data/lib/ruflet_ui/ruflet/ui/controls/materials/segment_control.rb +0 -33
- data/lib/ruflet_ui/ruflet/ui/controls/materials/segmentedbutton_control.rb +0 -63
- data/lib/ruflet_ui/ruflet/ui/controls/materials/selectionarea_control.rb +0 -32
- data/lib/ruflet_ui/ruflet/ui/controls/materials/slider_control.rb +0 -76
- data/lib/ruflet_ui/ruflet/ui/controls/materials/snackbar_control.rb +0 -51
- data/lib/ruflet_ui/ruflet/ui/controls/materials/submenubutton_control.rb +0 -66
- data/lib/ruflet_ui/ruflet/ui/controls/materials/switch_control.rb +0 -77
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tab_control.rb +0 -35
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabbar_control.rb +0 -77
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabbarview_control.rb +0 -57
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabs_control.rb +0 -59
- data/lib/ruflet_ui/ruflet/ui/controls/materials/textbutton_control.rb +0 -66
- data/lib/ruflet_ui/ruflet/ui/controls/materials/textfield_control.rb +0 -148
- data/lib/ruflet_ui/ruflet/ui/controls/materials/timepicker_control.rb +0 -50
- data/lib/ruflet_ui/ruflet/ui/controls/materials/verticaldivider_control.rb +0 -36
- data/lib/ruflet_ui/ruflet/ui/controls/materials/video_control.rb +0 -39
- data/lib/ruflet_ui/ruflet/ui/controls/materials/webview_control.rb +0 -35
- data/lib/ruflet_ui/ruflet/ui/controls/ruflet_controls.rb +0 -447
- data/lib/ruflet_ui/ruflet/ui/controls/shared/animatedswitcher_control.rb +0 -59
- data/lib/ruflet_ui/ruflet/ui/controls/shared/arc_control.rb +0 -29
- data/lib/ruflet_ui/ruflet/ui/controls/shared/autofillgroup_control.rb +0 -32
- data/lib/ruflet_ui/ruflet/ui/controls/shared/basepage_control.rb +0 -44
- data/lib/ruflet_ui/ruflet/ui/controls/shared/browsercontextmenu_control.rb +0 -21
- data/lib/ruflet_ui/ruflet/ui/controls/shared/canvas_control.rb +0 -57
- data/lib/ruflet_ui/ruflet/ui/controls/shared/circle_control.rb +0 -25
- data/lib/ruflet_ui/ruflet/ui/controls/shared/color_control.rb +0 -23
- data/lib/ruflet_ui/ruflet/ui/controls/shared/column_control.rb +0 -67
- data/lib/ruflet_ui/ruflet/ui/controls/shared/dialogs_control.rb +0 -22
- data/lib/ruflet_ui/ruflet/ui/controls/shared/dismissible_control.rb +0 -66
- data/lib/ruflet_ui/ruflet/ui/controls/shared/draggable_control.rb +0 -39
- data/lib/ruflet_ui/ruflet/ui/controls/shared/dragtarget_control.rb +0 -36
- data/lib/ruflet_ui/ruflet/ui/controls/shared/fill_control.rb +0 -22
- data/lib/ruflet_ui/ruflet/ui/controls/shared/fletapp_control.rb +0 -62
- data/lib/ruflet_ui/ruflet/ui/controls/shared/gesturedetector_control.rb +0 -129
- data/lib/ruflet_ui/ruflet/ui/controls/shared/gridview_control.rb +0 -71
- data/lib/ruflet_ui/ruflet/ui/controls/shared/hero_control.rb +0 -56
- data/lib/ruflet_ui/ruflet/ui/controls/shared/icon_control.rb +0 -64
- data/lib/ruflet_ui/ruflet/ui/controls/shared/image_control.rb +0 -27
- data/lib/ruflet_ui/ruflet/ui/controls/shared/interactiveviewer_control.rb +0 -69
- data/lib/ruflet_ui/ruflet/ui/controls/shared/keyboardlistener_control.rb +0 -36
- data/lib/ruflet_ui/ruflet/ui/controls/shared/line_control.rb +0 -26
- data/lib/ruflet_ui/ruflet/ui/controls/shared/listview_control.rb +0 -71
- data/lib/ruflet_ui/ruflet/ui/controls/shared/markdown_control.rb +0 -70
- data/lib/ruflet_ui/ruflet/ui/controls/shared/mergesemantics_control.rb +0 -31
- data/lib/ruflet_ui/ruflet/ui/controls/shared/oval_control.rb +0 -26
- data/lib/ruflet_ui/ruflet/ui/controls/shared/overlay_control.rb +0 -22
- data/lib/ruflet_ui/ruflet/ui/controls/shared/page_control.rb +0 -74
- data/lib/ruflet_ui/ruflet/ui/controls/shared/pagelet_control.rb +0 -64
- data/lib/ruflet_ui/ruflet/ui/controls/shared/pageview_control.rb +0 -64
- data/lib/ruflet_ui/ruflet/ui/controls/shared/path_control.rb +0 -23
- data/lib/ruflet_ui/ruflet/ui/controls/shared/placeholder_control.rb +0 -58
- data/lib/ruflet_ui/ruflet/ui/controls/shared/points_control.rb +0 -24
- data/lib/ruflet_ui/ruflet/ui/controls/shared/rect_control.rb +0 -27
- data/lib/ruflet_ui/ruflet/ui/controls/shared/reorderabledraghandle_control.rb +0 -56
- data/lib/ruflet_ui/ruflet/ui/controls/shared/responsiverow_control.rb +0 -61
- data/lib/ruflet_ui/ruflet/ui/controls/shared/row_control.rb +0 -67
- data/lib/ruflet_ui/ruflet/ui/controls/shared/ruflet_controls.rb +0 -140
- data/lib/ruflet_ui/ruflet/ui/controls/shared/safearea_control.rb +0 -61
- data/lib/ruflet_ui/ruflet/ui/controls/shared/semantics_control.rb +0 -79
- data/lib/ruflet_ui/ruflet/ui/controls/shared/serviceregistry_control.rb +0 -21
- data/lib/ruflet_ui/ruflet/ui/controls/shared/shadermask_control.rb +0 -57
- data/lib/ruflet_ui/ruflet/ui/controls/shared/shadow_control.rb +0 -25
- data/lib/ruflet_ui/ruflet/ui/controls/shared/shimmer_control.rb +0 -60
- data/lib/ruflet_ui/ruflet/ui/controls/shared/stack_control.rb +0 -58
- data/lib/ruflet_ui/ruflet/ui/controls/shared/text_control.rb +0 -32
- data/lib/ruflet_ui/ruflet/ui/controls/shared/textspan_control.rb +0 -39
- data/lib/ruflet_ui/ruflet/ui/controls/shared/transparentpointer_control.rb +0 -54
- data/lib/ruflet_ui/ruflet/ui/controls/shared/view_control.rb +0 -77
- data/lib/ruflet_ui/ruflet/ui/controls/shared/window_control.rb +0 -56
- data/lib/ruflet_ui/ruflet/ui/controls/shared/windowdragarea_control.rb +0 -58
- data/lib/ruflet_ui/ruflet/ui/cupertino_control_factory.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/cupertino_control_methods.rb +0 -26
- data/lib/ruflet_ui/ruflet/ui/cupertino_control_registry.rb +0 -49
- data/lib/ruflet_ui/ruflet/ui/material_control_factory.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/material_control_methods.rb +0 -170
- data/lib/ruflet_ui/ruflet/ui/material_control_registry.rb +0 -168
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/accelerometer_control.rb +0 -26
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/barometer_control.rb +0 -26
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/battery_control.rb +0 -22
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/camera_control.rb +0 -58
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/clipboard_control.rb +0 -21
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/connectivity_control.rb +0 -22
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/filepicker_control.rb +0 -23
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/flashlight_control.rb +0 -22
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/gyroscope_control.rb +0 -26
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/hapticfeedback_control.rb +0 -21
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/magnetometer_control.rb +0 -26
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/screenbrightness_control.rb +0 -23
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/screenshot_control.rb +0 -31
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/semanticsservice_control.rb +0 -21
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/shakedetector_control.rb +0 -26
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/share_control.rb +0 -21
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/sharedpreferences_control.rb +0 -21
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/storagepaths_control.rb +0 -21
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/urllauncher_control.rb +0 -21
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/useraccelerometer_control.rb +0 -26
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/wakelock_control.rb +0 -21
- data/lib/ruflet_ui/ruflet/ui/services/ruflet_services.rb +0 -66
- data/lib/ruflet_ui/ruflet/ui/shared_control_forwarders.rb +0 -129
- data/lib/ruflet_ui/ruflet/ui/widget_builder.rb +0 -64
- data/lib/ruflet_ui.rb +0 -124
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 23cfe984101f494774c2ad9c91c4fd26e7e22b0041c3be62fe9d8b4ff952b865
|
|
4
|
+
data.tar.gz: 921d636ba6c5a1428ff5354772d255971a03f2dc2e2f635b95c6108c8fbcdefc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d2344631fd97d318f6a8d10452cfec629302e79738fcce68f494f355383ed11f5d32a8b23c8988de3fb8646bd86296ac5cee8967a684e4674dafc4da20ad721
|
|
7
|
+
data.tar.gz: 050ffaebab43e40fdde94285bc991b7c5a566f5fb025a31290ca4c911659d2577f1e4ca8a3d8c8f12e89971e6221f14d685d9fd7c35f2bba9c1f16cfb15dc1c4
|
data/bin/ruflet
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "fileutils"
|
|
4
|
+
require "uri"
|
|
5
|
+
require "yaml"
|
|
6
|
+
|
|
7
|
+
module Ruflet
|
|
8
|
+
module CLI
|
|
9
|
+
module BuildCommand
|
|
10
|
+
include FlutterSdk
|
|
11
|
+
CLIENT_EXTENSION_MAP = {
|
|
12
|
+
"ads" => { package: "flet_ads", alias: "ruflet_ads" },
|
|
13
|
+
"audio" => { package: "flet_audio", alias: "ruflet_audio" },
|
|
14
|
+
"audio_recorder" => { package: "flet_audio_recorder", alias: "ruflet_audio_recorder" },
|
|
15
|
+
"camera" => { package: "flet_camera", alias: "ruflet_camera" },
|
|
16
|
+
"charts" => { package: "flet_charts", alias: "ruflet_charts" },
|
|
17
|
+
"code_editor" => { package: "flet_code_editor", alias: "ruflet_code_editor" },
|
|
18
|
+
"color_pickers" => { package: "flet_color_pickers", alias: "ruflet_color_picker" },
|
|
19
|
+
"datatable2" => { package: "flet_datatable2", alias: "ruflet_datatable2" },
|
|
20
|
+
"flashlight" => { package: "flet_flashlight", alias: "ruflet_flashlight" },
|
|
21
|
+
"geolocator" => { package: "flet_geolocator", alias: "ruflet_geolocator" },
|
|
22
|
+
"lottie" => { package: "flet_lottie", alias: "ruflet_lottie" },
|
|
23
|
+
"map" => { package: "flet_map", alias: "ruflet_map" },
|
|
24
|
+
"permission_handler" => { package: "flet_permission_handler", alias: "ruflet_permission_handler" },
|
|
25
|
+
"secure_storage" => { package: "flet_secure_storage", alias: "ruflet_secure_storage" },
|
|
26
|
+
"video" => { package: "flet_video", alias: "ruflet_video" },
|
|
27
|
+
"webview" => { package: "flet_webview", alias: "ruflet_webview" }
|
|
28
|
+
}.freeze
|
|
29
|
+
|
|
30
|
+
def command_build(args)
|
|
31
|
+
platform = (args.shift || "").downcase
|
|
32
|
+
if platform.empty?
|
|
33
|
+
warn "Usage: ruflet build <apk|android|ios|aab|web|macos|windows|linux>"
|
|
34
|
+
return 1
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
flutter_cmd = flutter_build_command(platform)
|
|
38
|
+
unless flutter_cmd
|
|
39
|
+
warn "Unsupported build target: #{platform}"
|
|
40
|
+
return 1
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
client_dir = detect_flutter_client_dir
|
|
44
|
+
unless client_dir
|
|
45
|
+
warn "Could not find Flutter client directory."
|
|
46
|
+
warn "Set RUFLET_CLIENT_DIR or place client at ./ruflet_client"
|
|
47
|
+
return 1
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
config = load_ruflet_config
|
|
51
|
+
tools = ensure_flutter!("build", client_dir: client_dir)
|
|
52
|
+
ok = prepare_flutter_client(client_dir, tools: tools, config: config)
|
|
53
|
+
return 1 unless ok
|
|
54
|
+
|
|
55
|
+
build_args = [*flutter_cmd, *args]
|
|
56
|
+
client_url = configured_client_url(config)
|
|
57
|
+
if client_url
|
|
58
|
+
build_args += ["--dart-define", "RUFLET_CLIENT_URL=#{client_url}"]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
ok = system(tools[:env], tools[:flutter], *build_args, chdir: client_dir)
|
|
62
|
+
ok ? 0 : 1
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
def detect_flutter_client_dir
|
|
68
|
+
env_dir = ENV["RUFLET_CLIENT_DIR"]
|
|
69
|
+
return env_dir if env_dir && Dir.exist?(env_dir)
|
|
70
|
+
|
|
71
|
+
local = File.expand_path("ruflet_client", Dir.pwd)
|
|
72
|
+
return local if Dir.exist?(local)
|
|
73
|
+
|
|
74
|
+
template = File.expand_path("templates/ruflet_flutter_template", Dir.pwd)
|
|
75
|
+
return template if Dir.exist?(template)
|
|
76
|
+
|
|
77
|
+
nil
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def prepare_flutter_client(client_dir, tools:, config:)
|
|
81
|
+
apply_service_extension_config(client_dir, config)
|
|
82
|
+
asset_flags = apply_build_config(client_dir, config)
|
|
83
|
+
if asset_flags[:error]
|
|
84
|
+
warn asset_flags[:error]
|
|
85
|
+
return false
|
|
86
|
+
end
|
|
87
|
+
unless system(tools[:env], tools[:flutter], "pub", "get", chdir: client_dir)
|
|
88
|
+
warn "flutter pub get failed"
|
|
89
|
+
return false
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
if asset_flags[:has_splash]
|
|
93
|
+
unless system(tools[:env], tools[:dart], "run", "flutter_native_splash:create", chdir: client_dir)
|
|
94
|
+
warn "flutter_native_splash failed"
|
|
95
|
+
return false
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if asset_flags[:has_icon]
|
|
100
|
+
unless system(tools[:env], tools[:dart], "run", "flutter_launcher_icons", chdir: client_dir)
|
|
101
|
+
warn "flutter_launcher_icons failed"
|
|
102
|
+
return false
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
true
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def configured_client_url(config)
|
|
110
|
+
candidates = [
|
|
111
|
+
config["ruflet_client_url"],
|
|
112
|
+
(config["app"].is_a?(Hash) ? config["app"]["ruflet_client_url"] : nil)
|
|
113
|
+
]
|
|
114
|
+
raw = candidates.find { |v| !v.to_s.strip.empty? }
|
|
115
|
+
return nil if raw.nil?
|
|
116
|
+
|
|
117
|
+
value = raw.to_s.strip
|
|
118
|
+
uri = URI.parse(value)
|
|
119
|
+
return nil unless %w[http https ws wss].include?(uri.scheme)
|
|
120
|
+
return nil if uri.host.to_s.strip.empty?
|
|
121
|
+
|
|
122
|
+
value
|
|
123
|
+
rescue URI::InvalidURIError
|
|
124
|
+
nil
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def load_ruflet_config
|
|
128
|
+
config_path = ENV["RUFLET_CONFIG"] || "ruflet.yaml"
|
|
129
|
+
unless File.file?(config_path)
|
|
130
|
+
alt = "ruflet.yml"
|
|
131
|
+
config_path = alt if File.file?(alt)
|
|
132
|
+
end
|
|
133
|
+
return {} unless File.file?(config_path)
|
|
134
|
+
|
|
135
|
+
YAML.safe_load(File.read(config_path), aliases: true) || {}
|
|
136
|
+
rescue StandardError => e
|
|
137
|
+
warn "Failed to load ruflet config: #{e.class}: #{e.message}"
|
|
138
|
+
{}
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def apply_build_config(client_dir, config = {})
|
|
142
|
+
config_path = ENV["RUFLET_CONFIG"] || (File.file?("ruflet.yaml") ? "ruflet.yaml" : "ruflet.yml")
|
|
143
|
+
config_present = File.file?(config_path)
|
|
144
|
+
build = config["build"] || {}
|
|
145
|
+
assets = config["assets"] || {}
|
|
146
|
+
config_dir = config_present ? File.dirname(File.expand_path(config_path)) : Dir.pwd
|
|
147
|
+
|
|
148
|
+
assets_root = build["assets_dir"] || assets["dir"] || config["assets_dir"] || "assets"
|
|
149
|
+
assets_root = File.expand_path(assets_root, config_dir)
|
|
150
|
+
|
|
151
|
+
resolve_asset = lambda do |path|
|
|
152
|
+
return nil if path.nil? || path.to_s.strip.empty?
|
|
153
|
+
full = File.expand_path(path.to_s, config_dir)
|
|
154
|
+
return full if File.file?(full)
|
|
155
|
+
|
|
156
|
+
rails_full = File.expand_path(File.join("app", path.to_s), config_dir)
|
|
157
|
+
return rails_full if File.file?(rails_full)
|
|
158
|
+
|
|
159
|
+
nil
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
splash_defined = key_defined?(build, "splash_screen") || key_defined?(assets, "splash_screen") || key_defined?(config, "splash_screen")
|
|
163
|
+
icon_defined = key_defined?(build, "icon_launcher") || key_defined?(assets, "icon_launcher") || key_defined?(config, "icon_launcher")
|
|
164
|
+
|
|
165
|
+
splash = resolve_asset.call(build["splash_screen"] || assets["splash_screen"] || config["splash_screen"])
|
|
166
|
+
splash_dark = resolve_asset.call(build["splash_dark"] || build["splash_dark_image"] || assets["splash_dark"])
|
|
167
|
+
icon = resolve_asset.call(build["icon_launcher"] || assets["icon_launcher"] || config["icon_launcher"])
|
|
168
|
+
icon_android = resolve_asset.call(build["icon_android"] || assets["icon_android"])
|
|
169
|
+
icon_ios = resolve_asset.call(build["icon_ios"] || assets["icon_ios"])
|
|
170
|
+
icon_web = resolve_asset.call(build["icon_web"] || assets["icon_web"])
|
|
171
|
+
icon_windows = resolve_asset.call(build["icon_windows"] || assets["icon_windows"])
|
|
172
|
+
icon_macos = resolve_asset.call(build["icon_macos"] || assets["icon_macos"])
|
|
173
|
+
|
|
174
|
+
splash_color = build["splash_color"]
|
|
175
|
+
splash_dark_color = build["splash_dark_color"] || build["splash_color_dark"]
|
|
176
|
+
icon_background = build["icon_background"]
|
|
177
|
+
theme_color = build["theme_color"]
|
|
178
|
+
|
|
179
|
+
assets_dir = File.join(client_dir, "assets")
|
|
180
|
+
FileUtils.mkdir_p(assets_dir)
|
|
181
|
+
|
|
182
|
+
copy_asset = lambda do |src, dest|
|
|
183
|
+
return unless src
|
|
184
|
+
FileUtils.cp(src, File.join(assets_dir, dest))
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
copy_asset.call(splash, "splash.png")
|
|
188
|
+
copy_asset.call(splash_dark, "splash_dark.png")
|
|
189
|
+
copy_asset.call(icon, "icon.png")
|
|
190
|
+
copy_asset.call(icon_android, "icon_android.png")
|
|
191
|
+
copy_asset.call(icon_ios, "icon_ios.png")
|
|
192
|
+
copy_asset.call(icon_web, "icon_web.png")
|
|
193
|
+
if icon_windows
|
|
194
|
+
ext = File.extname(icon_windows).downcase
|
|
195
|
+
copy_asset.call(icon_windows, ext == ".ico" ? "icon_windows.ico" : "icon_windows.png")
|
|
196
|
+
end
|
|
197
|
+
copy_asset.call(icon_macos, "icon_macos.png")
|
|
198
|
+
|
|
199
|
+
if splash_defined && splash.nil?
|
|
200
|
+
return { has_icon: false, has_splash: false, error: "build config error: splash_screen is set but file was not found" }
|
|
201
|
+
end
|
|
202
|
+
if icon_defined && icon.nil?
|
|
203
|
+
return { has_icon: false, has_splash: false, error: "build config error: icon_launcher is set but file was not found" }
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
pubspec_path = File.join(client_dir, "pubspec.yaml")
|
|
207
|
+
unless File.file?(pubspec_path)
|
|
208
|
+
return { has_icon: icon_defined && !icon.nil?, has_splash: splash_defined && !splash.nil?, error: nil }
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
if icon_defined && icon
|
|
212
|
+
update_pubspec_value(pubspec_path, "flutter_launcher_icons", "image_path", "\"assets/icon.png\"", multiple: true)
|
|
213
|
+
end
|
|
214
|
+
update_pubspec_value(pubspec_path, "flutter_launcher_icons", "image_path_android", "\"assets/icon_android.png\"", multiple: true) if icon_android
|
|
215
|
+
update_pubspec_value(pubspec_path, "flutter_launcher_icons", "image_path_ios", "\"assets/icon_ios.png\"", multiple: true) if icon_ios
|
|
216
|
+
update_pubspec_value(pubspec_path, "flutter_launcher_icons", "image_path_web", "\"assets/icon_web.png\"", multiple: true) if icon_web
|
|
217
|
+
if icon_windows
|
|
218
|
+
ext = File.extname(icon_windows).downcase
|
|
219
|
+
value = ext == ".ico" ? "\"assets/icon_windows.ico\"" : "\"assets/icon_windows.png\""
|
|
220
|
+
update_pubspec_value(pubspec_path, "flutter_launcher_icons", "image_path_windows", value, multiple: true)
|
|
221
|
+
end
|
|
222
|
+
update_pubspec_value(pubspec_path, "flutter_launcher_icons", "image_path_macos", "\"assets/icon_macos.png\"", multiple: true) if icon_macos
|
|
223
|
+
update_pubspec_value(pubspec_path, "flutter_launcher_icons", "background_color", "\"#{icon_background}\"") if icon_background
|
|
224
|
+
update_pubspec_value(pubspec_path, "flutter_launcher_icons", "theme_color", "\"#{theme_color}\"") if theme_color
|
|
225
|
+
|
|
226
|
+
update_pubspec_value(pubspec_path, "flutter_native_splash", "image", "\"assets/splash.png\"") if splash_defined && splash
|
|
227
|
+
update_pubspec_value(pubspec_path, "flutter_native_splash", "image_dark", "\"assets/splash_dark.png\"") if splash_dark
|
|
228
|
+
update_pubspec_value(pubspec_path, "flutter_native_splash", "color", "\"#{splash_color}\"") if splash_color
|
|
229
|
+
update_pubspec_value(pubspec_path, "flutter_native_splash", "color_dark", "\"#{splash_dark_color}\"") if splash_dark_color
|
|
230
|
+
|
|
231
|
+
{ has_icon: icon_defined && !icon.nil?, has_splash: splash_defined && !splash.nil?, error: nil }
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def key_defined?(hash, key)
|
|
235
|
+
hash.is_a?(Hash) && (hash.key?(key) || hash.key?(key.to_sym))
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def apply_service_extension_config(client_dir, config = {})
|
|
239
|
+
services = Array(config["services"])
|
|
240
|
+
extension_keys = services.map { |v| normalize_extension_key(v) }.compact.uniq
|
|
241
|
+
extension_packages = extension_keys.filter_map { |key| CLIENT_EXTENSION_MAP[key]&.fetch(:package) }.uniq
|
|
242
|
+
extension_aliases = extension_keys.filter_map { |key| CLIENT_EXTENSION_MAP[key]&.fetch(:alias) }.uniq
|
|
243
|
+
|
|
244
|
+
pubspec_path = File.join(client_dir, "pubspec.yaml")
|
|
245
|
+
main_path = File.join(client_dir, "lib", "main.dart")
|
|
246
|
+
prune_client_pubspec(pubspec_path, extension_packages) if File.file?(pubspec_path)
|
|
247
|
+
prune_client_main(main_path, extension_aliases) if File.file?(main_path)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def normalize_extension_key(value)
|
|
251
|
+
key = value.to_s.strip.downcase
|
|
252
|
+
return nil if key.empty?
|
|
253
|
+
|
|
254
|
+
key.tr!("-", "_")
|
|
255
|
+
key.gsub!(/\A(flet_)+/, "")
|
|
256
|
+
key.gsub!(/\Aservice_/, "")
|
|
257
|
+
key
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def prune_client_pubspec(path, selected_packages)
|
|
261
|
+
data = YAML.safe_load(File.read(path), aliases: true) || {}
|
|
262
|
+
deps = (data["dependencies"] || {}).dup
|
|
263
|
+
|
|
264
|
+
deps.keys.each do |name|
|
|
265
|
+
next unless name.start_with?("flet_")
|
|
266
|
+
next if name == "flet"
|
|
267
|
+
next if selected_packages.include?(name)
|
|
268
|
+
|
|
269
|
+
deps.delete(name)
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
data["dependencies"] = deps
|
|
273
|
+
File.write(path, YAML.dump(data))
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def prune_client_main(path, selected_aliases)
|
|
277
|
+
lines = File.readlines(path)
|
|
278
|
+
alias_to_package = {}
|
|
279
|
+
|
|
280
|
+
lines.each do |line|
|
|
281
|
+
match = line.match(%r{\Aimport 'package:(flet_[^/]+)/\1\.dart' as ([a-zA-Z0-9_]+);})
|
|
282
|
+
next unless match
|
|
283
|
+
|
|
284
|
+
alias_to_package[match[2]] = match[1]
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
kept = lines.select do |line|
|
|
288
|
+
import_match = line.match(%r{\Aimport 'package:(flet_[^/]+)/\1\.dart' as ([a-zA-Z0-9_]+);})
|
|
289
|
+
if import_match
|
|
290
|
+
package_name = import_match[1]
|
|
291
|
+
next true if package_name == "flet"
|
|
292
|
+
next true if selected_aliases.include?(import_match[2])
|
|
293
|
+
next false
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
extension_match = line.match(/\A\s*([a-zA-Z0-9_]+)\.Extension\(\),\s*\z/)
|
|
297
|
+
if extension_match
|
|
298
|
+
extension_alias = extension_match[1]
|
|
299
|
+
package_name = alias_to_package[extension_alias]
|
|
300
|
+
next true if package_name.nil?
|
|
301
|
+
next true if selected_aliases.include?(extension_alias)
|
|
302
|
+
next false
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
true
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
File.write(path, kept.join)
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def update_pubspec_value(path, block, key, value, multiple: false)
|
|
312
|
+
lines = File.read(path).split("\n", -1)
|
|
313
|
+
out = []
|
|
314
|
+
in_block = false
|
|
315
|
+
replaced = false
|
|
316
|
+
block_indent = nil
|
|
317
|
+
lines.each do |line|
|
|
318
|
+
if line.start_with?("#{block}:")
|
|
319
|
+
in_block = true
|
|
320
|
+
block_indent = line[/^\s*/] + " "
|
|
321
|
+
out << line
|
|
322
|
+
next
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
if in_block
|
|
326
|
+
if line =~ /^\S/ && !line.start_with?("#{block}:")
|
|
327
|
+
unless replaced
|
|
328
|
+
out << "#{block_indent}#{key}: #{value}"
|
|
329
|
+
replaced = true
|
|
330
|
+
end
|
|
331
|
+
in_block = false
|
|
332
|
+
else
|
|
333
|
+
if line.strip.start_with?("#{key}:")
|
|
334
|
+
indent = line[/^\s*/]
|
|
335
|
+
out << "#{indent}#{key}: #{value}"
|
|
336
|
+
replaced = true
|
|
337
|
+
next
|
|
338
|
+
end
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
out << line
|
|
343
|
+
end
|
|
344
|
+
if in_block && !replaced
|
|
345
|
+
out << "#{block_indent}#{key}: #{value}"
|
|
346
|
+
end
|
|
347
|
+
File.write(path, out.join("\n"))
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
def flutter_build_command(platform)
|
|
351
|
+
case platform
|
|
352
|
+
when "apk", "android"
|
|
353
|
+
["build", "apk"]
|
|
354
|
+
when "aab", "appbundle"
|
|
355
|
+
["build", "appbundle"]
|
|
356
|
+
when "ios"
|
|
357
|
+
["build", "ios", "--no-codesign"]
|
|
358
|
+
when "web"
|
|
359
|
+
["build", "web"]
|
|
360
|
+
when "macos"
|
|
361
|
+
["build", "macos"]
|
|
362
|
+
when "windows"
|
|
363
|
+
["build", "windows"]
|
|
364
|
+
when "linux"
|
|
365
|
+
["build", "linux"]
|
|
366
|
+
else
|
|
367
|
+
nil
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
end
|
|
371
|
+
end
|
|
372
|
+
end
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "optparse"
|
|
4
|
+
|
|
5
|
+
module Ruflet
|
|
6
|
+
module CLI
|
|
7
|
+
module ExtraCommand
|
|
8
|
+
include FlutterSdk
|
|
9
|
+
|
|
10
|
+
def command_create(args)
|
|
11
|
+
command_new(args)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def command_doctor(args)
|
|
15
|
+
verbose = args.delete("--verbose") || args.delete("-v")
|
|
16
|
+
fix = args.delete("--fix")
|
|
17
|
+
client_dir = detect_client_dir
|
|
18
|
+
puts "Ruflet doctor"
|
|
19
|
+
puts " Ruby: #{RUBY_VERSION}"
|
|
20
|
+
puts " Flutter host target: #{flutter_host || 'unsupported'}"
|
|
21
|
+
if fix
|
|
22
|
+
tools = ensure_flutter!("doctor", client_dir: client_dir, auto_install: true)
|
|
23
|
+
else
|
|
24
|
+
tools = flutter_tools(client_dir: client_dir, auto_install: false)
|
|
25
|
+
unless tools
|
|
26
|
+
warn " Flutter: missing"
|
|
27
|
+
warn "Run `ruflet doctor --fix` to install the host-platform Flutter SDK from .fvmrc."
|
|
28
|
+
return 1
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
puts " Flutter: #{flutter_version_summary(tools)}"
|
|
32
|
+
ok = system(tools[:env], tools[:flutter], "doctor", *(verbose ? ["-v"] : []))
|
|
33
|
+
status = $?.exitstatus if $?
|
|
34
|
+
status ||= ok ? 0 : 1
|
|
35
|
+
status
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def command_devices(args)
|
|
39
|
+
tools = ensure_flutter!("devices")
|
|
40
|
+
system(tools[:env], tools[:flutter], "devices", *args)
|
|
41
|
+
$?.exitstatus || 1
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def command_emulators(args)
|
|
45
|
+
tools = ensure_flutter!("emulators")
|
|
46
|
+
action = nil
|
|
47
|
+
emulator_id = nil
|
|
48
|
+
verbose = false
|
|
49
|
+
parser = OptionParser.new do |o|
|
|
50
|
+
o.on("--create") { action = "create" }
|
|
51
|
+
o.on("--delete") { action = "delete" }
|
|
52
|
+
o.on("--start") { action = "start" }
|
|
53
|
+
o.on("--emulator ID") { |v| emulator_id = v }
|
|
54
|
+
o.on("-v", "--verbose") { verbose = true }
|
|
55
|
+
end
|
|
56
|
+
parser.parse!(args)
|
|
57
|
+
|
|
58
|
+
case action
|
|
59
|
+
when "start"
|
|
60
|
+
unless emulator_id
|
|
61
|
+
warn "Missing --emulator for start"
|
|
62
|
+
return 1
|
|
63
|
+
end
|
|
64
|
+
cmd = [tools[:flutter], "emulators", "--launch", emulator_id]
|
|
65
|
+
cmd << "-v" if verbose
|
|
66
|
+
system(tools[:env], *cmd)
|
|
67
|
+
$?.exitstatus || 1
|
|
68
|
+
when "create", "delete"
|
|
69
|
+
warn "ruflet emulators --#{action} is not implemented yet. Use your platform tools."
|
|
70
|
+
1
|
|
71
|
+
else
|
|
72
|
+
cmd = [tools[:flutter], "emulators"]
|
|
73
|
+
cmd << "-v" if verbose
|
|
74
|
+
system(tools[:env], *cmd)
|
|
75
|
+
$?.exitstatus || 1
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def command_debug(args)
|
|
80
|
+
options = {
|
|
81
|
+
platform: nil,
|
|
82
|
+
device_id: nil,
|
|
83
|
+
release: false,
|
|
84
|
+
verbose: false,
|
|
85
|
+
web_renderer: nil
|
|
86
|
+
}
|
|
87
|
+
parser = OptionParser.new do |o|
|
|
88
|
+
o.on("--platform NAME") { |v| options[:platform] = v }
|
|
89
|
+
o.on("--device-id ID") { |v| options[:device_id] = v }
|
|
90
|
+
o.on("--release") { options[:release] = true }
|
|
91
|
+
o.on("-v", "--verbose") { options[:verbose] = true }
|
|
92
|
+
o.on("--web-renderer NAME") { |v| options[:web_renderer] = v }
|
|
93
|
+
end
|
|
94
|
+
parser.parse!(args)
|
|
95
|
+
|
|
96
|
+
options[:platform] ||= args.shift
|
|
97
|
+
client_dir = detect_client_dir
|
|
98
|
+
unless client_dir
|
|
99
|
+
warn "Could not find Flutter client directory."
|
|
100
|
+
warn "Set RUFLET_CLIENT_DIR or place client at ./ruflet_client"
|
|
101
|
+
warn "`ruflet debug` requires Flutter client source code."
|
|
102
|
+
warn "For prebuilt clients, use: `ruflet run --web` or `ruflet run --desktop`."
|
|
103
|
+
return 1
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
tools = ensure_flutter!("debug", client_dir: client_dir)
|
|
107
|
+
cmd = [tools[:flutter], "run"]
|
|
108
|
+
cmd << "--release" if options[:release]
|
|
109
|
+
cmd << "-v" if options[:verbose]
|
|
110
|
+
cmd += ["--web-renderer", options[:web_renderer]] if options[:web_renderer]
|
|
111
|
+
|
|
112
|
+
if options[:device_id]
|
|
113
|
+
cmd += ["-d", options[:device_id]]
|
|
114
|
+
else
|
|
115
|
+
case options[:platform]
|
|
116
|
+
when "web"
|
|
117
|
+
cmd += ["-d", "chrome"]
|
|
118
|
+
when "macos", "windows", "linux"
|
|
119
|
+
cmd += ["-d", options[:platform]]
|
|
120
|
+
when "ios", "android"
|
|
121
|
+
# let flutter pick the default device
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
system(tools[:env], *cmd, chdir: client_dir)
|
|
126
|
+
$?.exitstatus || 1
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
private
|
|
130
|
+
|
|
131
|
+
def detect_client_dir
|
|
132
|
+
env_dir = ENV["RUFLET_CLIENT_DIR"]
|
|
133
|
+
return env_dir if env_dir && Dir.exist?(env_dir)
|
|
134
|
+
|
|
135
|
+
local = File.expand_path("ruflet_client", Dir.pwd)
|
|
136
|
+
return local if Dir.exist?(local)
|
|
137
|
+
|
|
138
|
+
template = File.expand_path("templates/ruflet_flutter_template", Dir.pwd)
|
|
139
|
+
return template if Dir.exist?(template)
|
|
140
|
+
|
|
141
|
+
nil
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|