Skip to content

Add ability to customize the rspec command.#8

Merged
thadeu merged 2 commits into
thadeu:masterfrom
lucasprag:rspec-command
Jan 9, 2020
Merged

Add ability to customize the rspec command.#8
thadeu merged 2 commits into
thadeu:masterfrom
lucasprag:rspec-command

Conversation

@lucasprag

@lucasprag lucasprag commented Dec 17, 2019

Copy link
Copy Markdown
Contributor

This is needed because people might want to run rspec using
foreman or docker like foreman run bundle exec rspec --color

Hi 👋

Thanks for building this great extension. I was using it and I felt the need to customize the rspec command to prepend foreman. I've seen in plugins for other editors that they just let the user be able to customize the entire command so I did exactly that.

As the updated readme says the user can customize the rspec command using the vscode settings like:

{
  "vscode-run-rspec-file.custom-command": "foreman run bundle exec rspec --color",
}

and the default is bundle exec rspec --color

Maybe in the future we can update the rspec command based on projects somehow.

Thanks for reviewing @thadeu =)

This is needed because people might want to run rspec using
foreman or docker like `foreman run bundle exec rspec --color`
@lucasprag

lucasprag commented Dec 17, 2019

Copy link
Copy Markdown
Contributor Author

I just found out that we can overwrite any settings per project using the .vscode/settings.json file. That's cool 😎 . So I added a one line description to let people know since it's quite relevant in this case. Is that ok @thadeu?

Comment thread src/extension.ts
}

function getRSpecCommand(): string {
return vscode.workspace.getConfiguration().get(SETTINGS_RSPEC_COMMAND_KEY);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucasprag if configuration is empty or not exists? we should be return default value "bundle exec rspec --color" right?

@lucasprag lucasprag Dec 31, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah, I did that in my first version, but eventually I saw that there is an option to set the default in the configuration file so I did it here.
Docs: https://code.visualstudio.com/api/references/contribution-points#contributes.configuration

Comment thread src/extension.ts
}

function getRSpecCommand(): string {
return vscode.workspace.getConfiguration().get(SETTINGS_RSPEC_COMMAND_KEY);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return vscode.workspace.getConfiguration().get(SETTINGS_RSPEC_COMMAND_KEY);
let configCommand = vscode.workspace
.getConfiguration()
.get(SETTINGS_RSPEC_COMMAND_KEY);
return configCommand || "bundle exec rspec --color";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't need this based on my comment above, thanks =)

@andypike

andypike commented Jan 2, 2020

Copy link
Copy Markdown

This is exactly what I was looking for, thanks both for all your efforts! Can't wait to give this a go as we run our projects from inside Docker and so need to configure the command too <3

@thadeu thadeu merged commit ef790ae into thadeu:master Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants