Skip to content

Commit 67915c3

Browse files
committed
Improve Ruby recipe
1 parent 9c51e8c commit 67915c3

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/recipe/lang/Ruby/Ruby.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pl_ruby_prelude (void)
1818
chef_allow_gsr(pl_ruby);
1919

2020
chef_set_created_on (this, "2023-08-29");
21-
chef_set_last_updated (this, "2025-07-14");
21+
chef_set_last_updated (this, "2025-08-11");
2222
chef_set_sources_last_updated (this, "2024-12-18");
2323

2424
chef_set_authors (this, 1, "Aoran Zeng", "[email protected]");
@@ -31,17 +31,16 @@ pl_ruby_prelude (void)
3131
chef_allow_user_define(this);
3232

3333
def_sources_begin()
34-
{&UpstreamProvider, "https://rubygems.org", "https://rubygems.org/gems/nokogiri-1.15.0-java.gem"},
35-
{&RubyChina, "https://gems.ruby-china.com/", DelegateToMirror},
36-
{&Ustc, "https://mirrors.ustc.edu.cn/rubygems/", DelegateToMirror}
37-
38-
// {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rubygems/", DelegateToMirror},
39-
// {&Bfsu, "https://mirrors.bfsu.edu.cn/rubygems/", DelegateToMirror},
40-
41-
// {&Tencent, "https://mirrors.tencent.com/rubygems/", DelegateToMirror},
42-
// {&Tencent_Intra, "https://mirrors.tencentyun.com/rubygems/", DelegateToMirror},
43-
// {&Ali, "https://mirrors.aliyun.com/rubygems/", DelegateToMirror},
44-
// {&Huawei, "https://mirrors.huaweicloud.com/repository/rubygems/", DelegateToMirror},
34+
{&UpstreamProvider, "https://rubygems.org/", "https://rubygems.org/gems/nokogiri-1.15.0-java.gem"},
35+
{&RubyChina, "https://gems.ruby-china.com/", DelegateToMirror},
36+
{&Ustc, "https://mirrors.ustc.edu.cn/rubygems/", DelegateToMirror}
37+
// {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rubygems/", DelegateToMirror},
38+
// {&Bfsu, "https://mirrors.bfsu.edu.cn/rubygems/", DelegateToMirror},
39+
40+
// {&Tencent, "https://mirrors.tencent.com/rubygems/", DelegateToMirror},
41+
// {&Tencent_Intra, "https://mirrors.tencentyun.com/rubygems/", DelegateToMirror},
42+
// {&Ali, "https://mirrors.aliyun.com/rubygems/", DelegateToMirror},
43+
// {&Huawei, "https://mirrors.huaweicloud.com/repository/rubygems/", DelegateToMirror},
4544
def_sources_end()
4645
}
4746

@@ -76,11 +75,16 @@ pl_ruby_setsrc (char *option)
7675

7776
char *cmd = NULL;
7877

78+
// step1
7979
xy_run_iter ("gem sources -l", 0, pl_ruby_remove_gem_source);
8080

8181
cmd = xy_2strjoin ("gem source -a ", source.url);
8282
chsrc_run (cmd, RunOpt_Default);
8383

84+
// 我们在 step1 中,把源全部清空了,但是现在 RubyGems 的行为是: 当清空会自动给你把默认源给加回来
85+
// 所以我们在这一步,最后一次删除默认源,确保它不存在
86+
pl_ruby_remove_gem_source (this->sources[0].url);
87+
8488

8589
chsrc_ensure_program ("bundle");
8690

0 commit comments

Comments
 (0)