Skip to content

Instantly share code, notes, and snippets.

@masakielastic
Created June 22, 2012 21:27
Show Gist options
  • Save masakielastic/2975297 to your computer and use it in GitHub Desktop.
Save masakielastic/2975297 to your computer and use it in GitHub Desktop.
Formula for Composer 1.0-alpha3 (MD5 fixed)
require 'formula'
def php_installed?
`which php`.length > 0
end
def composer_reqs?
`curl -s http://getcomposer.org/installer | /usr/bin/env php -d allow_url_fopen=On -d detect_unicode=Off -- --check`.include? "All settings correct"
end
class Composer < Formula
homepage 'http://getcomposer.org'
url 'http://getcomposer.org/download/1.0.0-alpha3/composer.phar'
md5 'b221f8b0c3a211d909a2dc76b63ba75d'
version '1.0.0-alpha3'
depends_on 'php' => :recommended unless php_installed?
def install
unless composer_reqs?
raise <<-EOS.undent
Composer PHP requirements check has failed. Please run
`curl -s http://getcomposer.org/installer | /usr/bin/env php -d allow_url_fopen=On -d detect_unicode=Off -- --check`
to identify and fix any issues
EOS
end
libexec.install "composer.phar"
sh = libexec + "composer"
sh.write("/usr/bin/env php -d allow_url_fopen=On -d detect_unicode=Off #{libexec}/composer.phar $*")
chmod 0755, sh
bin.install_symlink sh
end
def test
system 'composer --version'
end
def caveats; <<-EOS.undent
Verify your installation by running:
"composer --version".
You can read more about composer and packagist by running:
"brew home composer".
EOS
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment