extracter 1.2.32 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e45b6d80b96923bfd8bd5e73c3f6e65ad98e4346eabadfca63a24b74dbedf1fa
4
- data.tar.gz: dc7b8883262c5f605eba796f10b9bb3956a66d0889d59140ce6ce02f318f922b
3
+ metadata.gz: a95e00b9a7abf4e622cd9cde61ceec1f7d4bc5fb50df1976aa4da761ab0ca90e
4
+ data.tar.gz: 520285f7bb8b7341566ef7334f334562c5fc8628b86883726760af23b906d35e
5
5
  SHA512:
6
- metadata.gz: 726275b6eb718a9fcb8f8c1f1a03f9358cfbdfe1b3074e5bfecd5dba77dc9bb712ed6574f6f18fb8e87802e5c8fbb5d75b4679bfbbddb44425c1aebe41dee82b
7
- data.tar.gz: dec795cfdff6ad71a6352537d775ad0fe4d4ef8f03567c869bb26f45a8de368f6c99632763e49df153e6c8787008b095e1c8b4408f308bbcb3735d14b86f1077
6
+ metadata.gz: 88a1da48bfae7baae6e292fd949b00d1797567d5ab708327ebbc911aea5191945ab47d981e2e6cb43eff7518fc5baa77e63166603306137f76c04d94bacc0acc
7
+ data.tar.gz: 8b3611961a90c158d0c79e30e98da166a70e31e2c18c3983a647aa2c253de75e5f49a8988dbeed9d159c06c319aa17a31f7be102c5ba1d10de0fd1e446aeace1
data/README.md CHANGED
@@ -2,168 +2,197 @@
2
2
  [![forthebadge](https://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
3
3
  [![Gem Version](https://badge.fury.io/rb/extracter.svg)](https://badge.fury.io/rb/extracter)
4
4
 
5
- # Extracter
5
+ # The Extracter project
6
6
 
7
7
  ## The primary goal of the extracter gem
8
8
 
9
- This gem can help the user if said user wants to **extract a given
10
- archive**.
9
+ This gem can help the user if said user wants to <b>extract a given
10
+ archive</b>.
11
11
 
12
- ## Scope of Extracter
12
+ Naturally this requires that ruby is installed on the target
13
+ computer.
13
14
 
14
- The scope (and goals) for **class Extracter** are really simple: throw
15
- any archive format at it, and the class will try to **extract** it.
15
+ The <b>extracter-gem</b> also works on Windows, since as of March 2024,
16
+ if the program <b>7z</b> (7zip) is installed. See
17
+ https://www.7-zip.org/ for binaries that will work on Windows.
16
18
 
17
- It can be used on the commandline as well, via **bin/extracter**.
19
+ ## The scope of class Extracter
20
+
21
+ The scope (and goals) for <b>class Extracter</b>, which is the primary
22
+ class of the extracter-gem, are rather simple: throw any archive format
23
+ at this class, and the class will try to <b>extract</b> it. That's it.
24
+
25
+ The class can be used on the commandline as well, via
26
+ <b>bin/extracter</b>.
18
27
 
19
28
  Note that in order to extract a given archive, some programs must
20
- be available still. On linux this tends to be **tar**, **bzip2**,
21
- **xz** and **gzip**. On windows it is recommended to use **7-zip**.
29
+ be available. On Linux this typically involves programs such as
30
+ <b>tar</b>, <b>bzip2</b>, <b>xz</b> and <b>gzip</b>. On Windows
31
+ it is recommended to use <b>7-zip</b> - I found that <b>7-zip</b>
32
+ (7z) works best on Windows, much better than unzip or rar/unrar.
22
33
 
23
34
  ## How to find out whether a given file is a valid archive
24
35
 
25
- You can find out whether a given input **xyz** is a valid archive by
26
- issuing the following toplevel-method:
36
+ You can find out whether a given input <b>xyz</b> is a valid archive
37
+ by making use of the following <b>toplevel-method</b>:
27
38
 
28
39
  Extracter.is_this_a_valid_archive?(path)
29
40
 
30
- This will return either true or false. In <b>August 2022</b> the
31
- code was adapted slightly to return true no matter if the
32
- file extension is upcased or lowercased. In other words: a
33
- file called <b>foobar.zip</b> will work fine, as will the same
34
- file but this time called <b>foobar.ZIP</b>. I had the latter issue
35
- when I downloaded a BIOS Firmware update in August 2022 - the
36
- file was .ZIP and Extracter did not work. So that was a tiny
37
- bug in the extracter gem - it really should work on .ZIP
38
- files just fine as well, since these are simply .zip files
39
- anyway.
41
+ This will return either <b>true</b> or <b>false</b>, with
42
+ <b>false</b> being the default.
43
+
44
+ In <b>August 2022</b> the code was adapted slightly to return true
45
+ no matter if the file extension is upcased or lowercased. In other
46
+ words: a file called <b>foobar.zip</b> will work fine, as far
47
+ as this method is concerned, as will the same file but this time
48
+ called <b>foobar.ZIP</b>. I had the latter situation be an issue
49
+ when I downloaded a <b>BIOS Firmware update</b> in August 2022 -
50
+ the file had as extension <b>.ZIP</b> and Extracter did not
51
+ work as a consequence. So that was a tiny bug, or rather, an
52
+ oversight in the extracter gem - it really should work on .ZIP
53
+ files just fine as well, since these are simply .zip files,
54
+ anyway; in particular on Windows.
40
55
 
41
56
  Keep in mind that not all archive formats have been added so far,
42
- so this will return false even if it should instead return true.
43
-
44
- More support for archive formats will be added whenever possible,
45
- as time permits.
57
+ so this will return <b>false</b> even if it should instead
58
+ return true. I am willing to add support for more archive formats
59
+ in the future, as time permits.
46
60
 
47
61
  ## How to extract an archive through class Extracter, in pure ruby
48
62
 
49
- You can use the following method to extract an archive, in ruby,
63
+ You can use the following method to <b>extract an archive</b>, in ruby,
50
64
  into a specific target location on the given computer system:
51
65
 
52
- Extracter.extract_what_to('foo-1.0.tar.xz', '/tmp')
66
+ Extracter.extract_what_to('foo-1.0.tar.xz', '/tmp/')
67
+
68
+ The <b>first argument</b> is the local path to an archive.
53
69
 
54
- The first argument is the local path to an archive. The second
55
- argument simply specifies the **target**, usually the target
56
- directory. Can't get any simpler than that!
70
+ The second argument simply specifies the <b>target</b>, usually the
71
+ target directory, such as <b>/tmp/</b> in this case. Can't
72
+ get any simpler than that!
57
73
 
58
74
  ## Colour support
59
75
 
60
- If the **Colours** gem (**gem install colours**) is available then colour
61
- support is possible for **class Extracter::Extracter**.
76
+ If the <b>Colours</b> gem (<b>gem install colours</b>) is
77
+ available then <b>colour support</b> is possible for
78
+ <b>class Extracter::Extracter</b>.
62
79
 
63
- For class Extracter::Extracter, whether colours are supported is
64
- determined via the method called **.colours?**. If true then colours
65
- will be used - at the least it will be tried.
80
+ For class Extracter::Extracter, whether colours are supported
81
+ is determined via the method called <b>.colours?</b>. If true then
82
+ colours will be used - at the least the class will try to make
83
+ use of colours.
66
84
 
67
- If you do not want to have colours, for whatever the reason or use case,
68
- then you can disable this, e. g. through the method call
69
- **.disable_colours** specifically, to give one example for doing so.
85
+ If you do not want to have colours, for whatever the reason or use
86
+ case, then you can disable this, e. g. through the method call
87
+ <b>.disable_colours</b> specifically, to give one example for
88
+ doing so.
70
89
 
71
90
  ## class Extracter::ExtractIt
72
91
 
73
- **class Extracter::ExtractIt** was a standalone .gem (named **extract_it**),
74
- but since as of **September 2020** it is now part of "module Extracter".
92
+ <b>class Extracter::ExtractIt</b> was a standalone .gem (named
93
+ <b>extract_it</b>), but since as of <b>September 2020</b> it is
94
+ now part of "<b>module Extracter</b>".
75
95
 
76
- Basically this class is is a wrapper over the class Extracter, which will
77
- extract archives in general. The extraction step will go into the current
78
- working directory.
96
+ Basically this class is is a wrapper over the class Extracter, which
97
+ will extract archives in general. The extraction step will go into the
98
+ current working directory, as far as class <b>ExtractIt</b> is
99
+ concerned.
79
100
 
80
101
  ## What archives and files can be extracted?
81
102
 
82
- **class Extracter** can extract .tar.xz, .tar.bz, .tar.gz, tar.Z,
83
- .zip and numerous other file formats. This requires that tools
84
- such as **tar** or **gzip** or **xz** are installed and available
103
+ <b>class Extracter</b> can extract <b>.tar.xz</b>, .tar.bz, .tar.gz, tar.Z,
104
+ <b>.zip</b> and numerous other file formats. This requires that tools
105
+ such as <b>tar</b> or <b>gzip</b> or <b>xz</b> are installed and available
85
106
  on the target computer-machine, as we will simply use ruby to
86
107
  shell out to these other programs. Ruby is the ultimate 'glue'
87
108
  language after all.
88
109
 
89
- This class can also **extract audio-files** if ffmpeg is installed and
90
- the multimedia_paradise project is available (**gem install
91
- multimedia_paradise**), as well as squashfs files (typically
110
+ This class can also <b>extract audio-files</b> if ffmpeg is installed and
111
+ the multimedia_paradise project is available (<b>gem install
112
+ multimedia_paradise</b>), as well as squashfs files (typically
92
113
  .img files). In the latter case, such an .img file will be mounted
93
114
  in the current directory. You could then simply copy the content,
94
115
  to have a 'full' archive situation (mounting means read-only by
95
116
  deafult in this regard, hence why the copy-operation has to be
96
117
  done).
97
118
 
98
- Support for extracting **.jar files** - used by Java - has been
99
- added in **May 2020**.
119
+ Support for extracting <b>.jar files</b> - used by Java - has been
120
+ added in <b>May 2020</b>.
100
121
 
101
- Support for 'extracting' .pdf files has been added in **January 2021**.
102
- This depends on **poppler**, and it is not really an extraction; we
122
+ Support for 'extracting' .pdf files has been added in <b>January 2021</b>.
123
+ This depends on <b>poppler</b>, and it is not really an extraction; we
103
124
  simply convert the file to a .txt (text) file. For this functionality
104
- the **pdf_paradise** project has to be available.
125
+ the <b>pdf_paradise</b> project has to be available.
105
126
 
106
127
  Support for extracting archives on windows via 7zip has been added
107
- in **August 2021**. This was done because I had problems with 'tar'
108
- on windows; using 7zip bypassed these problems, and I needed to
109
- be able to extract archives on windows easily.
110
-
111
- ## Usage example:
112
-
113
- _ = Extracter.extract_what_to('foobar-1.0.tar.bz2', '/tmp/')
128
+ in <b>August 2021</b>. This was done because I had problems with
129
+ '<b>tar</b>' on windows; using 7zip bypassed these problems, and I
130
+ needed to be able to extract archives on windows easily.
114
131
 
115
- You can also use the .new variant, which goes like so::
116
-
117
- _ = Extracter.new('foo.gz', '/tmp', false) # Yes, you can extract .gz files.
118
- _.run
119
-
120
- The argument false means "do not yet run". You have to invoke
121
- the .run method in that case.
122
-
123
- The second argument to the above method is the target location,
124
- the directory where we will extract our archive to.
132
+ ## Strip components
125
133
 
126
- ## strip components
134
+ Say that we have a path such as <b>/home/x/htop/htop-3.0.5.tar.xz</b>.
127
135
 
128
- Say that we have a path such as **/home/x/htop/htop-3.0.5.tar.xz**. You
129
- want to extract it, say, into **/tmp/**.
136
+ You want to extract this archive into a directory such as
137
+ <b>/tmp/</b>.
130
138
 
131
- Normally this would create the following directory:
139
+ Normally this would create the following directory, if everything
140
+ goes according to plan:
132
141
 
133
142
  /tmp/htop-3.0.5/
134
143
 
135
- In most cases this is what the user wants; at the least I expect this
136
- if an archive is correctly tarred up, such as a **.tar.xz** file.
144
+ In most cases this is what the user wants; at the least I expect
145
+ this, if an archive is correctly tarred up, such as a
146
+ <b>.tar.xz</b> file.
137
147
 
138
148
  But there are use cases where this is not the case so. For instance,
139
149
  say that you already did creat such a directory, cd-ed into it and
140
- now just want to extract right **into** this directory. Then you
150
+ now just want to extract right <b>into</b> this directory. Then you
141
151
  don't want to end up with:
142
152
 
143
153
  /tmp/htop-3.0.5/htop-3.0.5/
144
154
 
145
- **tar** allows us to avoid this, by using the commandline flag
146
- called **--strip-components=1**.
155
+ <b>tar</b> allows us to avoid this, by using the commandline flag
156
+ called <b>--strip-components=1</b>.
147
157
 
148
- In **October 2021** I needed this for the rbt-project. Since the
158
+ In <b>October 2021</b> I needed this for the rbt-project. Since the
149
159
  old class Extracter did not support it, and the code was very messy,
150
160
  I ended up re-writing the project. It should now be better -
151
161
  at the least cleaner than it once was. And support for the above
152
162
  is possible as well now; even with a specific method call
153
- (which is **.strip_components()**).
163
+ (which is <b>.strip_components()</b>).
154
164
 
155
165
  ## Extracter.remove_archive_type
156
166
 
157
- If you have a use case where you would like to remove the file
158
- suffix from an archive, such as turning
167
+ If you have a use case where you would like to remove the file suffix
168
+ from an archive, such as turning the String
159
169
  "https://rubygems.org/rubygems/rubygems-3.3.14.tgz" into
160
- "rubygems-3.3.14" exactly, then you can use
161
- Extracter.remove_archive_type() for this.
170
+ the String "rubygems-3.3.14" <b>exactly</b>, then you can use
171
+ the toplevel method called
172
+ <b>Extracter.remove_archive_type()</b> for this
173
+ task.
162
174
 
163
- Example follows:
175
+ An usage example for this follows:
164
176
 
165
177
  Extracter.remove_archive_type(File.basename("https://rubygems.org/rubygems/rubygems-3.3.14.tgz")) # => "rubygems-3.3.14"
166
178
 
179
+ ## Usage example of the primary API:
180
+
181
+ If you want to extract something, via ruby and Extract, use:
182
+
183
+ _ = Extracter.extract_what_to('foobar-1.0.tar.bz2', '/tmp/')
184
+
185
+ You can also use the <b>.new</b> variant, which goes like so::
186
+
187
+ _ = Extracter.new('foo.gz', '/tmp', false) # Yes, you can extract .gz files as well.
188
+ _.run
189
+
190
+ The argument false means "do not yet run". You have to invoke
191
+ the .run method in that case on your own.
192
+
193
+ The second argument to the above method is the target location,
194
+ the directory where we will extract our archive to.
195
+
167
196
 
168
197
  ## Contact information and mandatory 2FA (no longer) coming up in 2022 / 2023
169
198
 
data/bin/extract CHANGED
@@ -2,6 +2,6 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
- require 'extracter'
5
+ require 'extracter/requires/require_the_extracter_project.rb'
6
6
 
7
- Extracter.what_to(ARGV, Dir.pwd)
7
+ Extracter.what_to(ARGV, Extracter.return_pwd)
data/doc/README.gen CHANGED
@@ -1,165 +1,194 @@
1
1
  ADD_RUBY_BADGE
2
2
 
3
- # Extracter
3
+ # The Extracter project
4
4
 
5
5
  ## The primary goal of the extracter gem
6
6
 
7
- This gem can help the user if said user wants to **extract a given
8
- archive**.
7
+ This gem can help the user if said user wants to <b>extract a given
8
+ archive</b>.
9
9
 
10
- ## Scope of Extracter
10
+ Naturally this requires that ruby is installed on the target
11
+ computer.
11
12
 
12
- The scope (and goals) for **class Extracter** are really simple: throw
13
- any archive format at it, and the class will try to **extract** it.
13
+ The <b>extracter-gem</b> also works on Windows, since as of March 2024,
14
+ if the program <b>7z</b> (7zip) is installed. See
15
+ https://www.7-zip.org/ for binaries that will work on Windows.
14
16
 
15
- It can be used on the commandline as well, via **bin/extracter**.
17
+ ## The scope of class Extracter
18
+
19
+ The scope (and goals) for <b>class Extracter</b>, which is the primary
20
+ class of the extracter-gem, are rather simple: throw any archive format
21
+ at this class, and the class will try to <b>extract</b> it. That's it.
22
+
23
+ The class can be used on the commandline as well, via
24
+ <b>bin/extracter</b>.
16
25
 
17
26
  Note that in order to extract a given archive, some programs must
18
- be available still. On linux this tends to be **tar**, **bzip2**,
19
- **xz** and **gzip**. On windows it is recommended to use **7-zip**.
27
+ be available. On Linux this typically involves programs such as
28
+ <b>tar</b>, <b>bzip2</b>, <b>xz</b> and <b>gzip</b>. On Windows
29
+ it is recommended to use <b>7-zip</b> - I found that <b>7-zip</b>
30
+ (7z) works best on Windows, much better than unzip or rar/unrar.
20
31
 
21
32
  ## How to find out whether a given file is a valid archive
22
33
 
23
- You can find out whether a given input **xyz** is a valid archive by
24
- issuing the following toplevel-method:
34
+ You can find out whether a given input <b>xyz</b> is a valid archive
35
+ by making use of the following <b>toplevel-method</b>:
25
36
 
26
37
  Extracter.is_this_a_valid_archive?(path)
27
38
 
28
- This will return either true or false. In <b>August 2022</b> the
29
- code was adapted slightly to return true no matter if the
30
- file extension is upcased or lowercased. In other words: a
31
- file called <b>foobar.zip</b> will work fine, as will the same
32
- file but this time called <b>foobar.ZIP</b>. I had the latter issue
33
- when I downloaded a BIOS Firmware update in August 2022 - the
34
- file was .ZIP and Extracter did not work. So that was a tiny
35
- bug in the extracter gem - it really should work on .ZIP
36
- files just fine as well, since these are simply .zip files
37
- anyway.
39
+ This will return either <b>true</b> or <b>false</b>, with
40
+ <b>false</b> being the default.
41
+
42
+ In <b>August 2022</b> the code was adapted slightly to return true
43
+ no matter if the file extension is upcased or lowercased. In other
44
+ words: a file called <b>foobar.zip</b> will work fine, as far
45
+ as this method is concerned, as will the same file but this time
46
+ called <b>foobar.ZIP</b>. I had the latter situation be an issue
47
+ when I downloaded a <b>BIOS Firmware update</b> in August 2022 -
48
+ the file had as extension <b>.ZIP</b> and Extracter did not
49
+ work as a consequence. So that was a tiny bug, or rather, an
50
+ oversight in the extracter gem - it really should work on .ZIP
51
+ files just fine as well, since these are simply .zip files,
52
+ anyway; in particular on Windows.
38
53
 
39
54
  Keep in mind that not all archive formats have been added so far,
40
- so this will return false even if it should instead return true.
41
-
42
- More support for archive formats will be added whenever possible,
43
- as time permits.
55
+ so this will return <b>false</b> even if it should instead
56
+ return true. I am willing to add support for more archive formats
57
+ in the future, as time permits.
44
58
 
45
59
  ## How to extract an archive through class Extracter, in pure ruby
46
60
 
47
- You can use the following method to extract an archive, in ruby,
61
+ You can use the following method to <b>extract an archive</b>, in ruby,
48
62
  into a specific target location on the given computer system:
49
63
 
50
- Extracter.extract_what_to('foo-1.0.tar.xz', '/tmp')
64
+ Extracter.extract_what_to('foo-1.0.tar.xz', '/tmp/')
65
+
66
+ The <b>first argument</b> is the local path to an archive.
51
67
 
52
- The first argument is the local path to an archive. The second
53
- argument simply specifies the **target**, usually the target
54
- directory. Can't get any simpler than that!
68
+ The second argument simply specifies the <b>target</b>, usually the
69
+ target directory, such as <b>/tmp/</b> in this case. Can't
70
+ get any simpler than that!
55
71
 
56
72
  ## Colour support
57
73
 
58
- If the **Colours** gem (**gem install colours**) is available then colour
59
- support is possible for **class Extracter::Extracter**.
74
+ If the <b>Colours</b> gem (<b>gem install colours</b>) is
75
+ available then <b>colour support</b> is possible for
76
+ <b>class Extracter::Extracter</b>.
60
77
 
61
- For class Extracter::Extracter, whether colours are supported is
62
- determined via the method called **.colours?**. If true then colours
63
- will be used - at the least it will be tried.
78
+ For class Extracter::Extracter, whether colours are supported
79
+ is determined via the method called <b>.colours?</b>. If true then
80
+ colours will be used - at the least the class will try to make
81
+ use of colours.
64
82
 
65
- If you do not want to have colours, for whatever the reason or use case,
66
- then you can disable this, e. g. through the method call
67
- **.disable_colours** specifically, to give one example for doing so.
83
+ If you do not want to have colours, for whatever the reason or use
84
+ case, then you can disable this, e. g. through the method call
85
+ <b>.disable_colours</b> specifically, to give one example for
86
+ doing so.
68
87
 
69
88
  ## class Extracter::ExtractIt
70
89
 
71
- **class Extracter::ExtractIt** was a standalone .gem (named **extract_it**),
72
- but since as of **September 2020** it is now part of "module Extracter".
90
+ <b>class Extracter::ExtractIt</b> was a standalone .gem (named
91
+ <b>extract_it</b>), but since as of <b>September 2020</b> it is
92
+ now part of "<b>module Extracter</b>".
73
93
 
74
- Basically this class is is a wrapper over the class Extracter, which will
75
- extract archives in general. The extraction step will go into the current
76
- working directory.
94
+ Basically this class is is a wrapper over the class Extracter, which
95
+ will extract archives in general. The extraction step will go into the
96
+ current working directory, as far as class <b>ExtractIt</b> is
97
+ concerned.
77
98
 
78
99
  ## What archives and files can be extracted?
79
100
 
80
- **class Extracter** can extract .tar.xz, .tar.bz, .tar.gz, tar.Z,
81
- .zip and numerous other file formats. This requires that tools
82
- such as **tar** or **gzip** or **xz** are installed and available
101
+ <b>class Extracter</b> can extract <b>.tar.xz</b>, .tar.bz, .tar.gz, tar.Z,
102
+ <b>.zip</b> and numerous other file formats. This requires that tools
103
+ such as <b>tar</b> or <b>gzip</b> or <b>xz</b> are installed and available
83
104
  on the target computer-machine, as we will simply use ruby to
84
105
  shell out to these other programs. Ruby is the ultimate 'glue'
85
106
  language after all.
86
107
 
87
- This class can also **extract audio-files** if ffmpeg is installed and
88
- the multimedia_paradise project is available (**gem install
89
- multimedia_paradise**), as well as squashfs files (typically
108
+ This class can also <b>extract audio-files</b> if ffmpeg is installed and
109
+ the multimedia_paradise project is available (<b>gem install
110
+ multimedia_paradise</b>), as well as squashfs files (typically
90
111
  .img files). In the latter case, such an .img file will be mounted
91
112
  in the current directory. You could then simply copy the content,
92
113
  to have a 'full' archive situation (mounting means read-only by
93
114
  deafult in this regard, hence why the copy-operation has to be
94
115
  done).
95
116
 
96
- Support for extracting **.jar files** - used by Java - has been
97
- added in **May 2020**.
117
+ Support for extracting <b>.jar files</b> - used by Java - has been
118
+ added in <b>May 2020</b>.
98
119
 
99
- Support for 'extracting' .pdf files has been added in **January 2021**.
100
- This depends on **poppler**, and it is not really an extraction; we
120
+ Support for 'extracting' .pdf files has been added in <b>January 2021</b>.
121
+ This depends on <b>poppler</b>, and it is not really an extraction; we
101
122
  simply convert the file to a .txt (text) file. For this functionality
102
- the **pdf_paradise** project has to be available.
123
+ the <b>pdf_paradise</b> project has to be available.
103
124
 
104
125
  Support for extracting archives on windows via 7zip has been added
105
- in **August 2021**. This was done because I had problems with 'tar'
106
- on windows; using 7zip bypassed these problems, and I needed to
107
- be able to extract archives on windows easily.
108
-
109
- ## Usage example:
110
-
111
- _ = Extracter.extract_what_to('foobar-1.0.tar.bz2', '/tmp/')
126
+ in <b>August 2021</b>. This was done because I had problems with
127
+ '<b>tar</b>' on windows; using 7zip bypassed these problems, and I
128
+ needed to be able to extract archives on windows easily.
112
129
 
113
- You can also use the .new variant, which goes like so::
114
-
115
- _ = Extracter.new('foo.gz', '/tmp', false) # Yes, you can extract .gz files.
116
- _.run
117
-
118
- The argument false means "do not yet run". You have to invoke
119
- the .run method in that case.
120
-
121
- The second argument to the above method is the target location,
122
- the directory where we will extract our archive to.
130
+ ## Strip components
123
131
 
124
- ## strip components
132
+ Say that we have a path such as <b>/home/x/htop/htop-3.0.5.tar.xz</b>.
125
133
 
126
- Say that we have a path such as **/home/x/htop/htop-3.0.5.tar.xz**. You
127
- want to extract it, say, into **/tmp/**.
134
+ You want to extract this archive into a directory such as
135
+ <b>/tmp/</b>.
128
136
 
129
- Normally this would create the following directory:
137
+ Normally this would create the following directory, if everything
138
+ goes according to plan:
130
139
 
131
140
  /tmp/htop-3.0.5/
132
141
 
133
- In most cases this is what the user wants; at the least I expect this
134
- if an archive is correctly tarred up, such as a **.tar.xz** file.
142
+ In most cases this is what the user wants; at the least I expect
143
+ this, if an archive is correctly tarred up, such as a
144
+ <b>.tar.xz</b> file.
135
145
 
136
146
  But there are use cases where this is not the case so. For instance,
137
147
  say that you already did creat such a directory, cd-ed into it and
138
- now just want to extract right **into** this directory. Then you
148
+ now just want to extract right <b>into</b> this directory. Then you
139
149
  don't want to end up with:
140
150
 
141
151
  /tmp/htop-3.0.5/htop-3.0.5/
142
152
 
143
- **tar** allows us to avoid this, by using the commandline flag
144
- called **--strip-components=1**.
153
+ <b>tar</b> allows us to avoid this, by using the commandline flag
154
+ called <b>--strip-components=1</b>.
145
155
 
146
- In **October 2021** I needed this for the rbt-project. Since the
156
+ In <b>October 2021</b> I needed this for the rbt-project. Since the
147
157
  old class Extracter did not support it, and the code was very messy,
148
158
  I ended up re-writing the project. It should now be better -
149
159
  at the least cleaner than it once was. And support for the above
150
160
  is possible as well now; even with a specific method call
151
- (which is **.strip_components()**).
161
+ (which is <b>.strip_components()</b>).
152
162
 
153
163
  ## Extracter.remove_archive_type
154
164
 
155
- If you have a use case where you would like to remove the file
156
- suffix from an archive, such as turning
165
+ If you have a use case where you would like to remove the file suffix
166
+ from an archive, such as turning the String
157
167
  "https://rubygems.org/rubygems/rubygems-3.3.14.tgz" into
158
- "rubygems-3.3.14" exactly, then you can use
159
- Extracter.remove_archive_type() for this.
168
+ the String "rubygems-3.3.14" <b>exactly</b>, then you can use
169
+ the toplevel method called
170
+ <b>Extracter.remove_archive_type()</b> for this
171
+ task.
160
172
 
161
- Example follows:
173
+ An usage example for this follows:
162
174
 
163
175
  Extracter.remove_archive_type(File.basename("https://rubygems.org/rubygems/rubygems-3.3.14.tgz")) # => "rubygems-3.3.14"
164
176
 
165
- ADD_CONTACT_INFORMATION
177
+ ## Usage example of the primary API:
178
+
179
+ If you want to extract something, via ruby and Extract, use:
180
+
181
+ _ = Extracter.extract_what_to('foobar-1.0.tar.bz2', '/tmp/')
182
+
183
+ You can also use the <b>.new</b> variant, which goes like so::
184
+
185
+ _ = Extracter.new('foo.gz', '/tmp', false) # Yes, you can extract .gz files as well.
186
+ _.run
187
+
188
+ The argument false means "do not yet run". You have to invoke
189
+ the .run method in that case on your own.
190
+
191
+ The second argument to the above method is the target location,
192
+ the directory where we will extract our archive to.
193
+
194
+ ADD_CONTACT_INFORMATION