Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows Ruby script loading and opening a skp file on SketchUp startup. #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 36 additions & 5 deletions app/commands/sketchup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,52 @@ 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 = '', skp_file = '')
app = find_sketchup(version)
Skippy.os.launch_app(app.executable)

arguments = []

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 'list', 'List all known SketchUp versions'
Expand Down