Skip to content

Commit

Permalink
chore: remove unused gemfile detection
Browse files Browse the repository at this point in the history
  • Loading branch information
orsagie authored and lili2311 committed Aug 18, 2020
1 parent e182d1f commit de5db44
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
21 changes: 6 additions & 15 deletions src/lib/plugins/rubygems/inspectors/gemfile.ts
@@ -1,5 +1,5 @@
import * as path from 'path';
import { Files, tryGetSpec } from './try-get-spec';
import { tryGetSpec } from './try-get-spec';
import { Spec } from './index';

const pattern = /^Gemfile(\.lock)*$/;
Expand All @@ -11,31 +11,22 @@ export function canHandle(file: string): boolean {
export async function gatherSpecs(root: string, target: string): Promise<Spec> {
const targetName = path.basename(target);
const targetDir = path.dirname(target);
const files: Files = {};

const gemfileLock = await tryGetSpec(
root,
path.join(targetDir, 'Gemfile.lock'),
);

if (gemfileLock) {
files.gemfileLock = gemfileLock;
return {
packageName: path.basename(root),
targetFile: path.join(targetDir, targetName),
files: { gemfileLock },
};
} else {
throw new Error(
"Missing Gemfile.lock file: we can't test " +
'without dependencies.\nPlease run `bundle install` first.',
);
}

const gemfile = await tryGetSpec(root, path.join(targetDir, 'Gemfile'));

if (gemfile) {
files.gemfile = gemfile;
}

return {
packageName: path.basename(root),
targetFile: path.join(targetDir, targetName),
files,
};
}
6 changes: 0 additions & 6 deletions src/lib/plugins/rubygems/inspectors/gemspec.ts
Expand Up @@ -30,12 +30,6 @@ export async function gatherSpecs(root: string, target: string): Promise<Spec> {
files.gemfileLock = gemfileLock;
}

const gemfile = await tryGetSpec(root, path.join(targetDir, 'Gemfile'));

if (gemfile) {
files.gemfile = gemfile;
}

return {
packageName: path.basename(root),
targetFile: path.join(targetDir, targetName),
Expand Down
1 change: 0 additions & 1 deletion src/lib/plugins/rubygems/inspectors/try-get-spec.ts
Expand Up @@ -8,7 +8,6 @@ interface File {

export interface Files {
gemfileLock?: File;
gemfile?: File;
gemspec?: File;
}

Expand Down

0 comments on commit de5db44

Please sign in to comment.