Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrades to Rails 6 #470

Merged
merged 23 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",
// Uncomment the next line to run commands after the container is created - for example installing git.
"postCreateCommand": "/home/baw_web/baw-server/provision/dev_setup.sh",
"postCreateCommand": "/home/baw_web/baw-server/provision/entrypoint.sh",
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"rebornix.ruby",
"bung87.rails",
"misogi.ruby-rubocop",
"castwide.solargraph",
"bung87.vscode-gemfile",
Expand All @@ -40,5 +39,6 @@
"connorshea.vscode-ruby-test-adapter",
"knisterpeter.vscode-github",
"castwide.ruby-debug",
"pavlitsky.yard"
]
}
15 changes: 1 addition & 14 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,8 @@
/db/*.sqlite3
/db/*.sqlite3-journal

# ignore media folder
/media/*

# ignore custom rake import task
/lib/tasks/import.rake
/lib/tasks/sample_data.rake

# ignore deploy files
/config/deploy.rb
/config/deploy/production.rb
/config/deploy/staging.rb

# ignore settings files (except default.yml)
/config/settings/development.yml
/config/settings/test.yml
/config/settings/*.local.yml
/config/settings/staging.yml
/config/settings/production.yml

Expand Down
56 changes: 46 additions & 10 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,35 @@ AllCops:
Include:
- '**/Rakefile'
- '**/config.ru'
- '**/*.rb'
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
TargetRubyVersion: 2.6
# Rails:
# Enabled: true

# Customized options
Lint/DeprecatedOpenSSLConstant:
Enabled: true
Lint/MixedRegexpCaptureTypes:
Enabled: true
Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true
Layout/LineLength:
Max: 120
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true
Layout/EndOfLine:
EnforcedStyle: lf
# We sometimes leave commented out code in the code base
Layout/LeadingCommentSpace:
Enabled: false
Metrics/ClassLength:
Max: 300
Layout/EmptyLinesAroundBlockBody:
Enabled: false
Layout/SpaceAroundMethodCallOperator:
Enabled: true
Metrics/BlockLength:
ExcludedMethods:
- resource
Expand All @@ -30,21 +44,43 @@ Metrics/BlockLength:
- it
- group
- namespace
Metrics/LineLength:
Max: 120
- draw
- setup
- configure
- draw
- define
- factory
Metrics/MethodLength:
Max: 30
ExcludedMethods:
- filter_settings
Metrics/ModuleLength:
Max: 150
Metrics/AbcSize:
Max: 60
Style/BlockDelimiters:
EnforcedStyle: semantic
AllowBracesOnProceduralOneLiners: true
Style/BracesAroundHashParameters:
EnforcedStyle: context_dependent
Layout/LeadingCommentSpace:
Enabled: false
IgnoredMethods:
- its
Style/ExponentialNotation:
Enabled: true
EnforcedStyle: scientific
Style/HashEachMethods:
Enabled: true
AutoCorrect: false
Style/HashTransformKeys:
Enabled: true
AutoCorrect: false
Style/HashTransformValues:
Enabled: true
AutoCorrect: false
Style/RedundantRegexpCharacterClass:
Enabled: true
Style/RedundantRegexpEscape:
Enabled: true
Style/SlicingWithRange:
Enabled: true
Style/SymbolArray:
EnforcedStyle: brackets
Style/WordArray:
Expand Down
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,27 @@ RUN apt-get update \
&& mkdir -p "$GEM_HOME/bin" \
&& chmod 777 "$GEM_HOME/bin"


ENV RAILS_ENV=production \
APP_USER=${app_user} \
APP_NAME=${app_name} \
# enable binstubs to take priority
PATH=./bin:$PATH
PATH=./bin:$PATH \
BUNDLE_PATH__SYSTEM="true"


USER ${app_user}

RUN \
# temporarily upgrade bundler until we can jump to ruby 2.7
gem update --system \
&& gem install bundler

# change the working directory to the user's home directory
WORKDIR /home/${app_user}/${app_name}

# add base dependency files for bundle install (so we don't invalidate docker cache)
COPY --chown=${app_user} Gemfile Gemfile.lock /home/${app_user}/${app_name}/
COPY --chown=${app_user} Gemfile Gemfile.lock /home/${app_user}/${app_name}/

VOLUME [ "/data" ]

Expand All @@ -71,7 +79,7 @@ EXPOSE 3000
# install deps
RUN \
# install baw-server
bundle install --system \
BAW_SKIP_LOCAL_GEMS=true bundle install \
# install docs for dev work
&& solargraph download-core \
&& solargraph bundle
Expand All @@ -96,8 +104,9 @@ EXPOSE 80
# install deps
# skip installing gem documentation
RUN echo 'gem: --no-rdoc --no-ri' >> "$HOME/.gemrc" \
&& bundle config set without development test \
# install baw-server
&& bundle install --system --without 'development' 'test'
&& BAW_SKIP_LOCAL_GEMS=true bundle install

# Add the Rails app
COPY --chown=${app_user} ./ /home/${app_user}/${app_name}
Expand Down
Loading