Skip to content

Commit fb9d6fb

Browse files
committed
Automatically create a ~/.gemrc file
* To avoid generating documentation on `gem install`, which can take a long time.
1 parent 9c77d1b commit fb9d6fb

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

dist/index.js

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export async function run() {
1818
const engineVersions = installer.getAvailableVersions(platform, engine)
1919
const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version)
2020

21+
createGemRC()
22+
2123
const [rubyPrefix, newPathEntries] = await installer.install(platform, ruby)
2224

2325
setupPath(ruby, newPathEntries)
@@ -82,6 +84,13 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, version)
8284
return engine + '-' + version
8385
}
8486

87+
function createGemRC() {
88+
const gemrc = path.join(os.homedir(), '.gemrc')
89+
if (!fs.existsSync(gemrc)) {
90+
fs.writeFileSync(gemrc, `gem: --no-document${os.EOL}`)
91+
}
92+
}
93+
8594
function setupPath(ruby, newPathEntries) {
8695
const originalPath = process.env['PATH'].split(path.delimiter)
8796
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))

ruby-builder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function getAvailableVersions(platform, engine) {
1414

1515
export async function install(platform, ruby) {
1616
const rubyPrefix = await downloadAndExtract(platform, ruby)
17-
let newPathEntries;
17+
let newPathEntries
1818
if (ruby.startsWith('rubinius')) {
1919
newPathEntries = [path.join(rubyPrefix, 'bin'), path.join(rubyPrefix, 'gems', 'bin')]
2020
} else {

0 commit comments

Comments
 (0)