mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-02-24 05:50:55 +08:00
Split php out
This commit is contained in:
parent
182bed75d6
commit
2219cd3a7d
@ -127,19 +127,6 @@ typedef struct {
|
||||
|
||||
|
||||
static SourceInfo
|
||||
/**
|
||||
* @time 2024-04-18 更新
|
||||
* @note 缺少教育网或开源社区软件源
|
||||
*/
|
||||
pl_php_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Ali, "https://mirrors.aliyun.com/composer/"},
|
||||
{&Tencent, "https://mirrors.tencent.com/composer/"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/php/"}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @time 2024-05-24 更新
|
||||
* @note 以下都支持稀疏索引,我们换源时都将默认添加 `sparse+`
|
||||
@ -770,7 +757,6 @@ wr_tex_sources[] = {
|
||||
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
|
||||
|
||||
|
||||
def_sources_n(pl_php);
|
||||
def_sources_n(pl_rust);
|
||||
def_sources_n(pl_java); def_sources_n(pl_clojure);
|
||||
def_sources_n(pl_dotnet); def_sources_n(pl_dart); def_sources_n(pl_haskell);
|
||||
|
44
src/chsrc.c
44
src/chsrc.c
@ -26,48 +26,7 @@
|
||||
#include "recipe/lang/python.c"
|
||||
#include "recipe/lang/nodejs.c"
|
||||
#include "recipe/lang/perl.c"
|
||||
|
||||
|
||||
void
|
||||
pl_php_check_cmd ()
|
||||
{
|
||||
chsrc_ensure_program ("composer");
|
||||
}
|
||||
|
||||
/**
|
||||
* 已在Windows上测试通过,待其他平台PHP用户确认
|
||||
*/
|
||||
void
|
||||
pl_php_getsrc (char *option)
|
||||
{
|
||||
pl_php_check_cmd ();
|
||||
chsrc_run ("composer config -g repositories", RunOpt_Default);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP 换源,参考:https://developer.aliyun.com/composer
|
||||
*/
|
||||
void
|
||||
pl_php_setsrc (char *option)
|
||||
{
|
||||
pl_php_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_php);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
char *where = " -g ";
|
||||
if (CliOpt_Locally==true)
|
||||
{
|
||||
where = " ";
|
||||
}
|
||||
|
||||
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
#include "recipe/lang/php.c"
|
||||
#include "recipe/lang/lua.c"
|
||||
#include "recipe/lang/go.c"
|
||||
|
||||
@ -1932,7 +1891,6 @@ wr_anaconda_setsrc (char *option)
|
||||
|
||||
|
||||
/************************************** Begin Target Matrix ****************************************/
|
||||
def_target(pl_php);
|
||||
def_target(pl_rust); def_target(pl_java); def_target(pl_dart); def_target(pl_ocaml);
|
||||
def_target(pl_r); def_target(pl_julia);
|
||||
def_target_noget (pl_clojure);
|
||||
|
63
src/recipe/lang/php.c
Normal file
63
src/recipe/lang/php.c
Normal file
@ -0,0 +1,63 @@
|
||||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Created on : <2023-09-06>
|
||||
* Last modified : <2024-08-09>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @time 2024-04-18 更新
|
||||
* @note 缺少教育网或开源社区软件源
|
||||
*/
|
||||
static SourceInfo
|
||||
pl_php_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Ali, "https://mirrors.aliyun.com/composer/"},
|
||||
{&Tencent, "https://mirrors.tencent.com/composer/"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/php/"}
|
||||
};
|
||||
def_sources_n(pl_php);
|
||||
|
||||
|
||||
void
|
||||
pl_php_check_cmd ()
|
||||
{
|
||||
chsrc_ensure_program ("composer");
|
||||
}
|
||||
|
||||
/**
|
||||
* 已在Windows上测试通过,待其他平台PHP用户确认
|
||||
*/
|
||||
void
|
||||
pl_php_getsrc (char *option)
|
||||
{
|
||||
pl_php_check_cmd ();
|
||||
chsrc_run ("composer config -g repositories", RunOpt_Default);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP 换源,参考:https://developer.aliyun.com/composer
|
||||
*/
|
||||
void
|
||||
pl_php_setsrc (char *option)
|
||||
{
|
||||
pl_php_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_php);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
char *where = " -g ";
|
||||
if (CliOpt_Locally==true)
|
||||
{
|
||||
where = " ";
|
||||
}
|
||||
|
||||
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
def_target(pl_php);
|
Loading…
x
Reference in New Issue
Block a user