All Projects → frencojobs → Derry

frencojobs / Derry

Licence: mit
A script manager for Dart.

Programming Languages

rust
11053 projects
dart
5743 projects

Projects that are alternatives of or similar to Derry

Go Cshared Examples
Calling Go Functions from Other Languages using C Shared Libraries
Stars: ✭ 541 (+405.61%)
Mutual labels:  ffi
Rust V8worker2
Minimal Rust binding to V8 (based on ry/libv8worker2)
Stars: ✭ 33 (-69.16%)
Mutual labels:  ffi
Koreader Base
Base framework offering a Lua scriptable environment for creating document readers
Stars: ✭ 81 (-24.3%)
Mutual labels:  ffi
Core
MetaCall: The ultimate polyglot programming experience.
Stars: ✭ 596 (+457.01%)
Mutual labels:  ffi
Hcwiid
Haskell binding for CWiid (wiimote)
Stars: ✭ 7 (-93.46%)
Mutual labels:  ffi
Dustr
Dart - rust - Flutter compatibility
Stars: ✭ 37 (-65.42%)
Mutual labels:  ffi
Haskellr
The full power of R in Haskell.
Stars: ✭ 491 (+358.88%)
Mutual labels:  ffi
Ffi Convert Rs
Easier and safer interface between Rust, C, and other languages
Stars: ✭ 86 (-19.63%)
Mutual labels:  ffi
Zion
A statically-typed strictly-evaluated garbage-collected readable programming language.
Stars: ✭ 33 (-69.16%)
Mutual labels:  ffi
Winapi Rs
Rust bindings to Windows API
Stars: ✭ 1,237 (+1056.07%)
Mutual labels:  ffi
Cxx.jl
The Julia C++ Interface
Stars: ✭ 620 (+479.44%)
Mutual labels:  ffi
Php Ffi Examples
Runnable examples to learn how PHP FFI works
Stars: ✭ 26 (-75.7%)
Mutual labels:  ffi
Fruity
Rusty bindings for Apple libraries
Stars: ✭ 72 (-32.71%)
Mutual labels:  ffi
Dart native
Write iOS&Android Code using Dart. This package liberates you from redundant glue code and low performance of Flutter Channel.
Stars: ✭ 564 (+427.1%)
Mutual labels:  ffi
Realm Dart Ffi
Experimental Realm binding using dart:ffi preview support
Stars: ✭ 83 (-22.43%)
Mutual labels:  ffi
Rust Cpp
Embed C++ directly inside your rust code!
Stars: ✭ 502 (+369.16%)
Mutual labels:  ffi
Rucaja
Calling the JVM from Rust via JNI
Stars: ✭ 35 (-67.29%)
Mutual labels:  ffi
Android Luajit Launcher
Android NativeActivity based launcher for LuaJIT, implementing the main loop within Lua land via FFI
Stars: ✭ 87 (-18.69%)
Mutual labels:  ffi
Erlang nif Sys
Low level bindings to Erlang NIF API for Rust
Stars: ✭ 84 (-21.5%)
Mutual labels:  ffi
Ffi Platypus
Write Perl bindings to non-Perl libraries with FFI. No XS required.
Stars: ✭ 80 (-25.23%)
Mutual labels:  ffi

Derry

Derry is a script manager for Dart.

Overview

Derry helps you define shortcut scripts, and save you from having to type very long and forgettable long lines of scripts, again and again.

Instead of running this every time,

pub run build_runner build --delete-conflicting-outputs

Add this to pubspec.yaml,

scripts:
  build: pub run build_runner build --delete-conflicting-outputs

and run

derry build

Installation

Install derry as a global dependency from pub.dev as follows.

pub global activate derry

Then use derry to run a command from the current dart/flutter project.

derry [script]

Usage

When called, derry will look for a pubspec.yaml file in the current directory, and will throw an error if not exist. The scripts can be declared within the scripts node of the pubspec.yaml file.

scripts:
  build: pub run build_runner build
derry build
# or even with additional arguments
derry build -- --delete-conflicting-outputs

API Documentation

Use definition file

Scripts can be configured just inside the pubspec.yaml file or within a separate file. When using a separate file to configure scripts, pass the file name as the value of the scripts node in the pubspec.yaml file.

# pubspec.yaml
scripts: derry.yaml
# derry.yaml
build: pub run build_runner build

Use scripts as List

A script can either be a single string or a list of strings. If it is a list, the strings inside of the list will be executed synchronously in the given order of the list.

build:
  - pub run test
  - echo "test completed"
  - pub run build_runner build

Nested scripts

Scripts can be nested as the user needed. For example, you can use them to use different implementations of the build script based on operating system.

build:
  windows:
    - echo 0 # do something
  mac:
    - echo 1 # do something else

And you can use them by calling derry build windows on windows and derry build mac on macOS.

Pre and post scripts

With pre & post scripts, you can easily define a script to run before and after a specific script without hassling with references. Derry automatically understands them from the names.

prepublish:
  - cargo build && copy target blob
  - pub run test
publish:
  - pub publish
postpublish:
  - rm -rf blob

Configure execution type

Note that in the list of scripts, executions will happen in separate processes, use && to execute multiple scripts in the same process. Alternatively, you can also configure the execution value. To separate the configuration values from nested scripts, wrap the keys of the configurations with parenthesis as in (execution).

build:
  (execution): once # multiple by default
  (scripts):
    - cat generated.txt
    - pub run build_runner build # won't be called if generated.txt does not exist

This will be the same as using && but it saved the user from having very long lines of scripts.

Use subcommands

When defining scripts, the user can also define subcommands. Subcommands are references to commands/scripts that won't be executed with a separate derry process. For example,

test:
  - pub run test
  - echo "test completed"
build:
  - $test # instead of using derry test
  - $test --ignored # even with arguments
  - flutter build
generate:
  env:
    - echo env
release:
  - $generate:env # use nested subcommands
  - $build

derry test will spawn a new derry process to execute, while subcommands are not, reducing the time took to run dart code, and spawn that process. But note that subcommands will take a whole line of script. For example, you have to give a separate line for a subcommand, you can't use them together with other scripts or sandwiched.

List available scripts

Use this command to see what scripts are available in the current configuration.

derry ls

Check the location of the derry scripts

Use this command to see the location (both absolute and relative) path of the derry script file. You can also use this to check if the scripts are correctly formatted or the location is correct.

derry source # --absolute or -a to show absolute path

Upgrade derry

pub global activate derry # or
derry upgrade # will run `pub global activate derry`

Why & How

Honestly, I needed it. It was easy to make, though I had a hard time implementing the script execution. Since Dart's Process isn't good at executing system commands, I used Rust with the help of Foreign Function Interfaces. For execution, currently cmd is used for Windows and bash is used for Linux and Mac. I know that's not optimal and I'm still looking for a way to allow users to use the current shell for executions.


Currently Supported Platforms

64bit Linux, Windows, and Mac are currently supported.


License

MIT © Frenco Jobs

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].