My Extension automatically signed itself

I have just recently gotten into coding with ruby and sketchup and wrote myself a small code (see below). I manually installed it using the Extension Manager, after having changed .txt to .rb, placing it in .zip file and changing to .rbz.
After having installed extension, it came up as signed in the Extension Manager. Anyone able to explain why?

Name was “box.rbz”

Here is code:

def box

prompts = ["Width","Length","height"]
values = [,,]
results = inputbox prompts, values, "Shed Length"

width,length,height = results
nills = 0

lengthstart = [nills,length,nills]
lengthstop = [nills,nills,nills]
widthstart = [nills,nills,nills]
widthstop = [width,nills,nills]
otherlengthstart = [width,nills,nills]
otherlengthstop = [width,length,nills]
otherwidthstart = [width,length,nills]
otherwidthstop = [nills,length,nills]

model = Sketchup.active_model

entities = model.active_entities
baseface = entities.add_face lengthstart, widthstart, otherlengthstart, otherwidthstart
baseface.pushpull height


if(not file_loaded?("linefromto.rb") )"Draw").add_item("Line between two points") {shed_size}


It just worries me a little if you dont need to get your code signed…to have it register as signed :thinking:

try a unique name, you may be highjacking the ‘signing’ from a previously installed ‘box.rb’…


Well, renaming the file makes it unsigned, but shouldn’t it be a bit more difficult than that to hijack a signed object? I haven’t installed an extension named box before, either, in case that’s what you meant?

I realise from the posts I’ve read that signed and unsigned doesn’t really make much difference, its just there for Trimbles legal protection, but really?

The name of the RBZ is unimportant - it’s the file names it contains…
Is the RB named ‘box’ or ‘linefromto’ ?
The menu adding code checks for the latter name and prompts for a line not a box !
Since the code tries to draw a box I expect the former ?
Your post is unclear…
It is odd either way, because when [‘box’ or] ‘linefromto.rb’ loads SketchUp searches for a subfolder named [‘box’ or] ‘linefromto’, this contains at least the signed files [hash etc], if it’s not found it reports it as unsigned, if the files exist then the RB should be checked against the hashed data and if it doesn’t match then the signing is reported as ‘broken’ [invalid], or perhaps out-dated.
If there’s a full match it says ‘signed’.
Unless by some miracle your code matches some other code, which was signed by someone else and its subfolder is named to match your RB etc then it should not report as being properly signed ??
What does your Extension Manager show exactly ?
I’d guess signed but invalid, and there’s a subfolder in your Plugins subfolder with a matching name and mismatched hash files etc…

Your code is also very muddled, as the command run by the menu item ‘shed_size’ is undefined.
Whereas ‘box’ is defined and the prompt doesn’t match either…

You really ought to nest your own code inside your own module, named say “Poyda”, e.g.

module Poyda

    ###your code goes here

  unless file_loaded?(__FILE__)"Draw").add_item("Draw a Box") { }

end#module Poyda

To run in the Ruby Console you’d use

You could even add sub-modules, like this

module Poyda
  module Draw
    ### your own methods
      ### etc

    ### set up menu here

 end#module Draw
end#module Poyda

To run in the Ruby Console you’d use

This allows you to have several methods named ‘box’ used by different sub-modules… like Draw, Scale, Color etc…


box.rb IS in the examples folder, which I assumed you will have loaded as a learning aid…


So it will be signed in its subfolder…
However, the box.rb ‘signed’ status must be ‘invalid’, otherwise something is broken…

it loads latter [su_examples], so signed is checked on the real ‘box.rb’…


So having two loading RB files [in different loading folders] using the same RB name sidesteps the [useless!] signing-checks…
Probably something that SketchUp needs to address…
The first one has valid signing, the second one doesn’t…

Surely the second-loading RB should be barred from loading at all ?


careful what you wish for, the ‘fix’ could be far more damaging than status quo…

it is useful whilst developing, i.e. reloading single files in an extensions set of files…



What examples folder?

the one promoted on SU’s learn ruby site…

it’s in the EW…

animation.rb			examplescripts.rb
attributes.rb			extension_info.txt
box.rb				linetool.rb
contextmenu.rb			selection.rb


I probably should know, but where is that…?

I now see the links have changed to ‘gitHub’, and may have years ago…

but type ‘ruby’ or ‘examples’ into EW and it’s first hit…

this happens long before people find the API docs or it’s hidden GitHub examples link…