Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

Friday, January 11, 2013

Find command - find all files excluding some matching one path

Objective: So to list all files in current directory but those under .git.

I am often using find in combination to grep to exclude some of them:

    find . -type f | grep -v .git
but today I needed to move the logic under the find expression. It's a bit confusing to go from one tool to another when regular expressions don't work exactly the same. I spent a while getting this right so here's my findings.

This won't work:

    find . -type f -and -not -path ".git" -print
It should be -path "./.git*"

In other words this will work

    find . -type d -and -name .git -prune -o -print
    find . -type d -and -path "./.git" -prune -o -type f -print
    find . -type f -and -not -path "./.git*" -print
Now I can list all extensions of our project files in one line
    find . -type f -name "*.*" -and -not \( -path "./.git*" -or -path "./Library*" \) -print0 | xargs -0 -L1 basename | sed 's/.*\.//' | sort -u
Useful before starting to update a .gitattributes file.

Thursday, September 17, 2009

nose, subversion and executable bits

For some reason, nose wasn't executing some of my tests. I found out that nose doesn't select test files if they have an executable bit, and that subversion was configured to create the files with the executable bit. That's a bit unfortunate as I want some python files to be executable, other not. I guess I will let them non executable by default. Worklog below

Tuesday, September 8, 2009

Tips for autodeploying J2EE apps on Unix platforms

With a little bit of configuration you can have a nice autodeployment setup to save you time and remove potential errors.

For example this is something I can usually do after spending a few hours on the development infrastructure:

# from the build server, deploy the latest build for the specified project onto the 3 dev servers
deploy_build projectName trunk latest dev1 dev2 dev3

# deploy specified build for specified project
deploy_build projectName trunk build65 dev4

# deploy latest branch 2.0 onto specified server
deploy_build projectName 2.0 latest dev5


Also with a little bit more glue code those same commands can be run through your CI server interface, allowing one click deployment from the CI server GUI.

This is one way of achieving it, using standard Unix tools.