mor

Cross platform dependency manager

last commits

25f9c9c - Bharatvaj Hemanth2024-10-24 02:00
Add git clone feature
edfb6a1 - Bharatvaj Hemanth2024-10-12 22:48
Add multi-level variable expansion
more
mor
===
    .--.
   /    \
  ==( )-( )
  (    ._)
   |(-=) |

mor(pheus) is tool that simplifies dependency management the right way.
Some might even say it is a red-pill way of dependency management.

mor searches for requirements.ini file in the current folder, and uses it's
content to download files.

Goals
-----
* Should work standalone
* Cross-platform
* Tiny - mor.cmd for windows, mor.sh for *NIX

Note
----
- Read the FAQ section
- Check the Windows section below if you're using mor.cmd

Config File
------------
mor uses .ini files as config files and can be given to mor with -c flag.
When no flags are given, it searches for requirements.ini in the current
working directory.

In a mor config file, the [sections] represent a directory or target.
The key=value pair under the [section] are the files to download in that
current directory.

[$] is a special section that is discussed in 'Variables' below.

	; requirements.ini
	[$]
	/=out

	[precompiled]
	libfoo-2.7=https://example.com/awavauatush/libfoo.zip
	libbar-3.5=https://example.com/awavauatush/libbar.zip
	...

	$ mor precompiled
	$ tree out/
	precompile
	|--libbar-3.5.zip
	|--libbar-3.5/
	|--libfoo-2.7.zip
	|--libfoo-2.7/

Targets
-------

Not all sections create sub-directoies mind you!

Sections that have a '@' or '#' as the starting letter are treated as target(@)
and target query(#).

Previously we have created [precompiled] section and invoked the mor command to
download it. Real life is seldom this simple.

Usually we are in a situation where the pre-compiled binaries are different for
different architectures and platforms.

	; packages.ini
	[precompiled-macos]
	libfoo-2.7=https://example.com/macos/precompiled.zip

	[precompiled-linux]
	libfoo-2.7=https://example.com/linux/precompiled.zip

In that case we can define a target query with '#',

	; packages.ini
	[#lib]
	match=k-v
	paths=precompiled-$platform download

	; requirements.ini
	[@lib]
	libfoo=2.7

The $platform in the above can be passed to mor as,

	mor -Dplatform=linux @lib

Variables
---------

mor treats any word that starts with '$' as variable and tries to expand it.

Variables in mor has a specific rule and follows the following regex,

	([a-z][A-z])*[0-9][a-z]

	[$]
	; the output folder
	/=outfolder
	; arbitrary variables
	git=https://git.example.com

Status Messages
---------------
Mor uses the following symbols to denote the status to the user,

v - Download
| - Archive Extraction
g - Git
> - Info
! - Error

Example
-------
	; requirements.ini
	[$]
	>[]=packages.ini
	@[]=@lib @build

	[@lib]
	libfoo=2.7

	# when using apple-darwin, use @lib
	[@lib:x86_64-apple-darwin]
	libfoo-git=2.7

	; packages.ini
	[$]
	git=https://git.example.com
	match=k-v
	/=out/.sysroot

	[folder/]
	libfoo-2.7=$git/releases/libfoo/releases/v26.1/foo-26.1-osx-universal.zip
	libfoo-git-2.7=$github/foo/libfoo.git@master

Windows
-------
- curl is the preferred downloader for windows, but if it is missing, mor
defaults to bitsadmin.exe which is available in older versions of Windows.

If you face extreme slowness in downloads when using bitsadmin, it's probably
because some other application is using it to download
something (like Windows Update).If you are on a hurry, you can do

	C:\Users\Admin> bitsadmin /reset

to clear all downloads and try running mor again.

Bugs
----
- Currently it is not possible to null a variable with -D in Windows.

	mor -Dvar= download

The above will silently assign 'download' to $var.
This is a bug with how the cmd process arguments. Use -Dvar="" instead.

- It is currently not possible to use a '$something' directly in a URL if a
variable named 'something' is defined in '$' section

- The varable expansion is not really ([a-z][A-z])*[0-9][a-z].

FAQ
---
> Why the weird symbols ($/, $<, $>) instead of simple clean $root, $include,
etc in [$]?
I wanted mor to be as language agnostic as possible and I wanted the core
variables to be ASCII clean. This is also the reason why the status messages
are mostly made up of symbols.

> Why no 'clean' command?
To keep things simple.
Just do `rm -rf 'directory` or `rmdir /s/q directory` if using cmd

> Where are the damn CHANGELOGs?
For the complete changelog,
        git notes show v0.2~1..

For a specific version,
        git notes show v0.2

Credits
-------
The graphics is a derivative of "butler" by jgs.