Get is dev mode info from config binding and patch with packager (#383)

This commit is contained in:
Oğuzhan Koral
2024-08-29 19:18:16 +03:00
committed by GitHub
parent 8e9d98cd55
commit 8f97f59a9a
4 changed files with 26 additions and 1 deletions
+6
View File
@@ -15,6 +15,12 @@ def patch_connector(tag):
print(f"Patched connector version number in {rb_file}")
break
for (index, line) in enumerate(lines):
if 'DEV_MODE = ' in line:
lines[index] = f' DEV_MODE = false\n'
print(f"Patched dev mode to false in {rb_file}")
break
with open(rb_file, "w") as file:
file.writelines(lines)
+1 -1
View File
@@ -23,7 +23,7 @@ module SpeckleConnector3
PATH = File.join(PATH_ROOT, folder_name).freeze
# Run from localhost or from build files
DEV_MODE = false
DEV_MODE = true
puts("Loading Speckle Connector v#{CONNECTOR_VERSION} from #{DEV_MODE ? 'dev' : 'build'}")
unless file_loaded?(__FILE__)
@@ -0,0 +1,17 @@
# frozen_string_literal: true
require_relative '../action'
module SpeckleConnector3
module Actions
# Action to get is dev mode.
class GetIsDevMode < Action
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id)
js_script = "configBinding.receiveResponse('#{resolve_id}', #{DEV_MODE})"
state.with_add_queue_js_command('getIsDevMode', js_script)
end
end
end
end
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require_relative 'binding'
require_relative '../../actions/config_actions/get_is_dev_mode'
require_relative '../../actions/config_actions/get_config'
require_relative '../../actions/config_actions/update_config'
@@ -12,6 +13,7 @@ module SpeckleConnector3
class ConfigBinding < Binding
def commands
@commands ||= {
getIsDevMode: Commands::ActionCommand.new(@app, self, Actions::GetIsDevMode),
getConfig: Commands::ActionCommand.new(@app, self, Actions::GetConfig),
updateConfig: Commands::ActionCommand.new(@app, self, Actions::UpdateConfig)
}.freeze