Skip to content

Commit

Permalink
Merge pull request #36 from Snapp-Embedded/release/v1.0.0
Browse files Browse the repository at this point in the history
release: release V1.0.0
  • Loading branch information
payam-zahedi authored Jun 25, 2024
2 parents 39d22f5 + cdcb290 commit b705a1e
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 430 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.0.0
**Important**: We now Support flutter-pi.

* feat: add support to use flutter-pi as custom embedder by @payam-zahedi
* feat: speed up running flutter app on flutter linux embedder by @payam-zahedi
* fix: interaction issue on select/choose item on cli by @payam-zahedi

## 0.6.0 BETA
* add compatibility with flutter 3.22 by @payam-zahedi
Expand Down
94 changes: 43 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p align="center">
<!-- <p align="center">
<a href="https://www.snappembedded.io/"><img src="https://img.shields.io/badge/made_by-snapp_embedded-blue" alt="Snapp Embedded"></a>
<br>
<a href="https://pub.dev/packages/snapp_cli"><img src="https://badgen.net/pub/flutter-platform/snapp_cli" alt="Platforms"></a>
Expand All @@ -14,24 +14,33 @@
<a href="https://github.com/Snapp-Embedded/snapp_cli/graphs/contributors"><img src="https://badgen.net/github/contributors/Snapp-Embedded/snapp_cli" alt="Contributors"></a>
<a href="https://github.com/Snapp-Embedded/snapp_cli/blob/main/LICENSE"><img src="https://badgen.net/github/license/Snapp-Embedded/snapp_cli" alt="License"></a>
<br>
</p> -->
# Snapp CLI <a href="https://pub.dev/packages/snapp_cli"><img src="https://img.shields.io/pub/v/snapp_cli?logo=dart&logoColor=white" alt="Pub Version"></a>
Power Up Your Raspberry Pi for Flutter

<p align="left">
<img src="./assets/doc/header.png" width="100%" alt="Styles" />
</p>

## What is snapp_cli?

Imagine You have a **Raspberry Pi** sitting on your desk or tucked away in a drawer, collecting dust. You bought it with grand ideas of developing **Flutter** apps on it, but the thought of setting it up for development has always seemed too complicated. Now, picture a tool that makes this process simple and effortless – that’s **Snapp CLI**. 🚀

**Snapp CLI** allows you to control everything from your laptop 💻. Here’s how it simplifies your development process:

1. 🔗 **Effortless Connection:** Snapp CLI sets up a secure, passwordless SSH link from your laptop to your Raspberry Pi, so you can manage it without direct interaction.

## snapp\_cli
2. 🔧 **Automated Installation:** Snapp CLI automates the installation of Flutter and all necessary dependencies on your Raspberry Pi. You run Snapp CLI from your laptop, and it handles everything remotely. But that's not all – Snapp CLI also supports custom embedders like Flutter-pi.

`snapp_cli` is a powerful command-line interface tool designed to simplify the integration of embedded devices (like Raspberry Pi) with Flutter applications. Effortlessly manage your embedded devices, establish secure SSH connections, and streamline the development process by installing Flutter directly onto your custom devices from your PC.
3. ⚙️ **Custom Device Configuration:** Snapp CLI configures your Raspberry Pi to appear as a custom device in your IDE. You can easily select it and run your Flutter apps, just like you would on a phone or emulator.

## Features
- **🛠️ Single Command Setup:** Prepare your custom device completely by adding it to Flutter, establishing SSH connection, installing Flutter, and running your app—all with a single command.
- **📱 Device Management:** Add, list, and remove custom(**embedded**) devices effortlessly.
- **🔒 Automatic SSH Connection:** Configure and establish SSH connections to devices with ease.
- **🚀 Flutter Installation:** Install Flutter directly onto your custom devices from your PC.
- **🔥 Run & Debug Flutter Apps:** Utilize hot reload, hot restart, and Dart DevTools for efficient app development.
- **🎛️ User-Friendly Interface:** Intuitive CLI for seamless navigation and usage.
4. 🛠️ **Seamless Remote Development:** Develop and debug your Flutter apps directly from your laptop. Snapp CLI enables hot reload, restart, and access to DevTools, so you can run and test apps on your Raspberry Pi with all the tools you need for smooth and efficient remote development.

**In essence**, Snapp CLI transforms your idle Raspberry Pi into a powerful Flutter development platform, all managed from your laptop. Whether you're new to Flutter or an experienced developer, Snapp CLI makes remote development simple and effective.

## Installation

Before using `snapp_cli`, ensure that you have Dart and Flutter installed. You can install the tool using the Dart package manager:
Snapp CLI is a Dart-based command-line tool. If you already have Flutter installed on your laptop, getting Snapp CLI up and running is quick and easy. Just run the following command in your terminal:

``` bash
dart pub global activate snapp_cli
Expand All @@ -40,58 +49,41 @@ dart pub global activate snapp_cli
Make sure that system cache bin directory is added to your system's PATH to use snapp_cli globally. follow this link for more information: [Running a script from your PATH](https://dart.dev/tools/pub/cmd/pub-global#running-a-script-from-your-path "Running a script from your PATH")

## Usage
Using Snapp CLI is straightforward. Once installed, you can use it to set up and manage your Raspberry Pi for Flutter development. Let's start with `bootstrap` command.

#### Single Command Setup - **Bootstrap**
### Bootstrap Command
The most important command in Snapp CLI is the bootstrap command. This command is interactive and guides you through the entire setup process, making your remote device(Raspberry Pi) ready for Flutter development with minimal effort.

Bootstrap command is a way to setup a device from scratch.
It will add a new device to custom devices, create a ssh connection to the device,
install flutter on the device and finally help you to run your app on the device.
To use the bootstrap command, simply run:

```bash
$ snapp_cli bootstrap
```

#### Device Management
<p align="left">
<img src="./assets/doc/bootstrap.png" width="100%" alt="Styles" />
</p>

- **List Devices:** Display all connected/embedded devices.
```bash
$ snapp_cli devices list
```
- **Add a Device:** Add a new device to the Flutter SDK.
```bash
$ snapp_cli devices add
```
- **Delete a Device:** Remove a device from the Flutter SDK.
```bash
$ snapp_cli devices delete
```
- **Update Device IP:** Update the IP address of a device.
```bash
$ snapp_cli devices update-ip
```
- **Install Flutter:** Install Flutter directly onto a device.
```bash
$ snapp_cli devices install-flutter
```
The `bootstrap` command simplifies the entire setup process for your Raspberry Pi. It prompts for your Raspberry Pi's **IP address** and **username** to establish a **passwordless SSH connection**. You'll then choose a **Flutter Embedder** (**Flutter Desktop**, **Flutter Pi** or ...), and the command checks and installs it along with any necessary dependencies. Finally, it configures your Raspberry Pi as a **custom device** in the **Flutter SDK**, allowing you to select and run your Flutter apps on the Raspberry Pi directly from your laptop, enabling seamless remote debugging and development.

#### SSH Connection
### Other Commands
Snapp CLI includes additional commands to help you manage your devices and SSH connections efficiently:

- **Create SSH Connection:** Create a passwordless SSH connection to a device.
```bash
$ snapp_cli ssh create-connection
```
- **Test SSH Connection:** Test a passwordless SSH connection to a device.
```bash
$ snapp_cli ssh test-connection
```
<p align="left">
<img src="./assets/doc/commands.png" width="100%" alt="Styles" />
</p>

The `devices` command helps you manage your custom devices in the Flutter SDK. With subcommands to add, delete, list, and update the IP addresses of your devices, you have full control over your development environment.

The `ssh` command assists in establishing and managing secure, passwordless SSH connections to your remote devices. Subcommands are available to create and test SSH connections, making remote access and management straightforward.

------------------------------------

Each command has specific options and usage, which you can explore further by running `snapp_cli --help` or `snapp_cli <command> --help`.

## Troubleshooting

### Running Commands in Verbose Mode
#### Running Commands in Verbose Mode

If you encounter any issues while using the `snapp_cli` tool, you can run the commands in verbose mode to obtain more detailed information about the error. To do this, simply add the `-v` flag to your command. For example:

Expand All @@ -100,7 +92,7 @@ If you encounter any issues while using the `snapp_cli` tool, you can run the co
$ snapp_cli bootstrap -v
```

### SSH Connection Issues
#### SSH Connection Issues

Sometimes, you may face difficulties establishing an SSH connection to a device due to various reasons, such as an incorrect IP address, username, password, or SSH key. To verify whether the SSH connection is functioning correctly, you can execute the `snapp_cli ssh test-connection` command. If the connection fails, attempt to establish a new connection using the `snapp_cli ssh create-connection` command.

Expand All @@ -109,7 +101,7 @@ If you still cannot establish an SSH connection, it may be necessary to review t
However, be cautious: if you have any other SSH connections to your remote device or to other devices, using the following commands will remove them.


#### Host Device - Your PC
##### Host Device - Your PC
* Clear the `.snapp_cli` directory:
``` bash
rm -r ~/.snapp_cli
Expand All @@ -123,7 +115,7 @@ However, be cautious: if you have any other SSH connections to your remote devic
ssh-add -D
```

#### Remote Device - Raspberry Pi
##### Remote Device - Raspberry Pi
Connect to your remote device via a simple SSH connection:

``` bash
Expand All @@ -136,11 +128,11 @@ After successfully connecting to your remote device, remove the `.ssh` folder th
rm -r ~/.ssh
```

### Notes:
#### Notes:
* Ensure you replace yourIpAddress with the actual IP address of your device.
* Be explicit about replacing placeholders like username@ipAddress with the appropriate user and IP address for the Raspberry Pi.

### Manually Editing `flutter_custom_devices.json`
#### Manually Editing `flutter_custom_devices.json`

In some cases, you may need to manually edit the `flutter_custom_devices.json` file, which stores the configurations for custom devices. Here are the steps to follow if you encounter this situation:

Expand Down
Binary file added assets/doc/bootstrap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/doc/commands.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/doc/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions lib/commands/bootstrap/bootstarp_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class BootstrapCommand extends BaseSnappCommand {

@override
Future<int> run() async {
logger.info('new version');

logger.spaces();

logger.info('''
Expand Down
Loading

0 comments on commit b705a1e

Please sign in to comment.