Code shared between various Ember software.
ember-shared provides the following command-line scripts, mainly useful for writing other scripts.
- Returns a timestamp combined with a random (V4) UUID. Synopsis:
- Returns an estimate sum of the disk usage of the specified files, in bytes. Synopsis:
- Notify the user of a shell script of an error condition. Synopsis:
error-notify [exit-status] [message-to-user]...(if the first argument is an integer, it is used as the exit status; otherwise error-notify exits with status 1)
- Notify the user of a shell script of a warning. Synopsis:
- Notify the user of a shell script of a warning, and wait a bit in the hope that they see the warning. Synopsis:
warn <message-to-user> [time-to-wait-in-seconds](time-to-wait defaults to 10 seconds)
In addition, ember-shared also provides the following scripts that it uses internally that are not supported for independent use.
- Set up the bash environment shared by various Ember projects. Synopsis:
- Tells the user that their bash environment is misconfigured (this script should never run if everything is working). Synopsis:
die [exit-status] [message-to-user]...(if the first argument is an integer, it is used as the exit status; otherwise die exits with status 1)
ember_bash_setup provides these bash functions.
- Notify the user of a shell script of an error condition, and exit. Synopsis:
die [exit-status] [message-to-user]...(if the first argument is an integer, it is used as the exit status; otherwise the script exits with status 1)
- Replacement for
basenamein bash. Synopsis:
- Cross-platform replacement for
- Wrapper around the
iatool for communicating with the Internet Archive, which can be used as a drop-in replacement for the standard
- Alternative to bash command substitution (
"$(command)") that preserves trailing newlines.
variable-namemust not be "
setVariableToCommandOutput <variable-name> <command> [argument]...
- Replace one string with another in the specified file. Synopsis:
ereplace <string-to-replace> <replacement-string> <file>
- Prints a string. Synopsis:
- Read a value from a configuration file, and return it as
readconfValue(this is an array, and will contain multiple results if the key is present multiple times in the file). If
<key>is not provided, it will return the non-comment lines of the file instead. Synopsis:
readconf [<key>] <file>
- Read a value from a configuration file, and print it (if the key is present multiple times in the file, the first value will be printed). Synopsis:
preadconf <key> <file>
- URL encode the specified string. Synopsis:
- URL decode the specified string. Synopsis:
For Wreathe 7.3, an ebuild (
app-misc/ember-shared) is available in the Wreathe overlay (this may also work for similar operating systems such as Ututo XS GNU/Linux).
For other operating systems, use the following installation instructions.
Instructions for installation without ebuild
- A recent version of bash
ia command, the following additional requirements apply.
- An account at the non-profit Internet Archive
- ia (https://pypi.python.org/pypi/internetarchive) 1.0.2 or later (ia must be configured by running
ia configuresince installing 1.0.2 or later before Crystallize can be used)
To download ember-shared, run:
git clone https://github.com/ethus3h/ember-shared.git
To install the downloaded scripts, copy them to your preferred location.
To learn about contributing to this project, visit the development page.