diff --git a/.circleci/config.yml b/.circleci/config.yml index c458500b..45942dcd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,7 @@ executors: - image: ruby:<< parameters.tag >> environment: BUNDLE_PATH: vendor/bundle - BUNDLE_WITHOUT: development + BUNDLE_WITHOUT: "development" working_directory: ~/app commands: @@ -141,8 +141,8 @@ build_jobs: &build_jobs parameters: ruby-version: # - "3.0.1" # たまにSEGVするので - - "3.0.2" - - "3.1.2" + # - "3.0.2" + # - "3.1.2" requires: - bundle_install - rspec: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 207be02f..93fe0ece 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,8 @@ jobs: timeout-minutes: 5 permissions: contents: write + env: + BUNDLE_WITHOUT: "development" steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index fcb0e3e8..7246fa9b 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -17,6 +17,8 @@ jobs: strategy: matrix: ruby-version: ['3.0', '3.1', '3.2', '3.3.0'] + env: + BUNDLE_WITHOUT: "development" steps: - uses: actions/checkout@v3 @@ -28,4 +30,4 @@ jobs: - name: Run tests run: |- bundle exec rake - bundle exec steep check + # bundle exec steep check diff --git a/.rubocop.yml b/.rubocop.yml index 65e53a88..a1c08602 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -38,3 +38,5 @@ Lint/AmbiguousBlockAssociation: Enabled: false Security/Eval: Enabled: false +Lint/MissingSuper: + Enabled: false diff --git a/CHANGELOG.md b/CHANGELOG.md index b50fc66d..c6161aa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## unrelease +* ruby-2.5のサポート終了しました + ## [0.3.12] 2024-1-8 * sudoをつけずにPBMを起動できるようになりました。(なお周辺ファイルは未対応) * setting.ymlからコントローラーアイコンの色を変更できるようになりました diff --git a/Gemfile b/Gemfile index 5f51c0c0..06772541 100644 --- a/Gemfile +++ b/Gemfile @@ -10,11 +10,14 @@ gem "rake" gem "rspec" gem "rubocop", require: false gem "serialport" # シリアル通信をする時に必要。通常はいらない -gem "sinatra", require: false -gem "solargraph", require: false -gem "stackprof", require: false gem "timecop" -gem "webrick", require: false + +group :development do + gem "sinatra", require: false + gem "solargraph", "0.50.0", require: false + gem "stackprof", require: false + gem "webrick", require: false +end if Gem::Version.new(RUBY_VERSION) > Gem::Version.new("2.6.0") gem 'rbs', require: false diff --git a/Gemfile.lock b/Gemfile.lock index c0aa6e4b..5fc70126 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,135 +12,171 @@ GEM specs: action_cable_client (3.1.0) websocket-eventmachine-client (>= 1.2.0) - activesupport (6.1.4.1) + activesupport (7.1.3) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) - zeitwerk (~> 2.3) ast (2.4.2) backport (1.2.0) - benchmark (0.2.1) + base64 (0.2.0) + benchmark (0.3.0) + bigdecimal (3.1.6) blue_green_process (0.1.4.3) coderay (1.1.3) - concurrent-ruby (1.1.9) - diff-lcs (1.4.4) + concurrent-ruby (1.2.3) + connection_pool (2.4.1) + csv (3.2.8) + diff-lcs (1.5.0) + drb (2.2.0) + ruby2_keywords e2mmap (0.1.0) eventmachine (1.2.7) - ffi (1.15.4) - i18n (1.8.11) + ffi (1.16.3) + fileutils (1.7.2) + i18n (1.14.1) concurrent-ruby (~> 1.0) jaro_winkler (1.5.6) + json (2.7.1) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - language_server-protocol (3.16.0.3) - listen (3.7.0) + language_server-protocol (3.17.0.3) + listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.0) method_source (1.0.0) mini_portile2 (2.8.5) - minitest (5.14.4) - mustermann (1.1.1) + minitest (5.21.2) + mustermann (3.0.0) ruby2_keywords (~> 0.0.1) + mutex_m (0.2.0) nokogiri (1.15.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) - parallel (1.21.0) - parser (3.0.3.2) + nokogiri (1.15.5-arm-linux) + racc (~> 1.4) + nokogiri (1.15.5-arm64-darwin) + racc (~> 1.4) + nokogiri (1.15.5-x86_64-linux) + racc (~> 1.4) + parallel (1.24.0) + parser (3.3.0.4) ast (~> 2.4.1) + racc pbmenv (0.1.13) - pry (0.14.1) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) racc (1.7.3) - rack (2.2.3.1) - rack-protection (2.2.0) - rack - rainbow (3.0.0) - rake (13.0.6) - rb-fsevent (0.11.0) + rack (3.0.8) + rack-protection (4.0.0) + base64 (>= 0.1.0) + rack (>= 3.0.0, < 4) + rack-session (2.0.0) + rack (>= 3.0.0) + rainbow (3.1.1) + rake (13.1.0) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rbs (1.7.1) + rbs (2.8.4) rbtree (0.4.6) - regexp_parser (2.2.0) + regexp_parser (2.9.0) reverse_markdown (2.1.1) nokogiri - rexml (3.2.5) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) + rexml (3.2.6) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.2) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-support (3.10.3) - rubocop (1.23.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.1) + rubocop (1.60.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.12.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.14.0) - parser (>= 3.0.1.1) - ruby-progressbar (1.11.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) + securerandom (0.3.1) serialport (1.3.2) set (1.1.0) - sinatra (2.2.0) - mustermann (~> 1.0) - rack (~> 2.2) - rack-protection (= 2.2.0) + sinatra (4.0.0) + mustermann (~> 3.0) + rack (>= 3.0.0, < 4) + rack-protection (= 4.0.0) + rack-session (>= 2.0.0, < 3) tilt (~> 2.0) - solargraph (0.48.0) + solargraph (0.50.0) backport (~> 1.2) benchmark - bundler (>= 1.17.2) + bundler (~> 2.0) diff-lcs (~> 1.4) e2mmap jaro_winkler (~> 1.5) kramdown (~> 2.3) kramdown-parser-gfm (~> 1.1) parser (~> 3.0) - reverse_markdown (>= 1.0.5, < 3) - rubocop (>= 0.52) + rbs (~> 2.0) + reverse_markdown (~> 2.0) + rubocop (~> 1.38) thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9, >= 0.9.24) sorted_set (1.0.3) rbtree set (~> 1.0) - stackprof (0.2.22) - steep (0.47.0) + stackprof (0.2.26) + steep (1.4.0) activesupport (>= 5.1) + concurrent-ruby (>= 1.2.2) + csv (>= 3.0.9) + fileutils (>= 1.1.0) + json (>= 2.1.0) language_server-protocol (>= 3.15, < 4.0) listen (~> 3.0) - parallel (>= 1.0.0) - parser (>= 3.0) + logger (>= 1.3.0) + parser (>= 3.1) rainbow (>= 2.2.2, < 4.0) - rbs (~> 1.7.0) + rbs (>= 2.8.0) + securerandom (>= 0.1) + strscan (>= 1.0.0) terminal-table (>= 2, < 4) + strscan (3.0.9) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - thor (1.2.2) - tilt (2.0.10) - timecop (0.9.4) - typeprof (0.20.4) - rbs (>= 1.6.2) - tzinfo (2.0.4) + thor (1.3.0) + tilt (2.3.0) + timecop (0.9.8) + typeprof (0.21.9) + rbs (>= 1.8.1) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.1.0) - webrick (1.7.0) + unicode-display_width (2.5.0) + webrick (1.8.1) websocket (1.2.10) websocket-eventmachine-base (1.2.0) eventmachine (~> 1.0) @@ -150,7 +186,6 @@ GEM websocket-eventmachine-base (~> 1.0) websocket-native (1.0.0) yard (0.9.34) - zeitwerk (2.5.1) PLATFORMS arm-linux @@ -169,7 +204,7 @@ DEPENDENCIES rubocop serialport sinatra - solargraph + solargraph (= 0.50.0) stackprof steep timecop diff --git a/lib/procon_bypass_man/buttons_setting_configuration/layer.rb b/lib/procon_bypass_man/buttons_setting_configuration/layer.rb index 82460ed9..ae5833cb 100644 --- a/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +++ b/lib/procon_bypass_man/buttons_setting_configuration/layer.rb @@ -133,7 +133,7 @@ def open_macro(name, steps: [], if_pressed: nil, if_tilted_left_stick: nil, forc return end - macro_name = name || "OpenMacro-#{steps.join}".to_sym + macro_name = name || :"OpenMacro-#{steps.join}" @context.macro_registry.install_plugin(macro_name, steps: steps) self.macros[macro_name] = { if_pressed: if_pressed, if_tilted_left_stick: if_tilted_left_stick, force_neutral: force_neutral }.compact end diff --git a/lib/procon_bypass_man/bypass/bypass_command.rb b/lib/procon_bypass_man/bypass/bypass_command.rb index efccf288..402de9e9 100644 --- a/lib/procon_bypass_man/bypass/bypass_command.rb +++ b/lib/procon_bypass_man/bypass/bypass_command.rb @@ -89,7 +89,7 @@ def execute # TODO: 本当はいらないんだけど、なぜか反映されないのでここでも設定する BlueGreenProcess.config.logger = ProconBypassMan.logger - while(readable_io = IO.select([self_read])) + while(readable_io = IO.select([self_read])) # rubocop:disable Lint/IncompatibleIoSelectWithFiberScheduler # TODO後で直す signal = readable_io.first[0].gets.strip case signal when 'USR2' diff --git a/lib/procon_bypass_man/commands/print_boot_message_command.rb b/lib/procon_bypass_man/commands/print_boot_message_command.rb index 1290e8cb..f7c7688c 100644 --- a/lib/procon_bypass_man/commands/print_boot_message_command.rb +++ b/lib/procon_bypass_man/commands/print_boot_message_command.rb @@ -59,6 +59,6 @@ def self.execute message = BootMessage.new ProconBypassMan::ReportBootJob.perform_async(message.to_hash) ProconBypassMan.logger.info message.to_s - puts message.to_s + puts message end end diff --git a/lib/procon_bypass_man/device_connection/command.rb b/lib/procon_bypass_man/device_connection/command.rb index 326954d3..664c5c51 100644 --- a/lib/procon_bypass_man/device_connection/command.rb +++ b/lib/procon_bypass_man/device_connection/command.rb @@ -15,7 +15,8 @@ def self.execute!(retry_count: 0) retry_count = retry_count + 1 retry - rescue ProconBypassMan::DeviceConnection::NotFoundProconError, ProconBypassMan::DeviceConnection::SetupIncompleteError => e + rescue ProconBypassMan::DeviceConnection::NotFoundProconError, ProconBypassMan::DeviceConnection::SetupIncompleteError => e # rubocop:disable Lint/UselessRescue + # TODO: エラークラスを作ってなげる raise end diff --git a/lib/procon_bypass_man/external_input/external_data.rb b/lib/procon_bypass_man/external_input/external_data.rb index acd8d1f2..957fb82e 100644 --- a/lib/procon_bypass_man/external_input/external_data.rb +++ b/lib/procon_bypass_man/external_input/external_data.rb @@ -1,7 +1,7 @@ module ProconBypassMan module ExternalInput class ExternalData - UNPRESS_BUTTONS = Set.new(ProconBypassMan::Procon::ButtonCollection.available.map { |x| "un#{x}".to_sym }) + UNPRESS_BUTTONS = Set.new(ProconBypassMan::Procon::ButtonCollection.available.map { |x| :"un#{x}" }) # @return [String, NilClass] 16進数表現のデータ attr_reader :hex diff --git a/lib/procon_bypass_man/procon.rb b/lib/procon_bypass_man/procon.rb index 48720a46..126de187 100644 --- a/lib/procon_bypass_man/procon.rb +++ b/lib/procon_bypass_man/procon.rb @@ -133,7 +133,7 @@ def apply! no_op_step = :wait_for_0_3 # マクロの最後に固まって最後の入力をし続けるので、無の状態を最後に注入する BlueGreenProcess::SharedVariable.extend_run_on_this_process = true ProconBypassMan.buttons_setting_configuration.macro_registry.cleanup_remote_macros! - macro_name = task.name || "RemoteMacro-#{task.steps.join}".to_sym + macro_name = task.name || :"RemoteMacro-#{task.steps.join}" task.steps << no_op_step ProconBypassMan.buttons_setting_configuration.macro_registry.install_plugin(macro_name, steps: task.steps, macro_type: :remote) @@status[:ongoing_macro] = ProconBypassMan.buttons_setting_configuration.macro_registry.load(macro_name, macro_type: :remote) do diff --git a/lib/procon_bypass_man/procon/macro_builder.rb b/lib/procon_bypass_man/procon/macro_builder.rb index 73ababbe..9a7d44ac 100644 --- a/lib/procon_bypass_man/procon/macro_builder.rb +++ b/lib/procon_bypass_man/procon/macro_builder.rb @@ -17,7 +17,7 @@ def self.merge(subjects) class Subject def initialize(value) - if not /^shake_/ =~ value + if not (/^shake_/ =~ value) @button = if match = value.match(/_(\w+)\z/) match[1] @@ -106,7 +106,7 @@ def build_if_v2_format?(step: ) end if /^rotation_left_stick/ =~ step - roll_left_stick_steps = 0.step(359, 17).map { |x| ["tilt_left_stick_completely_to_#{x}deg".to_sym] } + roll_left_stick_steps = 0.step(359, 17).map { |x| [:"tilt_left_stick_completely_to_#{x}deg"] } return { steps: roll_left_stick_steps } end diff --git a/lib/procon_bypass_man/runner.rb b/lib/procon_bypass_man/runner.rb index 1adb9c05..10b1d0ee 100644 --- a/lib/procon_bypass_man/runner.rb +++ b/lib/procon_bypass_man/runner.rb @@ -28,7 +28,7 @@ def run begin # TODO 子プロセスが消滅した時に、メインプロセスは生き続けてしまい、何もできなくなる問題がある - while(readable_io = IO.select([self_read])) + while(readable_io = IO.select([self_read])) # rubocop:disable Lint/IncompatibleIoSelectWithFiberScheduler # TODO後で直す signal = readable_io.first[0].gets.strip ProconBypassMan.logger.debug "[BYPASS] MASTERプロセスで#{signal}シグナルを受け取りました" case signal diff --git a/lib/procon_bypass_man/support/can_over_process.rb b/lib/procon_bypass_man/support/can_over_process.rb index 793799fd..154be097 100644 --- a/lib/procon_bypass_man/support/can_over_process.rb +++ b/lib/procon_bypass_man/support/can_over_process.rb @@ -13,7 +13,7 @@ def self.extended(mod) def start_distributed_object! return unless enable? - FileUtils.rm_rf(socket_file_path) if File.exist?(socket_file_path) + FileUtils.rm_rf(socket_file_path) begin self.drb_server = DRb.start_service(socket_path, distributed_class.new, safe_level: 1) rescue Errno::EADDRINUSE => e