RPMs and Effing Package Management

I’ve been using FPM to build native packages for applications for the last few months and so far I cannot believe just how cool it is. It can create RPMs and DEBs from ruby gems, python modules, node packages and even directories. The last one is very useful for packaging up stand-alone java apps. Check it out, you may like it too.

Tags: , , ,

AWS CloudFront invalidation

It is now possible to invalidate objects (files) inĀ AWS CloudFront distributions. Handy when someone, like me, occasionally publishes files with the wrong content type. Here is how I implement this invalidation in python.

Tags: , , , ,

JRuby rake and maven

I cannot stand Maven. It makes me nauseous. However that does not seem to be the case for other institutionalised developers. Here’s what I did on a project where I wanted to isolate its craziness and still use jruby and rake.

namespace :maven do

  M2_HOME = "binaries/apache-maven-3.0.3"

  desc "Run the maven package goal"
  task :package => :clean do
    mvn "package"
  end

  desc "Run the application"
  task :application => :clean do
    mvn "test-compile", "exec:java", "-Dexec.mainClass=com.example.Application", "-Dexec.classpathScope=test"
  end

  desc "Run the maven dependencies report"
  task :dependencies do
    mvn "dependency:tree", "-DoutputFile=deps.txt"
  end

  def mvn(*args)
    require 'java'

    m2_conf = "#{M2_HOME}/bin/m2.conf"
    classpath = "#{M2_HOME}/boot/plexus-classworlds-2.4.jar"

    java.lang.System.setProperty('maven.home', M2_HOME)
    java.lang.System.setProperty('classworlds.conf', m2_conf)

    require classpath
    include_class Java::org.codehaus.plexus.classworlds.launcher.Launcher
    exit_code = Launcher.mainWithExitCode(args.flatten.to_java(:string))
    puts "Maven has completed with exit code: #{exit_code}"
    fail 'Build failed' if exit_code != 0
  end

end

You foul rancid beast.

Tags: , , ,