Skip to content

Commit

Permalink
Merge pull request #683 from hernanmd/compression_UI_utilities
Browse files Browse the repository at this point in the history
Compression UI utilities
  • Loading branch information
guillep committed Feb 14, 2024
2 parents 803d855 + a0e34cf commit ef9aad0
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/BaselineOfNewTools/BaselineOfNewTools.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ BaselineOfNewTools >> baseline: spec [
package: 'NewTools-Finder-Tests' with: [ spec requires: #('NewTools-Finder') ];

package: 'NewTools-SettingsBrowser' with: [ spec requires: #('ColorPicker') ];
package: 'NewTools-SettingsBrowser-Tests' with: [ spec requires: #('NewTools-SettingsBrowser') ].
package: 'NewTools-SettingsBrowser-Tests' with: [ spec requires: #('NewTools-SettingsBrowser') ];

package: 'NewTools-Compression-Utils' with: [ spec requires: #('NewTools-FileBrowser') ].

spec
group: 'Core' with: #( 'NewTools-Core' 'NewTools-Morphic' );
Expand Down Expand Up @@ -136,34 +138,37 @@ BaselineOfNewTools >> baseline: spec [
'Core'
'NewTools-FlagBrowser'
'NewTools-FlagBrowser-Tests' );
group: #development with: #( 'default'
group: 'development' with: #( 'default'
'NewTools-DebuggerSelector'
'NewTools-DebuggerSelector-Tests' );
group: #FileBrowser with: #(
group: 'FileBrowser' with: #(
'NewTools-FileBrowser'
'NewTools-FileBrowser-Tests' );
group: #RewriterTools with: #(
group: 'RewriterTools' with: #(
'NewTools-RewriterTools-Backend'
'NewTools-RewriterTools'
'NewTools-RewriterTools-Backend-Tests'
'NewTools-RewriterTools-Tests' );
group: 'Profiler' with: #( 'NewTools-ProfilerUI' );
"ScopesEditor"
group: #ScopesEditor with: #(
group: 'ScopesEditor' with: #(
'NewTools-Scopes'
'NewTools-Scopes-Editor'
'NewTools-Scopes-Resources-A-Tests'
'NewTools-Scopes-Resources-B-Tests'
'NewTools-Scopes-Resources-C-Tests'
'NewTools-Scopes-Tests');
"Finder"
group: #Finder with: #(
group: 'Finder' with: #(
'NewTools-Finder'
'NewTools-Finder-Tests');
"Settings Browser"
group: #SettingsBrowser with: #(
group: 'SettingsBrowser' with: #(
'NewTools-SettingsBrowser'
'NewTools-SettingsBrowser-Tests');
"Compression Utilities"
group: 'CompressionUtilities' with: #(
'NewTools-Compression-Utils');

group: 'default' with: #(
'Playground'
Expand All @@ -179,7 +184,8 @@ BaselineOfNewTools >> baseline: spec [
'FileBrowser'
'Finder'
'Profiler'
'SettingsBrowser') ]
'SettingsBrowser'
'CompressionUtilities') ]
]

{ #category : 'external projects' }
Expand Down
26 changes: 26 additions & 0 deletions src/NewTools-Compression-Utils/InflateStream.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Extension { #name : 'InflateStream' }

{ #category : '*NewTools-Compression-Utils' }
InflateStream class >> openWithContents: contentsString label: titleString [
"Open a text viewer on contentsString and window label titleString"

SpTextPresenter new
text: contentsString;
open;
withWindowDo: [ : w |
w
title: titleString;
extent: 600 @ 800 ]
]

{ #category : '*NewTools-Compression-Utils' }
InflateStream class >> viewContents: fullFileName [
"Open the decompressed contents of fullFileName"

| file |
(file := fullFileName asFileReference) binaryReadStreamDo: [ :aStream |
self with: aStream do: [ :aGzStream |
self
openWithContents: aGzStream upToEnd
label: 'Decompressed contents of: ' , file basename ] ]
]
18 changes: 18 additions & 0 deletions src/NewTools-Compression-Utils/ZipArchive.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Extension { #name : 'ZipArchive' }

{ #category : '*NewTools-Compression-Utils' }
ZipArchive class >> extractAllIn: aFileReferenceOrFileName [
"Service method to extract all contents of a zip.
Example:
ZipArchive extractAllIn: 'my_file.zip'
"
| directory |

directory := (StOpenDirectoryDialog new
currentDirectory: FileSystem workingDirectory;
openModal) ifNil: [ ^ self ].

^ self new
readFrom: aFileReferenceOrFileName;
extractAllTo: directory
]
1 change: 1 addition & 0 deletions src/NewTools-Compression-Utils/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : 'NewTools-Compression-Utils' }

0 comments on commit ef9aad0

Please sign in to comment.