Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
move ENV setting to devcontainer.json, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Amblizer committed Jun 2, 2019
1 parent f5ab366 commit 1e73f3e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
4 changes: 1 addition & 3 deletions containers/ruby-2-rails-5/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@ RUN apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

# Set the default shell to bash instead of sh
ENV SHELL /bin/bash

ENV PROJECT_NAME test-project
ENV SHELL /bin/bash
4 changes: 4 additions & 0 deletions containers/ruby-2-rails-5/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"rebornix.Ruby",
"craigmaslowski.erb"
],
"runArgs": [
// change this to your project name to debug
"-e", "PROJECT_NAME=test-project"
],
// Uncomment the next line if you want to publish any ports.
// "appPort": ["80:80"],

Expand Down
19 changes: 2 additions & 17 deletions containers/ruby-2-rails-5/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,10 @@
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{ // 2. bundle install in project folder
{ // bundle install in project folder
"label": "bundleInstall",
"dependsOn": "setEnv", // sequential
"type": "shell",
"command": "cd ${env:PROJECT_NAME} && bundle install"
"command": "cd ${env:PROJECT_NAME} && bundle install && gem cleanup"
},
{ // 1. input project name and set as env variable, the only way
// to share it to launch.json. You can also hard code it.
"label": "setEnv",
"type": "shell",
"command": "export PROJECT_NAME=${input:projectName}"
}
],
"inputs": [
{ // prompt user to input project name for debugging
"type": "promptString",
"id": "projectName",
"description": "Please input the name of the project to debug.",
"default": "test-project"
}
]
}
4 changes: 2 additions & 2 deletions containers/ruby-2-rails-5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ This definition includes some test code that will help you verify it is working
2. Clone this repository.
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
4. Select the `containers/ruby-2-rails-5` folder.
5. After the folder has opened in the container, press <kbd>F5</kbd> to start the project. Enter the name of the project to debug at popup input bar (it is populated for the test-project).
6. You should see "* Listening on tcp://0.0.0.0:80" in the Debug Console. press <kbd>F1</kbd>. Select **Remote-Containers: Forward Porrt From Container...** then choose **Forward 80**, and by browsing http://localhost/ you should see "Yay! You’re on Rails!".
5. After the folder has opened in the container, press <kbd>F5</kbd> to start the project.
6. You should see "* Listening on tcp://0.0.0.0:80" in the Debug Console. Press <kbd>F1</kbd>. Select **Remote-Containers: Forward Porrt From Container...** then choose **Forward 80**, and by browsing http://localhost/ you should see "Yay! You’re on Rails!".
7. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.

## License
Expand Down

0 comments on commit 1e73f3e

Please sign in to comment.