Skip to content

Commit

Permalink
Merge pull request #27 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
Updating master
  • Loading branch information
anastasia-mbithe authored Nov 29, 2021
2 parents 39cc56b + 577ff7e commit 8fc5bbe
Show file tree
Hide file tree
Showing 71 changed files with 3,828 additions and 1,833 deletions.
4 changes: 2 additions & 2 deletions docs/Download.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
<div class="col-lg-8 col-lg-offset-2 text-center">
<h2 class="section-heading">Download R-Instat</h2>
<hr class="light">
<p><a href=https://bit.ly/r-instat_072_installer_32bit" style="color:blue;" target="_blank">R-Instat 0.7.2 Installer 32 Bit (.exe 669MB)</a></p>
<p><a href=https://bit.ly/r-instat_0731_Installer_32bit style="color:blue;" target="_blank">R-Instat 0.7.3.1 Installer 32 Bit (.exe 732MB)</a></p>
<p>If you know that you have a 64 bit computer, we suggest you download the 64 Bit version</p>
<a href=https://bit.ly/r-instat_072_installer_64bit" style="color:blue;" target="_blank">R-Instat 0.7.2 Installer 64 Bit (.exe 755MB)</a>
<a href=https://bit.ly/r-instat_0731_Installer_64bit style="color:blue;" target="_blank">R-Instat 0.7.3.1 Installer 64 Bit (.exe 732MB)</a>
<p>R-Instat is currently a Windows only application. However, it can be accessed on Mac or Linux through use of a Virtual Windows Machine.</p>

<h2 class="section-heading">Installation & Documentation</h2>
Expand Down
11 changes: 4 additions & 7 deletions docs/ReleaseNotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,17 @@ <h3 class="section-heading">Installation Guide</h3>
<br />
<h3 class="section-heading">Introductory Tutorials</h3>
<p>If you are new to R-Instat, these tutorials are a good way to begin to familiarise yourself with how it works using real and interesting data sets.</p>
<p>Part 1: Describing Data <a href="Resources/Introductory-Tutorial--Part-1---Describing-Data.pdf" style="color:blue;" target="_blank">PDF version</a> |
<a href="https://github.com/africanmathsinitiative/R-Instat/wiki/Introductory-Tutorial:-Part-1---Describing-Data" style="color:blue;" target="_blank">Online version</a></p>
<p>Part 2: A Second Data Set <a href="Resources/Introductory-Tutorial--Part-2---A-Second-Data-Set.pdf" style="color:blue;" target="_blank">PDF version</a> |
<a href="https://github.com/africanmathsinitiative/R-Instat/wiki/Introductory-Tutorial:-Part-2---A-Second-Data-Set" style="color:blue;" target="_blank">Online version</a></p>
<p>Part 3: Working with Labelled Data <a href="Resources/Introductory-Tutorial--Part-3---Working-with-Labelled-Data.pdf" style="color:blue;" target="_blank">PDF version</a> |
<a href="https://github.com/africanmathsinitiative/R-Instat/wiki/Introductory-Tutorial:-Part-3-Working-with-Labelled-Data" style="color:blue;" target="_blank">Online version</a></p>
<p>Part 1: Describing Data <a href="Resources/Introductory-Tutorial--Part-1---Describing-Data.pdf" style="color:blue;" target="_blank">PDF version</a></p>
<p>Part 2: A Second Data Set <a href="Resources/Introductory-Tutorial--Part-2---A-Second-Data-Set.pdf" style="color:blue;" target="_blank">PDF version</a></p>
<p>Part 3: Working with Labelled Data <a href="Resources/Introductory-Tutorial--Part-3---Working-with-Labelled-Data.pdf" style="color:blue;" target="_blank">PDF version</a></p>
<br />
<h3 class="section-heading">Climatic Guide</h3>
<p>R-Instat includes a special climatic menu for the analysis for historical climatic data. The Climatic Guide is a comprehensive guide to R-Instat's climatic functionalities.</p>
<p>R-Instat Climatic Guide <a href="https://bit.ly/2GW8xU6" style="color:blue;" target="_blank">PDF version (48MB)</a>

<br />
<h3 class="section-heading">Tutorial Videos</h3>
<p>We are beginning to create a series of "How To" videos for R-Instat. Go to our <a href="https://www.youtube.com/watch?v=ISzrdfmFDR8&list=PLx5FJ5icCaj0_EWh6q7GfZdl01RACdueJ" style="color:blue" target="_blank"> YouTube playlist</a> to see the current collection.
<p>We have a growing collection of tutorial videos for R-Instat. Go to our <a href="https://www.youtube.com/channel/UCUprzjp27nBwycQZod_LGgw/videos" style="color:blue" target="_blank"> YouTube Channel</a> to see the current collection.
</p>
<br />
<h3 class="section-heading">Built in Help</h3>
Expand Down
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion docs/Resources/tmp.txt

This file was deleted.

126 changes: 94 additions & 32 deletions installer/Installer_Generation_Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,121 @@

To generate the installer for R-Instat with R bundled inside and all the R packages pre-installed requires a few steps.

## Step 1: Build R-Instat from Visual Studio
## 1. Pull Latest Changes
1. Update your master branch with the latest changes for the installation. Pull this to your local repo.

You will have to repeat this step for generating 32 bit and 64 bit binaries.
- In Visual Studio open the R-Instat solution.
- To the left of the Start button are two dropdowns.
- Select Release for the first dropdown
- Select x86 for 32 bit build, and x64 for 64 bit build.
- Check that clsRLink.vb is pointing to the version of R you plan to bundle
## 2. Update frmMain Title Bar
1. Open `frmMain.resx` in a text editor mode
2. Add the version number for the new version of R-Instat to `$this.Text` i.e.
```
<data name="$this.Text" xml:space="preserve">
<value>R-Instat 0.7.3</value>
</data>
```
Private strRBundledVersion As String = "3.6.2"
3. Do **not** commit this change to the repo or your local repo. The text in the development version should remain as `R-Instat`.

## 3. Check R version in `clsRLink`
1. Check that `clsRLink.vb` is pointing to the version of R you plan to bundle e.g.
```
Private strRBundledVersion As String = "R-4.1.0"
```
2. Check that this is also consistent with `strRVersionMajorRequired` and `strRVersionMinorRequired`

## 4: Build R-Instat from Visual Studio

You will have to repeat this step for generating 32 bit and 64 bit binaries.
1. In Visual Studio open the R-Instat solution.
2. To the left of the Start button are two dropdowns.
3. Select Release for the first dropdown
4. Select x86 for 32 bit build, and x64 for 64 bit build.

## 5. Add the library data sets

1. Download the R-Instat Library datasets from https://github.com/africanmathsinitiative/R-Instat-Data
2. Copy the contents of the `data` folder into `static/Library` in the Release folders for the 64 and 32 bit versions.
3. The `Library` folder should have the same subfolders and the `data` folder on GitHub https://github.com/africanmathsinitiative/R-Instat-Data/tree/main/data

## Step 2: Generate Bundled R Install
## 6. Generate Bundled R Install

Once you have built release binaries of R-Instat:
1. Open cmd.exe as an Administrator
2. cd to the the bin folder with the Release binaries. It will probably look similar to C:/Users/YourName/source/repos/R-Instat/instat/bin/Release
or for 64 bit /R-Instat/instat/bin/x64/Release
3. Then cd into the static folder (e.g R-Instat/instat/bin/Release/static)
4. Download the R installer EXE from (https://cran.r-project.org/bin/windows/base/R-3.6.2-win.exe) and save into this directory
4. Download the latest R installer EXE from (https://cran.r-project.org/) and save into this directory
5. Run the installer using
```
R-3.6.2-win.exe /DIR="./R-3.6.2"
R-4.1.0-win.exe /DIR="./R-4.1.0"
```
6. Go through the install process. Choose custom install and deselect either 32 bit or 64 bit. (If you're building for 32 bit then exclude 64 bit). Also uncheck "Save version number in registry" so that a registery entry isn't added on your machine.
7. Remove the installer from this folder after installing.
7. **Remove the installer from this folder after installing.**

## Step 3: Install R packages inside bundled R
## 7. Install R packages inside bundled R

1. Cd into the R folder you just installed ./R-3.6.2/bin
2. Run R.exe
3. Run the install_bundled_packages.R script in the same folder as this Readme.
4. The ncdf4.helpers package required a custom version, you can download it from here: https://drive.google.com/file/d/1UqwqVDxMvlHNocUa0i6uiGFT24zwGdgB/view?usp=sharing
Once you've downloaded that zip file, extract the ncdf4.helpers folder into the ./R-3.6.2/library folder
1. Open `R-4.1.0/etc/Rprofile.site` in a text editor
2. Add a blank line and then following two lines after the line that starts: `# .Library.site <-`
```r
# Only use internal library
if (length(.libPaths()) == 2) .libPaths(.libPaths()[2])
```
3. Save the file and close it. This ensures the bundled R only accesses and installs packages internally and not from other folders on your machine.

4. cd into the bin folder in the R folder you just installed `cd R-4.1.0/bin`
5. Run `R.exe`
6. Run `.libPaths()` and confirm this returns only one path which is within the bundled R e.g.
`"C:/Users/[your name]/source/repos/R-Instat/instat/bin/x64/Release/static/R-4.1.0/library"`
7. Open the file `static\InstatObject\R\Rsetup.R` in RStudio or a text editor.
8. Copy the first part of this file up to but not including the line starting `load_R_Instat_packages <-` and paste and run the copied text into your R console running in cmd.
9. If `mmtable2` is at the end of the list remove it e.g. `packs <- packs[1:length(packs)-1]` and also from versions: `versions <- versions[1:length(versions)-1]`
10. Run `packs` to confirm this outpus a long list of R packages.
11. Run `install.packages(packs, dependencies = FALSE)`. This will install all the R packages. Select the default CRAN minor if prompted. You can confirm that the packages are being installed in the correct location by opening the folder `static\R-4.1.0\library`. After running, the new packages should be listed there.
12. Run `packages_not_installed()` (which is defined in `Rsetup.R`). This should return `character(0)` to indicate that all packages are installed with their required versions.
13. Sometimes they don't install first time. If not, try running `install.packages(packages_not_installed(), dependencies = FALSE)`. Then run `packages_not_installed()` again. If there are still packages listed try closing all R/RStudio instances down and open R again in cmd. If you're still stuck, ask an R guru.
14. Install the `mmtable2` package from CRAN if it was in `packs` list. Run `devtools::install_github("ianmoran11/mmtable2")`. If prompted about updating other packages, choose "None". Confirm that it installed `packageVersion("mmtable2")`.
15. Close cmd.

## 8. Check R-Instat runs with package messages or errors.

1. Run `instat.exe` from the top level e.g. `C:\Users\[your name]\source\repos\R-Instat\instat\bin\x64\Release`
2. Confirm the version number in the title bar is correct and that there are no warnings/errors on opening.
3. Open a data set, produce a graph, produce some output, and change the langauge (and change it back) to confirm there are no serious errors.
4. Close R-Instat. Almost there!

## Step 4: Build Installer EXE using Inno Setup
## 9. Build Installer EXE using Inno Setup

1. Install Inno Setup from here: https://www.jrsoftware.org/isdl.php
2. Scroll down and select innosetup-6.0.3.exe (or a newer version)
1. Install Inno Setup from here: https://www.jrsoftware.org/isdl.php if you don't already have it
3. Open the Inno Script Compiler from the start menu
4. From the file menu choose open
5. Then navigate to the inno_install_script_32bit.iss script (or 64 bit version) in the same folder as this readme.
6. Modify neccessary detailed e.g. version numbers
7. From the top menu choose compile.
8. The installer should be in installer/Output folder
6. Change the AppId. Delete the current AppId between `{` and `}`. Leave one `{` remaining and place the cursor after it. From the top menu choose Tools > Generate GUID. Use the same AppId for the 64 and 32 bit versions so only do this once and copy from the other script the second time.
6. Update the version numbers in 4 places.
7. Change `OnlyBelowVersions` to +.1 from the new version.
8. From the top menu choose Build > Compile.
9. The installer will be in installer/Output folder

## 10. Code sign installers
Ensure that the installers are code signed by the IDEMS International code signing certificate. This requires the physical USB key. You may need to contact the key holder in the development team to arrange this.

1. Download the Windows App Certification Kit
2. Insert the USB key into your computer
3. Open cmd as Administrator
4. Run `cd C:\Program Files (x86)\Windows Kits\10\App Certification Kit`
5. Run `signtool sign /tr http://timestamp.comodoca.com?td=sha256 /td sha256 /fd sha256 /n "IDEMS International Community Interest Company" "C:\Users\Danny\Downloads\R-Instat_0.7.3_Installer_32.exe"`
6. Enter the password for the key when prompted
7. You should receive the confirmation:
```
Done Adding Additional Store
Successfully signed: C:\Users\Danny\Downloads\R-Instat_0.7.3_Installer_32.exe
```

## Step 5: Code sign installers
Ensure that the installers are code signed by the IDEMS International code signing certificate. This requires the physical USB key. You may need to contact a member of the development team to arrange this.
## 11. Draft a new release on GitHub

## Bundling a newer version of R
1. Go to Releases on GitHub https://github.com/africanmathsinitiative/R-Instat/releases and edit the current draft release. The changes should be auto populated from the list of merged PRs by the GitHub Action set up to do this.
2. Modify the notes as necessary.
3. Publish the (pre)-release.

If you want to bundle a newer version of R (after discussing with the team the consequences of that) you'll need to change the following files:
- clsRLink.vb
- inno_install_script_32bit.iss
- inno_install_script_36bit.iss
- Installer_Generation_Guide.md
## 12. Upload the installer to the website
1. Upload the installer to the central storage location (currently https://drive.google.com/drive/folders/1h5bjyRj1eEIQmWlMiactO6t2YHTs9DQb?usp=sharing)
2. Get the public link to the files
3. Create a bit.ly short link for the installer in the format https://bit.ly/r-instat_072_installer_64bit
4. Update the R-Instat website to link to the short link
12 changes: 6 additions & 6 deletions installer/inno_install_script_32bit.iss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{372F52B6-473D-48FA-BA8D-A9F794FBB800}
AppId={{82EDE163-D0A3-46BB-81E4-20166879108F}
AppName=R-Instat
#define AppVerName "0.7.2"
#define AppVerName "0.7.3"
AppVersion={#AppVerName}
AppPublisher=African Maths Initiative
AppPublisherURL=http://r-instat.org/
Expand All @@ -23,18 +23,18 @@ SolidCompression=yes

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; OnlyBelowVersion: 0,7.3
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; OnlyBelowVersion: 0,7.4

[Files]
Source: "..\instat\bin\Release\instat.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\instat\bin\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\R-Instat 0.7.2"; Filename: "{app}\instat.exe"
Name: "{group}\R-Instat 0.7.3"; Filename: "{app}\instat.exe"
Name: "{group}\{cm:UninstallProgram,R-Instat}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\R-Instat 0.7.2"; Filename: "{app}\instat.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\R-Instat 0.7.2"; Filename: "{app}\instat.exe"; Tasks: quicklaunchicon
Name: "{commondesktop}\R-Instat 0.7.3"; Filename: "{app}\instat.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\R-Instat 0.7.3"; Filename: "{app}\instat.exe"; Tasks: quicklaunchicon

[Run]
Filename: "{app}\instat.exe"; Description: "{cm:LaunchProgram,R-Instat}"; Flags: nowait postinstall skipifsilent
12 changes: 6 additions & 6 deletions installer/inno_install_script_64bit.iss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{372F52B6-473D-48FA-BA8D-A9F794FBB800}
AppId={{82EDE163-D0A3-46BB-81E4-20166879108F}
AppName=R-Instat
#define AppVerName "0.7.2"
#define AppVerName "0.7.3"
AppVersion={#AppVerName}
AppPublisher=African Maths Initiative
AppPublisherURL=http://r-instat.org/
Expand All @@ -24,18 +24,18 @@ ArchitecturesInstallIn64BitMode=x64

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; OnlyBelowVersion: 0,7.3
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; OnlyBelowVersion: 0,7.4

[Files]
Source: "..\instat\bin\x64\Release\instat.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\instat\bin\x64\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\R-Instat 0.7.2"; Filename: "{app}\instat.exe"
Name: "{group}\R-Instat 0.7.3"; Filename: "{app}\instat.exe"
Name: "{group}\{cm:UninstallProgram,R-Instat}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\R-Instat 0.7.2"; Filename: "{app}\instat.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\R-Instat 0.7.2"; Filename: "{app}\instat.exe"; Tasks: quicklaunchicon
Name: "{commondesktop}\R-Instat 0.7.3"; Filename: "{app}\instat.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\R-Instat 0.7.3"; Filename: "{app}\instat.exe"; Tasks: quicklaunchicon

[Run]
Filename: "{app}\instat.exe"; Description: "{cm:LaunchProgram,R-Instat}"; Flags: nowait postinstall skipifsilent
18 changes: 17 additions & 1 deletion instat/Model/DataFrame/clsColumnMetaData.vb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Public Class clsColumnMetaData
Private _strName As String
Private _RLink As RLink
Private _clsDataFrame As DataFrame
Private _hasChanged As Boolean

''' <summary>
''' Returns data for a given cell within the Column Meta data table
Expand Down Expand Up @@ -77,6 +78,20 @@ Public Class clsColumnMetaData
End Get
End Property

''' <summary>
''' holds whether the dataframe is different from visual grid component
''' ToDo This is more ViewModel level not here where its stored
''' </summary>
''' <returns></returns>
Public Property HasChanged() As Boolean
Get
Return _hasChanged
End Get
Set(ByVal value As Boolean)
_hasChanged = value
End Set
End Property

''' <summary>
''' Creates new instance of a column metadata class
''' </summary>
Expand All @@ -85,6 +100,7 @@ Public Class clsColumnMetaData
Public Sub New(rLink As RLink, strName As String)
_RLink = rLink
_strName = strName
_hasChanged = True
End Sub

Private Function HasDataChanged() As Boolean
Expand Down Expand Up @@ -114,7 +130,7 @@ Public Class clsColumnMetaData
Private Function GetDataFrameFromRCommand() As DataFrame
Dim clsGetVariablesMetadata As New RFunction
Dim expTemp As SymbolicExpression

_hasChanged = True
clsGetVariablesMetadata.SetRCommand(_RLink.strInstatDataObject & "$get_variables_metadata")
clsGetVariablesMetadata.AddParameter("convert_to_character", "TRUE")
clsGetVariablesMetadata.AddParameter("data_name", Chr(34) & _strName & Chr(34))
Expand Down
Loading

0 comments on commit 8fc5bbe

Please sign in to comment.