2013-09-02 11:43:49 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Ansible < Formula
|
2013-09-23 21:28:37 +00:00
|
|
|
homepage 'http://www.ansibleworks.com/'
|
2013-12-22 18:04:23 +00:00
|
|
|
url 'https://github.com/ansible/ansible/archive/v1.4.3.tar.gz'
|
|
|
|
sha1 '56939be3bf2884082dd30dea9d2aa00e375d8ede'
|
2013-09-02 11:43:49 +00:00
|
|
|
|
|
|
|
head 'https://github.com/ansible/ansible.git', :branch => :devel
|
|
|
|
|
|
|
|
depends_on :python
|
|
|
|
depends_on 'libyaml'
|
|
|
|
|
2013-10-20 13:44:20 +00:00
|
|
|
option 'with-accelerate', "Enable accelerated mode"
|
|
|
|
|
2013-10-30 18:59:06 +00:00
|
|
|
resource 'pycrypto' do
|
|
|
|
url 'https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.tar.gz'
|
|
|
|
sha1 'c17e41a80b3fbf2ee4e8f2d8bb9e28c5d08bbb84'
|
|
|
|
end
|
|
|
|
|
|
|
|
resource 'pyyaml' do
|
|
|
|
url 'https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz'
|
|
|
|
sha1 '476dcfbcc6f4ebf3c06186229e8e2bd7d7b20e73'
|
|
|
|
end
|
|
|
|
|
|
|
|
resource 'paramiko' do
|
|
|
|
url 'https://pypi.python.org/packages/source/p/paramiko/paramiko-1.11.0.tar.gz'
|
|
|
|
sha1 'fd925569b9f0b1bd32ce6575235d152616e64e46'
|
|
|
|
end
|
|
|
|
|
|
|
|
resource 'markupsafe' do
|
|
|
|
url 'https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.18.tar.gz'
|
|
|
|
sha1 '9fe11891773f922a8b92e83c8f48edeb2f68631e'
|
|
|
|
end
|
|
|
|
|
|
|
|
resource 'jinja2' do
|
|
|
|
url 'https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.1.tar.gz'
|
|
|
|
sha1 'a9b24d887f2be772921b3ee30a0b9d435cffadda'
|
|
|
|
end
|
|
|
|
|
|
|
|
if build.with? 'accelerate'
|
|
|
|
resource 'python-keyczar' do
|
|
|
|
url 'https://pypi.python.org/packages/source/p/python-keyczar/python-keyczar-0.71b.tar.gz'
|
|
|
|
sha1 '20c7c5d54c0ce79262092b4cc691aa309fb277fa'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-09-23 16:54:53 +00:00
|
|
|
# TODO: Move this into Library/Homebrew somewhere (see also mitmproxy.rb).
|
2013-09-05 08:10:05 +00:00
|
|
|
def wrap bin_file, pythonpath
|
|
|
|
bin_file = Pathname.new bin_file
|
|
|
|
libexec_bin = Pathname.new libexec/'bin'
|
|
|
|
libexec_bin.mkpath
|
|
|
|
mv bin_file, libexec_bin
|
|
|
|
bin_file.write <<-EOS.undent
|
2013-09-03 09:13:20 +00:00
|
|
|
#!/bin/sh
|
2013-09-05 08:10:05 +00:00
|
|
|
PYTHONPATH="#{pythonpath}:$PYTHONPATH" "#{libexec_bin}/#{bin_file.basename}" "$@"
|
2013-09-02 11:43:49 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
|
|
|
install_args = [ "setup.py", "install", "--prefix=#{libexec}" ]
|
|
|
|
|
2013-09-03 09:13:20 +00:00
|
|
|
python do
|
2013-10-30 18:59:06 +00:00
|
|
|
resource('pycrypto').stage { system python, *install_args }
|
|
|
|
resource('pyyaml').stage { system python, *install_args }
|
|
|
|
resource('paramiko').stage { system python, *install_args }
|
|
|
|
resource('markupsafe').stage { system python, *install_args }
|
|
|
|
resource('jinja2').stage { system python, *install_args }
|
2013-10-20 13:44:20 +00:00
|
|
|
if build.with? 'accelerate'
|
2013-10-30 18:59:06 +00:00
|
|
|
resource('python-keyczar').stage { system python, *install_args }
|
2013-10-20 13:44:20 +00:00
|
|
|
end
|
2013-09-02 11:43:49 +00:00
|
|
|
|
2013-09-03 09:13:20 +00:00
|
|
|
inreplace 'lib/ansible/constants.py' do |s|
|
|
|
|
s.gsub! '/usr/share/ansible', share+'ansible'
|
|
|
|
s.gsub! '/etc/ansible', etc+'ansible'
|
|
|
|
end
|
2013-09-02 11:43:49 +00:00
|
|
|
|
2013-09-03 09:13:20 +00:00
|
|
|
# The "main" ansible module is installed in the default location and
|
|
|
|
# in order for it to be usable, we add the private_site_packages
|
|
|
|
# to the __init__.py of ansible so the deps (PyYAML etc) are found.
|
|
|
|
inreplace 'lib/ansible/__init__.py',
|
|
|
|
"__author__ = 'Michael DeHaan'",
|
|
|
|
"__author__ = 'Michael DeHaan'; import site; site.addsitedir('#{python.private_site_packages}')"
|
2013-09-02 11:43:49 +00:00
|
|
|
|
2013-09-03 09:13:20 +00:00
|
|
|
system python, "setup.py", "install", "--prefix=#{prefix}"
|
|
|
|
end
|
2013-09-02 11:43:49 +00:00
|
|
|
|
2013-09-03 09:13:20 +00:00
|
|
|
man1.install Dir['docs/man/man1/*.1']
|
2013-09-02 11:43:49 +00:00
|
|
|
|
2013-09-05 08:10:05 +00:00
|
|
|
Dir["#{bin}/*"].each do |bin_file|
|
|
|
|
wrap bin_file, python.site_packages
|
2013-09-02 11:43:49 +00:00
|
|
|
end
|
|
|
|
end
|
2013-10-18 23:51:59 +00:00
|
|
|
|
|
|
|
def test
|
|
|
|
system "#{bin}/ansible", "--version"
|
|
|
|
end
|
2013-09-02 11:43:49 +00:00
|
|
|
end
|