Skip to content

Commit

Permalink
Vscode debug (#892)
Browse files Browse the repository at this point in the history
support debugging on vscode:

* add some gems for IDE debugging support
* add some setup script
* add settings for vscode
  • Loading branch information
tdtds committed Jun 19, 2020
1 parent aa979ca commit cbb7aab
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 41 deletions.
13 changes: 11 additions & 2 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Docker image for tdiary development

## how to build
Your editor is vscode? See bottom of this document.

## how to build an image

```
% docker build -t tdiary-devel .devcontainer
```

## how to run
## how to run in the Docker

```
% docker run -v $(pwd):/workspace -p 9292:9292 -it --rm tdiary-devel
Expand All @@ -17,3 +19,10 @@ or debugging `contrib` in the parent directory:
```
% docker run -v $(pwd):/usr/src/app -v $(pwd)/../contrib:/usr/src/contrib -p 9292:9292 -it --rm tdiary-devel
```

## develoment on vscode remote-container

1. Open the folder of this repository by Remte-Container Extention, then starting build a image automatically.
2. Only at first, run `.devcontainer/setup-app.sh` for making `tdiary.conf` and `.htpasswd`.
3. Open Debug (`Ctrl + Shift + D`) and start "Debug tDiary".
4. Open [`http://localhost:9292`](http://localhost:9292) in your browser.
6 changes: 4 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": null
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": []
"extensions": [
"rebornix.ruby"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [9292],
Expand Down
9 changes: 1 addition & 8 deletions .devcontainer/run-app.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#!/bin/bash
if [ ! -f tdiary.conf ]; then
cp tdiary.conf.beginner tdiary.conf
fi
bundle --path=vendor/bundle --jobs=4 --retry=3
bundle exec rake assets:copy
if [ ! -f .htpasswd ]; then
bundle exec bin/tdiary htpasswd
fi
source `dirname $0`/setup-app.sh
bundle exec rackup -o 0.0.0.0 -p 9292
9 changes: 9 additions & 0 deletions .devcontainer/setup-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
if [ ! -f tdiary.conf ]; then
cp tdiary.conf.beginner tdiary.conf
fi
bundle --path=vendor/bundle --jobs=4 --retry=3
bundle exec rake assets:copy
if [ ! -f .htpasswd ]; then
bundle exec bin/tdiary htpasswd
fi
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.htpasswd
vendor/bundle
public/assets/*
tdiary.pid
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ doc/*.html
/Gemfile.local
spec/javascripts/lib
node_modules
public/assets
public/assets
tdiary.pid
15 changes: 13 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@
"version": "0.2.0",
"configurations": [
{
"name": "tDiary server",
"name": "Debug tDiary",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/bin/tdiary",
"args": [
"server"
"server", "-p", "9292"
],
"useBundler": true
},
{
"name": "RSpec - all",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "bundle",
"args": [
"exec", "rake", "spec"
],
"useBundler": true
}
Expand Down
8 changes: 2 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ group :development do
gem 'redcarpet'
gem 'octokit'
gem 'mime-types'

platforms :ruby_24 do
gem 'ruby-debug-ide'
gem 'debase'
end
gem "ruby-debug-ide"
gem "debase"

group :test do
gem 'pry-byebug', platforms: [:ruby_24]
gem 'test-unit'
gem 'rspec'
gem 'capybara', require: 'capybara/rspec'
Expand Down
10 changes: 0 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ GEM
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
byebug (11.1.3)
capybara (3.32.2)
addressable
mini_mime (>= 0.1.3)
Expand All @@ -13,7 +12,6 @@ GEM
regexp_parser (~> 1.5)
xpath (~> 3.2)
childprocess (3.0.0)
coderay (1.1.2)
coveralls (0.8.23)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
Expand Down Expand Up @@ -42,7 +40,6 @@ GEM
addressable (~> 2.7)
mail (2.7.1)
mini_mime (>= 0.1.1)
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.0512)
Expand All @@ -57,12 +54,6 @@ GEM
phantomjs (2.1.1.0)
pit (0.0.7)
power_assert (1.2.0)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
public_suffix (4.0.5)
rack (2.2.2)
rack-test (1.1.0)
Expand Down Expand Up @@ -129,7 +120,6 @@ DEPENDENCIES
mime-types
octokit
pit
pry-byebug
rack
racksh
rake
Expand Down
10 changes: 0 additions & 10 deletions misc/paas/heroku/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ GEM
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
bson (4.8.2)
byebug (11.1.3)
capybara (3.32.2)
addressable
mini_mime (>= 0.1.3)
Expand All @@ -40,7 +39,6 @@ GEM
regexp_parser (~> 1.5)
xpath (~> 3.2)
childprocess (3.0.0)
coderay (1.1.2)
commonmarker (0.21.0)
ruby-enum (~> 0.5)
concurrent-ruby (1.1.6)
Expand Down Expand Up @@ -78,7 +76,6 @@ GEM
mail (2.7.1)
mini_mime (>= 0.1.1)
memcachier (0.0.2)
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.0512)
Expand Down Expand Up @@ -110,12 +107,6 @@ GEM
phantomjs (2.1.1.0)
pit (0.0.7)
power_assert (1.2.0)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
public_suffix (4.0.5)
puma (4.3.5)
nio4r (~> 2.0)
Expand Down Expand Up @@ -219,7 +210,6 @@ DEPENDENCIES
omniauth
omniauth-twitter
pit
pry-byebug
puma
rack
racksh
Expand Down

0 comments on commit cbb7aab

Please sign in to comment.