From 6a9cbc5d32ee04de06f11240473042e3e26e4b63 Mon Sep 17 00:00:00 2001 From: brodao Date: Sat, 5 Aug 2023 10:51:47 -0300 Subject: [PATCH 1/3] Update sketchup.rb Allows Ruby script loading and opening a skp file on SketchUp startup. --- app/commands/sketchup.rb | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/app/commands/sketchup.rb b/app/commands/sketchup.rb index c19f389..e5d687b 100644 --- a/app/commands/sketchup.rb +++ b/app/commands/sketchup.rb @@ -11,20 +11,49 @@ class Sketchup < Skippy::Command include Thor::Actions option :port, :type => :numeric, :default => 7000 - desc 'debug VERSION', 'Start SketchUp with Ruby Debugger' - def debug(version) + option :rubyStartup, :type => :string, :default => '' + option :skpFile, :type => :string, :default => '' + + desc 'debug VERSION [rubyStartup] [skpFile]', 'Start SketchUp with Ruby Debugger' + def debug(version, ruby_startup = '', skp_file = '') app = find_sketchup(version) unless app.can_debug raise Skippy::Error, "Debug library not installed for Sketchup #{version}" end arguments = ['-rdebug', %("ide port=#{options.port}")] + + if ruby_startup != '' + if ruby_startup.end_with?('.skp') + skp_file = ruby_startup + else + arguments.append(['-RubyStartup', ruby_startup]) + end + end + + if skp_file != '' + arguments.append(skp_file) + end + Skippy.os.launch_app(app.executable, *arguments) end - desc 'launch VERSION', 'Start SketchUp' - def launch(version) + desc 'launch VERSION [rubyStartup] [skpFile]', 'Start SketchUp' + def launch(version, ruby_startup = '') app = find_sketchup(version) + + if ruby_startup != '' + if ruby_startup.end_with?('.skp') + skp_file = ruby_startup + else + arguments.append(['-RubyStartup', ruby_startup]) + end + end + + if skp_file != '' + arguments.append(skp_file) + end + Skippy.os.launch_app(app.executable) end From 28fa010d35a41a13f486bdc15a4b29441d407772 Mon Sep 17 00:00:00 2001 From: brodao Date: Fri, 11 Aug 2023 20:48:06 -0300 Subject: [PATCH 2/3] Update sketchup.rb Tweak in launcher command --- app/commands/sketchup.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/commands/sketchup.rb b/app/commands/sketchup.rb index e5d687b..2bba968 100644 --- a/app/commands/sketchup.rb +++ b/app/commands/sketchup.rb @@ -42,6 +42,8 @@ def debug(version, ruby_startup = '', skp_file = '') def launch(version, ruby_startup = '') app = find_sketchup(version) + arguments = [] + if ruby_startup != '' if ruby_startup.end_with?('.skp') skp_file = ruby_startup @@ -54,7 +56,7 @@ def launch(version, ruby_startup = '') arguments.append(skp_file) end - Skippy.os.launch_app(app.executable) + Skippy.os.launch_app(app.executable, *arguments) end desc 'list', 'List all known SketchUp versions' From 0ab174dc13c31bd4b26bbaa92137b675365f65db Mon Sep 17 00:00:00 2001 From: brodao Date: Fri, 11 Aug 2023 22:47:32 -0300 Subject: [PATCH 3/3] Update sketchup.rb --- app/commands/sketchup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/commands/sketchup.rb b/app/commands/sketchup.rb index 2bba968..ae77faa 100644 --- a/app/commands/sketchup.rb +++ b/app/commands/sketchup.rb @@ -39,7 +39,7 @@ def debug(version, ruby_startup = '', skp_file = '') end desc 'launch VERSION [rubyStartup] [skpFile]', 'Start SketchUp' - def launch(version, ruby_startup = '') + def launch(version, ruby_startup = '', skp_file = '') app = find_sketchup(version) arguments = []