Skip to content

Commit

Permalink
refactored constants from installation
Browse files Browse the repository at this point in the history
  • Loading branch information
mandersch committed Jul 22, 2019
1 parent 7a85454 commit c7c8fed
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library
awesomeLibraryName
^ 'MyAwesomeLibrary.so'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library
gitDictionaryURL
^ SPCHunspellAPIDecorator gitURL, 'build-support/dictionaries/'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library
gitURL
^'https://raw.githubusercontent.com/hpi-swa-teaching/SpellChecking/dev/'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
library installation
downloadDictionaries: aString ofLanguage: aLanguage

| resourceDirectory |
resourceDirectory := self class ressourceDirectory directoryNamed: 'dictionaries'.
resourceDirectory createDirectory: aLanguage.
resourceDirectory := resourceDirectory directoryNamed: aLanguage.
self downloadFileTo: resourceDirectory fromURL: self class gitDictionaryURL, aLanguage, '/', aString, '.dic' toFileNamed: aString, '.dic' inBinary: false.
self downloadFileTo: resourceDirectory fromURL: self class gitDictionaryURL, aLanguage, '/', aString, '.aff' toFileNamed: aString, '.aff' inBinary: false.
Original file line number Diff line number Diff line change
@@ -1,40 +1,18 @@
library installation
downloadDictionaries
| resourceDir aStream |
| resourceDir |
resourceDir := self class ressourceDirectory.
(resourceDir directoryExists: 'dictionaries') ifFalse: [
'Fetching SpellChecking dependencies' displayProgressAt: Sensor cursorPoint from: 0 to: 6 during: [ :bar |
'Fetching SpellChecking dependencies' displayProgressAt: Sensor cursorPoint from: 0 to: 3 during: [ :bar |
resourceDir createDirectory: 'dictionaries'.
resourceDir := resourceDir directoryNamed: 'dictionaries'.
resourceDir createDirectory: 'english'.
resourceDir := resourceDir directoryNamed: 'english'.
self downloadFileTo: resourceDir fromURL: 'https://github.com/hpi-swa-teaching/SpellChecking/raw/libraries-install-squeak/en_US.dic' toFileNamed: 'en_US.dic' inBinary: false.
self downloadDictionaries: 'en_US' ofLanguage: 'english'.
bar value: 1.
self downloadFileTo: resourceDir fromURL: 'https://github.com/hpi-swa-teaching/SpellChecking/raw/libraries-install-squeak/en_US.aff' toFileNamed: 'en_US.aff' inBinary: false.

self downloadDictionaries: 'de_DE' ofLanguage: 'german'.
bar value: 2.
resourceDir := FileDirectory forFileName: resourceDir pathName.
resourceDir createDirectory: 'german'.
resourceDir := resourceDir directoryNamed: 'german'.
self downloadFileTo: resourceDir fromURL: 'https://github.com/hpi-swa-teaching/SpellChecking/raw/libraries-install-squeak/de_DE.dic' toFileNamed: 'de_DE.dic' inBinary: false.

self downloadDictionaries: 'sq_SQ' ofLanguage: 'squeak'.
bar value: 3.
self downloadFileTo: resourceDir fromURL: 'https://github.com/hpi-swa-teaching/SpellChecking/raw/libraries-install-squeak/de_DE.aff' toFileNamed: 'de_DE.aff' inBinary: false.
bar value: 4.
resourceDir := FileDirectory forFileName: resourceDir pathName.
resourceDir createDirectory: 'squeak'.
resourceDir := resourceDir directoryNamed: 'squeak'.
self downloadFileTo: resourceDir fromURL: 'https://raw.githubusercontent.com/hpi-swa-teaching/SpellChecking/dev/build-support/dictionaries/squeak/sq_SQ.dic' toFileNamed: 'sq_SQ.dic' inBinary: false.
bar value: 5.
self downloadFileTo: resourceDir fromURL: 'https://raw.githubusercontent.com/hpi-swa-teaching/SpellChecking/dev/build-support/dictionaries/squeak/sq_SQ.aff' toFileNamed: 'sq_SQ.aff' inBinary: false.
bar value: 6.
]
].
resourceDir := self class ressourceDirectory directoryNamed: 'dictionaries'.
(resourceDir directoryExists: 'custom') ifFalse: [
resourceDir createDirectory: 'custom'.
resourceDir := resourceDir directoryNamed: 'custom'.
resourceDir newFileNamed: 'cu_CU.aff'.
aStream := FileStream fileNamed: SPCSpellChecker defaultCustomDictionaryPath.
aStream nextPutAll: '0'.
aStream lf.
aStream close
]
self initializeCustomDictionary.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
library installation
initializeCustomDictionary

| aStream resourceDir |
resourceDir := self class ressourceDirectory directoryNamed: 'dictionaries'.
(resourceDir directoryExists: 'custom') ifFalse: [
resourceDir createDirectory: 'custom'.
resourceDir := resourceDir directoryNamed: 'custom'.
resourceDir newFileNamed: 'cu_CU.aff'.
aStream := FileStream fileNamed: SPCSpellChecker defaultCustomDictionaryPath.
aStream nextPutAll: '0'.
aStream lf.
aStream close
]
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
library installation
installLibrariesForLinux: anInteger in: anEntry
| subdir |
| subdir urlAddition |
subdir := anEntry.
(anInteger = 64) ifTrue: [
(subdir fileExists: 'libhunspell-1.6.so.0') ifFalse: [
self downloadFileTo: subdir fromURL: 'https://github.com/hpi-swa-teaching/SpellChecking/raw/dev/64bit-libhunspell-1.6.so.0' toFileNamed: 'libhunspell-1.6.so.0' inBinary: true.
]
]
ifFalse: [
(subdir fileExists: 'libhunspell-1.6.so.0') ifFalse: [
self downloadFileTo: subdir fromURL: 'https://github.com/hpi-swa-teaching/SpellChecking/raw/dev/libhunspell-1.6.so.0' toFileNamed: 'libhunspell-1.6.so.0' inBinary: true
].
urlAddition := ''.
(subdir fileExists: self class moduleName) ifFalse:[
(anInteger = 64) ifTrue: [
urlAddition :='64bit-'
] ifFalse: [
(subdir fileExists: 'libstdc++.so.6') ifFalse: [
self downloadFileTo: subdir fromURL: 'https://github.com/hpi-swa-teaching/SpellChecking/raw/dev/libstdc%2B%2B.so.6' toFileNamed: 'libstdc++.so.6' inBinary: true
]
self downloadFileTo: subdir fromURL: (self class gitURL,'libstdc%2B%2B.so.6') toFileNamed: 'libstdc++.so.6' inBinary: true
]
].
(subdir fileExists: 'MyAwesomeLibrary.so') ifFalse: [
self downloadFileTo: subdir fromURL: 'https://github.com/hpi-swa-teaching/SpellChecking/raw/dev/MyAwesomeLibrary.so' toFileNamed: 'MyAwesomeLibrary.so' inBinary: true
]
self downloadFileTo: subdir fromURL: (self class gitURL, urlAddition, self class moduleName) toFileNamed: self class moduleName inBinary: true
].
(subdir fileExists: self class awesomeLibraryName) ifFalse: [
self downloadFileTo: subdir fromURL: (self class gitURL, self class awesomeLibraryName) toFileNamed: self class awesomeLibraryName inBinary: true
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
library installation
installLibrariesForMacOS: anInteger in: anEntry

(anEntry fileExists: 'libhunspell-darwin-x86-32.dylib') ifFalse: [
self downloadFileTo: (anEntry) fromURL: 'https://raw.githubusercontent.com/hpi-swa-teaching/SpellChecking/dev/libhunspell-darwin-x86-32.dylib' toFileNamed: 'libhunspell-darwin-x86-32.dylib' inBinary: true
(anEntry fileExists: self class moduleName) ifFalse: [
self downloadFileTo: anEntry fromURL: self class gitURL, self class moduleName toFileNamed: self class moduleName inBinary: true
]
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
library installation
installLibrariesForWindows: anInteger in: anEntry

(anInteger = 64) ifTrue: [
(anEntry fileExists: 'libhunspellx64.dll') ifFalse: [
self downloadFileTo: anEntry fromURL: 'https://raw.githubusercontent.com/hpi-swa-teaching/SpellChecking/dev/libhunspellx64.dll' toFileNamed: 'libhunspellx64.dll' inBinary: true
]
]
ifFalse: [
(anEntry fileExists: 'libhunspellx64.dll') ifFalse: [
self downloadFileTo: anEntry fromURL: 'https://raw.githubusercontent.com/hpi-swa-teaching/SpellChecking/dev/libhunspellx32.dll' toFileNamed: 'libhunspellx64.dll' inBinary: true
]
]
| downloadURL |
(anEntry fileExists: self class moduleName) ifFalse: [
(anInteger = 64) ifTrue: [
downloadURL := self class gitURL, self class moduleName
] ifFalse: [
downloadURL := self class gitURL, 'libhunspellx32.dll'
].
self downloadFileTo: anEntry fromURL: downloadURL toFileNamed: self class moduleName inBinary: true
].
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"class" : {
"affixFileType" : "mka 6/13/2019 10:26",
"awesomeLibraryName" : "mka 7/22/2019 12:29",
"dictionaryFileType" : "mka 6/13/2019 10:27",
"disableDownload" : "mka 7/1/2019 13:20",
"disableDownload:" : "mka 7/1/2019 13:21",
"fileExists:" : "mka 7/1/2019 13:31",
"gitDictionaryURL" : "mka 7/22/2019 12:35",
"gitURL" : "mka 7/22/2019 13:06",
"libraryExists" : "mka 7/2/2019 11:16",
"moduleName" : "mka 7/1/2019 13:23",
"ressourceDirectory" : "mka 7/1/2019 13:22",
Expand All @@ -22,18 +25,20 @@
"createHandle" : "ea 6/7/2019 17:21",
"createHandle:affix:" : "ea 6/7/2019 16:04",
"destroyHandle" : "ea 6/7/2019 16:58",
"downloadDictionaries" : "mka 7/16/2019 17:01",
"downloadDictionaries" : "mka 7/22/2019 13:08",
"downloadDictionaries:ofLanguage:" : "mka 7/22/2019 12:52",
"downloadFileTo:fromURL:toFileNamed:inBinary:" : "mka 7/1/2019 13:17",
"downloadLibraries" : "mka 7/16/2019 17:01",
"getAffixPath:" : "mka 6/13/2019 10:24",
"getSuggestions:" : "mka 7/16/2019 17:02",
"importDictionary:withAffix:of:" : "mka 7/16/2019 17:02",
"initialize" : "mka 7/2/2019 12:06",
"initializeCustomDictionary" : "mka 7/22/2019 12:57",
"initializeLevenshteinMatrixfor:toString:" : "mka 7/16/2019 17:02",
"installDependencies" : "mka 7/1/2019 13:19",
"installLibrariesForLinux:in:" : "mka 7/16/2019 17:03",
"installLibrariesForMacOS:in:" : "mka 7/16/2019 17:03",
"installLibrariesForWindows:in:" : "mka 7/16/2019 17:03",
"installLibrariesForLinux:in:" : "mka 7/22/2019 12:29",
"installLibrariesForMacOS:in:" : "mka 7/22/2019 12:27",
"installLibrariesForWindows:in:" : "mka 7/22/2019 12:27",
"instances" : "ea 6/7/2019 15:23",
"instances:" : "ea 6/7/2019 15:23",
"isDecorator" : "ea 6/7/2019 15:25",
Expand Down
2 changes: 1 addition & 1 deletion packages/Spellcheck-Core.package/monticello.meta/version

Large diffs are not rendered by default.

0 comments on commit c7c8fed

Please sign in to comment.