Skip to content

Commit

Permalink
Run bundle install on behalf of the user before proceeding
Browse files Browse the repository at this point in the history
See: #2400

This catches all sorts of errors (example: mismatched Ruby versions) early.
  • Loading branch information
rubys committed Jun 4, 2023
1 parent cd430c6 commit 90edeac
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scanner/rails.go
Expand Up @@ -26,6 +26,22 @@ func configureRails(sourceDir string, config *ScannerConfig) (*SourceInfo, error
return nil, nil
}

// verify that the bundle will install before proceeding
args := []string{"install"}

if checksPass(sourceDir, fileExists("Gemfile.lock")) {
args = append(args, "--quiet")
}

cmd := exec.Command("bundle", args...)
cmd.Stdin = nil
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

if err := cmd.Run(); err != nil {
return nil, errors.Wrap(err, "Failed to install bundle, exiting")
}

s := &SourceInfo{
Family: "Rails",
Callback: RailsCallback,
Expand Down

0 comments on commit 90edeac

Please sign in to comment.