Automation

Modern Web Development and Dependency Management

Package Management

Package management is a collection of the software packages which ease the process of installing, upgrading, deleting and configuring software packages from the project or computer operating system. As most of the web developers use Linux or Mac OSX for the web development, we have plenty of options

HomeBrew

Homebrew  is a package manage for OSX. Homebrew can be easily installed with Ruby with the following command.

HomeBrew


Once installed, We can then install packages with simple command

Packages installed with Homebrew are installed at “/usr/local/Cellar” directory in OSX. There are various options available for uninstall, list, search, update or upgrade brew packages. Usage and troubleshooting information just do

MacPorts

MacPorts is another package manager for the OSX. In order to install MacPorts, we need to have Xcode with command line tools. We can install  depending on OSX version. Once installed, you can install packages


Packages installed via MacPorts are installed in the “/opt/local” directory in the OSX. Similar to Homebrew, we can uninstall, search, list, update packages. Look at Quick Start Guide

Apple Store

Apple Store  is another place to find a software packages required for the web development. We can search and install packages from the Apple store. We need to have an Apple ID

RPM
RMP a.k.a Red Hat Package manager is a package management system intended for the Linux Distribution. We can install repositories over internet using RPM front end like YUM, APT etc.

APT a.k.a Advance Packaging tool  is package management system for the Debian GNU/ Linux distribution. APT packages can be installed using

Installed packages can be removed, upgraded or listed. Read ubuntu AptGet guide 

YUM is package manager used to install, update, uninstall the rpm packages.

Application level package management tools

NPM

 NPM is a node package manager.You can browser any package by searching on the npm website. You need to install NodeJS in order to use NPM. NodeJS can be installed on any platform.

nodeJS

Once you installed NodeJS. Any package can be installed using

Another approach to NPM packages are create a ‘package.json’ file and mention all the dependencies. You can read more about package json file here . Example package.json file looks like this

Now that, we have all our dependencies in the package.json file. We can run ‘npm install’ which install all the dependencies in the directory ‘./node_modules‘ . Now We can run installed package e.g Appium like this

RubyGems

Rubygems is a package management framework for the Ruby packages. You can latest download latest version of the RubyGems from the download page. Once you installed RubyGems, you can install any Gem with the command

RubyGems

 

Another approach to install Gems are from ‘Gemfile’ with Bundler which manage versions of the RubyGems installed. We can create a ‘Gemfile’ and list all the dependencies over there. Typical gemfile looks like this:

Now that, we have all the Gems in the Gemfile, now we can install all these gems with bubdler like this

All the Gems will be installed in the ‘./vendor’ directory.

Composer

Composer is a package management system for the PHP packages. We can install composer by running one simple command

It will download ‘composer.phar’,  We can make it global by copying composer.phar into local binary.

composer

 We can create ‘composer.json’ file with all the required dependencies. Composer.json file looks like this:

Now we can install these package by running command

These packages will be installed and can be run from the ‘bin’ directory.

 

Bower

Bower is a package management system for the web. It’s based on the NodeJS and npm. Bower can be installed with the npm

This will install bower globally.

bower

 

Bower will create ‘bower.json’ file with template with ‘bower init’ command and we can add our dependencies. You can also search for the bower packages . Typical bower.json looks like this:

Now that, we have all bower dependencoes in the bower.json file. We can now install those dependencies

Now, we can make use of the bower dependencies.

Conclusion

Package and dependency management system makes web development smarter and faster. Modern web development practices uses dependency management to separate dependency code form the application code.