diff --git a/.gitignore b/.gitignore index 0c5c10e..9452511 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,8 @@ appdev/ node_modules package-lock.json core.chrome* +vendor/bundle/* +!vendor/bundle/.keep !/vendor* .theia/.ltici_apitoken.yml diff --git a/.gitpod.yml b/.gitpod.yml index c765d5b..20d17c4 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,11 +1,12 @@ -image: patrickmckernin/rpsbootstrap2022winter +image: patrickmckernin/rps-bootstrap-2022-spring tasks: - - init: bin/setup + - before: | + bin/setup ports: - port: 3000 onOpen: open-preview - - port: 9515 + - port: 9500-9999 onOpen: ignore diff --git a/.vscode/settings.json b/.vscode/settings.json index 9d5bf9a..6c50f84 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,10 +1,47 @@ { - "editor.tabSize": 2, - "emmet.includeLanguages": { - "erb": "html" - }, - "files.associations": { - "*.erb": "erb" - } - } - \ No newline at end of file + "editor.tabSize": 2, + "editor.acceptSuggestionOnEnter": "off", + "editor.bracketPairColorization.enabled": false, + "editor.cursorSurroundingLines": 8, + "editor.dragAndDrop": false, + "editor.guides.bracketPairs": true, + "editor.linkedEditing": true, + "editor.minimap.enabled": false, + "editor.smoothScrolling": false, + "editor.wordBasedSuggestionsMode": "allDocuments", + "editor.wordWrap": "on", + "editor.wrappingIndent": "deepIndent", + "workbench.editor.closeOnFileDelete": true, + "workbench.fontAliasing": "auto", + "workbench.startupEditor": "none", + "workbench.tree.renderIndentGuides": "always", + "files.autoSaveDelay": 500, + "files.exclude": { + "**/.git": true, + ".vscode": true, + ".bundle": true, + }, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "screencastMode.onlyKeyboardShortcuts": true, + "screencastMode.verticalOffset": 10, + "explorer.compactFolders": false, + "explorer.incrementalNaming": "smart", + "html.format.endWithNewline": true, + "html.format.preserveNewLines": true, + "html.format.templating": true, + "terminal.integrated.altClickMovesCursor": true, + "[erb]": { + "editor.formatOnSave": true + }, + "[ruby]": { + "editor.formatOnSave": true + }, + "vscode-erb-beautify.keepBlankLines": 1, + "ruby.intellisense": false, + "gitpod.openInStable.neverPrompt": true, + "redhat.telemetry.enabled": false, + "emmet.includeLanguages": { + "erb": "html" + }, +} diff --git a/Dockerfile b/Dockerfile index ba1a882..521d3ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,8 +60,7 @@ RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import - \ && rvm install 2.7.3 \ && rvm use 2.7.3 --default \ && rvm rubygems current \ - && gem install bundler --no-document \ - && gem install solargraph --no-document" \ + && gem install bundler --no-document" \ && echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*' >> /home/gitpod/.bashrc.d/70-ruby RUN echo "rvm_gems_path=/home/gitpod/.rvm" > ~/.rvmrc @@ -71,36 +70,67 @@ USER gitpod WORKDIR /base-rails # Install Google Chrome -RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - -RUN sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' -RUN sudo apt-get -y update -RUN sudo apt-get -y install google-chrome-stable -# Install Chromedriver -RUN sudo apt-get -y install google-chrome-stable -RUN wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip -RUN unzip chromedriver_linux64.zip - -RUN sudo mv chromedriver /usr/bin/chromedriver -RUN sudo chown root:root /usr/bin/chromedriver -RUN sudo chmod +x /usr/bin/chromedriver - +RUN sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | \ + tee -a /etc/apt/sources.list.d/google.list' && \ + wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | \ + sudo apt-key add - && \ + sudo apt-get update && \ + sudo apt-get install -y google-chrome-stable libxss1 + +# Install Chromedriver (compatable with Google Chrome version) +# See https://gerg.dev/2021/06/making-chromedriver-and-chrome-versions-match-in-a-docker-image/ +RUN BROWSER_MAJOR=$(google-chrome --version | sed 's/Google Chrome \([0-9]*\).*/\1/g') && \ + wget https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${BROWSER_MAJOR} -O chrome_version && \ + wget https://chromedriver.storage.googleapis.com/`cat chrome_version`/chromedriver_linux64.zip && \ + unzip chromedriver_linux64.zip && \ + sudo mv chromedriver /usr/local/bin/ && \ + DRIVER_MAJOR=$(chromedriver --version | sed 's/ChromeDriver \([0-9]*\).*/\1/g') && \ + echo "chrome version: $BROWSER_MAJOR" && \ + echo "chromedriver version: $DRIVER_MAJOR" && \ + if [ $BROWSER_MAJOR != $DRIVER_MAJOR ]; then echo "VERSION MISMATCH"; exit 1; fi + +# Pre-install gems into /base-rails/gems/ COPY Gemfile /base-rails/Gemfile COPY --chown=gitpod:gitpod Gemfile.lock /base-rails/Gemfile.lock RUN /bin/bash -l -c "gem install bundler:2.1.4" - -USER gitpod - +RUN /bin/bash -l -c "mkdir gems && bundle config set --local path 'gems'" RUN /bin/bash -l -c "bundle install" -RUN /bin/bash -l -c "curl https://cli-assets.heroku.com/install.sh | sh" +# Install fuser (bin/server) and expect (web_git) +RUN sudo apt install -y libpq-dev psmisc lsof expect -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - -RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list +# Install heroku-cli +RUN /bin/bash -l -c "curl https://cli-assets.heroku.com/install.sh | sh" -RUN sudo apt-get update && sudo apt-get install -y nodejs yarn -# postgresql-client -# RUN sudo apt-get update && sudo apt-get install -y yarn -RUN sudo apt install -y postgresql postgresql-contrib libpq-dev psmisc lsof expect -USER gitpod +# Install JS Dependencies +RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list \ + && sudo apt-get update && sudo apt-get install -y nodejs yarn + +# Git global configuration +RUN git config --global push.default upstream \ + && git config --global merge.ff only \ + && git config --global alias.acm '!f(){ git add -A && git commit -am "${*}"; };f' \ + && git config --global alias.as '!git add -A && git stash' \ + && git config --global alias.p 'push' \ + && git config --global alias.sla 'log --oneline --decorate --graph --all' \ + && git config --global alias.co 'checkout' \ + && git config --global alias.cob 'checkout -b' + +# Alias 'git' to 'g' +RUN echo 'export PATH="$PATH:$GITPOD_REPO_ROOT/bin"' >> ~/.bashrc +RUN echo "# No arguments: 'git status'\n\ +# With arguments: acts like 'git'\n\ +g() {\n\ + if [[ \$# > 0 ]]; then\n\ + git \$@\n\ + else\n\ + git status\n\ + fi\n\ +}\n# Complete g like git\n\ +source /usr/share/bash-completion/completions/git\n\ +__git_complete g __git_main" >> ~/.bash_aliases + +# Hack to pre-install bundled gems RUN echo "rvm use 2.7.3" >> ~/.bashrc RUN echo "rvm_silence_path_mismatch_check_flag=1" >> ~/.rvmrc diff --git a/Gemfile b/Gemfile index 80b4846..bb4b127 100644 --- a/Gemfile +++ b/Gemfile @@ -45,7 +45,7 @@ group :development do gem 'annotate' gem 'better_errors' gem 'binding_of_caller' - gem 'draft_generators', github: 'firstdraft/draft_generators', branch: 'winter-2020' + gem 'draft_generators', github: 'firstdraft/draft_generators' gem 'rufo' gem 'htmlbeautifier' end diff --git a/Gemfile.lock b/Gemfile.lock index 84a0521..ca94b8c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,9 @@ GIT remote: https://github.com/firstdraft/draft_generators.git - revision: 2635764769e293ef79d8183392cd4e8ae17cc2c4 - branch: winter-2020 + revision: 4b0d9b35d61c6582beb78504f5e0291953189924 specs: draft_generators (0.0.3) devise - indefinite_article GIT remote: https://github.com/firstdraft/grade_runner.git @@ -92,8 +90,8 @@ GEM activerecord (>= 3.2, < 8.0) rake (>= 10.4, < 14.0) ansispan (0.0.1) - bcrypt (3.1.16) - bcrypt (3.1.16-java) + bcrypt (3.1.17) + bcrypt (3.1.17-java) better_errors (2.9.1) coderay (>= 1.0.0) erubi (>= 1.0.0) @@ -103,7 +101,7 @@ GEM debug_inspector (>= 0.0.1) builder (3.2.4) byebug (11.1.3) - capybara (3.36.0) + capybara (3.37.1) addressable matrix mini_mime (>= 0.1.3) @@ -117,7 +115,7 @@ GEM color (1.8) color_namer (0.1.0) color (>= 1.4.1) - concurrent-ruby (1.1.9) + concurrent-ruby (1.1.10) crack (0.4.5) rexml crass (1.0.6) @@ -136,7 +134,7 @@ GEM railties (>= 3.2) erubi (1.10.0) execjs (2.8.1) - factory_bot (6.2.0) + factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) @@ -145,22 +143,20 @@ GEM ffi (1.15.5-java) ffi (1.15.5-x64-mingw32) ffi (1.15.5-x86-mingw32) - git (1.10.2) + git (1.11.0) rchardet (~> 1.8) globalid (1.0.0) activesupport (>= 5.0) hashdiff (1.0.1) - htmlbeautifier (1.4.1) + htmlbeautifier (1.4.2) i18n (1.10.0) concurrent-ruby (~> 1.0) - indefinite_article (0.2.4) - activesupport libv8 (3.16.14.19) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.14.0) + loofah (2.18.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -175,20 +171,20 @@ GEM ruby2_keywords (~> 0.0.1) nio4r (2.5.8) nio4r (2.5.8-java) - nokogiri (1.13.3) + nokogiri (1.13.6) mini_portile2 (~> 2.8.0) racc (~> 1.4) - nokogiri (1.13.3-java) + nokogiri (1.13.6-java) racc (~> 1.4) - nokogiri (1.13.3-x64-mingw32) + nokogiri (1.13.6-x64-mingw32) racc (~> 1.4) - nokogiri (1.13.3-x86-mingw32) + nokogiri (1.13.6-x86-mingw32) racc (~> 1.4) oj (3.13.11) orm_adapter (0.5.0) - pg (1.3.3) - pg (1.3.3-x64-mingw32) - pg (1.3.3-x86-mingw32) + pg (1.3.5) + pg (1.3.5-x64-mingw32) + pg (1.3.5-x86-mingw32) pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) @@ -198,10 +194,10 @@ GEM spoon (~> 0.0) pry-rails (0.3.9) pry (>= 0.10.4) - public_suffix (4.0.6) - puma (4.3.11) + public_suffix (4.0.7) + puma (4.3.12) nio4r (~> 2.0) - puma (4.3.11-java) + puma (4.3.12-java) nio4r (~> 2.0) racc (1.6.0) racc (1.6.0-java) @@ -243,7 +239,7 @@ GEM ffi (~> 1.0) rchardet (1.8.0) ref (2.0.0) - regexp_parser (2.2.1) + regexp_parser (2.4.0) responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) @@ -260,10 +256,10 @@ GEM rspec-html-matchers (0.9.4) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.11.0) + rspec-mocks (3.11.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.11.0) - rspec-rails (5.1.1) + rspec-rails (5.1.2) actionpack (>= 5.2) activesupport (>= 5.2) railties (>= 5.2) @@ -315,7 +311,7 @@ GEM tilt (2.0.10) tzinfo (1.2.9) thread_safe (~> 0.1) - tzinfo-data (1.2021.5) + tzinfo-data (1.2022.1) tzinfo (>= 1.0.0) warden (1.2.9) rack (>= 2.0.9) diff --git a/bin/setup b/bin/setup index 6bf47ce..8899f26 100755 --- a/bin/setup +++ b/bin/setup @@ -14,6 +14,11 @@ chdir APP_ROOT do # This script is a starting point to setup your application. # Add necessary setup steps to this file. puts "== Installing dependencies ==" + if !Dir.exist?("vendor/bundle/ruby") && Dir.exist?("/base-rails/gems/ruby") + FileUtils.cp_r("/base-rails/gems/ruby", "vendor/bundle") + system! "bundle config set --local path 'vendor/bundle'" + end + system! "gem install rufo htmlbeautifier --no-document" system! "bundle install" # system! "yarn install --check-files" diff --git a/vendor/.keep b/vendor/bundle/.keep similarity index 100% rename from vendor/.keep rename to vendor/bundle/.keep