LoginSignup
0
1

More than 5 years have passed since last update.

MintやらMarathonやらでよくわからなくなってきたのでちょっと調査

Posted at

MintとMarathonなんてツールがあって何がなにやらわからなかったのでその当たりについて調査しました。

Mintって?

Mintとの出会いはSwiftLintでした。ここにUsing Mintなる項目があって、なんぞや?ってなりました。
realm_SwiftLint__A_tool_to_enforce_Swift_style_and_conventions_.png
Gitのリポジトリの説明にはA package manager that installs and runs Swift command line toolsと書いてあるので、Swift製コマンドラインツールをインストールして実行するためのパッケージマネージャになるようです。
READMEを読むと、サンプルにSwiftLint v0.22.0の実行方法が書いてあります。

mint run realm/SwiftLint@0.22.0 swiftlint

上記のコマンドだけでよいようです。便利そうです。

Exampleにはバージョン指定でのインストール、最新版のインストールが記述してあり、バージョン指定での実行も記述してあります。とても便利そうです。

mint install yonaskolb/XcodeGen@1.2.4 # use version 1.2.4
mint install yonaskolb/XcodeGen # use newest tag
mint run yonaskolb/XcodeGen@1.2.4 # run 1.2.4
mint run XcodeGen # use newest tag and find XcodeGen in installed tools

手元で実際に動かしてみました。

$ mint install yonaskolb/XcodeGen@1.2.4
🌱  Cloning https://github.com/yonaskolb/XcodeGen.git "1.2.4"...
🌱  Building XcodeGen. This may take a few minutes...
🌱  Installing XcodeGen...
🌱  Copying resources for XcodeGen: SettingPresets ...
🌱  Installed XcodeGen "1.2.4"
$
$ mint install yonaskolb/XcodeGen
🌱  Using XcodeGen "1.4.0"
🌱  Cloning https://github.com/yonaskolb/XcodeGen.git "1.4.0"...
🌱  Building XcodeGen. This may take a few minutes...
🌱  Installing XcodeGen...
🌱  Copying resources for XcodeGen: SettingPresets ...
🌱  Installed XcodeGen "1.4.0"
$ mint run yonaskolb/XcodeGen@1.2.4
🌱  XcodeGen "1.2.4" already installed
🌱  Running XcodeGen "1.2.4"...
Parsing spec failed: The file “project.yml” couldn’t be opened because there is no such file.
$ mint run XcodeGen@1.2.4
🌱  XcodeGen "1.2.4" already installed
🌱  Running XcodeGen "1.2.4"...
Parsing spec failed: The file “project.yml” couldn’t be opened because there is no such file.
$ mint run XcodeGen
🌱  Using XcodeGen "1.4.0"
🌱  XcodeGen "1.4.0" already installed
🌱  Running XcodeGen "1.4.0"...
No project spec found at ./project.yml

確かに、v1.2.4と最新版のv1.4.0が共存できていて、バージョン指定で実行できることも確認できました。これはとても便利!SwiftLintとCarthageのバージョン固定ってどうしようって考えていたけど、そういったチーム内でバージョン固定するのに使えそうです。
でも、Mint経由でコマンド実行すると少し重たい気がします。あと、インストールしたコマンドの削除方法が公式には乗っていません(2017/12時点)。今、気になるのはそれくらいです。

Marathonって?

Marathonとの出会いはTestDriveでした。InstallationにMarathonでインストールするのが簡単だよってあって、え?知らないけど?って思いました。

JohnSundell_TestDrive__Quickly_try_out_any_Swift_pod_or_framework_in_a_playground.png

Gitのリポジトリの説明にはMarathon makes it easy to write, run and manage your Swift scripts 🏃と書いてあるので、Swiftのスクリプトを簡単に管理するためのツールのようです。これだけだとよくわかりませんでしたが、サンプルを読むと納得です。確かに、Scriptを管理しています。

スクリプトを作ります。

marathon create helloWorld "import Foundation; print(\"Hello world\")"

作ったスクリプトを実行します。

marathon run helloWorld
> Hello world

ちなみに、オプション一覧は下記の通りです。

$ marathon
Welcome to Marathon 🏃
----------------------
Marathon makes it easy to write, run and manage your Swift scripts.

These are the available commands:

🐣    create    Create new script at a given path and open it
✏️    edit      Edit a script at a given path
🗑    remove    Remove a package or the cache data for a script at a given path
🏃‍♀️    run       Run a script at a given path
💻    install   Install a script at a given path or URL as a binary
📦    add       Add a package from a given URL to be able to use it from your scripts
📋    list      List all packages and cached script data
♻️    update    Update all added packages to their latest versions
ℹ️    help      Print these instructions

👉  You can also type a command you wish to know more about after 'help'
   For example: 'marathon help create' will show information about the 'create' command

🌏  For more information, go to https://github.com/johnsundell/marathon

必要最低限の機能がちゃんと用意されている感じがします。
Mintと違い、removeできます。良いですね。
また、Gitリポジトリから直接Swiftのスクリプト(コマンド)をインストールして実行することもできるようです。とても便利です。

まとめ

MintはSwift製コマンドのパッケージマネージャです。異なるバージョン共存させることもできます。
MarathonはSwift製スクリプトのマネージャです。スクリプトを作成、編集、破棄など一通りのことができる。リモートのスクリプトを取り込んで実行することもできます。
今のところ、MintとMarathonの使い分けは異なるバージョンの共存という1点に尽きそうです。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1