Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The simplest build tool on earth. An all-purpose build tool and a build file all in one. It's trying to be better than the usual home-grown Shell hell.

License

NotificationsYou must be signed in to change notification settings

8gears/do.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Do ordo.sh [dosh] is abuild tool and abuild file in one and the same self-executable shell script 🪄. (Read that again)

  • ✅ No installation (Just Copy & Paste the starter script)
  • ✅ No libraries
  • ✅ No dependencies
  • ✅ Easy to use and understand
  • ✅ Simple to extend
  • ✅ Runs on anything with a Shell
  • 🔴 Is not intended to replace a full blown build tool

Why Do.sh

There aremany build-tools that are more powerful, versatile or expressive than Do.sh. If you are already using a well-known build tool, then keep on using it. Do is for use cases where the major build tools aren't the best fit. The second purpose of Do is to tame the complexity of usual Shell build scripts. Do provides a consistent reference, interface, documentation and best practices on how to write build scripts.

Do scripts should be recognizable and understandable even if they are customized.

Typical Use Cases

Some use cases whereDo can shine are:

  • A Build Tool or CI/CD pipeline that interact nicely with the Shell. UseDo to apply a consistent workflow and syntax.
  • Golang'sgo already provides some build tool like functionality and most of the major build tools are too much to justify the overhead. A combination of a few commands willDo it.
  • Building or Deploying Container Images can get out of hand quickly,Do can help by providing a consistent and understandable flow to build, ship and run images.
  • Declarative CI/CD Build files like GitLabCI or TravisCI can become quite complex and are hard to test locally.Do can help here by wrapping those commands inDo tasks and make them locally testable. At the same time it will reduce the Build files making them easy understandable.

If you have some other use cases whereDo can shine, open an issue or submit a PR.

Installation

The simplest way to useDo is to copy and paste the content of thedo.sh file into your project and extend it as needed.

Usage

Do expects one argument on what to do, If more than one argument is provided, then the following arguments are all passed on to the task. Seedo.arguments.sh in examples directory.

$ ./do.sh buildI am building...

If no argument is providedDo prints out a help message with all the available tasks.

$ ./do.shUsage:   ./do.sh (all|build|deploy|test)

Take also a look into theExamples Directory to see different use cases ofDo.

Concept

The concept ofDo is simple to explain. Functions are Tasks and Tasks can be combined to new Tasks. Tasks can also accept parameters and return values.

It is possible to define as many tasks as needed. TheDo template for definesbuild, test, deploy, all for your convenience.

#!/usr/bin/env sh# Do - The Simplest Build Tool on Earth.# Documentation and examples see https://github.com/8gears/doset -e -u# -e "Automatic exit from bash shell script on error"  -u "Treat unset variables and parameters as errors"build() {echo"I am${FUNCNAME[0]}ing"exit 1}test() {echo"I am${FUNCNAME[0]}ing"}deploy() {echo"I am${FUNCNAME[0]}ing"}all() {   build&&test&& deploy}_hidden() {echo"I am a hidden task and won't appear in the usage desciption because I start with an _ (underscore). If you know me you can still call me directly"}"$@"# <- execute the task["$#"-gt 0 ]||printf"Usage:\n\t./do.sh %s\n""($(compgen -Afunction| grep'^[^_]'| paste -sd'|' -))"

In case no argument was provided the linelet $# || echo "Usage:\n\t./do.sh ($(compgen -A function | paste -sd '|' -))" will print out a help message with all the available tasks in this build file.

It is important to be disciplined withDo and avoid adding too much complexity, which is common in the case of shell scripts. Otherwise, it would blur the simple syntax ofDo and make it harder for others to understand the build file. In doubtKISS.

Convenience

For your convenience you can create an alias in your~/.zsrc|.bashrc file

alias doo='./do.sh'

From now on you can type>doo instead of./do.sh The secondois there too not get confused with the reserved looping construct worddo.

Examples

Theexamples directory contains a few different usage examples fordo.

How To Contribute

You can contribute by improvingdo.sh or by providing examples on how to useDo in an elegant or creative way.Follow theKISS principle. Don't add complexity. Don't make it bigger than needed.

Create an issue describing the problem you a trying to solve to start a discussion. Do the changes and open a merge request.

Projects using Do

There aren't any public projects yet, If you have one open a PR to add your project here.

Related Tools

  • Bake a pure bash project automation tool
  • Taskfile a task runner / simpler Make alternative written in Go
  • Robo Simple Go / YAML-based task runner for the team.
  • godo godo is a task runner and file watcher for golang in the spirit of rake, gulp. It has kind of same name.

About

The simplest build tool on earth. An all-purpose build tool and a build file all in one. It's trying to be better than the usual home-grown Shell hell.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2026 Movatter.jp