From 62300436dd5bedd99c3cb40afbf8fb46b65cf0b5 Mon Sep 17 00:00:00 2001 From: dphdave <58987011+dphdave@users.noreply.github.com> Date: Thu, 10 Nov 2022 15:39:41 +0000 Subject: [PATCH 1/4] Update README.md Make setup instructions a little more user-friendly! --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b9d4b9d..bd63c5b 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,11 @@ This is a profiling tool for SketchUp Ruby extensions. It wraps [`Benchmark`](ht ![Profiling in SketchUp](docs/images/profiling.png) +## UI +The extension adds a new sub-menu at: +`Extensions > Developer > SpeedUp` (From SketchUp 2021.1) +`Extensions > SpeedUp` (Before SketchUp 2021.1) + ## Setup [RubyProf](https://github.com/ruby-prof/ruby-prof) is a gem that needs to be compiled as it's installed. This prevents it from being installed from within SketchUp under Windows. To compile gems you need the [Ruby DevKit](https://rubyinstaller.org/add-ons/devkit.html) to be configured for the compiler. @@ -14,10 +19,16 @@ Additionally the gem started misbehaving in SketchUp 2017 and up. The profiler i To make it easier for SketchUp extension developers this extension bundles pre-compiled versions of RubyProf and will attempt to install it into SketchUp's gems directory. +To initialise this process, you need to run the `Setup` command from the sub-menu at: `Extensions > Developer > SpeedUp > Setup` (From SketchUp 2021.1) - `Extensions > SpeedUp > Setup` (Before SketchUp 2021.1) +If you have not run setup, you will see something like this in the Ruby Console: +``` +Warning: SpeedUp was unable to activate the ruby-prof gem. +Warning: SpeedUp was unable to load ruby-prof +``` + ### Compatibility / Version Chart | SketchUp | Ruby | ruby-prof (Win) | ruby-prof (Mac) | @@ -114,4 +125,4 @@ def fibonacci(number) end SpeedUp.profile { fibonacci(20) } -``` \ No newline at end of file +``` From a111c55852e866a00bf3e9caa0af73855ab1efe8 Mon Sep 17 00:00:00 2001 From: Dave Edwards <58987011+dphdave@users.noreply.github.com> Date: Thu, 10 Nov 2022 16:29:30 +0000 Subject: [PATCH 2/4] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index bd63c5b..63e4c1a 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ This is a profiling tool for SketchUp Ruby extensions. It wraps [`Benchmark`](ht ![Profiling in SketchUp](docs/images/profiling.png) +## Installation +There is no RBZ file! Download the ZIP archive of the code from https://github.com/SketchUp/speedup/archive/refs/heads/main.zip +Inside you will find the `src` folder, this contains the extension structure (`speedup.rb` and `speedup` folder). Manually drop those into your SketchUp Plugins folder(s) and restart SU. + ## UI The extension adds a new sub-menu at: `Extensions > Developer > SpeedUp` (From SketchUp 2021.1) From 8796e1dd7670bd83379b51cc7910b9c2e422ebbf Mon Sep 17 00:00:00 2001 From: Dave Edwards <58987011+dphdave@users.noreply.github.com> Date: Thu, 10 Nov 2022 16:30:37 +0000 Subject: [PATCH 3/4] Create README.md From 22f6a480acdc3d6fb85c168a62082b8ede95bb17 Mon Sep 17 00:00:00 2001 From: Dave Edwards <58987011+dphdave@users.noreply.github.com> Date: Fri, 11 Nov 2022 22:34:59 +0000 Subject: [PATCH 4/4] Update profile_test.rb Add a warning when trying to load code that was pasted from the Ruby Console (hence has no source location) --- src/speedup/profile_test.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/speedup/profile_test.rb b/src/speedup/profile_test.rb index 2e386fb..0ecce63 100644 --- a/src/speedup/profile_test.rb +++ b/src/speedup/profile_test.rb @@ -39,7 +39,11 @@ def self.reload random_profile_method = self.instance_methods.grep(/^profile_/).first path = self.instance_method(random_profile_method).source_location.first $VERBOSE = nil - load path + if File.exist?(path) + load path + else + UI.messagebox("Method '#{random_profile_method}' could not be loaded from path #{path.inspect}. Was the code pasted into the Ruby Console?") + end ensure $VERBOSE = original_verbose end