Skip to content

Commit

Permalink
Rename the initialization module as loader
Browse files Browse the repository at this point in the history
The bootstrap module can now call the toolkit's Initialize subroutine
directly.  Therefore, the initialization module's purpose has been
trimmed down to focus on loading the toolkit's modules in development
mode.  And hence, a more appropriate new name for the module.
  • Loading branch information
jimm-domingo committed May 12, 2016
1 parent a729ec2 commit f8292fe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
Binary file modified Simple Toolkit_DEV.xlam
Binary file not shown.
16 changes: 8 additions & 8 deletions bootstrap.bas
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ End Enum
' The mode that the add-in is currently running in.
Public CurrentMode As ToolkitMode

' The name and file path for the configuration and initialization modules that
' The name and file path for the configuration and loader modules that
' are imported in Development mode.
Public ConfModule_Name As String
Public ConfModule_Path As String
Public InitModule_Name As String
Public InitModule_Path As String
Public LoaderModule_Name As String
Public LoaderModule_Path As String

' This module is NOT imported into the development version of the add-in.
' It is exported to MODULE_FILENAME so a copy of its code is under version
Expand All @@ -38,15 +38,15 @@ Public Sub InitializeAddIn()
CurrentMode = Development
ConfModule_Path = Replace(ThisWorkbook.FullName, "DEV.xlam", _
"conf.bas")
InitModule_Path = ThisWorkbook.Path & Application.PathSeparator _
& "initialization.bas"
LoaderModule_Path = ThisWorkbook.Path & Application.PathSeparator _
& "loader.bas"
With ThisWorkbook.VBProject.VBComponents
ConfModule_Name = .Import(ConfModule_Path).Name
InitModule_Name = .Import(InitModule_Path).Name
LoaderModule_Name = .Import(LoaderModule_Path).Name
End With
Application.Run "InitializeDevelopmentMode"
Application.Run "loader.LoadToolkitModules"
Else
CurrentMode = Production
Application.Run "InitializeProductionMode"
End If
Application.Run "toolkit.Initialize"
End Sub
4 changes: 2 additions & 2 deletions dev_tools.bas
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Option Explicit

' Module dependencies:
' conf
' initialization
' loader
' toolkit


Expand All @@ -34,7 +34,7 @@ Public Sub ExportVbaCode()
If component.Name = "ThisWorkbook" Or component.Name = "Sheet1" Then
module_path = PathInThisWorkbookDir(component.Name & ".cls")
Else
module_path = initialization.ModulePaths(component.Name)
module_path = loader.ModulePaths(component.Name)
End If
component.Export module_path
Dim file_name As String
Expand Down
13 changes: 4 additions & 9 deletions initialization.bas → loader.bas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Attribute VB_Name = "initialization"
Attribute VB_Name = "loader"
Option Explicit

' This file is part of the Minnesota Population Center's VBA libraries project.
Expand All @@ -17,14 +17,9 @@ Option Explicit
' its Attribute VB_Name).
Public ModulePaths As Collection

Public Sub InitializeDevelopmentMode()
Public Sub LoadToolkitModules()
InitializeModulePaths
LoadModules
Application.Run "toolkit.Initialize"
End Sub

Public Sub InitializeProductionMode()
Application.Run "toolkit.Initialize"
End Sub

' Initialize ModulePaths with the 3 modules that are initially in the add-in
Expand All @@ -37,8 +32,8 @@ Private Sub InitializeModulePaths()
Dim module_path As String
If component.Name = bootstrap.ConfModule_Name Then
module_path = bootstrap.ConfModule_Path
ElseIf component.Name = bootstrap.InitModule_Name Then
module_path = bootstrap.InitModule_Path
ElseIf component.Name = bootstrap.LoaderModule_Name Then
module_path = bootstrap.LoaderModule_Path
Else
' Only other module is the bootstrap one
module_path = PathInThisWorkbookDir(bootstrap.MODULE_FILENAME)
Expand Down

0 comments on commit f8292fe

Please sign in to comment.