Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to customize the rspec command. #8

Merged
merged 2 commits into from Jan 9, 2020

Conversation

@lucasprag
Copy link
Contributor

lucasprag commented Dec 17, 2019

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 =)

lucasprag added 2 commits Dec 17, 2019
This is needed because people might want to run rspec using
foreman or docker like `foreman run bundle exec rspec --color`
@lucasprag

This comment has been minimized.

Copy link
Contributor Author

lucasprag commented Dec 17, 2019

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?

@@ -94,6 +95,10 @@ function bundleRspecLastExecuted() {
}
}

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

This comment has been minimized.

Copy link
@thadeu

thadeu Dec 30, 2019

Owner

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

This comment has been minimized.

Copy link
@lucasprag

lucasprag Dec 31, 2019

Author Contributor

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

@@ -94,6 +95,10 @@ function bundleRspecLastExecuted() {
}
}

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

This comment has been minimized.

Copy link
@thadeu

thadeu Dec 30, 2019

Owner
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";

This comment has been minimized.

Copy link
@lucasprag

lucasprag Dec 31, 2019

Author Contributor

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

@andypike

This comment has been minimized.

Copy link

andypike commented Jan 2, 2020

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
Projects
None yet
3 participants
You can鈥檛 perform that action at this time.