Closed Postur closed 3 years ago
Can you elaborate on how it fails? Do you get an error? If so, what's the error message and stack trace?
skippy sketchup:list
Known SketchUp versions:
Traceback (most recent call last):
20: from C:/Ruby27-x64/bin/skippy:23:in `<main>'
19: from C:/Ruby27-x64/bin/skippy:23:in `load'
18: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/skippy-0.4.2.a/exe/skippy:2:in `<top (required)>'
17: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/skippy-0.4.2.a/exe/skippy:2:in `require_relative'
16: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/skippy-0.4.2.a/app/boot.rb:40:in `<top (required)>'
15: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
14: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
13: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
12: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/command.rb:128:in `run'
11: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/command.rb:29:in `run'
10: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/skippy-0.4.2.a/lib/skippy/cli.rb:71:in `method_missing'
9: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
8: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/skippy-0.4.2.a/app/commands/sketchup.rb:32:in `list'
4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/skippy-0.4.2.a/lib/skippy/os/win.rb:23:in `sketchup_apps'
3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/skippy-0.4.2.a/lib/skippy/os/win.rb:23:in `each'
2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/skippy-0.4.2.a/lib/skippy/os/win.rb:25:in `block in sketchup_apps'
1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/skippy-0.4.2.a/lib/skippy/os/win.rb:25:in `glob'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/skippy-0.4.2.a/lib/skippy/os/win.rb:28:in `block (2 levels) in sketchup_apps': undefined method `[]' for nil:NilClass (NoMethodError)
Edit: sorry for bad formatting, vscode includes github code block characters
When running skippy sketchup:list
The pattern is going to match with sketchup veiwer folder. (default install dir)
And the version evaluation can't happen because this line:
version = File.basename(path).match(/[0-9.]+$/)[0].to_i
specifically:
'C:\Program Files\SketchUp\SketchUp Viewer'.match(/[0-9.]+$/)
match will return nothing (nil). Therefore if you index into nothing with [0] you'll get a nil:NilClass NoMethodError.
A proper fix would be to exclude the Veiwer folder in the pattern. I just don't know the correct syntax. My fix works if you only use sketchup versions starting with a 2.
I just pushed an update to the gem; 0.4.3 which should fix the problem. Skippy should be more robust to parsing the version number from that paths now.
Nice, that's great turnaround time, very fast. Thank you.
fails in Win.rb
pattern = "#{program_files}/{@Last Software,Google,SketchUp}/*SketchUp *"
--- Will include the sketchup veiwer pathlater
version = File.basename(path).match(/[0-9.]+$/)[0].to_i
--- will return undefined method for veiwer path as it does not contain numbersthis fources skippy to crash
my fix
pattern = "#{program_files}/{@Last Software,Google,SketchUp}/*SketchUp 2*"
works for me because I don't use version not starting with 2