Skip to content

Commit 79fa30b

Browse files
committed
Merge remote-tracking branch 'origin/master' into issue#200
2 parents d1f9d4b + afb9bb1 commit 79fa30b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+2623
-1844
lines changed

.devcontainer/Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.0, 2, 2.7, 2.6, 3-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 2.6-bullseye, 3-buster, 3.0-buster, 2-buster, 2.7-buster, 2.6-buster
2+
ARG VARIANT=2-bullseye
3+
FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT}
4+
5+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
6+
ARG NODE_VERSION="none"
7+
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
8+
9+
# [Optional] Uncomment this section to install additional OS packages.
10+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
11+
# && apt-get -y install --no-install-recommends chromium
12+
13+
# OS packages required to run the application
14+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
15+
&& apt-get -y install --no-install-recommends \
16+
libasound2 \
17+
libatk-bridge2.0-0 \
18+
libatk1.0-0 \
19+
libatspi2.0-0 \
20+
libcairo2 \
21+
libcups2 \
22+
libdrm2 \
23+
libgbm1 \
24+
libgtk-3-0 \
25+
libnspr4 \
26+
libnss3 \
27+
libpango-1.0-0 \
28+
libx11-6 \
29+
libxcb1 \
30+
libxcomposite1 \
31+
libxdamage1 \
32+
libxext6 \
33+
libxfixes3 \
34+
libxkbcommon0 \
35+
libxrandr2 \
36+
libxshmfence1 \
37+
xdg-utils
38+
39+
RUN curl --silent --show-error --location --fail --retry 3 --output /tmp/google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
40+
&& (sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb || sudo apt-get -fy install) \
41+
&& rm -rf /tmp/google-chrome-stable_current_amd64.deb \
42+
&& sudo sed -i 's|HERE/chrome"|HERE/chrome" --disable-setuid-sandbox --no-sandbox|g' \
43+
"/opt/google/chrome/google-chrome" \
44+
&& google-chrome --version
45+
46+
RUN mkdir /app
47+
WORKDIR /app
48+
49+
# Install gems
50+
ARG BUNDLER_VERSION=2.2.11
51+
RUN gem install bundler:${BUNDLER_VERSION} solargraph
52+
53+
# [Optional] Uncomment this line to install global node packages.
54+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/base.Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.0, 2, 2.7, 2.6, 3-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 2.6-bullseye, 3-buster, 3.0-buster, 2-buster, 2.7-buster, 2.6-buster
2+
ARG VARIANT=2-bullseye
3+
FROM ruby:${VARIANT}
4+
5+
# Copy library scripts to execute
6+
COPY library-scripts/*.sh library-scripts/*.env /tmp/library-scripts/
7+
8+
# [Option] Install zsh
9+
ARG INSTALL_ZSH="true"
10+
# [Option] Upgrade OS packages to their latest versions
11+
ARG UPGRADE_PACKAGES="true"
12+
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
13+
ARG USERNAME=vscode
14+
ARG USER_UID=1000
15+
ARG USER_GID=$USER_UID
16+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
17+
# Remove imagemagick due to https://security-tracker.debian.org/tracker/CVE-2019-10131
18+
&& apt-get purge -y imagemagick imagemagick-6-common \
19+
# Install common packages, non-root user, rvm, core build tools
20+
&& bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
21+
&& bash /tmp/library-scripts/ruby-debian.sh "none" "${USERNAME}" "true" "true" \
22+
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
23+
24+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
25+
ARG NODE_VERSION="none"
26+
ENV NVM_DIR=/usr/local/share/nvm
27+
ENV NVM_SYMLINK_CURRENT=true \
28+
PATH=${NVM_DIR}/current/bin:${PATH}
29+
RUN bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \
30+
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
31+
32+
# Remove library scripts for final image
33+
RUN rm -rf /tmp/library-scripts
34+
35+
# [Optional] Uncomment this section to install additional OS packages.
36+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
37+
# && apt-get -y install --no-install-recommends <your-package-list-here>
38+
39+
# [Optional] Uncomment this line to install additional gems.
40+
# RUN gem install <your-gem-names-here>
41+
42+
# [Optional] Uncomment this line to install global node packages.
43+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/devcontainer.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.203.0/containers/ruby
3+
{
4+
"name": "Ruby",
5+
"runArgs": ["--init"],
6+
"build": {
7+
"dockerfile": "Dockerfile",
8+
"args": {
9+
// Update 'VARIANT' to pick a Ruby version: 3, 3.0, 2, 2.7, 2.6
10+
// Append -bullseye or -buster to pin to an OS version.
11+
// Use -bullseye variants on local on arm64/Apple Silicon.
12+
"VARIANT": "3-bullseye",
13+
// Options
14+
"NODE_VERSION": "none"
15+
}
16+
},
17+
18+
// Set *default* container specific settings.json values on container create.
19+
"settings": {},
20+
21+
// Add the IDs of extensions you want installed when the container is created.
22+
"extensions": [
23+
"rebornix.Ruby"
24+
],
25+
26+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
27+
// "forwardPorts": [],
28+
29+
// Use 'postCreateCommand' to run commands after the container is created.
30+
// "postCreateCommand": "ruby --version",
31+
32+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
33+
"remoteUser": "vscode",
34+
"features": {
35+
"git": "latest",
36+
"github-cli": "latest"
37+
}
38+
39+
}

.github/gemfiles/websocket-driver-0.6.x.gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
source "https://rubygems.org"
44

55
gem "websocket-driver", "~> 0.6.5"
6+
gem "cliver", github: "route/cliver", branch: "develop"
67

78
gemspec path: "../../"

.github/gemfiles/websocket-driver-0.7.x.gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
source "https://rubygems.org"
44

55
gem "websocket-driver", "~> 0.7.1"
6+
gem "cliver", github: "route/cliver", branch: "develop"
67

78
gemspec path: "../../"

.github/workflows/linter.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Linter
2+
on: [push]
3+
4+
jobs:
5+
linters:
6+
name: Linters
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
ruby: [ 2.7, 3.0 ]
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Setup Ruby
17+
uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: ${{ matrix.ruby }}
20+
bundler-cache: true
21+
22+
- name: Ruby gem cache
23+
uses: actions/cache@v1
24+
with:
25+
path: vendor/bundle
26+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
27+
restore-keys: |
28+
${{ runner.os }}-gems-
29+
30+
- name: Install gems
31+
run: |
32+
bundle config path vendor/bundle
33+
bundle install --jobs 4 --retry 3
34+
35+
- name: Run linters
36+
run: |
37+
bundle exec rubocop --parallel

.github/workflows/tests.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ on:
88
jobs:
99
tests:
1010
name: Tests
11-
1211
strategy:
1312
fail-fast: false
1413
matrix:
1514
gemfile: [websocket-driver-0.6.x, websocket-driver-0.7.x]
16-
ruby: [2.5, 2.6, 2.7]
17-
15+
ruby: [2.6, 2.7, 3.0]
1816
runs-on: ubuntu-latest
1917
env:
2018
FERRUM_PROCESS_TIMEOUT: 20
@@ -30,6 +28,11 @@ jobs:
3028
ruby-version: ${{ matrix.ruby }}
3129
bundler-cache: true
3230

31+
- name: Setup Chrome
32+
uses: browser-actions/setup-chrome@latest
33+
with:
34+
chrome-version: stable
35+
3336
- run: mkdir -p /tmp/ferrum
3437

3538
- name: Run tests

.rubocop.yml

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,58 @@
1-
inherit_from: .rubocop_todo.yml
2-
31
AllCops:
4-
TargetRubyVersion: 2.4
2+
TargetRubyVersion: 2.6
53
NewCops: enable
64

75
Layout/FirstArrayElementIndentation:
86
EnforcedStyle: consistent
97

8+
Naming/MethodParameterName:
9+
MinNameLength: 2
10+
AllowedNames:
11+
- x
12+
- y
13+
14+
Naming/FileName:
15+
Exclude:
16+
- 'gemfiles/*.gemfile'
17+
1018
Style/StringLiterals:
1119
EnforcedStyle: double_quotes
1220

21+
Style/MultilineBlockChain:
22+
Exclude:
23+
- spec/**/*
24+
25+
Style/Documentation:
26+
Enabled: false
27+
1328
Metrics/BlockLength:
1429
Exclude:
1530
- spec/**/*
31+
- "*.gemspec"
1632

17-
Naming/MethodParameterName:
18-
AllowedNames:
19-
- x
20-
- y
21-
- id
22-
- to
33+
Metrics/ParameterLists:
34+
Max: 6
2335

24-
Naming/FileName:
36+
Metrics/AbcSize:
37+
Max: 66
38+
39+
Metrics/ClassLength:
40+
Max: 258
41+
42+
Metrics/CyclomaticComplexity:
43+
Max: 14
44+
45+
Metrics/MethodLength:
46+
Max: 52
47+
48+
Metrics/ModuleLength:
2549
Exclude:
26-
- 'gemfiles/websocket-driver-*.gemfile'
50+
- spec/**/*
51+
Max: 602
52+
53+
Metrics/PerceivedComplexity:
54+
Max: 14
55+
56+
#require:
57+
# - rubocop-rake
58+
# - rubocop-rspec

.rubocop_todo.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)