procon_bypass_man 0.3.4 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/Gemfile.lock +3 -3
- data/README.md +1 -8
- data/Steepfile +0 -1
- data/bin/generate_output_report +18 -0
- data/docs/getting_started.md +13 -9
- data/docs/setting/splatoon3_macro_dasei_cancel.md +7 -0
- data/docs/setting/{splatoon3_rotation_forward_stick.md → splatoon3_rotation_left_stick.md} +1 -1
- data/lib/procon_bypass_man/background/jobs/post_completed_remote_action_job.rb +20 -0
- data/lib/procon_bypass_man/background/jobs/report_info_log_job.rb +11 -0
- data/lib/procon_bypass_man/background/jobs/report_warning_job.rb +11 -0
- data/lib/procon_bypass_man/background.rb +2 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/loader.rb +6 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/metadata_loader.rb +27 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/validator.rb +4 -4
- data/lib/procon_bypass_man/bypass/bypass_command.rb +2 -2
- data/lib/procon_bypass_man/bypass/procon_to_switch.rb +3 -0
- data/lib/procon_bypass_man/commands/send_info_log_command.rb +11 -0
- data/lib/procon_bypass_man/commands/send_warning_command.rb +18 -0
- data/lib/procon_bypass_man/commands.rb +2 -0
- data/lib/procon_bypass_man/configuration.rb +1 -1
- data/lib/procon_bypass_man/procon.rb +22 -11
- data/lib/procon_bypass_man/procon_display/status.rb +1 -0
- data/lib/procon_bypass_man/procon_display.rb +0 -1
- data/lib/procon_bypass_man/{remote_macro → remote_action}/queue_over_process.rb +2 -2
- data/lib/procon_bypass_man/{remote_macro/remote_macro_object.rb → remote_action/remote_action_object.rb} +1 -1
- data/lib/procon_bypass_man/{remote_macro/remote_macro_receiver.rb → remote_action/remote_action_receiver.rb} +8 -7
- data/lib/procon_bypass_man/remote_action/remote_action_sender.rb +9 -0
- data/lib/procon_bypass_man/remote_action/remote_pbm_job/base_action.rb +55 -0
- data/lib/procon_bypass_man/remote_action/remote_pbm_job/change_pbm_version_action.rb +31 -0
- data/lib/procon_bypass_man/remote_action/remote_pbm_job/commands/run_remote_pbm_job_dispatch_command.rb +29 -0
- data/lib/procon_bypass_man/{remote_pbm_action/commands/update_remote_pbm_action_status_command.rb → remote_action/remote_pbm_job/commands/update_remote_pbm_job_status_command.rb} +2 -2
- data/lib/procon_bypass_man/remote_action/remote_pbm_job/reboot_os_action.rb +24 -0
- data/lib/procon_bypass_man/remote_action/remote_pbm_job/report_procon_status.rb +25 -0
- data/lib/procon_bypass_man/remote_action/remote_pbm_job/restore_pbm_setting.rb +42 -0
- data/lib/procon_bypass_man/remote_action/remote_pbm_job/stop_pbm_action.rb +23 -0
- data/lib/procon_bypass_man/{remote_pbm_action/value_objects/remote_pbm_action_object.rb → remote_action/remote_pbm_job/value_objects/remote_pbm_job_object.rb} +2 -2
- data/lib/procon_bypass_man/remote_action/remote_pbm_job.rb +45 -0
- data/lib/procon_bypass_man/remote_action/task.rb +14 -0
- data/lib/procon_bypass_man/{remote_macro → remote_action}/task_queue.rb +1 -1
- data/lib/procon_bypass_man/remote_action.rb +19 -0
- data/lib/procon_bypass_man/support/callbacks.rb +1 -0
- data/lib/procon_bypass_man/support/{update_remote_pbm_action_status_http_client.rb → update_remote_pbm_job_status_http_client.rb} +1 -1
- data/lib/procon_bypass_man/version.rb +1 -1
- data/lib/procon_bypass_man/websocket/client.rb +42 -26
- data/lib/procon_bypass_man.rb +5 -7
- data/procon_bypass_man.gemspec +1 -1
- data/project_template/app.rb +1 -1
- data/project_template/app.rb.erb +1 -1
- data/sig/main.rbs +0 -6
- metadata +30 -23
- data/lib/procon_bypass_man/procon_display/bypass_hook.rb +0 -12
- data/lib/procon_bypass_man/remote_macro/remote_macro_sender.rb +0 -8
- data/lib/procon_bypass_man/remote_macro/task.rb +0 -2
- data/lib/procon_bypass_man/remote_macro.rb +0 -16
- data/lib/procon_bypass_man/remote_pbm_action/base_action.rb +0 -53
- data/lib/procon_bypass_man/remote_pbm_action/change_pbm_version_action.rb +0 -28
- data/lib/procon_bypass_man/remote_pbm_action/commands/run_remote_pbm_action_dispatch_command.rb +0 -21
- data/lib/procon_bypass_man/remote_pbm_action/reboot_os_action.rb +0 -22
- data/lib/procon_bypass_man/remote_pbm_action/restore_pbm_setting.rb +0 -41
- data/lib/procon_bypass_man/remote_pbm_action/stop_pbm_action.rb +0 -21
- data/lib/procon_bypass_man/remote_pbm_action.rb +0 -36
@@ -1,53 +0,0 @@
|
|
1
|
-
module ProconBypassMan
|
2
|
-
module RemotePbmAction
|
3
|
-
class ActionUnexpectedError < StandardError; end
|
4
|
-
class NeedPbmVersionError < ActionUnexpectedError; end
|
5
|
-
|
6
|
-
class BaseAction
|
7
|
-
attr_accessor :pbm_job_uuid
|
8
|
-
|
9
|
-
# @param [String] pbm_job_uuid
|
10
|
-
def initialize(pbm_job_uuid: )
|
11
|
-
self.pbm_job_uuid = pbm_job_uuid
|
12
|
-
end
|
13
|
-
|
14
|
-
# @return [void]
|
15
|
-
def action_content(_args)
|
16
|
-
raise NotImplementedError, nil
|
17
|
-
end
|
18
|
-
|
19
|
-
# @param [Hash] args
|
20
|
-
# @return [void]
|
21
|
-
def run!(job_args: )
|
22
|
-
before_action_callback
|
23
|
-
action_content(args: job_args)
|
24
|
-
after_action_callback
|
25
|
-
rescue => e
|
26
|
-
be_failed
|
27
|
-
ProconBypassMan::SendErrorCommand.execute(error: e)
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
# @return [void]
|
33
|
-
def before_action_callback; end
|
34
|
-
# @return [void]
|
35
|
-
def after_action_callback; end
|
36
|
-
|
37
|
-
# @return [void]
|
38
|
-
def be_failed
|
39
|
-
ProconBypassMan::UpdateRemotePbmActionStatusCommand.new(pbm_job_uuid: pbm_job_uuid).execute(to_status: :failed)
|
40
|
-
end
|
41
|
-
|
42
|
-
# @return [void]
|
43
|
-
def be_in_progress
|
44
|
-
ProconBypassMan::UpdateRemotePbmActionStatusCommand.new(pbm_job_uuid: pbm_job_uuid).execute(to_status: :in_progress)
|
45
|
-
end
|
46
|
-
|
47
|
-
# @return [void]
|
48
|
-
def be_processed
|
49
|
-
ProconBypassMan::UpdateRemotePbmActionStatusCommand.new(pbm_job_uuid: pbm_job_uuid).execute(to_status: :processed)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module ProconBypassMan
|
2
|
-
module RemotePbmAction
|
3
|
-
class ChangePbmVersionAction < BaseAction
|
4
|
-
|
5
|
-
def action_content(args: )
|
6
|
-
require "pbmenv"
|
7
|
-
ProconBypassMan.logger.info "execute ChangePbmVersionAction!"
|
8
|
-
pbm_version = args["pbm_version"] or raise(ProconBypassMan::RemotePbmAction::NeedPbmVersionError, "pbm_versionが必要です, #{args.inspect}")
|
9
|
-
Pbmenv.uninstall(pbm_version) # 途中でシャットダウンしてしまった、とか状態が途中の状態かもしれないので一旦消す
|
10
|
-
Pbmenv.install(pbm_version, enable_pbm_cloud: true)
|
11
|
-
Pbmenv.use(pbm_version)
|
12
|
-
ProconBypassMan.logger.info "#{pbm_version}へアップグレードしました"
|
13
|
-
ProconBypassMan::ReportCompletedUpgradePbmJob.perform
|
14
|
-
`reboot` # symlinkの参照先が変わるのでrebootする必要がある
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def before_action_callback
|
20
|
-
be_processed
|
21
|
-
end
|
22
|
-
|
23
|
-
def after_action_callback
|
24
|
-
# no-op
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/lib/procon_bypass_man/remote_pbm_action/commands/run_remote_pbm_action_dispatch_command.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
class ProconBypassMan::RunRemotePbmActionDispatchCommand
|
2
|
-
# @param [String] action
|
3
|
-
# @param [String] uuid
|
4
|
-
# @return [void]
|
5
|
-
def self.execute(action: , uuid: , job_args: )
|
6
|
-
case action
|
7
|
-
when ProconBypassMan::RemotePbmAction::ACTION_CHANGE_PBM_VERSION
|
8
|
-
ProconBypassMan::RemotePbmAction::ChangePbmVersionAction.new(pbm_job_uuid: uuid).run!(job_args: job_args)
|
9
|
-
when ProconBypassMan::RemotePbmAction::ACTION_STOP_PBM
|
10
|
-
ProconBypassMan::RemotePbmAction::StopPbmAction.new(pbm_job_uuid: uuid).run!(job_args: {})
|
11
|
-
when ProconBypassMan::RemotePbmAction::ACTION_REBOOT_OS
|
12
|
-
ProconBypassMan::RemotePbmAction::RebootOsAction.new(pbm_job_uuid: uuid).run!(job_args: {})
|
13
|
-
when ProconBypassMan::RemotePbmAction::ACTION_RESTORE_SETTING
|
14
|
-
ProconBypassMan::RemotePbmAction::RestorePbmSettingAction.new(pbm_job_uuid: uuid).run!(job_args: job_args)
|
15
|
-
else
|
16
|
-
raise "#{action}は対応していないアクションです"
|
17
|
-
end
|
18
|
-
rescue ProconBypassMan::RemotePbmAction::ActionUnexpectedError => e
|
19
|
-
ProconBypassMan::SendErrorCommand.execute(error: e)
|
20
|
-
end
|
21
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module ProconBypassMan
|
2
|
-
module RemotePbmAction
|
3
|
-
class RebootOsAction < BaseAction
|
4
|
-
|
5
|
-
def action_content(_args)
|
6
|
-
ProconBypassMan.logger.info "execute RebootOsAction!"
|
7
|
-
`reboot`
|
8
|
-
end
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
def before_action_callback
|
13
|
-
ProconBypassMan::ReportStartRebootJob.perform
|
14
|
-
be_processed
|
15
|
-
end
|
16
|
-
|
17
|
-
def after_action_callback
|
18
|
-
# no-op
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module ProconBypassMan
|
2
|
-
module RemotePbmAction
|
3
|
-
class RestorePbmSettingAction < BaseAction
|
4
|
-
|
5
|
-
def action_content(args: )
|
6
|
-
require "pbmenv"
|
7
|
-
ProconBypassMan.logger.info "execute RestorePbmSettingAction!"
|
8
|
-
setting = args.dig("setting") or raise(ProconBypassMan::RemotePbmAction::NeedPbmVersionError, "settingが必要です, #{args.inspect}")
|
9
|
-
|
10
|
-
# 復元に失敗したら戻せるように退避する
|
11
|
-
FileUtils.copy(
|
12
|
-
ProconBypassMan::ButtonsSettingConfiguration.instance.setting_path,
|
13
|
-
ProconBypassMan.fallback_setting_path,
|
14
|
-
)
|
15
|
-
|
16
|
-
ProconBypassMan::YamlWriter.write(
|
17
|
-
path: ProconBypassMan::ButtonsSettingConfiguration.instance.setting_path,
|
18
|
-
content: setting,
|
19
|
-
)
|
20
|
-
|
21
|
-
hot_reload!
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def before_action_callback
|
27
|
-
be_in_progress
|
28
|
-
end
|
29
|
-
|
30
|
-
def after_action_callback
|
31
|
-
be_processed
|
32
|
-
end
|
33
|
-
|
34
|
-
# @return [void]
|
35
|
-
def hot_reload!
|
36
|
-
Process.kill(:USR2, ProconBypassMan.pid)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module ProconBypassMan
|
2
|
-
module RemotePbmAction
|
3
|
-
class StopPbmAction < BaseAction
|
4
|
-
|
5
|
-
def action_content(_args)
|
6
|
-
ProconBypassMan.logger.info "execute StopPbmAction!"
|
7
|
-
Process.kill("TERM", ProconBypassMan.pid)
|
8
|
-
end
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
def before_action_callback
|
13
|
-
be_processed
|
14
|
-
end
|
15
|
-
|
16
|
-
def after_action_callback
|
17
|
-
# no-op
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ProconBypassMan
|
4
|
-
module RemotePbmAction
|
5
|
-
require "procon_bypass_man/remote_pbm_action/base_action"
|
6
|
-
require "procon_bypass_man/remote_pbm_action/change_pbm_version_action"
|
7
|
-
require "procon_bypass_man/remote_pbm_action/reboot_os_action"
|
8
|
-
require "procon_bypass_man/remote_pbm_action/stop_pbm_action"
|
9
|
-
require "procon_bypass_man/remote_pbm_action/restore_pbm_setting.rb"
|
10
|
-
require "procon_bypass_man/remote_pbm_action/commands/update_remote_pbm_action_status_command"
|
11
|
-
require "procon_bypass_man/remote_pbm_action/commands/run_remote_pbm_action_dispatch_command"
|
12
|
-
require "procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object"
|
13
|
-
|
14
|
-
ACTION_CHANGE_PBM_VERSION = "change_pbm_version"
|
15
|
-
ACTION_REBOOT_OS = "reboot_os"
|
16
|
-
ACTION_STOP_PBM = "stop_pbm"
|
17
|
-
ACTION_RESTORE_SETTING = "restore_pbm_setting"
|
18
|
-
|
19
|
-
ACTIONS = [
|
20
|
-
ACTION_CHANGE_PBM_VERSION,
|
21
|
-
ACTION_REBOOT_OS,
|
22
|
-
ACTION_STOP_PBM,
|
23
|
-
ACTION_RESTORE_SETTING,
|
24
|
-
]
|
25
|
-
|
26
|
-
STATUS_FAILED = :failed
|
27
|
-
STATUS_IN_PROGRESS = :in_progress
|
28
|
-
STATUS_PROCESSED = :processed
|
29
|
-
|
30
|
-
ACTION_STATUSES = [
|
31
|
-
STATUS_FAILED,
|
32
|
-
STATUS_IN_PROGRESS,
|
33
|
-
STATUS_PROCESSED,
|
34
|
-
]
|
35
|
-
end
|
36
|
-
end
|