mirror of
https://github.com/RubyMetric/chsrc
synced 2025-06-14 15:26:59 +08:00
Add support for bioconductor
This commit is contained in:
parent
e92509d0e0
commit
b7fb8326b6
@ -41,7 +41,7 @@ set <target> <mirror> # 换源,指定使用某镜像站
|
|||||||
- [ ] `chsrc set rust` 或 `chsrc set cargo` 或 `chsrc crate`
|
- [ ] `chsrc set rust` 或 `chsrc set cargo` 或 `chsrc crate`
|
||||||
- [ ] `chsrc set java` 或 `chsrc set maven` 或 `chsrc set mvn` 或 `chsrc gradle`
|
- [ ] `chsrc set java` 或 `chsrc set maven` 或 `chsrc set mvn` 或 `chsrc gradle`
|
||||||
|
|
||||||
- [x] `chsrc set r` 或 `chsrc set cran`
|
- [x] `chsrc set r` 或 `chsrc set cran` (同时会为 `bioconductor` 换源)
|
||||||
- [ ] `chsrc set julia`
|
- [ ] `chsrc set julia`
|
||||||
|
|
||||||
## 操作系统
|
## 操作系统
|
||||||
|
21
chsrc.c
21
chsrc.c
@ -631,6 +631,11 @@ pl_java_setsrc (char* option)
|
|||||||
void
|
void
|
||||||
pl_r_getsrc (char* option)
|
pl_r_getsrc (char* option)
|
||||||
{
|
{
|
||||||
|
// 或参考:https://zhuanlan.zhihu.com/p/585036231
|
||||||
|
//
|
||||||
|
// options()$repos
|
||||||
|
// options()$BioC_mirror
|
||||||
|
//
|
||||||
char* cmd = NULL;
|
char* cmd = NULL;
|
||||||
if(xy_on_windows) {
|
if(xy_on_windows) {
|
||||||
cmd = "type %USERPROFILE%\\Documents\\.Rprofile";
|
cmd = "type %USERPROFILE%\\Documents\\.Rprofile";
|
||||||
@ -643,7 +648,6 @@ pl_r_getsrc (char* option)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* R 换源,参考:https://help.mirrors.cernet.edu.cn/CRAN/
|
* R 换源,参考:https://help.mirrors.cernet.edu.cn/CRAN/
|
||||||
* TODO: bioconductor 换源
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pl_r_setsrc (char* option)
|
pl_r_setsrc (char* option)
|
||||||
@ -659,9 +663,24 @@ pl_r_setsrc (char* option)
|
|||||||
source_info source = pl_r_sources[index];
|
source_info source = pl_r_sources[index];
|
||||||
chsrc_say_selection(&source);
|
chsrc_say_selection(&source);
|
||||||
|
|
||||||
|
char* bioconductor_url = xy_str_delete_suffix(xy_str_delete_suffix(source.url, "cran/"), "CRAN/");
|
||||||
|
bioconductor_url = xy_2strjoin(bioconductor_url, "bioconductor");
|
||||||
|
|
||||||
const char* file = xy_strjoin (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))" );
|
const char* file = xy_strjoin (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))" );
|
||||||
|
|
||||||
char* cmd = NULL;
|
char* cmd = NULL;
|
||||||
|
// 或者我们调用 r.exe --slave -e 上面的内容
|
||||||
|
if (xy_on_windows)
|
||||||
|
cmd = xy_strjoin(3, "echo ", file, " >> %USERPROFILE%/Documents/.Rprofile");
|
||||||
|
else
|
||||||
|
cmd = xy_strjoin(3, "echo ", file, " >> ~/.Rprofile");
|
||||||
|
|
||||||
|
chsrc_logcmd(cmd);
|
||||||
|
system(cmd);
|
||||||
|
|
||||||
|
|
||||||
|
file = xy_strjoin (3, "options(BioC_mirror=\"", bioconductor_url, "\")" );
|
||||||
|
// 或者我们调用 r.exe --slave -e 上面的内容
|
||||||
if (xy_on_windows)
|
if (xy_on_windows)
|
||||||
cmd = xy_strjoin(3, "echo ", file, " >> %USERPROFILE%/Documents/.Rprofile");
|
cmd = xy_strjoin(3, "echo ", file, " >> %USERPROFILE%/Documents/.Rprofile");
|
||||||
else
|
else
|
||||||
|
13
chsrc.h
13
chsrc.h
@ -175,8 +175,6 @@ pl_nodejs_sources[] = {
|
|||||||
*
|
*
|
||||||
* 参考:https://help.mirrors.cernet.edu.cn/CPAN/
|
* 参考:https://help.mirrors.cernet.edu.cn/CPAN/
|
||||||
*
|
*
|
||||||
* Jlu 吉林大学没有该源
|
|
||||||
*
|
|
||||||
* TODO: 速度未经测试,请Perl用户协助
|
* TODO: 速度未经测试,请Perl用户协助
|
||||||
*/
|
*/
|
||||||
pl_perl_sources[] = {
|
pl_perl_sources[] = {
|
||||||
@ -191,15 +189,16 @@ pl_perl_sources[] = {
|
|||||||
/**
|
/**
|
||||||
* 2023-09-04 更新
|
* 2023-09-04 更新
|
||||||
*
|
*
|
||||||
* TODO: 速度未经测试,请R用户协助
|
* @note 以下注释的,是不含有bioconductor的镜像站,
|
||||||
|
* 我们在换cran的同时,也直接帮助用户换bioconductor
|
||||||
*/
|
*/
|
||||||
pl_r_sources[] = {
|
pl_r_sources[] = {
|
||||||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/cran/"},
|
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/cran/"},
|
||||||
{&Ali, "https://mirrors.aliyun.com/CRAN/"},
|
// {&Ali, "https://mirrors.aliyun.com/CRAN/"},
|
||||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CRAN/"},
|
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CRAN/"},
|
||||||
{&Sustech, "https://mirrors.sustech.edu.cn/CRAN"},
|
// {&Sustech, "https://mirrors.sustech.edu.cn/CRAN"},
|
||||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/CRAN/"},
|
// {&Bfsu, "https://mirrors.bfsu.edu.cn/CRAN/"},
|
||||||
{&Bjtu, "https://mirror.bjtu.edu.cn/cran/"},
|
// {&Bjtu, "https://mirror.bjtu.edu.cn/cran/"},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user