Speed up initial require with autoload

This commit is contained in:
Andy Meneely
2021-10-25 22:32:34 -04:00
parent 531c831684
commit 4b7ea50d42
4 changed files with 8 additions and 5 deletions
+3
View File
@@ -17,6 +17,9 @@ Bugs:
* Fix frozen string error on `Squib.xlsx` import when stripping newlines is enabled * Fix frozen string error on `Squib.xlsx` import when stripping newlines is enabled
* `save_sheet` works with `rtl` and `trim` altogether properly now. * `save_sheet` works with `rtl` and `trim` altogether properly now.
Chores:
* Added autoloading for various slow-loading libraries, speeding up initial `require`
## v0.17.1 / 2021-08-11 ## v0.17.1 / 2021-08-11
Bugs: Bugs:
+1
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'squib' require 'squib'
require 'squib/commands/cli'
Squib::CLI.new.run Squib::CLI.new.run
+3 -4
View File
@@ -1,7 +1,7 @@
autoload :Cairo, 'cairo'
autoload :Pango, 'pango'
autoload :Rsvg, 'rsvg2'
require 'logger' require 'logger'
require 'cairo'
require 'pango'
require 'rsvg2'
require 'rainbow/refinement' require 'rainbow/refinement'
require_relative 'squib/version' require_relative 'squib/version'
require_relative 'squib/commands/cli' require_relative 'squib/commands/cli'
@@ -9,7 +9,6 @@ require_relative 'squib/deck'
require_relative 'squib/card' require_relative 'squib/card'
require_relative 'squib/system_fonts' require_relative 'squib/system_fonts'
module Squib module Squib
using Rainbow # we can colorize strings now! using Rainbow # we can colorize strings now!
+1 -1
View File
@@ -1,4 +1,4 @@
require 'roo' autoload :Roo, 'roo'
require_relative 'quantity_exploder' require_relative 'quantity_exploder'
module Squib::Import module Squib::Import