You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+61Lines changed: 61 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,6 +159,67 @@ As for the local dev setup:
159
159
- there's docker-compose in the rails_application, if you're into Docker
160
160
- Ruby version, it's best to use the same, which we use for CI/production: [as defined in this file](https://github.com/RailsEventStore/ecommerce/blob/master/.github/workflows/rails_application.yml#L31)
161
161
162
+
**Windows setup**
163
+
164
+
If you're a Windows user, there are some additional steps thay are needed to comfortably work with this code.
165
+
A very convenient way is to use WSL (Linux subsystem) for working with Rails and this application. It allows to avoid many issues you'd meet working directly on Windows.
166
+
167
+
The following steps are based on VS Code, but you can use any editor you like.
168
+
169
+
Follow these steps to set up this application in WSL on Windows 11 with VS Code:
170
+
- install VS Code and [WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl) in your Windows environment
171
+
- install WSL, Rails and PostgreSQL following this tutorial: https://gorails.com/setup/windows/11 (create a postgres user with password)
172
+
- install and start Redis with the following commands:
173
+
174
+
```console
175
+
# Install Redis
176
+
sudo apt-get update
177
+
sudo apt-get install redis-server
178
+
179
+
# Check Redis version to make sure it has been installed correctly
180
+
redis-server --version
181
+
182
+
# Start the Redis server
183
+
sudo service redis-server start
184
+
185
+
# To start Redis automatically when your WSL instance starts:
186
+
sudo systemctl enable redis-server
187
+
```
188
+
189
+
- clone this repository into your Ubuntu WSL (it is advised to use a path under `/home/your_username/`)
190
+
-`cd` into the main repository folder and execute `code .` It should open the repo in VS Code on Windows
191
+
- configure environment variables for your postgres database connection (username and password) in `.env.development` and `.env.test` files
192
+
- in the main repository folder, run `make install`. It should install all necessary dependencies and set up a database
193
+
-`cd` into `rails_application` folder and execute `rails tailwindcss:install`
194
+
-`cd` back into the main repository folder and execute `make dev`. It should start the eCommerce Rails web app and you should be able to access it
195
+
196
+
*OPTIONAL: debugging the app from VS Code*
197
+
198
+
If you are used to debugging using breakpoints, it can be done from VS Code:
199
+
* install the [VSCode rdbg Ruby Debugger](https://marketplace.visualstudio.com/items?itemName=KoichiSasada.vscode-rdbg) extension
200
+
* stop the Rails app
201
+
* add `gem 'debug'` to `rails_application/Gemfile`
202
+
*`cd` into `rails_application` folder and open VS Code from there (`code .`)
203
+
* add `launch.json` file by going to "Run and Debug" section, clicking "Create a launch.json file" and choosing "Ruby (rdbg)" and add the following configuration entry:
204
+
205
+
```json
206
+
{
207
+
"type": "rdbg",
208
+
"name": "Debug Rails Integrated with VSCode",
209
+
"rdbgPath": "bundle exec rdbg",
210
+
"request": "launch",
211
+
"command": "bin/rails",
212
+
"script": "s",
213
+
"args": [],
214
+
"askParameters": false,
215
+
}
216
+
```
217
+
* run the app with debugger attached using "Debug Rails Integrated with VSCode" configuration in "Run and Debug" section
218
+
* from now on, the app should be running and you should be able to place breakpoints in the code (e.g. in controllers) and debug them
219
+
220
+
A good alternative to VS Code for integrated debugging experience on Windows is RubyMine IDE.
221
+
222
+
162
223
**Bundler note**
163
224
164
225
Please check that your bundler version is not ancient, and up to date. For more details check:
0 commit comments