Skip to content

Instantly share code, notes, and snippets.

@ryanmcgrath
Created March 4, 2010 18:17
Show Gist options
  • Save ryanmcgrath/321973 to your computer and use it in GitHub Desktop.
Save ryanmcgrath/321973 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# A build script for this Maven-bullshit, because there's certain people here who don't
# actually *care* about this junk and just wanna get their work done. This is also meant to
# bring some semblance of sanity to alpha, because even though certain people have indicated that
# they don't wanna support it as an environment, they're still letting people code, build, and push
# from said environment. ;P
#
# This is meant to be run from your root webs directory/git repo.
#
# -- Ryan, who works locally, but is tired of dealing with other peoples problems
# Used for proper buffer flushing. Don't mess with this. ;P
STDOUT.sync = true
# Store our current directory so we can play nicely.
current_directory = Dir.getwd
# An array of directories to change into, and the respective commands to run in those
# directories. If you need to add/change/whatever a step in the build process, this should
# make life ten times easier. ;P
build_commands = [
{:dir => "", :cmd => "mvn install -DskipTests"},
{:dir => "", :cmd => "mvn install -DskipTests"},
{:dir => "", :cmd => "mvn install -DskipTests"},
{:dir => "", :cmd => "mvn compile war:inplace"}
]
# Jump through every command and execute our build process. If you don't know Ruby, and don't like
# Maven, don't fuck with this. ;P
build_commands.each { |obj|
Dir.chdir(current_directory + "/" + obj[:dir])
IO.popen(obj[:cmd]) { |f|
until f.eof?
puts f.gets
end
}
}
# Set us back to normal, since we just teleported all over the place.
Dir.chdir(current_directory)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment