mor

Cross platform dependency manager
git clone git@getsh.org:mor.git
Log | Files | Refs | README | LICENSE

README (4214B)


      1 mor
      2 ===
      3     .--.
      4    /    \
      5   ==( )-( )
      6   (    ._)
      7    |(-=) |
      8 
      9 mor(pheus) is tool that simplifies dependency management the right way.
     10 Some might even say it is a red-pill way of dependency management.
     11 
     12 mor searches for requirements.ini file in the current folder, and uses it's
     13 content to download files.
     14 
     15 Goals
     16 -----
     17 * Should work standalone
     18 * Cross-platform
     19 * Tiny - mor.cmd for windows, mor.sh for *NIX
     20 
     21 Note
     22 ----
     23 - Read the FAQ section
     24 - Check the Windows section below if you're using mor.cmd
     25 
     26 Config File
     27 ------------
     28 mor uses .ini files as config files and can be given to mor with -c flag.
     29 When no flags are given, it searches for requirements.ini in the current
     30 working directory.
     31 
     32 In a mor config file, the [sections] represent a directory or target.
     33 The key=value pair under the [section] are the files to download in that
     34 current directory.
     35 
     36 [$] is a special section that is discussed in 'Variables' below.
     37 
     38 	; requirements.ini
     39 	[$]
     40 	/=out
     41 
     42 	[precompiled]
     43 	libfoo-2.7=https://example.com/awavauatush/libfoo.zip
     44 	libbar-3.5=https://example.com/awavauatush/libbar.zip
     45 	...
     46 
     47 	$ mor precompiled
     48 	$ tree out/
     49 	precompile
     50 	|--libbar-3.5.zip
     51 	|--libbar-3.5/
     52 	|--libfoo-2.7.zip
     53 	|--libfoo-2.7/
     54 
     55 Targets
     56 -------
     57 
     58 Not all sections create sub-directoies mind you!
     59 
     60 Sections that have a '@' or '#' as the starting letter are treated as target(@)
     61 and target query(#).
     62 
     63 Previously we have created [precompiled] section and invoked the mor command to
     64 download it. Real life is seldom this simple.
     65 
     66 Usually we are in a situation where the pre-compiled binaries are different for
     67 different architectures and platforms.
     68 
     69 	; packages.ini
     70 	[precompiled-macos]
     71 	libfoo-2.7=https://example.com/macos/precompiled.zip
     72 
     73 	[precompiled-linux]
     74 	libfoo-2.7=https://example.com/linux/precompiled.zip
     75 
     76 In that case we can define a target query with '#',
     77 
     78 	; packages.ini
     79 	[#lib]
     80 	match=k-v
     81 	paths=precompiled-$platform download
     82 
     83 	; requirements.ini
     84 	[@lib]
     85 	libfoo=2.7
     86 
     87 The $platform in the above can be passed to mor as,
     88 
     89 	mor -Dplatform=linux @lib
     90 
     91 Variables
     92 ---------
     93 
     94 mor treats any word that starts with '$' as variable and tries to expand it.
     95 
     96 Variables in mor has a specific rule and follows the following regex,
     97 
     98 	([a-z][A-z])*[0-9][a-z]
     99 
    100 	[$]
    101 	; the output folder
    102 	/=outfolder
    103 	; arbitrary variables
    104 	github=https://github.com
    105 
    106 Status Messages
    107 ---------------
    108 Mor uses the following symbols to denote the status to the user,
    109 
    110 v - Download
    111 | - Archive Extraction
    112 g - Git
    113 ! - Error
    114 
    115 Example
    116 -------
    117 	; requirements.ini
    118 	[$]
    119 	>[]=packages.ini
    120 	@[]=@lib @build
    121 
    122 	[@lib]
    123 	libfoo=2.7
    124 
    125 	# when using apple-darwin, use @lib
    126 	[@lib:x86_64-apple-darwin]
    127 	libfoo-git=2.7
    128 
    129 	; packages.ini
    130 	[$]
    131 	github=https://github.com
    132 	match=k-v
    133 	/=out/.sysroot
    134 
    135 	[folder/]
    136 	libfoo-2.7=$github/foo/libfoo/releases/download/v26.1/foo-26.1-osx-universal_binary.zip
    137 	libfoo-git-2.7=$github/foo/libfoo.git
    138 
    139 Windows
    140 -------
    141 - bitsadmin.exe is used to download files in Windows as 'curl' is not available in older versions of Windows.
    142 
    143 If you face extreme slowness in downloads, it's probably because some other application is using bitsadmin to download something (like Windows Update)
    144 
    145 If you are on a hurry, you can do
    146 
    147 	C:\Users\Admin> bitsadmin /reset
    148 
    149 to clear all downloads and try running mor again.
    150 
    151 Bugs/Feature/Todo
    152 -----------------
    153 - Deferencing a $variable second time is disabled. This is for simplicity/security.
    154 
    155 - Currently it is not possible to null a variable with -D in Windows.
    156 
    157 	mor -Dvar= download
    158 
    159 The above will silently assign 'download' to $var.
    160 This is a bug with how the cmd process arguments. Use -Dvar="" instead.
    161 
    162 - TODO Implement variables expansion
    163 - TODO Add test cases
    164 - TODO Merge if two section with same names are present
    165 
    166 FAQ
    167 ---
    168 > Why the weird symbols ($/, $<, $>) instead of simple clean $root, $include, etc in [$]?
    169 I wanted mor to be as language agnostic as possible and I wanted the core variables to be
    170 ASCII clean. This is also the reason why the status messages are mostly made up of symbols.
    171 
    172 > Where are the damn CHANGELOGs?
    173 For the complete changelog,
    174         git notes show v0.2~1..
    175 
    176 For a specific version,
    177         git notes show v0.2
    178 
    179 Credits
    180 -------
    181 The graphics is a derivative of "butler" by jgs.