Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jun 16, 2021. It is now read-only.

Commit c58246c

Browse files
author
zouyi
committed
add lang
1 parent 2765114 commit c58246c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

language/php.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
require File.expand_path("../../Requirements/php-meta-requirement", __FILE__)
2+
3+
module Language
4+
module PHP
5+
module Composer
6+
def self.included(base)
7+
base.depends_on "composer" => :build
8+
end
9+
10+
def composer(*args)
11+
# No interaction is possible during brew commands
12+
args.unshift("--no-interaction")
13+
14+
if ARGV.verbose?
15+
args.unshift("--verbose")
16+
end
17+
18+
system "composer", *args
19+
end
20+
21+
def composer_config_github_api_token
22+
# Configure the Github API token if we have one and no token is configured yet
23+
if ENV["HOMEBREW_GITHUB_API_TOKEN"] and !(quiet_system "composer", "--no-interaction", "config", "github-oauth.github.com")
24+
# We don't want to expose the token in the terminal
25+
ohai "composer config github-oauth.github.com <HOMEBREW_GITHUB_API_TOKEN>".strip
26+
Homebrew._system "composer", "--no-interaction", "config", "github-oauth.github.com", ENV["HOMEBREW_GITHUB_API_TOKEN"]
27+
end
28+
end
29+
30+
def composer_install(*args)
31+
# Use a token for install to get around API rate limit
32+
composer_config_github_api_token
33+
composer "install", *args
34+
end
35+
end
36+
end
37+
end

0 commit comments

Comments
 (0)