Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

I haven't really ever been much of an IDE buff. I'm told that both Eclipse, Netbeans and IntelliJ does all of the following in smart(er) ways. I just really like output that is pipeable. The following should not be viewed as best practices in any way. They are just the tools that help me when I'm in a tight spot. If you have improvements, even if they are of the form "Steen, get into the 21st century already", please leave them in the comments.

Grep, the friend in need

For finding the dependencies of all the protocolterminator submodules in one go. Without the version numbers

find . -name "pom.xml" | xargs grep -A 2 "<dependency>" | grep -A 1 -E "<groupId>eu.europa.ec.joinup.ecc</groupId>" | egrep -o "artifactId.*" | sort | uniq

 

Git command line stuff

I keep all the OpenNCP components in a separate directory. This allows me to do git operations on all of them in one go:

Checking the status of all git repositories:

back=`pwd`; for d in `find . -type d -name .git`; do cd "$d/.."; pwd; git st ;echo "\n"; cd $back ; done

 

Creating a release branch on all git repositories:

(a variation on the theme above)

back=`pwd`; for d in `find . -type d -name .git`; do cd "$d/.."; pwd; git-flow release start 1.1.0; cd $back ; done

please observe that the above command might exit with errors for some of the repositories. For those wishing to anticipate this, they can run 

back=`pwd`; for d in `find . -type d -name .git`; do cd "$d/.."; pwd; git co develop; cd $back ; done

before hand.

 

Checking the if branches are out of date:

Another variation on the theme is viewing which of your local branches need pull-ing:

back=`pwd`; for d in `find . -type d -name .git`; do cd "$d/.."; pwd; git remote show origin | grep out\ of\ date; cd $back ; done

which can conveniently be accomplished by:

back=`pwd`; for d in `find . -type d -name .git`; do cd "$d/.."; pwd; git co develop; git pull; cd $back ; done


Rudimentary SLOC count (java files only)

find . -name "*.java" | xargs egrep -v -h "^\s*[//|/*|*/]" | egrep -v "^\s*$" | wc -l




  • No labels