mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-01-22 20:44:01 +08:00
Split r out
This commit is contained in:
parent
79e7296b63
commit
4a8a3dcb9a
|
@ -186,24 +186,6 @@ pl_haskell_sources[] = {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-04 更新
|
||||
* @note {
|
||||
* 以下注释的,是不含有bioconductor的镜像站,
|
||||
* 我们在换cran的同时,也直接帮助用户换bioconductor
|
||||
* }
|
||||
*/
|
||||
pl_r_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/cran/"},
|
||||
// {&Ali, "https://mirrors.aliyun.com/CRAN/"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CRAN/"},
|
||||
// {&Sustech, "https://mirrors.sustech.edu.cn/CRAN"},
|
||||
// {&Bfsu, "https://mirrors.bfsu.edu.cn/CRAN/"},
|
||||
// {&Bjtu, "https://mirror.bjtu.edu.cn/cran/"},
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-05 更新
|
||||
* @note 缺少商业公司或开源社区软件源
|
||||
|
@ -724,7 +706,7 @@ wr_tex_sources[] = {
|
|||
|
||||
def_sources_n(pl_clojure);
|
||||
def_sources_n(pl_dotnet); def_sources_n(pl_dart); def_sources_n(pl_haskell);
|
||||
def_sources_n(pl_r); def_sources_n(pl_julia);
|
||||
def_sources_n(pl_julia);
|
||||
|
||||
def_sources_n(os_ubuntu); def_sources_n(os_mint);
|
||||
def_sources_n(os_debian); def_sources_n(os_fedora);
|
||||
|
|
49
src/chsrc.c
49
src/chsrc.c
|
@ -176,54 +176,7 @@ pl_haskell_setsrc (char *option)
|
|||
|
||||
|
||||
#include "recipe/lang/ocaml.c"
|
||||
|
||||
void
|
||||
pl_r_getsrc (char *option)
|
||||
{
|
||||
// 或参考:https://zhuanlan.zhihu.com/p/585036231
|
||||
//
|
||||
// options()$repos
|
||||
// options()$BioC_mirror
|
||||
//
|
||||
if (xy_on_windows)
|
||||
{
|
||||
chsrc_view_file ("~/Documents/.Rprofile");
|
||||
}
|
||||
else
|
||||
{
|
||||
chsrc_view_file ("~/.Rprofile");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* R 换源,参考:https://help.mirrors.cernet.edu.cn/CRAN/
|
||||
*/
|
||||
void
|
||||
pl_r_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_r);
|
||||
chsrc_confirm_source (&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 *towrite1 = xy_strjoin (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))" );
|
||||
const char *towrite2 = xy_strjoin (3, "options(BioC_mirror=\"", bioconductor_url, "\")" );
|
||||
|
||||
// 或者我们调用 r.exe --slave -e 上面的内容
|
||||
if (xy_on_windows)
|
||||
{
|
||||
chsrc_append_to_file (towrite1, "~/Documents/.Rprofile");
|
||||
chsrc_append_to_file (towrite2, "~/Documents/.Rprofile");
|
||||
}
|
||||
else
|
||||
{
|
||||
chsrc_append_to_file (towrite1, "~/.Rprofile");
|
||||
chsrc_append_to_file (towrite2, "~/.Rprofile");
|
||||
}
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
}
|
||||
#include "recipe/lang/r.c"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
/* Begin Target Matrix */
|
||||
def_target(pl_dart);
|
||||
def_target(pl_r); def_target(pl_julia);
|
||||
def_target(pl_julia);
|
||||
def_target_noget (pl_clojure);
|
||||
def_target_noget (pl_dotnet);
|
||||
def_target_noget (pl_haskell);
|
||||
|
|
79
src/recipe/lang/r.c
Normal file
79
src/recipe/lang/r.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* Created on : <2023-09-21>
|
||||
* Last modified : <2024-08-15>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @time 2023-09-04 更新
|
||||
* @note {
|
||||
* 以下注释的,是不含有bioconductor的镜像站,
|
||||
* 我们在换cran的同时,也直接帮助用户换bioconductor
|
||||
* }
|
||||
*/
|
||||
static SourceInfo
|
||||
pl_r_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/cran/"},
|
||||
// {&Ali, "https://mirrors.aliyun.com/CRAN/"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CRAN/"},
|
||||
// {&Sustech, "https://mirrors.sustech.edu.cn/CRAN"},
|
||||
// {&Bfsu, "https://mirrors.bfsu.edu.cn/CRAN/"},
|
||||
// {&Bjtu, "https://mirror.bjtu.edu.cn/cran/"},
|
||||
};
|
||||
def_sources_n(pl_r);
|
||||
|
||||
|
||||
void
|
||||
pl_r_getsrc (char *option)
|
||||
{
|
||||
/**
|
||||
* 或参考:https://zhuanlan.zhihu.com/p/585036231
|
||||
*
|
||||
* options()$repos
|
||||
* options()$BioC_mirror
|
||||
*/
|
||||
if (xy_on_windows)
|
||||
{
|
||||
chsrc_view_file ("~/Documents/.Rprofile");
|
||||
}
|
||||
else
|
||||
{
|
||||
chsrc_view_file ("~/.Rprofile");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* R 换源,参考:https://help.mirrors.cernet.edu.cn/CRAN/
|
||||
*/
|
||||
void
|
||||
pl_r_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_r);
|
||||
chsrc_confirm_source (&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 *towrite1 = xy_strjoin (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))" );
|
||||
const char *towrite2 = xy_strjoin (3, "options(BioC_mirror=\"", bioconductor_url, "\")" );
|
||||
|
||||
// 或者我们调用 r.exe --slave -e 上面的内容
|
||||
if (xy_on_windows)
|
||||
{
|
||||
chsrc_append_to_file (towrite1, "~/Documents/.Rprofile");
|
||||
chsrc_append_to_file (towrite2, "~/Documents/.Rprofile");
|
||||
}
|
||||
else
|
||||
{
|
||||
chsrc_append_to_file (towrite1, "~/.Rprofile");
|
||||
chsrc_append_to_file (towrite2, "~/.Rprofile");
|
||||
}
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target(pl_r);
|
Loading…
Reference in New Issue
Block a user