Coder Social home page Coder Social logo

made's Introduction

Made - Automate all your scripts

The made program is a command line tool that automates the execution of commands defined in Madefiles and Makefiles, searching for these files in various directories, concatenating their sections, and producing a shell script for execution. It extends the functionality of make by reading not only the Makefile/Madefile in the current directory but also Madefiles in different locations within the system.

Even if make is an excellent building tool, I only use it to remember long commands.

Guillermo Álvarez author of the made command

Table of Contents

Installation

Download the binary for your system from github and place it within your path.

Define scripts everywere

Contrary to make, made not only reads targets from the Makefile in the current directory.

It reads:

  • Madefile
  • madefiles/*.made
  • .madefiles/*.made

And it also loads Madefiles from different parts of the system.

  • Current directory
  • Each directory up until it reaches your HOME or /
  • ~/.config/madefiles
  • ~/.local/share/madefiles
  • /etc/madefiles
  • /var/lib/madefiles

The Madefile

A madefile looks like this:

# This is a comment
# And the header of the Madefile
# Every thing will be appended to the generated script

: ${BRANCH:?master}  # Assign a default value to the variable BRANCH

# Now we have the tasks
# they have a name semicolon dependencies and an optional comment prepended with #

deploy: check_clean # Deploy 
	git push dokku $BRANCH

staging: # Configuration for staging environment
	BRANCH=staging

check_clean:
	if ! $(git diff --exit-code > /dev/null) ; then
		echo "Can't operate while there are non commited changes." >&2
		exit 2
	fi 
  
notify: # Notify in the chat 
	curl https://somenotificationservice.com/new_deploy
	
run: # Run a command in the server
	ssh dokku $*

Now let's run it:

$ made staging deploy notify
... and it deploys stagings and notifies

The command

$ made # To display all the tasks
deploy  Deploy
staging Configuration for staging environment
notify  Notify in the chat

$ made deploy # To run a single task
...

$ made -s notify # Output the generated script
: ${BRANCH:?master}  # Assign a default value to the variable BRANCH
curl https://somenotificationservice.com/new_deploy

$ BRANCH=production made deploy  # Pass variables to made
...

$ made run -- help # Pass arguments to the script
...

Where to put the madefiles

madecommand searches for Madefiles in: All directories from current up to HOME.

It looks for files called Madefile or with .made extension, in the directory or inside a .made directory.

Install

Visit the releases page download and unpack the binary in /usr/local/bin

Update

Just run made --update

Why?

Whenever I wanted make to do more complex scripting, I spent a lot of time because Makefiles are not shell scripts, so I needed to relearn how to do it the make way.

Why can't make concatenate the scripts in a file and run it?

made's People

Contributors

guillermo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

made's Issues

Have runner scopes

Allow to run inside a docker container, docker compose, or remote machine

Have user level tasks

Read task from a user level made directory
Only display that tasks if the -g or --global paramenter is passed

made-webserver

made -web should open a web where the tasks should be initialize

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.