megalodon 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/Gemfile +4 -0
  2. data/README.md +80 -0
  3. data/bin/megalodon +68 -0
  4. data/config/rake.rb +60 -0
  5. data/config/run_list.json +5 -0
  6. data/config/run_vhosts.json +5 -0
  7. data/config/solo.rb +20 -0
  8. data/cookbooks/dnsmasq/recipies/default.rb +28 -0
  9. data/cookbooks/elasticsearch/recipies/default.rb +23 -0
  10. data/cookbooks/erlang/README.rdoc +8 -0
  11. data/cookbooks/erlang/metadata.rb +6 -0
  12. data/cookbooks/erlang/recipes/default.rb +8 -0
  13. data/cookbooks/git/README.rdoc +8 -0
  14. data/cookbooks/git/metadata.rb +6 -0
  15. data/cookbooks/git/recipes/default.rb +24 -0
  16. data/cookbooks/git/templates/default/dot.gitconfig.erb +47 -0
  17. data/cookbooks/homebrew/README.rdoc +73 -0
  18. data/cookbooks/homebrew/libraries/homebrew_package.rb +85 -0
  19. data/cookbooks/homebrew/metadata.json +33 -0
  20. data/cookbooks/homebrew/metadata.rb +9 -0
  21. data/cookbooks/homebrew/recipes/default.rb +11 -0
  22. data/cookbooks/jenkins/metadata.rb +9 -0
  23. data/cookbooks/jenkins/recipes/default.rb +21 -0
  24. data/cookbooks/maatkit/recipes/default.rb +10 -0
  25. data/cookbooks/megalodon/attributes/default.rb +3 -0
  26. data/cookbooks/megalodon/definitions/megalodon_app.rb +21 -0
  27. data/cookbooks/megalodon/recipes/apache_vhosts.rb +46 -0
  28. data/cookbooks/megalodon/recipes/default.rb +55 -0
  29. data/cookbooks/megalodon/recipes/misc.rb +14 -0
  30. data/cookbooks/megalodon/templates/default/default.conf.erb +26 -0
  31. data/cookbooks/megalodon/templates/default/default.json.erb +5 -0
  32. data/cookbooks/megalodon/templates/default/dot.profile.erb +22 -0
  33. data/cookbooks/megalodon/templates/default/php5.conf.erb +12 -0
  34. data/cookbooks/megalodon/templates/default/vhost.conf.erb +28 -0
  35. data/cookbooks/memcached/README.rdoc +8 -0
  36. data/cookbooks/memcached/metadata.rb +2 -0
  37. data/cookbooks/memcached/recipes/default.rb +9 -0
  38. data/cookbooks/mongodb/recipes/default.rb +23 -0
  39. data/cookbooks/mvim/README.rdoc +8 -0
  40. data/cookbooks/mvim/metadata.rb +6 -0
  41. data/cookbooks/mvim/recipes/default.rb +47 -0
  42. data/cookbooks/mvim/templates/default/dot.vimrc.erb +23 -0
  43. data/cookbooks/mysql/README.rdoc +143 -0
  44. data/cookbooks/mysql/attributes/server.rb +58 -0
  45. data/cookbooks/mysql/metadata.rb +78 -0
  46. data/cookbooks/mysql/recipes/default.rb +24 -0
  47. data/cookbooks/mysql/recipes/mariadb.rb +41 -0
  48. data/cookbooks/mysql/templates/default/my.cnf.erb +161 -0
  49. data/cookbooks/nginx/recipes/default.rb +66 -0
  50. data/cookbooks/nginx/templates/default/app_nginx.conf.erb +42 -0
  51. data/cookbooks/nginx/templates/default/default.conf.erb +40 -0
  52. data/cookbooks/nginx/templates/default/fastcgi_params.erb +23 -0
  53. data/cookbooks/nginx/templates/default/nginx.conf.erb +33 -0
  54. data/cookbooks/node/README.rdoc +8 -0
  55. data/cookbooks/node/metadata.rb +6 -0
  56. data/cookbooks/node/recipes/default.rb +12 -0
  57. data/cookbooks/php/attributes/default.rb +3 -0
  58. data/cookbooks/php/metadata.rb +2 -0
  59. data/cookbooks/php/providers/pear.rb +229 -0
  60. data/cookbooks/php/providers/pear_channel.rb +91 -0
  61. data/cookbooks/php/recipes/default.rb +25 -0
  62. data/cookbooks/php/recipes/fpm.rb +45 -0
  63. data/cookbooks/php/recipes/module_apc.rb +12 -0
  64. data/cookbooks/php/recipes/module_memcached.rb +12 -0
  65. data/cookbooks/php/recipes/module_mongo.rb +11 -0
  66. data/cookbooks/php/recipes/module_xdebug.rb +11 -0
  67. data/cookbooks/php/resources/pear.rb +28 -0
  68. data/cookbooks/php/resources/pear_channel.rb +28 -0
  69. data/cookbooks/php/templates/default/mods/apc.ini.erb +4 -0
  70. data/cookbooks/php/templates/default/mods/memcached.ini.erb +1 -0
  71. data/cookbooks/php/templates/default/mods/mongo.ini.erb +1 -0
  72. data/cookbooks/php/templates/default/mods/xdebug.ini.erb +39 -0
  73. data/cookbooks/php/templates/default/net.php.php-fpm.plist.erb +23 -0
  74. data/cookbooks/php/templates/default/php-fpm.conf.erb +323 -0
  75. data/cookbooks/php/templates/default/php.ini.erb +1854 -0
  76. data/cookbooks/php.tgz +0 -0
  77. data/cookbooks/phpunit/metadata.rb +8 -0
  78. data/cookbooks/phpunit/recipes/default.rb +38 -0
  79. data/cookbooks/python/README.rdoc +8 -0
  80. data/cookbooks/python/metadata.rb +6 -0
  81. data/cookbooks/python/recipes/default.rb +6 -0
  82. data/cookbooks/redis/recipes/default.rb +23 -0
  83. data/cookbooks/siege/recipes/default.rb +4 -0
  84. data/cookbooks/solr/metadata.json +36 -0
  85. data/cookbooks/solr/metadata.rb +9 -0
  86. data/cookbooks/solr/recipes/default.rb +18 -0
  87. data/cookbooks/varnish/attributes/default.rb +2 -0
  88. data/cookbooks/varnish/recipes/default.rb +24 -0
  89. data/cookbooks/varnish/templates/default/default.vcl.erb +268 -0
  90. data/cookbooks/varnish/templates/default/ubuntu-default.erb +103 -0
  91. data/cookbooks/xhprof/metadata.json +36 -0
  92. data/cookbooks/xhprof/metadata.rb +12 -0
  93. data/cookbooks/xhprof/recipes/default.rb +43 -0
  94. data/cookbooks/xhprof/templates/default/xhprof.ini.erb +2 -0
  95. data/formulas/apc.rb +63 -0
  96. data/formulas/cclient.rb +57 -0
  97. data/formulas/megalodon.rb +27 -0
  98. data/formulas/memcached-php.rb +24 -0
  99. data/formulas/mongo-php.rb +25 -0
  100. data/formulas/mongodb-php.rb +31 -0
  101. data/formulas/php-memcached.rb +31 -0
  102. data/formulas/php.rb +261 -0
  103. data/formulas/xdebug.rb +36 -0
  104. data/formulas/xhprof.rb +33 -0
  105. data/lib/megalodon/version.rb +3 -0
  106. data/megalodon.gemspec +14 -0
  107. data/roles/nginx_web_server.json +23 -0
  108. data/roles/web_server.json +19 -0
  109. metadata +170 -0
data/formulas/apc.rb ADDED
@@ -0,0 +1,63 @@
1
+ require 'formula'
2
+
3
+ class Apc < Formula
4
+ url 'http://pecl.php.net/get/APC-3.1.9.tgz'
5
+ homepage 'http://pecl.php.net/package/apc'
6
+ md5 'a2cf7fbf6f3a87f190d897a53260ddaa'
7
+
8
+ depends_on 'pcre'
9
+ depends_on 'autoconf' => :build
10
+
11
+ def patches
12
+ # fixes "PHP Fatal error: Unknown: apc_fcntl_unlock failed: in Unknown on line 0"
13
+ # this has been fixed in the APC trunk but has not been released yet (as of 3.1.9)
14
+ # https://bugs.php.net/bug.php?id=59750
15
+ DATA
16
+ end
17
+
18
+ def install
19
+ extensions = lib + %x[php-config --extension-dir].split('lib/')[1].strip
20
+
21
+ Dir.chdir "APC-#{version}" do
22
+ system "phpize"
23
+ system "./configure", "--prefix=#{prefix}"
24
+ system "make"
25
+
26
+ prefix.install "apc.php"
27
+ extensions.install "modules/apc.so"
28
+ end
29
+ end
30
+
31
+ def caveats; <<-EOS.undent
32
+ To finish installing APC:
33
+ * Add the following lines to php.ini:
34
+ [apc]
35
+ extension="#{prefix}/apc.so"
36
+ apc.enabled=1
37
+ apc.shm_segments=1
38
+ apc.shm_size=64M
39
+ apc.ttl=7200
40
+ apc.user_ttl=7200
41
+ apc.num_files_hint=1024
42
+ apc.mmap_file_mask=/tmp/apc.XXXXXX
43
+ apc.enable_cli=1
44
+ * Restart your webserver
45
+ * Copy "#{prefix}/apc.php" to any site to see APC's usage.
46
+ EOS
47
+ end
48
+ end
49
+
50
+ __END__
51
+ diff --git a/APC-3.1.9/apc_lock.h b/APC-3.1.9/apc_lock.h
52
+ index 77f66d5..aafa3b7 100644
53
+ --- a/APC-3.1.9/apc_lock.h
54
+ +++ b/APC-3.1.9/apc_lock.h
55
+ @@ -154,7 +154,7 @@
56
+ # define apc_lck_nb_lock(a) apc_fcntl_nonblocking_lock(a TSRMLS_CC)
57
+ # define apc_lck_rdlock(a) apc_fcntl_rdlock(a TSRMLS_CC)
58
+ # define apc_lck_unlock(a) apc_fcntl_unlock(a TSRMLS_CC)
59
+ -# define apc_lck_rdunlock(a) apc_fcntl_unlock(&a TSRMLS_CC)
60
+ +# define apc_lck_rdunlock(a) apc_fcntl_unlock(a TSRMLS_CC)
61
+ #endif
62
+
63
+ #endif
@@ -0,0 +1,57 @@
1
+ require 'formula'
2
+
3
+ class Cclient <Formula
4
+ url 'ftp://ftp.cac.washington.edu/mail/imap.tar.Z'
5
+ homepage 'http://www.washington.edu/imap/'
6
+ md5 'd9f7fd4e1d93ad9fca1df8717a79d1c5'
7
+ version '2007e'
8
+
9
+ def patches; DATA; end
10
+
11
+ def install
12
+ # make breaks with -j option
13
+ system "/usr/bin/make", "oxp","MAKEFLAGS="
14
+ system "install -m 755 -d #{prefix}/include/c-client"
15
+ system "cd c-client; install -m 644 \
16
+ c-client.h dummy.h env.h env_unix.h fdstring.h flockcyg.h flocksim.h \
17
+ flstring.h fs.h ftl.h imap4r1.h linkage.c linkage.h mail.h \
18
+ misc.h netmsg.h newsrc.h nl.h nntp.h osdep.h \
19
+ pseudo.h rfc822.h smtp.h sslio.h tcp.h tcp_unix.h unix.h \
20
+ utf8.h utf8aux.h \
21
+ #{prefix}/include/c-client"
22
+ lib.install "c-client/c-client.a" => "libc-client4.a"
23
+ #system "ranlib #{prefix}/lib/libc-client4.a"
24
+ end
25
+ end
26
+
27
+ __END__
28
+ diff --git a/Makefile b/Makefile
29
+ index e6e4987..d75306c 100644
30
+ --- a/Makefile
31
+ +++ b/Makefile
32
+ @@ -418,7 +418,7 @@ oxp: an
33
+ $(TOUCH) ip6
34
+ $(BUILD) BUILDTYPE=osx IP=$(IP6) EXTRAAUTHENTICATORS="$(EXTRAAUTHENTICATORS) gss" \
35
+ PASSWDTYPE=pam \
36
+ - EXTRACFLAGS="$(EXTRACFLAGS) -DMAC_OSX_KLUDGE=1" \
37
+ + EXTRACFLAGS="$(EXTRACFLAGS)" \
38
+ SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/System/Library/OpenSSL/certs SSLKEYS=/System/Library/OpenSSL/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib PAMDLFLAGS=-lpam"
39
+
40
+ osx: osxok an
41
+ diff --git a/src/osdep/unix/ckp_pam.c b/src/osdep/unix/ckp_pam.c
42
+ index 60c6c1f..674941c 100644
43
+ --- a/src/osdep/unix/ckp_pam.c
44
+ +++ b/src/osdep/unix/ckp_pam.c
45
+ @@ -27,11 +27,7 @@
46
+ */
47
+
48
+
49
+ -#ifdef MAC_OSX_KLUDGE /* why can't Apple be compatible? */
50
+ -#include <pam/pam_appl.h>
51
+ -#else
52
+ #include <security/pam_appl.h>
53
+ -#endif
54
+
55
+ struct checkpw_cred {
56
+ char *uname; /* user name */
57
+
@@ -0,0 +1,27 @@
1
+ require 'formula'
2
+
3
+ class Megalodon <Formula
4
+ head 'git://github.com/msonnabaum/megalodon.git'
5
+ homepage 'https://github.com/msonnabaum/megalodon'
6
+
7
+ def patches; DATA; end
8
+
9
+ def install
10
+ prefix.install Dir['config', 'cookbooks', 'formulas', 'roles']
11
+ bin.install "megalodon"
12
+ end
13
+ end
14
+
15
+ __END__
16
+ diff --git a/megalodon b/megalodon
17
+ index f04db01..da7d117 100755
18
+ --- a/megalodon
19
+ +++ b/megalodon
20
+ @@ -54,7 +54,7 @@ end
21
+ directory_name = "#{ENV['HOME']}/.megalodon/data_bags/vhosts"
22
+ FileUtils.mkdir_p(directory_name) unless FileTest::directory?(directory_name)
23
+
24
+ -cwd = Dir.pwd
25
+ +cwd = `brew --prefix megalodon`.strip
26
+
27
+ chef_solo = which('chef-solo') || install_chef
@@ -0,0 +1,24 @@
1
+ require 'formula'
2
+
3
+ class MemcachedPhp < Formula
4
+ url 'http://pecl.php.net/get/memcached-1.0.2.tgz'
5
+ homepage 'http://pecl.php.net/package/memcached'
6
+ md5 'b91f815ad59086d0c3564cce022b5c4f'
7
+
8
+ def install
9
+ Dir.chdir "memcached-#{version}" do
10
+ system "phpize"
11
+ system "./configure", "--prefix=#{prefix}"
12
+ system "make"
13
+ prefix.install 'modules/memcached.so'
14
+ end
15
+ end
16
+
17
+ def caveats; <<-EOS.undent
18
+ To finish installing memcached:
19
+ * Add the following line to php.ini:
20
+ extension="#{prefix}/memcached.so"
21
+ * Restart your webserver
22
+ EOS
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ require 'formula'
2
+
3
+ class MongoPhp < Formula
4
+ url 'http://pecl.php.net/get/mongo-1.1.4.tgz'
5
+ homepage 'http://pecl.php.net/package/mongo'
6
+ md5 '22f1e25690589f6d80d5ed29e56644eb'
7
+
8
+ def install
9
+ Dir.chdir "mongo-#{version}" do
10
+ system "phpize"
11
+ system "./configure", "--prefix=#{prefix}"
12
+ system "make"
13
+ prefix.install "modules/mongo.so"
14
+ end
15
+ end
16
+
17
+ def caveats; <<-EOS.undent
18
+ To finish installing MongoDB extension:
19
+ * Add the following lines to #{etc}/php.ini:
20
+ [mongo]
21
+ extension="#{prefix}/mongo.so"
22
+ * Restart your webserver
23
+ EOS
24
+ end
25
+ end
@@ -0,0 +1,31 @@
1
+ require 'formula'
2
+
3
+ class MongodbPhp <Formula
4
+ url 'http://pecl.php.net/get/mongo-1.2.2.tgz'
5
+ homepage 'http://pecl.php.net/package/mongo'
6
+ md5 'b589a922222bfe5a13e5b18359e87437'
7
+
8
+ depends_on 'mongodb'
9
+ depends_on 'autoconf' => :build
10
+
11
+ def install
12
+ extensions = lib + %x[php-config --extension-dir].split('lib/')[1].strip
13
+ Dir.chdir "mongo-#{version}" do
14
+ system "phpize"
15
+ system "./configure", "--prefix=#{prefix}"
16
+ system "make"
17
+
18
+ extensions.install "modules/mongo.so"
19
+ end
20
+
21
+ end
22
+
23
+ def caveats; <<-EOS.undent
24
+ To finish installing mongodb:
25
+ * Add the following lines to php.ini:
26
+ [mongodb]
27
+ extension="#{prefix}/mongo.so"
28
+ * Restart your webserver
29
+ EOS
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ require 'formula'
2
+
3
+ class PhpMemcached <Formula
4
+ url 'http://pecl.php.net/get/memcached-2.1.0.tgz'
5
+ homepage 'http://pecl.php.net/package/memcached'
6
+ md5 'daf070aad13bebffdff50acf6e93043c'
7
+
8
+ depends_on 'autoconf' => :build
9
+ depends_on 'libmemcached'
10
+
11
+ def install
12
+ extensions = lib + %x[php-config --extension-dir].split('lib/')[1].strip
13
+ Dir.chdir "memcached-#{version}" do
14
+ system "phpize"
15
+ system "./configure", "--prefix=#{prefix}"
16
+ system "make"
17
+
18
+ extensions.install "modules/memcached.so"
19
+ end
20
+
21
+ end
22
+
23
+ def caveats; <<-EOS.undent
24
+ To finish installing memcached:
25
+ * Add the following lines to php.ini:
26
+ [memcached]
27
+ extension="#{prefix}/memcached.so"
28
+ * Restart your webserver
29
+ EOS
30
+ end
31
+ end
data/formulas/php.rb ADDED
@@ -0,0 +1,261 @@
1
+ require 'formula'
2
+
3
+ def mysql_installed?
4
+ `which mysql_config`.length > 0
5
+ end
6
+
7
+ class Php < Formula
8
+ url 'http://www.php.net/get/php-5.3.17.tar.gz/from/this/mirror'
9
+ homepage 'http://php.net/'
10
+ md5 '002e02e36c2cbcada8c49a7e5956d787'
11
+ version '5.3.17'
12
+
13
+ # So PHP extensions don't report missing symbols
14
+ skip_clean ['bin', 'sbin']
15
+
16
+ depends_on 'gettext'
17
+ depends_on 'readline' unless ARGV.include? '--without-readline'
18
+ depends_on 'libxml2'
19
+ depends_on 'jpeg'
20
+ depends_on 'libpng'
21
+ depends_on 'mcrypt'
22
+ depends_on 'libtool'
23
+
24
+ if ARGV.include? '--with-mysql'
25
+ depends_on 'mysql' unless mysql_installed?
26
+ end
27
+ if ARGV.include? '--with-fpm'
28
+ depends_on 'libevent'
29
+ end
30
+ if ARGV.include? '--with-pgsql'
31
+ depends_on 'postgresql'
32
+ end
33
+ if ARGV.include? '--with-mssql'
34
+ depends_on 'freetds'
35
+ end
36
+ if ARGV.include? '--with-intl'
37
+ depends_on 'icu4c'
38
+ end
39
+ if ARGV.include? '--with-imap'
40
+ depends_on 'cclient'
41
+ end
42
+
43
+ def options
44
+ [
45
+ ['--with-mysql', 'Include MySQL support'],
46
+ ['--with-pgsql', 'Include PostgreSQL support'],
47
+ ['--with-mssql', 'Include MSSQL-DB support'],
48
+ ['--with-fpm', 'Enable building of the fpm SAPI executable'],
49
+ ['--with-apache', 'Build shared Apache 2.0 Handler module'],
50
+ ['--with-intl', 'Include intl extension'],
51
+ ['--without-readline', 'Build without readline support'],
52
+ ['--with-imap', 'Include IMAP support.'],
53
+ ['--with-cgi', 'Include CGI support.']
54
+ ]
55
+ end
56
+
57
+ def patches; DATA; end
58
+
59
+ def install
60
+ ENV.x11 # For freetype and libpng
61
+ ENV.O3 # Speed things up
62
+ ENV["EXTENSION_DIR"] = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626"
63
+
64
+ args = [
65
+ "--prefix=#{prefix}",
66
+ "--disable-debug",
67
+ "--disable-dependency-tracking",
68
+ "--with-config-file-path=#{HOMEBREW_PREFIX}/etc/php5",
69
+ "--with-config-file-scan-dir=#{HOMEBREW_PREFIX}/etc/php5/conf.d",
70
+ "--with-iconv-dir=/usr",
71
+ "--enable-exif",
72
+ "--enable-soap",
73
+ "--enable-sqlite-utf8",
74
+ "--enable-wddx",
75
+ "--enable-ftp",
76
+ "--enable-sockets",
77
+ "--enable-zip",
78
+ "--enable-pcntl",
79
+ "--enable-shmop",
80
+ "--enable-sysvsem",
81
+ "--enable-sysvshm",
82
+ "--enable-sysvmsg",
83
+ "--enable-memory-limit",
84
+ "--enable-mbstring",
85
+ "--enable-mbregex",
86
+ "--enable-bcmath",
87
+ "--enable-calendar",
88
+ "--enable-memcache",
89
+ "--enable-zend-multibyte",
90
+ "--with-openssl=/usr",
91
+ "--with-zlib=/usr",
92
+ "--with-bz2=/usr",
93
+ "--with-ldap",
94
+ "--with-ldap-sasl=/usr",
95
+ "--with-xmlrpc",
96
+ "--with-iodbc",
97
+ "--with-kerberos=/usr",
98
+ "--with-xsl=/usr",
99
+ "--with-curl=/usr",
100
+ "--with-gd",
101
+ "--with-snmp=/usr",
102
+ "--enable-gd-native-ttf",
103
+ "--with-mcrypt=#{Formula.factory('mcrypt').prefix}",
104
+ "--with-jpeg-dir=#{Formula.factory('jpeg').prefix}",
105
+ "--with-png-dir=/usr/X11",
106
+ "--with-gettext=#{Formula.factory('gettext').prefix}",
107
+ "--with-tidy",
108
+ "--mandir=#{man}"
109
+ ]
110
+
111
+ # Bail if both php-fpm and apxs are enabled
112
+ # http://bugs.php.net/bug.php?id=52419
113
+ if (ARGV.include? '--with-fpm') && (ARGV.include? '--with-apache')
114
+ onoe "You can only enable PHP FPM or Apache, not both"
115
+ puts "http://bugs.php.net/bug.php?id=52419"
116
+ exit 99
117
+ end
118
+
119
+ # Enable PHP FPM
120
+ if ARGV.include? '--with-fpm'
121
+ args.push "--enable-fpm"
122
+ args.push "--with-fpm-conf=#{HOMEBREW_PREFIX}/etc/php5/fpm/php-fpm.conf"
123
+ end
124
+
125
+ # Build Apache module
126
+ if ARGV.include? '--with-apache'
127
+ args.push "--with-apxs2=/usr/sbin/apxs"
128
+ args.push "--libexecdir=#{prefix}/libexec"
129
+ end
130
+
131
+ if ARGV.include? '--with-mysql'
132
+ args.push "--with-mysql-sock=/tmp/mysql.sock"
133
+ args.push "--with-mysqli=mysqlnd"
134
+ args.push "--with-mysql=mysqlnd"
135
+ args.push "--with-pdo-mysql=mysqlnd"
136
+ end
137
+
138
+ if ARGV.include? '--with-pgsql'
139
+ args.push "--with-pgsql=#{Formula.factory('postgresql').prefix}"
140
+ args.push "--with-pdo-pgsql=#{Formula.factory('postgresql').prefix}"
141
+ end
142
+
143
+ if ARGV.include? '--with-mssql'
144
+ args.push "--with-mssql=#{Formula.factory('freetds').prefix}"
145
+ end
146
+
147
+ if ARGV.include? '--with-intl'
148
+ args.push "--enable-intl"
149
+ args.push "--with-icu-dir=#{Formula.factory('icu4c').prefix}"
150
+ end
151
+
152
+ if ARGV.include? '--with-imap'
153
+ args.push "--with-imap=#{Formula.factory('cclient').prefix}"
154
+ args.push "--with-imap-ssl=#{Formula.factory('cclient').prefix}"
155
+ end
156
+
157
+ if ARGV.include? '--with-cgi'
158
+ unless (ARGV.include? '--with-fpm') && (ARGV.include? '--with-apache')
159
+ args.push "--enable-cgi"
160
+ end
161
+ end
162
+
163
+ args.push "--with-readline=#{Formula.factory('readline').prefix}" unless ARGV.include? '--without-readline'
164
+
165
+ system "./configure", *args
166
+
167
+ unless ARGV.include? '--without-apache'
168
+ # Use Homebrew prefix for the Apache libexec folder
169
+ inreplace "Makefile",
170
+ "INSTALL_IT = $(mkinstalldirs) '$(INSTALL_ROOT)/usr/libexec/apache2' && $(mkinstalldirs) '$(INSTALL_ROOT)/private/etc/apache2' && /usr/sbin/apxs -S LIBEXECDIR='$(INSTALL_ROOT)/usr/libexec/apache2' -S SYSCONFDIR='$(INSTALL_ROOT)/private/etc/apache2' -i -a -n php5 libs/libphp5.so",
171
+ "INSTALL_IT = $(mkinstalldirs) '#{prefix}/libexec/apache2' && $(mkinstalldirs) '$(INSTALL_ROOT)/private/etc/apache2' && /usr/sbin/apxs -S LIBEXECDIR='#{prefix}/libexec/apache2' -S SYSCONFDIR='$(INSTALL_ROOT)/private/etc/apache2' -i -a -n php5 libs/libphp5.so"
172
+ end
173
+
174
+ if ARGV.include? '--with-intl'
175
+ inreplace 'Makefile' do |s|
176
+ s.change_make_var! "EXTRA_LIBS", "\\1 -lstdc++"
177
+ end
178
+ end
179
+
180
+ system "make"
181
+ system "make install"
182
+
183
+ if ARGV.include? '--with-cgi'
184
+ if ARGV.include? '--with-fpm'
185
+ args.delete "--enable-fpm"
186
+ args.delete "--with-fpm-conf=#{HOMEBREW_PREFIX}/etc/php5/fpm/php-fpm.conf"
187
+ end
188
+
189
+ if ARGV.include? '--with-apache'
190
+ args.delete "--with-apxs2=/usr/sbin/apxs"
191
+ args.delete "--libexecdir=#{prefix}/libexec"
192
+ end
193
+
194
+ args.push "--enable-cgi"
195
+ system "./configure", *args
196
+ system "make"
197
+ system "make install"
198
+ end
199
+
200
+ (prefix+'etc/php5').install "php.ini-production" => "php.ini"
201
+
202
+ if ARGV.include? '--with-fpm'
203
+ (prefix+'org.php.php-fpm.plist').write startup_plist
204
+ system "cp #{prefix}/etc/php-fpm.conf.default #{prefix}/etc/php-fpm.conf"
205
+ (prefix+'var/log').mkpath
206
+ touch prefix+'var/log/php-fpm.log'
207
+ end
208
+ end
209
+
210
+ def caveats; <<-EOS
211
+ For 10.5 and Apache:
212
+ Apache needs to run in 32-bit mode. You can either force Apache to start
213
+ in 32-bit mode or you can thin the Apache executable.
214
+
215
+ To enable PHP in Apache add the following to httpd.conf and restart Apache:
216
+ LoadModule php5_module #{prefix}/libexec/apache2/libphp5.so
217
+
218
+ The php.ini file can be found in:
219
+ #{prefix}/etc/php5/php.ini
220
+ EOS
221
+ end
222
+
223
+ def startup_plist; <<-EOPLIST.undent
224
+ <?xml version="1.0" encoding="UTF-8"?>
225
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
226
+ <plist version="1.0">
227
+ <dict>
228
+ <key>Label</key>
229
+ <string>org.php.php-fpm</string>
230
+ <key>Program</key>
231
+ <string>#{sbin}/php-fpm</string>
232
+ <key>RunAtLoad</key>
233
+ <true/>
234
+ </dict>
235
+ </plist>
236
+ EOPLIST
237
+
238
+ end
239
+ end
240
+
241
+ __END__
242
+ diff -Naur php-5.3.2/ext/tidy/tidy.c php/ext/tidy/tidy.c
243
+ --- php-5.3.2/ext/tidy/tidy.c 2010-02-12 04:36:40.000000000 +1100
244
+ +++ php/ext/tidy/tidy.c 2010-05-23 19:49:47.000000000 +1000
245
+ @@ -22,6 +22,8 @@
246
+ #include "config.h"
247
+ #endif
248
+
249
+ +#include "tidy.h"
250
+ +
251
+ #include "php.h"
252
+ #include "php_tidy.h"
253
+
254
+ @@ -31,7 +33,6 @@
255
+ #include "ext/standard/info.h"
256
+ #include "safe_mode.h"
257
+
258
+ -#include "tidy.h"
259
+ #include "buffio.h"
260
+
261
+ /* compatibility with older versions of libtidy */
@@ -0,0 +1,36 @@
1
+ require 'formula'
2
+
3
+ class Xdebug < Formula
4
+ url 'http://xdebug.org/files/xdebug-2.1.1.tgz'
5
+ homepage 'http://xdebug.org'
6
+ md5 'fcdf078e715f44b77f13bac721ad63ce'
7
+
8
+ depends_on 'autoconf' => :build
9
+
10
+ def install
11
+ extensions = lib + %x[php-config --extension-dir].split('lib/')[1].strip
12
+
13
+ Dir.chdir "xdebug-#{version}" do
14
+ # See https://github.com/mxcl/homebrew/issues/issue/69
15
+ ENV.universal_binary
16
+
17
+ system "phpize"
18
+ system "./configure", "--disable-debug", "--disable-dependency-tracking",
19
+ "--prefix=#{prefix}",
20
+ "--enable-xdebug"
21
+ system "make"
22
+ extensions.install "modules/xdebug.so"
23
+ end
24
+ end
25
+
26
+ def caveats; <<-EOS.undent
27
+ To use this software:
28
+ * Add the following line to php.ini:
29
+ zend_extension="#{prefix}/xdebug.so"
30
+ * Restart your webserver.
31
+ * Write a PHP page that calls "phpinfo();"
32
+ * Load it in a browser and look for the info on the xdebug module.
33
+ * If you see it, you have been successful!
34
+ EOS
35
+ end
36
+ end
@@ -0,0 +1,33 @@
1
+ require 'formula'
2
+
3
+ class Xhprof <Formula
4
+ url 'http://pecl.php.net/get/xhprof-0.9.2.tgz'
5
+ homepage 'http://mirror.facebook.net/facebook/xhprof/doc.html'
6
+ md5 'ae40b153d157e6369a32e2c1a59a61ec'
7
+
8
+ depends_on 'pcre'
9
+ depends_on 'autoconf' => :build
10
+
11
+ def install
12
+ extensions = lib + %x[php-config --extension-dir].split('lib/')[1].strip
13
+
14
+ Dir.chdir "xhprof-#{version}/extension" do
15
+ system "phpize"
16
+ system "./configure", "--prefix=#{prefix}"
17
+ system "make"
18
+ extensions.install 'modules/xhprof.so'
19
+ end
20
+ Dir.chdir "xhprof-#{version}" do
21
+ prefix.install %w(xhprof_html xhprof_lib)
22
+ end
23
+ end
24
+
25
+ def caveats; <<-EOS.undent
26
+ To finish installing XHProf:
27
+ * Add the following lines to php.ini:
28
+ [xhprof]
29
+ extension="#{prefix}/xhprof.so"
30
+ * Restart your webserver
31
+ EOS
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module Megalodon
2
+ VERSION = "0.1.0"
3
+ end
data/megalodon.gemspec ADDED
@@ -0,0 +1,14 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "megalodon/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "megalodon"
6
+ s.version = Megalodon::VERSION
7
+ s.summary = "Setup a modern PHP development environment on Mac."
8
+ s.homepage = "http://msonnabaum.github.com/megalodon/"
9
+ s.authors = ['Mark Sonnabaum', 'Glenn Pratt']
10
+ s.files = `git ls-files`.split($\)
11
+ s.executables = `git ls-files bin | cut -c5-`.split($\)
12
+
13
+ s.add_dependency "chef", "~> 10.24.0"
14
+ end
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "nginx_web_server",
3
+ "default_attributes": {
4
+ },
5
+ "json_class": "Chef::Role",
6
+ "default": {
7
+ },
8
+ "override": {
9
+ },
10
+ "run_list": [
11
+ "recipe[nginx]",
12
+ "recipe[mysql::mariadb]",
13
+ "recipe[php::fpm]",
14
+ "recipe[php::module_apc]",
15
+ "recipe[php::module_memcached]",
16
+ "recipe[php::module_xdebug]",
17
+ "recipe[xhprof]"
18
+ ],
19
+ "description": "",
20
+ "chef_type": "role",
21
+ "override_attributes": {
22
+ }
23
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "web_server",
3
+ "default_attributes": {
4
+ },
5
+ "json_class": "Chef::Role",
6
+ "run_list": [
7
+ "recipe[mysql::mariadb]",
8
+ "recipe[php]",
9
+ "recipe[php::module_apc]",
10
+ "recipe[php::module_memcached]",
11
+ "recipe[php::module_xdebug]",
12
+ "recipe[xhprof]",
13
+ "recipe[megalodon::apache_vhosts]"
14
+ ],
15
+ "description": "",
16
+ "chef_type": "role",
17
+ "override_attributes": {
18
+ }
19
+ }