github.com/kick-project/maker@v1.1.1-0.20211031110251-7b74922fa493/README.md (about)

     1  [![Github Actions](https://github.com/kick-project/maker/workflows/Go/badge.svg?branch=master)](https://github.com/kick-project/maker/actions) [![Go Report Card](https://goreportcard.com/badge/kick-project/maker)](https://goreportcard.com/report/kick-project/maker)  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/kick-project/maker/blob/master/LICENSE)
     2  
     3  # maker
     4  
     5  maker a tool that augments make with Makefile menu help, dotenv support
     6  
     7  # Examples
     8  
     9  ## Example Help
    10  
    11  This help output
    12  
    13  ```text
    14  Usage: make <target>
    15  
    16  ### HELP
    17    help - Print Help
    18  ### DEVELOPMENT
    19    build - Build binary
    20    test  - Test
    21  ```
    22  
    23  is generated using `make help` and this `Makefile`
    24  
    25  ```Makefile
    26  .PHONY: help build install clean test
    27  
    28  ### HELP
    29  help: ## Print Help
    30  	@maker --menu Makefile
    31  
    32  ### DEVELOPMENT
    33  build: ## Build binary
    34  	@echo "Run build ..."
    35  
    36  test: build ## Test
    37  	@echo "Run Tests ..."
    38  ```
    39  
    40  ## Example dotenv support
    41  
    42  Maker supports `.env` files. The default is to load `$HOME/.env` then the
    43  projects `.env` file.
    44  
    45  Given the following `.env` files.
    46  
    47  ```dotenv
    48  # Home directory "$HOME/.env" file
    49  MYSECRET=MySeceret
    50  ```
    51  
    52  ```dotenv
    53  # Projects "./.env" file
    54  REPO=http://artifactory.mycompany.com/packages
    55  ```
    56  
    57  Then the `Makefile` will print the environment variables listed in the
    58  `_printvars` target.
    59  
    60  **NOTE** Maker will automatically prepend the underscore "_" to the target
    61  *before calling make again. E.G. `make target` will become `make _target` when
    62  *it falls through to the catchall.
    63  
    64  ```Makefile
    65  MAKEFLAGS += --no-print-directory
    66  .PHONY: _printvars
    67  
    68  ### HELP
    69  _printvars: ## Print variables
    70  	@echo "HOME=${HOME}"
    71  	@echo "REPO=${REPO}"
    72  	@echo "MYSECRET=${MYSECRET}"
    73  
    74  # Catch all target to wrap tasks with a single underscore prefix.
    75  %:
    76  	@maker $@
    77  ```
    78  
    79  Output of `make printvars` (Notice no preceding underscore)
    80  
    81  ```
    82  HOME=/home/username
    83  REPO=http://artifactory.mycompany.com/packages
    84  MYSECRET=MySeceret
    85  ```
    86  
    87  Maker will not override any existing environment variables. The default order of
    88  precedence is.
    89  
    90  1. Global environment variables.
    91  2. Home directory `~/.env` file.
    92  3. The current folders `.env` file.
    93  
    94  # Help
    95  
    96  ```
    97  # maker --help
    98  maker
    99  
   100  Usage:
   101    maker [--dotenv=<files>] [--scan=<makefile>] [--prefix=<prefix>] <target>
   102    maker --menu=<makefile>
   103  
   104  Options:
   105    -h --help          Show this screen
   106    --version          Show version
   107    --dotenv=<files>   List of comma separated paths to load dotenv files [default: ~/.env,.env]
   108    --menu=<makefile>  Print Makefile menu
   109    --prefix=<prefix>  Scan for "<target>" then "<prefix><target>" when scanning makefiles [default: "_"]
   110    --scan=<makefile>  Scan make makefile for targets and wrap with dotenv variables [default: Makefile]
   111    <target>           makefile target
   112  
   113  ```
   114  
   115  # Install
   116  
   117  ## Install MACOS
   118  ```bash
   119  wget https://github.com/kick-project/maker/releases/latest/download/maker.rb
   120  brew install maker.rb
   121  ```
   122  
   123  ## Install RPM
   124  ```bash
   125  sudo rpm -ivh https://github.com/kick-project/maker/releases/download/v1.1.0/maker-1.1.0.x86_64.rpm
   126  ```
   127  
   128  ## Install DEBs
   129  ```bash
   130  wget https://github.com/kick-project/maker/releases/download/v1.1.0/maker_1.1.0_amd64.deb
   131  sudo apt install ./maker_1.1.0_amd64.deb
   132  ```