pkopriv2 / bashum

Finally, a package manager for bash
Other
7 stars 1 forks source link

Bashum

Finally, a package manager for bash - written in bash! But it's much more than a simple package manager. Bashum is a complete development ecosystem for bash.

For those who aren't all that interested in developing bash code, you can still use bashum to use bash code. I love writing bash tools and love giving them away. Feel free to use bashum to install some of my stuff and let me know how things are working.

Commands

Dependencies

Bash:4.x

OSX:

sudo brew install bash
sudo mv /bin/bash /bin/bash3
sudo ln -s /usr/local/bin/bash /bin/bash

Linux:

aptitude install bash

Windows:

http://www.cygwin.com/ ( or just get smart and get Linux... )

GNU Core Utils

OSX:

brew install coreutils

Linux:

aptitude install coreutils

Windows:

http://www.cygwin.com/ 

GNU Tar

OSX:

brew install gnu-tar
sudo mv /usr/bin/tar /usr/bin/tar-bsd
sudo ln -s /usr/local/bin/gtar /usr/bin/tar

Linux:

aptitude install tar

Windows:

http://www.cygwin.com/ 

Git

OSX:

brew install git

Linux:

aptitude install git-svn

Windows:

http://www.cygwin.com/ 

Installation

Resource your bash environment. Usually, just start a new terminal session.

Installing Bashums

With the latest releast of bashum, installing packages has become incredibly easy. To search for a list of bashums to install, simply type:

bashum search <expression>

The search expressions are simply grep expressions - so feel free to use those regular expressions! Once you have found a bashum to install, type:

bashum install <package> [--version <optional_version>]

And that's it!

Remote Repositories

By default, bashum is configured to search and install from a single remote repository (http://github.com/pkopriv2/bashum-main). If you'd like to checkout some tools that are still in development:

bashum remote add https://github.com/pkopriv2/bashum-snapshot.git

You may add as many repositories as you'd like by using:

bashum remote add <url>

A bashum repository is nothing but a git repo, so feel free to make your own! The only requirements are that the bashums sit at the root of the repo and they are named with the following pattern: \<name>-\<version>.bashum, e.g.:

Building a Bashum Project

The standard set of bashum files are those that are assembled by default when building a bashum project:

/project.sh

The project.sh file is the only explicitly required file in a bashum project. It is a bash-dsl that describes the project. The following functions are available:

Example:

name    "test-project"
version "1.0.0-SNAPSHOT"
author  "Preston Koprivica"
email   "pkopriv2@gmail.com"

file    "license.txt" 
file    "lib2/*.sh" 

depends "stdlib" 
depends "other" "1.0.0"

snapshot_repo      "git@github.com:pkopriv2/bashum-snapshot.git"
snapshot_site_repo "git@github.com:pkopriv2/bashum-snapshot-site.git"

release_repo       "git@github.com:pkopriv2/bashum-main.git"
release_site_repo  "git@github.com:pkopriv2/bashum-main-site.git"

Requiring other files

For the most part, bashum tries to be transparent to the current environment. Things should just work. However, a custom "require" function is available all bashum projects and libraries. Within the project itself, the files are referenced relative to the root of the project. When referencing other projects, you must first require the project, then files relative to the project.

Example:

Given the following project:

/bin/test:

require_bashum 'stdlib'    # imports the stdlib bashum. (require 'stdlib' would work too) 

require 'lib/lib.sh'       # imports the lib.sh in this project.    
require 'lib/console.sh'   # imports the stdlib console. 

Copyright

Copyright 2013 Preston Koprivica (pkopriv2@gmail.com)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.