rpremote 0.1.0 → 0.2.0
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/CHANGELOG.md +21 -17
- data/README.ja.md +43 -33
- data/README.md +41 -32
- data/RELEASING.md +23 -23
- data/THIRD_PARTY_NOTICES.md +4 -18
- data/lib/rpremote/builder.rb +9 -2
- data/lib/rpremote/cli.rb +26 -17
- data/lib/rpremote/config.rb +1 -0
- data/lib/rpremote/config_show.rb +91 -0
- data/lib/rpremote/dfu_command.rb +4 -4
- data/lib/rpremote/flash_command.rb +5 -2
- data/lib/rpremote/flasher.rb +1 -1
- data/lib/rpremote/help.rb +253 -26
- data/lib/rpremote/language_source.rb +4 -1
- data/lib/rpremote/picomodem.rb +3 -7
- data/lib/rpremote/picoruby_source_patch.rb +32 -0
- data/lib/rpremote/resetter.rb +1 -1
- data/lib/rpremote/runner.rb +2 -2
- data/lib/rpremote/shell.rb +38 -7
- data/lib/rpremote/version.rb +1 -1
- data/lib/rpremote.rb +1 -0
- data/patches/picoruby-3.4.5-ruby-exception-status.patch +59 -0
- data/patches/picoruby-4.0.3-ruby-exception-status.patch +59 -0
- data/sig/rpremote.rbs +17 -3
- data/tasks/firmware_build.rb +2 -8
- data/tasks/release_check.rb +3 -7
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8dfb50a1e7d831a80c938b09c267d0ffa38bbcba43c9c0d870d2bfd594fe5502
|
|
4
|
+
data.tar.gz: af28f94924f0d121960a32f58dda68d3927d02b69d8d7cf13ce1680307ecf36f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d9cbfdb48f779fdd0075e3712dac31a7ec815cc96b9779144b05a5970a24e8ee39ed7994eca120f55b248617173455ad951c8a431a0d3feb29a336b6be51875
|
|
7
|
+
data.tar.gz: e9a4d8a3aaf6de6a88adeac72ed27b880665a33621499c9ce062ea404bdd594361e08bc3a4d646dfbac48c50526046acdf24ef4d97895cff95d376a6fe62cf81
|
data/CHANGELOG.md
CHANGED
|
@@ -2,23 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 0.2.0 - 2026-08-26
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Make `run` and `exec` exit nonzero when compatible R2P2 firmware reports a Ruby exception, while preserving real-time program output.
|
|
8
|
+
- Increase the default command timeout from 10 to 20 seconds.
|
|
9
|
+
- Add a bilingual education example for practical PicoModem DFU application updates, startup confirmation, and A/B-slot rollback.
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- Add
|
|
12
|
-
|
|
13
|
-
- Add `Mrbgems` and `Mrbgems.lock` support for reproducible public and local
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- Add PicoModem DFU staging, status, compatible bytecode compilation, and
|
|
17
|
-
A/B-slot rollback support for Ruby and `.mrb` applications.
|
|
18
|
-
- Add binary-safe file transfer and remote filesystem commands, plus `run`,
|
|
19
|
-
`exec`, `monitor`, `repl`, and reset with reconnect waiting.
|
|
11
|
+
## 0.1.0 - 2026-08-24
|
|
12
|
+
|
|
13
|
+
- Add `setup`, `build`, and RP2350 BOOTSEL `flash` commands for custom PicoRuby R2P2 firmware on Raspberry Pi Pico 2 and Pico 2 W.
|
|
14
|
+
- Add target configuration for language, language version, board, cache, firmware path, serial port, and timeouts, with command-line precedence.
|
|
15
|
+
- Add `Mrbgems` and `Mrbgems.lock` support for reproducible public and local mrbgems, including automatic regeneration of PicoRuby build output when a custom mrbgem changes.
|
|
16
|
+
- Add PicoModem DFU staging, status, compatible bytecode compilation, and A/B-slot rollback support for Ruby and `.mrb` applications.
|
|
17
|
+
- Add binary-safe file transfer and remote filesystem commands, plus `run`, `exec`, `monitor`, `repl`, and reset with reconnect waiting.
|
|
20
18
|
- Add macOS R2P2 serial-port detection for Raspberry Pi Pico 2 and Pico 2 W.
|
|
21
|
-
- Add bilingual repository, package, configuration, firmware, mrbgem, DFU,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
- Add bilingual repository, package, configuration, firmware, mrbgem, DFU, and electronic-craft example documentation.
|
|
20
|
+
- Add RBS signatures, automated tests, macOS CI, and release validation with isolated gem installation and CLI smoke testing.
|
|
21
|
+
|
|
22
|
+
### Limitations
|
|
23
|
+
|
|
24
|
+
- rpremote currently supports PicoRuby only.
|
|
25
|
+
- Supported boards are Raspberry Pi Pico 2 and Pico 2 W; serial commands currently require macOS.
|
|
26
|
+
- `rpremote run` and `exec` are temporary R2P2 executions, not persistent deployments. Use `build` and `flash` to replace firmware.
|
|
27
|
+
- PicoModem DFU updates only the boot application. Changes to PicoRuby, R2P2, or embedded mrbgems require rebuilding and flashing a UF2.
|
|
28
|
+
- DFU retains the complete application in RAM before writing flash. Verify available memory, bytecode compatibility, boot confirmation, and rollback on target hardware.
|
data/README.ja.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
# rpremote
|
|
1
|
+
# rpremote CLIリファレンス
|
|
2
2
|
|
|
3
3
|
[English](README.md)
|
|
4
4
|
|
|
5
|
-
Raspberry Pi Pico向けのカスタムPicoRuby R2P2
|
|
6
|
-
書き込み、操作するためのコマンドラインツールです。
|
|
5
|
+
Raspberry Pi Pico向けのカスタムPicoRuby R2P2ファームウェアを準備、ビルド、書き込み、操作するためのコマンドラインツールです。
|
|
7
6
|
|
|
8
|
-
公開mrbgemとローカルmrbgemを再現可能なファームウェアへ組み込み、生成したUF2の
|
|
9
|
-
BOOTSEL書き込み、R2P2経由のバイナリ安全なファイル転送とRuby実行を行えます。
|
|
7
|
+
公開mrbgemとローカルmrbgemを再現可能なファームウェアへ組み込み、生成したUF2のBOOTSEL書き込み、R2P2経由のバイナリ安全なファイル転送とRuby実行を行えます。
|
|
10
8
|
|
|
11
9
|
## 必要環境
|
|
12
10
|
|
|
@@ -32,9 +30,7 @@ rpremote flash --mount /Volumes/RP2350
|
|
|
32
30
|
rpremote run main.rb
|
|
33
31
|
```
|
|
34
32
|
|
|
35
|
-
既定では`firmware/picoruby-4.0.3
|
|
36
|
-
`firmware/picoruby-4.0.3-pico2.uf2`を生成します。対象ボードを明示する必要がある
|
|
37
|
-
場合は、`rpremote ports`でR2P2のCDC 0ポートを確認してください。
|
|
33
|
+
既定では`firmware/picoruby-4.0.3/`にソースを準備し、`firmware/picoruby-4.0.3-pico2.uf2`を生成します。対象ボードを明示する必要がある場合は、`rpremote ports`でR2P2のCDC 0ポートを確認してください。
|
|
38
34
|
|
|
39
35
|
## mrbgemを追加する
|
|
40
36
|
|
|
@@ -42,7 +38,6 @@ rpremote run main.rb
|
|
|
42
38
|
|
|
43
39
|
```ruby
|
|
44
40
|
vm :mrubyc
|
|
45
|
-
|
|
46
41
|
gem github: "ksbmyk/picoruby-ws2812-plus", branch: "main"
|
|
47
42
|
gem path: "../mrbgems/my-device"
|
|
48
43
|
```
|
|
@@ -55,21 +50,17 @@ rpremote mrbgems lock
|
|
|
55
50
|
rpremote build
|
|
56
51
|
```
|
|
57
52
|
|
|
58
|
-
`Mrbgems.lock`はGitHub
|
|
59
|
-
既存lockを再利用し、`rpremote mrbgems update`だけが新しいcommitを解決します。
|
|
53
|
+
`Mrbgems.lock`はGitHubのコミットとローカルgemの内容ハッシュを固定します。`build`は既存のlockを再利用し、`rpremote mrbgems update`だけが新しいコミットを解決します。
|
|
60
54
|
|
|
61
55
|
## 対象を選択する
|
|
62
56
|
|
|
63
57
|
```sh
|
|
64
58
|
rpremote setup --language picoruby --language-version 3.4.2
|
|
65
59
|
rpremote build --language picoruby --language-version 3.4.2 --board pico2
|
|
66
|
-
rpremote flash --language picoruby --language-version 3.4.2 --board pico2
|
|
67
|
-
--mount /Volumes/RP2350
|
|
60
|
+
rpremote flash --language picoruby --language-version 3.4.2 --board pico2 --mount /Volumes/RP2350
|
|
68
61
|
```
|
|
69
62
|
|
|
70
|
-
コマンドラインオプションは`config/setting.json
|
|
71
|
-
いるのはPicoRubyです。将来のMicroPythonと追加Picoボード対応に備え、
|
|
72
|
-
`language`と`board`はインターフェースに残しています。
|
|
63
|
+
コマンドラインオプションは`config/setting.json`より優先されます。現在実装されているのはPicoRubyです。将来のMicroPythonと追加Picoボード対応に備え、`language`と`board`はインターフェースに残しています。
|
|
73
64
|
|
|
74
65
|
## コマンド
|
|
75
66
|
|
|
@@ -82,41 +73,60 @@ rpremote flash --language picoruby --language-version 3.4.2 --board pico2 \
|
|
|
82
73
|
| `rpremote dfu compile FILE` | DFU用にPicoRuby版と一致する`.mrb`を生成します。 |
|
|
83
74
|
| `rpremote dfu status` | DFUのアクティブおよび起動候補スロットを表示します。 |
|
|
84
75
|
| `rpremote mrbgems …` | mrbgemを検査、表示、固定、更新します。 |
|
|
85
|
-
| `rpremote flash` | 選択したUF2をBOOTSEL
|
|
76
|
+
| `rpremote flash` | 選択したUF2をBOOTSEL経由で書き込みます。 |
|
|
77
|
+
| `rpremote config show` | 設定ファイルとコマンドラインオプションを反映した実効設定を表示します。 |
|
|
86
78
|
| `rpremote ports` | R2P2シリアルポートを表示します。 |
|
|
87
|
-
| `rpremote run FILE` | Ruby
|
|
88
|
-
| `rpremote exec CODE` | 短いRubyコードを実行します。 |
|
|
89
|
-
| `rpremote monitor` / `repl` |
|
|
90
|
-
| `rpremote reset` | R2P2
|
|
79
|
+
| `rpremote run FILE` | Rubyファイルを転送して実行し、出力をリアルタイム表示します。Ruby例外時は非0で終了します。 |
|
|
80
|
+
| `rpremote exec CODE` | 短いRubyコードを実行します。Ruby例外時は非0で終了します。 |
|
|
81
|
+
| `rpremote monitor` / `repl` | 対話型シリアルセッションを開きます。 |
|
|
82
|
+
| `rpremote reset` | R2P2を再起動して再接続まで待ちます。 |
|
|
91
83
|
| `rpremote fs cp/cat/ls/rm/mkdir` | R2P2ファイルシステムを操作します。 |
|
|
92
84
|
|
|
93
|
-
|
|
94
|
-
|
|
85
|
+
コマンド一覧は`rpremote --help`で確認できます。コマンド固有の構文、既定値、影響は`rpremote <command> --help`で確認できます。
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
rpremote flash --help
|
|
89
|
+
rpremote dfu app --help
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`monitor`と`repl`は`Ctrl-]`で終了します。
|
|
93
|
+
|
|
94
|
+
`run`と`exec`の例外終了コードには、Ruby例外ステータスに対応したR2P2ファームウェアが必要です。[GitHubリポジトリ](https://github.com/ogom/rpremote)のPicoRubyソースから`rpremote build`で生成したUF2が対応しています。
|
|
95
|
+
|
|
96
|
+
## 操作モデル
|
|
97
|
+
|
|
98
|
+
- `run`と`exec`はRubyコードを一時的に転送・実行して出力を表示し、一時リモートファイルを削除します。対応するR2P2ファームウェアがRuby例外を報告した場合は、非0で終了します。
|
|
99
|
+
- `flash`はUF2をRP2350 BOOTSELボリュームへコピーし、永続的なR2P2ファームウェアを置き換えます。
|
|
100
|
+
- `dfu app`はRubyソースまたは対応するバイトコードのアプリを非アクティブDFUスロットへ登録します。R2P2を再起動して試行し、正常に起動したアプリは`DFU.confirm`を呼び出します。
|
|
101
|
+
- リモートパスには`:/REMOTE/PATH`を使います。`fs cp`はローカルパスとリモートパスの間で転送し、`fs rm`は指定したリモートパスを完全に削除します。
|
|
95
102
|
|
|
96
103
|
## ドキュメントとサンプル
|
|
97
104
|
|
|
98
|
-
[GitHubリポジトリ](https://github.com/ogom/rpremote)
|
|
99
|
-
設定リファレンス、Mrbgems.lockの解説、カスタムファームウェア手順、電子工作
|
|
100
|
-
サンプルがあります。
|
|
105
|
+
[GitHubリポジトリ](https://github.com/ogom/rpremote)に、英語・日本語のガイド、設定リファレンス、Mrbgems.lockの解説、カスタムファームウェア手順、電子工作サンプルがあります。
|
|
101
106
|
|
|
102
107
|
## 関連プロジェクト
|
|
103
108
|
|
|
104
|
-
- [mbremote](https://github.com/ogom/mbremote)は、BBC micro:bit向けの
|
|
105
|
-
MicroPython/PicoRubyプロジェクトをビルド、書き込み、操作する、同じコンセプトの
|
|
106
|
-
ツールです。
|
|
109
|
+
- [mbremote](https://github.com/ogom/mbremote)は、BBC micro:bit向けのMicroPython/PicoRubyプロジェクトをビルド、書き込み、操作する、同じコンセプトのツールです。
|
|
107
110
|
|
|
108
111
|
## 開発
|
|
109
112
|
|
|
113
|
+
依存gemを導入して、テスト、静的解析、RBSを検証します。
|
|
114
|
+
|
|
110
115
|
```sh
|
|
111
116
|
bundle install
|
|
112
117
|
bundle exec rake
|
|
113
118
|
bundle exec rbs -I sig validate
|
|
114
119
|
```
|
|
115
120
|
|
|
116
|
-
|
|
117
|
-
|
|
121
|
+
変更したローカル版を試すときは、次を実行します。ネットワークへ接続せずにgemをビルドし、現在のRuby環境へインストールします。
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
bundle exec rake install:local
|
|
125
|
+
rpremote --version
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
リリースする版は`lib/rpremote/version.rb`と`CHANGELOG.md`を更新します。公開前は`bundle exec rake release:check`を実行し、[RELEASING.md](RELEASING.md)に従ってください。
|
|
118
129
|
|
|
119
130
|
## ライセンス
|
|
120
131
|
|
|
121
|
-
[MIT](LICENSE)です。外部ソフトウェアについては
|
|
122
|
-
[第三者ソフトウェアに関する通知](THIRD_PARTY_NOTICES.md)を参照してください。
|
|
132
|
+
[MIT](LICENSE)です。外部ソフトウェアについては[第三者ソフトウェアに関する通知](THIRD_PARTY_NOTICES.md)を参照してください。
|
data/README.md
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
# rpremote
|
|
1
|
+
# rpremote CLI reference
|
|
2
2
|
|
|
3
3
|
[日本語](README.ja.md)
|
|
4
4
|
|
|
5
|
-
Command-line tools for preparing, building, flashing, and controlling custom
|
|
6
|
-
PicoRuby R2P2 firmware on Raspberry Pi Pico boards.
|
|
5
|
+
Command-line tools for preparing, building, flashing, and controlling custom PicoRuby R2P2 firmware on Raspberry Pi Pico boards.
|
|
7
6
|
|
|
8
|
-
rpremote embeds public and local mrbgems in reproducible firmware, flashes the
|
|
9
|
-
generated UF2 through BOOTSEL, and provides binary-safe file transfer and Ruby
|
|
10
|
-
execution through R2P2.
|
|
7
|
+
rpremote embeds public and local mrbgems in reproducible firmware, flashes the generated UF2 through BOOTSEL, and provides binary-safe file transfer and Ruby execution through R2P2.
|
|
11
8
|
|
|
12
9
|
## Requirements
|
|
13
10
|
|
|
@@ -33,9 +30,7 @@ rpremote flash --mount /Volumes/RP2350
|
|
|
33
30
|
rpremote run main.rb
|
|
34
31
|
```
|
|
35
32
|
|
|
36
|
-
The defaults prepare `firmware/picoruby-4.0.3/` and create
|
|
37
|
-
`firmware/picoruby-4.0.3-pico2.uf2`. Use `rpremote ports` to locate the R2P2
|
|
38
|
-
CDC 0 port when a board must be selected explicitly.
|
|
33
|
+
The defaults prepare `firmware/picoruby-4.0.3/` and create `firmware/picoruby-4.0.3-pico2.uf2`. Use `rpremote ports` to locate the R2P2 CDC 0 port when a board must be selected explicitly.
|
|
39
34
|
|
|
40
35
|
## Add mrbgems
|
|
41
36
|
|
|
@@ -43,7 +38,6 @@ Create a project-level `Mrbgems` file. Local paths are relative to that file.
|
|
|
43
38
|
|
|
44
39
|
```ruby
|
|
45
40
|
vm :mrubyc
|
|
46
|
-
|
|
47
41
|
gem github: "ksbmyk/picoruby-ws2812-plus", branch: "main"
|
|
48
42
|
gem path: "../mrbgems/my-device"
|
|
49
43
|
```
|
|
@@ -56,22 +50,17 @@ rpremote mrbgems lock
|
|
|
56
50
|
rpremote build
|
|
57
51
|
```
|
|
58
52
|
|
|
59
|
-
`Mrbgems.lock` pins GitHub commits and hashes local gem contents. Existing
|
|
60
|
-
locks are reused by `build`; `rpremote mrbgems update` deliberately resolves
|
|
61
|
-
new commits.
|
|
53
|
+
`Mrbgems.lock` pins GitHub commits and hashes local gem contents. Existing locks are reused by `build`; `rpremote mrbgems update` deliberately resolves new commits.
|
|
62
54
|
|
|
63
55
|
## Select a target
|
|
64
56
|
|
|
65
57
|
```sh
|
|
66
58
|
rpremote setup --language picoruby --language-version 3.4.2
|
|
67
59
|
rpremote build --language picoruby --language-version 3.4.2 --board pico2
|
|
68
|
-
rpremote flash --language picoruby --language-version 3.4.2 --board pico2
|
|
69
|
-
--mount /Volumes/RP2350
|
|
60
|
+
rpremote flash --language picoruby --language-version 3.4.2 --board pico2 --mount /Volumes/RP2350
|
|
70
61
|
```
|
|
71
62
|
|
|
72
|
-
Command-line options override `config/setting.json`. PicoRuby is implemented
|
|
73
|
-
today; `language` and `board` are retained for planned MicroPython and
|
|
74
|
-
additional Pico board support.
|
|
63
|
+
Command-line options override `config/setting.json`. PicoRuby is implemented today; `language` and `board` are retained for planned MicroPython and additional Pico board support.
|
|
75
64
|
|
|
76
65
|
## Commands
|
|
77
66
|
|
|
@@ -85,40 +74,60 @@ additional Pico board support.
|
|
|
85
74
|
| `rpremote dfu status` | Show the active and candidate DFU slots. |
|
|
86
75
|
| `rpremote mrbgems …` | Check, list, lock, or update mrbgems. |
|
|
87
76
|
| `rpremote flash` | Flash the selected UF2 through BOOTSEL. |
|
|
77
|
+
| `rpremote config show` | Show the effective configuration after file and command-line options are resolved. |
|
|
88
78
|
| `rpremote ports` | List detected R2P2 serial ports. |
|
|
89
|
-
| `rpremote run FILE` | Upload and run a Ruby file. |
|
|
90
|
-
| `rpremote exec CODE` | Run
|
|
79
|
+
| `rpremote run FILE` | Upload and run a Ruby file with real-time output; exit nonzero on a Ruby exception. |
|
|
80
|
+
| `rpremote exec CODE` | Run short Ruby code and exit nonzero on a Ruby exception. |
|
|
91
81
|
| `rpremote monitor` / `repl` | Open an interactive serial session. |
|
|
92
82
|
| `rpremote reset` | Reboot R2P2 and wait for reconnection. |
|
|
93
83
|
| `rpremote fs cp/cat/ls/rm/mkdir` | Operate on the R2P2 filesystem. |
|
|
94
84
|
|
|
95
|
-
Run `rpremote --help` for complete
|
|
96
|
-
|
|
85
|
+
Run `rpremote --help` for the complete command list. Run `rpremote <command> --help` for command-specific syntax, defaults, and effects.
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
rpremote flash --help
|
|
89
|
+
rpremote dfu app --help
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`monitor` and `repl` exit with `Ctrl-]`.
|
|
93
|
+
|
|
94
|
+
Ruby-exception exit statuses for `run` and `exec` require R2P2 firmware with Ruby exception status support.
|
|
95
|
+
UF2 files built with `rpremote build` from the [GitHub repository](https://github.com/ogom/rpremote) include that support.
|
|
96
|
+
|
|
97
|
+
## Operation model
|
|
98
|
+
|
|
99
|
+
- `run` and `exec` upload Ruby code temporarily, relay output, then remove the temporary remote file. A Ruby exception reported by compatible R2P2 firmware makes the command exit nonzero.
|
|
100
|
+
- `flash` copies a UF2 to the RP2350 BOOTSEL volume and replaces persistent R2P2 firmware.
|
|
101
|
+
- `dfu app` stages a Ruby source or matching bytecode app in the inactive DFU slot. Restart R2P2 to try it; a successful app must call `DFU.confirm`.
|
|
102
|
+
- Remote paths use `:/REMOTE/PATH`. `fs cp` transfers between one local and one remote path, and `fs rm` permanently deletes the selected remote path.
|
|
97
103
|
|
|
98
104
|
## Documentation and examples
|
|
99
105
|
|
|
100
|
-
The [GitHub repository](https://github.com/ogom/rpremote) contains the full
|
|
101
|
-
English and Japanese guides, configuration reference, Mrbgems.lock reference,
|
|
102
|
-
custom firmware guide, and electronic-craft examples.
|
|
106
|
+
The [GitHub repository](https://github.com/ogom/rpremote) contains the full English and Japanese guides, configuration reference, Mrbgems.lock reference, custom firmware guide, and electronic-craft examples.
|
|
103
107
|
|
|
104
108
|
## Related projects
|
|
105
109
|
|
|
106
|
-
- [mbremote](https://github.com/ogom/mbremote) is a tool with the same concept
|
|
107
|
-
for building, flashing, and controlling MicroPython and PicoRuby projects on
|
|
108
|
-
BBC micro:bit boards.
|
|
110
|
+
- [mbremote](https://github.com/ogom/mbremote) is a tool with the same concept for building, flashing, and controlling MicroPython and PicoRuby projects on BBC micro:bit boards.
|
|
109
111
|
|
|
110
112
|
## Development
|
|
111
113
|
|
|
114
|
+
Install dependencies, then run the test and static checks:
|
|
115
|
+
|
|
112
116
|
```sh
|
|
113
117
|
bundle install
|
|
114
118
|
bundle exec rake
|
|
115
119
|
bundle exec rbs -I sig validate
|
|
116
120
|
```
|
|
117
121
|
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
To try the local gem without publishing it, install it into the current Ruby environment:
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
bundle exec rake install:local
|
|
126
|
+
rpremote --version
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Before publishing, run `bundle exec rake release:check` and follow [RELEASING.md](RELEASING.md).
|
|
120
130
|
|
|
121
131
|
## License
|
|
122
132
|
|
|
123
|
-
[MIT](LICENSE). See [Third-Party Notices](THIRD_PARTY_NOTICES.md) for
|
|
124
|
-
externally downloaded software.
|
|
133
|
+
[MIT](LICENSE). See [Third-Party Notices](THIRD_PARTY_NOTICES.md) for externally downloaded software.
|
data/RELEASING.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Releasing rpremote
|
|
2
2
|
|
|
3
|
-
This checklist prepares and publishes one immutable gem version. Run every
|
|
4
|
-
command from `packages/rpremote`.
|
|
3
|
+
This checklist prepares and publishes one immutable gem version. Run every command from `packages/rpremote`.
|
|
5
4
|
|
|
6
5
|
## 1. Prepare the version
|
|
7
6
|
|
|
@@ -10,45 +9,46 @@ command from `packages/rpremote`.
|
|
|
10
9
|
3. Commit all intended files and verify that `git status --short` is empty.
|
|
11
10
|
4. Run the non-publishing release check:
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
```sh
|
|
13
|
+
bundle exec rake release:check
|
|
14
|
+
```
|
|
16
15
|
|
|
17
|
-
The check runs the specs, RuboCop, and RBS validation; builds the gem; checks
|
|
18
|
-
its metadata and packaged documentation; installs it into a temporary isolated
|
|
19
|
-
gem directory; and executes the installed `rpremote --version` command.
|
|
16
|
+
The check runs the specs, RuboCop, and RBS validation; builds the gem; checks its metadata and packaged documentation; installs it into a temporary isolated gem directory; and executes the installed `rpremote --version` command.
|
|
20
17
|
|
|
21
18
|
## 2. Prepare publishing services
|
|
22
19
|
|
|
23
|
-
The repository must have an `origin` remote before releasing. Confirm
|
|
20
|
+
The repository must have an `origin` remote and GitHub CLI authentication before releasing. Confirm them with:
|
|
24
21
|
|
|
25
22
|
```sh
|
|
26
23
|
git remote -v
|
|
24
|
+
gh auth status
|
|
27
25
|
```
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
Choose one publishing route before the first release:
|
|
28
|
+
|
|
29
|
+
- For a manual release, sign in to RubyGems.org, confirm that the account owns `rpremote`, and enable MFA:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
gem signin
|
|
33
|
+
gem owner rpremote
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- For a GitHub Actions trusted publisher, confirm the RubyGems.org trusted-publisher entry names this repository and workflow before starting the release.
|
|
37
|
+
|
|
38
|
+
Never commit an API key or `~/.gem/credentials`.
|
|
33
39
|
|
|
34
40
|
## 3. Publish deliberately
|
|
35
41
|
|
|
36
|
-
`bundle exec rake release` is a publishing command: it creates and pushes the
|
|
37
|
-
version tag and pushes the built gem to RubyGems.org. Run it only after the
|
|
38
|
-
release check passes and the working tree is clean:
|
|
42
|
+
`bundle exec rake release` is a publishing command: it creates and pushes the version tag and pushes the built gem to RubyGems.org. It is not a dry run. Run it only after the release check passes and the working tree is clean:
|
|
39
43
|
|
|
40
44
|
```sh
|
|
41
45
|
bundle exec rake release
|
|
42
46
|
```
|
|
43
47
|
|
|
44
|
-
After the tag exists on GitHub, create a GitHub Release and attach the exact
|
|
45
|
-
gem that passed validation. `--verify-tag` prevents GitHub CLI from silently
|
|
46
|
-
creating a tag at another commit:
|
|
48
|
+
After the tag exists on GitHub, create a GitHub Release and attach the exact gem that passed validation. `--verify-tag` prevents GitHub CLI from silently creating a tag at another commit:
|
|
47
49
|
|
|
48
50
|
```sh
|
|
49
|
-
gh release create v0.1.0 rpremote-0.1.0.gem
|
|
50
|
-
--verify-tag --generate-notes
|
|
51
|
+
gh release create v0.1.0 rpremote-0.1.0.gem --verify-tag --generate-notes
|
|
51
52
|
```
|
|
52
53
|
|
|
53
|
-
Replace `0.1.0` in both places for later versions. Finally, install from
|
|
54
|
-
RubyGems.org in a fresh environment and run `rpremote --version`.
|
|
54
|
+
Replace `0.1.0` in both places for later versions. Finally, install from RubyGems.org in a fresh environment and run `rpremote --version`.
|
data/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# Third-Party Notices
|
|
2
2
|
|
|
3
|
-
`rpremote` does not bundle R2P2 firmware. The `setup` command downloads a
|
|
4
|
-
selected PicoRuby/R2P2 4.0.3 or 3.4.2 release from the PicoRuby project and
|
|
5
|
-
verifies its published SHA-256 digest.
|
|
3
|
+
`rpremote` does not bundle R2P2 firmware. The `setup` command downloads a selected PicoRuby/R2P2 4.0.3 or 3.4.2 release from the PicoRuby project and verifies its published SHA-256 digest.
|
|
6
4
|
|
|
7
5
|
## PicoRuby and R2P2
|
|
8
6
|
|
|
@@ -10,20 +8,8 @@ Source: <https://github.com/picoruby/picoruby>
|
|
|
10
8
|
|
|
11
9
|
Copyright © 2020 HASUMI Hitoshi
|
|
12
10
|
|
|
13
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
14
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
15
|
-
the Software without restriction, including without limitation the rights to
|
|
16
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
17
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
|
18
|
-
so, subject to the following conditions:
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
19
12
|
|
|
20
|
-
The above copyright notice and this permission notice shall be included in all
|
|
21
|
-
copies or substantial portions of the Software.
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
22
14
|
|
|
23
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
-
SOFTWARE.
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/rpremote/builder.rb
CHANGED
|
@@ -4,15 +4,17 @@ require "rbconfig"
|
|
|
4
4
|
require "fileutils"
|
|
5
5
|
require "rubygems/version"
|
|
6
6
|
require_relative "mrbgems"
|
|
7
|
+
require_relative "picoruby_source_patch"
|
|
7
8
|
|
|
8
9
|
module Rpremote
|
|
9
10
|
class Builder
|
|
10
11
|
class Error < Rpremote::Error; end
|
|
11
12
|
|
|
12
|
-
def initialize(root: Dir.pwd, runner: nil, mrbgems_class: Mrbgems)
|
|
13
|
+
def initialize(root: Dir.pwd, runner: nil, mrbgems_class: Mrbgems, source_patcher: nil)
|
|
13
14
|
@root = File.expand_path(root)
|
|
14
15
|
@runner = runner || method(:run_command)
|
|
15
16
|
@mrbgems_class = mrbgems_class
|
|
17
|
+
@source_patcher = source_patcher || method(:patch_source)
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
def build(output: $stdout, error: $stderr, **options)
|
|
@@ -23,6 +25,7 @@ module Rpremote
|
|
|
23
25
|
Language.validate!(target.language)
|
|
24
26
|
|
|
25
27
|
source_dir = source_for(target)
|
|
28
|
+
source_patcher.call(source_dir, target.language_version)
|
|
26
29
|
environment = {
|
|
27
30
|
"RPREMOTE_LANGUAGE" => target.language,
|
|
28
31
|
"RPREMOTE_LANGUAGE_VERSION" => target.language_version,
|
|
@@ -61,7 +64,11 @@ module Rpremote
|
|
|
61
64
|
|
|
62
65
|
private
|
|
63
66
|
|
|
64
|
-
attr_reader :root, :runner, :mrbgems_class
|
|
67
|
+
attr_reader :root, :runner, :mrbgems_class, :source_patcher
|
|
68
|
+
|
|
69
|
+
def patch_source(source, version)
|
|
70
|
+
PicoRubySourcePatch.new(version: version).apply(source)
|
|
71
|
+
end
|
|
65
72
|
|
|
66
73
|
def add_mrbgems_environment!(environment, options, source_dir, output)
|
|
67
74
|
definition = mrbgems_definition(options[:mrbgems])
|
data/lib/rpremote/cli.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "optparse"
|
|
4
4
|
require_relative "build_command"
|
|
5
|
+
require_relative "config_show"
|
|
5
6
|
require_relative "dfu_command"
|
|
6
7
|
require_relative "flash_command"
|
|
7
8
|
require_relative "help"
|
|
@@ -36,6 +37,8 @@ module Rpremote
|
|
|
36
37
|
@config_class = config
|
|
37
38
|
@config_filename, config_required = config.extract_option!(args)
|
|
38
39
|
command = args.shift
|
|
40
|
+
return show_help(command, args) if Help.requested?(command, args)
|
|
41
|
+
|
|
39
42
|
@config_options = config.load_command(command, filename: config_filename, required: config_required)
|
|
40
43
|
dispatch(command, args)
|
|
41
44
|
0
|
|
@@ -46,6 +49,11 @@ module Rpremote
|
|
|
46
49
|
attr_reader :stdout, :stderr, :serial, :device, :flasher,
|
|
47
50
|
:config_class, :config_filename, :config_options
|
|
48
51
|
|
|
52
|
+
def show_help(command, args)
|
|
53
|
+
stdout.puts(Help.command_text(command, args))
|
|
54
|
+
0
|
|
55
|
+
end
|
|
56
|
+
|
|
49
57
|
def dispatch(command, args)
|
|
50
58
|
case command
|
|
51
59
|
when nil, "help", "--help", "-h"
|
|
@@ -54,6 +62,8 @@ module Rpremote
|
|
|
54
62
|
stdout.puts(Rpremote::VERSION)
|
|
55
63
|
when "ports"
|
|
56
64
|
ports(args)
|
|
65
|
+
when "config"
|
|
66
|
+
config_command(args)
|
|
57
67
|
when "setup", "flash", "build", "dfu", "mrbgems"
|
|
58
68
|
project_command(command, args)
|
|
59
69
|
when "run", "monitor", "repl", "exec", "reset", "fs"
|
|
@@ -66,21 +76,13 @@ module Rpremote
|
|
|
66
76
|
def project_command(command, args)
|
|
67
77
|
case command
|
|
68
78
|
when "setup"
|
|
69
|
-
SetupCommand.run(
|
|
70
|
-
args,
|
|
71
|
-
defaults: config_options,
|
|
72
|
-
config: config_class,
|
|
73
|
-
config_filename: config_filename,
|
|
74
|
-
output: stdout
|
|
75
|
-
)
|
|
79
|
+
SetupCommand.run(args, defaults: config_options, config: config_class, config_filename: config_filename, output: stdout)
|
|
76
80
|
when "flash"
|
|
77
81
|
FlashCommand.run(args, defaults: config_options, output: stdout, flasher: flasher)
|
|
78
82
|
when "build"
|
|
79
83
|
BuildCommand.run(args, defaults: config_options, output: stdout, error: stderr)
|
|
80
84
|
when "dfu"
|
|
81
|
-
DfuCommand.run(
|
|
82
|
-
args, defaults: config_options, output: stdout, services: { serial: serial, device: device }
|
|
83
|
-
)
|
|
85
|
+
DfuCommand.run(args, defaults: config_options, output: stdout, services: { serial: serial, device: device })
|
|
84
86
|
when "mrbgems"
|
|
85
87
|
MrbgemsCommand.run(args, output: stdout)
|
|
86
88
|
end
|
|
@@ -108,6 +110,13 @@ module Rpremote
|
|
|
108
110
|
end
|
|
109
111
|
end
|
|
110
112
|
|
|
113
|
+
def config_command(args)
|
|
114
|
+
subcommand = args.shift
|
|
115
|
+
raise ArgumentError, "unknown config command: #{subcommand || "(none)"}" unless subcommand == "show"
|
|
116
|
+
|
|
117
|
+
ConfigShow.run(args, defaults: config_options, output: stdout)
|
|
118
|
+
end
|
|
119
|
+
|
|
111
120
|
def fs(args)
|
|
112
121
|
subcommand = args.shift
|
|
113
122
|
options = parse_connection_options(args)
|
|
@@ -129,7 +138,7 @@ module Rpremote
|
|
|
129
138
|
|
|
130
139
|
source = args.first
|
|
131
140
|
data = File.binread(source)
|
|
132
|
-
|
|
141
|
+
execute_temporary(data, options, output: stdout)
|
|
133
142
|
rescue Errno::ENOENT => e
|
|
134
143
|
raise ArgumentError, e.message
|
|
135
144
|
end
|
|
@@ -138,14 +147,15 @@ module Rpremote
|
|
|
138
147
|
options = parse_connection_options(args)
|
|
139
148
|
raise ArgumentError, "usage: rpremote exec CODE [options]" unless args.length == 1
|
|
140
149
|
|
|
141
|
-
|
|
150
|
+
execute_temporary(args.first, options, output: stdout)
|
|
142
151
|
end
|
|
143
152
|
|
|
144
|
-
def execute_temporary(data, options)
|
|
153
|
+
def execute_temporary(data, options, output: nil)
|
|
145
154
|
Language.validate!(options[:language])
|
|
146
155
|
port_path = device.main_port(options[:port])
|
|
147
156
|
serial.open(port_path, baud: options[:baud]) do |port|
|
|
148
|
-
Runner.new(port, timeout: options[:timeout])
|
|
157
|
+
runner = Runner.new(port, timeout: options[:timeout])
|
|
158
|
+
output ? runner.run(data, output: output) : runner.run(data)
|
|
149
159
|
end
|
|
150
160
|
end
|
|
151
161
|
|
|
@@ -201,9 +211,7 @@ module Rpremote
|
|
|
201
211
|
source, destination = args
|
|
202
212
|
source_remote = RemotePath.remote?(source)
|
|
203
213
|
destination_remote = RemotePath.remote?(destination)
|
|
204
|
-
if source_remote == destination_remote
|
|
205
|
-
raise ArgumentError, "exactly one cp path must be remote (prefix remote paths with :)"
|
|
206
|
-
end
|
|
214
|
+
raise ArgumentError, "exactly one cp path must be remote (prefix remote paths with :)" if source_remote == destination_remote
|
|
207
215
|
|
|
208
216
|
if source_remote
|
|
209
217
|
data = with_modem(options) { |modem| modem.download(RemotePath.unwrap(source)) }
|
|
@@ -230,6 +238,7 @@ module Rpremote
|
|
|
230
238
|
raise ArgumentError, usage unless args.length == 1
|
|
231
239
|
|
|
232
240
|
path = RemotePath.validate(args.first)
|
|
241
|
+
stdout.puts("deleting remote path permanently: #{path}") if command == "rm"
|
|
233
242
|
output = with_shell(options) do |shell|
|
|
234
243
|
shell.execute("#{command} #{Shell.quote_argument(path)}")
|
|
235
244
|
end
|