Skip to content

Releases: BeameryHQ/micromanage

Beamery Micromanage V.1.1

22 Jun 09:53
Compare
Choose a tag to compare

Beamery Micromanage - A Micro-services Helpers Framework

In this release we have revamped the main pluginInterface so that we can show proper repository information based on the filters passed to the command. For example, the repo name will only be shown if the repo satisfies the -g (git only repos) or -n (node only repos).

In addition to this, various plugins have been adjusted to print out the results in a nicer way. This mainly affected list_git_active_branches

We have also added a new plugin check_node_package_usage. This plugin takes an node package name as a parameter and then will print out a list of repositories that require this package.

Example:

beamery check_node_package_usage moment

[Repository] ./api-plugin-xxx             "moment": "^2.17.1",
[Repository] ./api-plugin-xxx             "moment": "^2.15.0",
[Repository] ./api-plugin-xxx             "moment": "^2.15.2",

Beamery Micromanage V.1.0

22 Jun 09:48
Compare
Choose a tag to compare

Beamery Micromanage - A Micro-services Helpers Framework

At Beamery we follow Microservices Architecture which has various advantages from it being easier to scale, deploy independent services to elimination of any long-term commitment to a technology stack. However, Microservices Architecture also has its fair number of disadvantages as testing and inter-services communication become harder.

We currently have a good 50+ git repository. Developing features affect very often more than one of these repos. Changing branches, syncing and development is hard as you have to keep flipping between multiple terminal tabs to make sure all the repos are in order. Beamery Micro-services Helpers are shell helper functions that will automate and facilitate manipulating micro-services repos and in general any multiple folders in a certain directory.

demo

supports bash (version >= 4.0) and zsh (>= 5.0)

These helper functions are configured out of the box to work bash-it plugins framework for bash and oh-my-zsh plugins framework for zsh.

Installation

You can install the helpers using the installation script by executing . install.sh .. the script will then prompt to select the type of shell you are using, check for the existence of any shell helper and then install the relevant helpers accordingly.

One-liner installation

You can install this pugin via the command-line with either curl or wget:

via curl

bash -c "$(curl -fsSL https://raw.githubusercontent.com/SeedJobs/beamery-micromanage/master/install.sh)"

via wget

bash -c "$(wget https://raw.githubusercontent.com/SeedJobs/beamery-micromanage/master/install.sh -O -)"

The manual installation details for these are:

bash-it

bash-it separates plugins, aliases and completion functions into three separate folders. To install the completion you will need to copy bash-it/beamery.completion.bash to $BASH_IT/completion/available which is usually is in $HOME/.bash_it/completion/available.

To Install the plugin, you need to copy both the main plugin in bash-it/beamery.plugin.bash and the plugins folder in bash-it/beamery/ to $BASH_IT/plugins/available which is usually is in $HOME/.bash_it/plugins/available

Activating now the plugins and completion is done via executing both bash-it enable completion beamery and bash-it enable plugin beamery in the terminal and then reloading the sherll either by reload which is a bash-it alias or by sourcing .bash_profile or .bashrc depending on your OSX by executing source $HOME/.bash_profile; source $HOME/.bashrc

oh-my-zsh

oh-my-zsh have all their plugin in the plugins folder inside the installation directory of oh-my-zsh which is usually in $HOMR/.oh-my-zsh/plugins.

Installing oh-my-zsh beamery plugin is done by copying beamery folder in zsh/beamery/ to oh-my-zsh plugins directory and then activating the plugin by editing your $HOME/.zshrc and adding beamery to the list of plugins so that you have something similar to:

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.

plugins=(brew git npm nvm node osx pyenv python scala sublime tmux beamery)

Manual

If you do not use any shell halpers but still want to take advantage of these helper functions, you can still install them manually. Basically all what you need to do is source the main entry file which is in manual/beamery.sh from your .bash_profile or .bashrc depending on your OSX. Basically, i create a new folder in my $HOME and i call it .beamery so thats its hidden, and i copy the contents of manual inside so that i have:

├── .beamery
    ├── beamery.sh
    ├── plugins
    └── pluginsInterface.sh

then i add the line source $HOME/.beamery/beamery.sh inside my $HOME/.bash_profile as i am on OSX but can be inside your .bashrc as well. Simply, reload by re-sourcing these files and you are good to go.

What does it do ?

Currently the helper functions configured are:

  • audit_git_branches: List all the branches of a .git repository sorted by date creation
  • check_node_package_usage: Check the places a certain npm package is used across all the repos
  • clean_git_branches: Total cleaning on branches by first performing deletion of remote branches that have been merged into master
  • clean_git_local_branches: Clean any local branches that have been deleted on remote
  • clean_git_remote_branches: Clean remote branches that have been merged into master and delete them from remotes as well
  • clean_git_stash: Clean any stashed commits
  • clean_npm_modules: Clean unused NPM modules from each repo
  • generate_npm_report: Generate NPM report using the npm-check module to inspect the state of our npm modules
  • link_node_modules: Remove all node_modules from all the repos and run zelda to link and download all
  • list_git_active_branch: List the current branches on the repos
  • switch_git_branch: Switch the branches of .git repos into a specific branch
  • switch_git_branch_and_update: Switch the branches of .git repos into a specific branch and update from the latest remote origin
  • track_all_remote_git_branches: Track all remote branches that are not being tracked locally
  • update_git_branch: Update .git branches from the latest remote origin

For the all the plugins, any supported flag (-g, -n, -h, -s) that are described below will be ported as well and executed with each function. So for example, if you wish to only execute clean_npm_modules inside of any folder you can then execute beamery clean_npm_modules -s

For git functions, there are default params set for pull and push which are origin for your remote and master for local branch. However, these can be easily overridden by passing the desired names to the appropriate function call. Example:

beamery switch_git_branch_and_update
# This will call the sub functions for example like `git checkout master` and `git pull origin master`
beamery switch_git_branch_and_update development
# This will call the sub functions for example like `git checkout development` and `git pull origin development`
beamery switch_git_branch_and_update development upstream
# This will call the sub functions for example like `git checkout development` and `git pull upstream development`