diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 56b8435a9..4a1d0703c 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -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 @@ -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. \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0ca1b49f8..05bbf7d91 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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], diff --git a/.devcontainer/run-app.sh b/.devcontainer/run-app.sh index bec8f3a86..e2b86cd35 100644 --- a/.devcontainer/run-app.sh +++ b/.devcontainer/run-app.sh @@ -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 diff --git a/.devcontainer/setup-app.sh b/.devcontainer/setup-app.sh new file mode 100644 index 000000000..6e19267ad --- /dev/null +++ b/.devcontainer/setup-app.sh @@ -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 diff --git a/.dockerignore b/.dockerignore index 934e4a13b..65c43d3b0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,3 +2,4 @@ .htpasswd vendor/bundle public/assets/* +tdiary.pid \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3d970d3b3..cc4819bc6 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,5 @@ doc/*.html /Gemfile.local spec/javascripts/lib node_modules -public/assets \ No newline at end of file +public/assets +tdiary.pid \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index d2dae7714..bae6deb7f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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 } diff --git a/Gemfile b/Gemfile index 448f3bf08..54c822d90 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 950abaf7a..31c9f36c1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -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) @@ -129,7 +120,6 @@ DEPENDENCIES mime-types octokit pit - pry-byebug rack racksh rake diff --git a/misc/paas/heroku/Gemfile.lock b/misc/paas/heroku/Gemfile.lock index d7ffe59d6..7b982d485 100644 --- a/misc/paas/heroku/Gemfile.lock +++ b/misc/paas/heroku/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -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) @@ -219,7 +210,6 @@ DEPENDENCIES omniauth omniauth-twitter pit - pry-byebug puma rack racksh