Skip to content

Commit

Permalink
feat(gems): installed from the generated Gemfile
Browse files Browse the repository at this point in the history
  • Loading branch information
travi committed Aug 20, 2019
1 parent 4dda5fa commit 2fd1c6e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ leverage [rbenv](https://github.com/rbenv/rbenv) to install the version of
[Ruby](https://www.ruby-lang.org/en/) that is defined in the generated
`.ruby-version` file.

It is also expected that [bundler](https://bundler.io) is available for
installing gems from a [Gemfile](https://bundler.io/v2.0/man/gemfile.5.html).
It can be installed automatically in [rbenv](https://github.com/rbenv/rbenv)
managed [Ruby](https://www.ruby-lang.org/en/) versions by [including it in your
`~/.rbenv/default-gems` file](https://github.com/rbenv/rbenv-default-gems#usage)
when you have the [`rbenv-default-gems` plugin](https://github.com/rbenv/rbenv-default-gems)
installed.

## Contributing

<!-- contribution badges -->
Expand Down
4 changes: 4 additions & 0 deletions src/gems-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {assert} from 'chai';
import sinon from 'sinon';
import any from '@travi/any';
import * as fsAsync from '../thirdparty-wrappers/fs';
import * as execa from '../thirdparty-wrappers/execa';
import scaffoldGems from './gems';

suite('Gems', () => {
Expand All @@ -12,6 +13,7 @@ suite('Gems', () => {
sandbox = sinon.createSandbox();

sandbox.stub(fsAsync, 'copyFile');
sandbox.stub(execa, 'default');
});

teardown(() => sandbox.restore());
Expand All @@ -26,5 +28,7 @@ suite('Gems', () => {
resolve(__dirname, '..', 'templates', 'Gemfile.rb'),
`${projectRoot}/Gemfile`
);
assert.calledWith(execa.default, 'bundle', ['install']);
assert.isTrue(execa.default.calledAfter(fsAsync.copyFile));
});
});
3 changes: 3 additions & 0 deletions src/gems.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import {resolve} from 'path';
import {copyFile} from '../thirdparty-wrappers/fs';
import execa from '../thirdparty-wrappers/execa';

export default async function (projectRoot) {
await copyFile(resolve(__dirname, '..', 'templates', 'Gemfile.rb'), `${projectRoot}/Gemfile`);

await execa('bundle', ['install']);
}
1 change: 1 addition & 0 deletions src/ruby-version-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ suite('ruby-version', () => {

assert.calledWith(fsPromises.writeFile, `${projectRoot}/.ruby-version`, '2.6.3');
assert.calledWith(execa.default, 'rbenv', ['install']);
assert.isTrue(execa.default.calledAfter(fsPromises.writeFile));
});
});

0 comments on commit 2fd1c6e

Please sign in to comment.