extracter 1.2.21

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of extracter might be problematic. Click here for more details.

@@ -0,0 +1,157 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'extracter/constants/constants.rb'
6
+ # =========================================================================== #
7
+ module Extracter
8
+
9
+ # ========================================================================= #
10
+ # === N
11
+ # ========================================================================= #
12
+ N = "\n"
13
+
14
+ # ========================================================================= #
15
+ # === Extracter::ARRAY_REGISTERED_ARCHIVES
16
+ #
17
+ # Archives that can be extracted, have to be registered in this Array.
18
+ #
19
+ # Sort alphabetically.
20
+ #
21
+ # The libreoffice format .odt is just like .zip.
22
+ # ========================================================================= #
23
+ ARRAY_REGISTERED_ARCHIVES = %w(
24
+ 7z
25
+ apk
26
+ apkg
27
+ bin
28
+ bz2
29
+ deb
30
+ gem
31
+ gz
32
+ img
33
+ iso
34
+ jar
35
+ lz
36
+ lzma
37
+ odt
38
+ mp4
39
+ pdf
40
+ rar
41
+ rpm
42
+ squashfs
43
+ sxz
44
+ tar
45
+ taz
46
+ tbz
47
+ tgz
48
+ txz
49
+ xpi
50
+ xz
51
+ zip
52
+ Z
53
+ zst
54
+ )
55
+
56
+ # ========================================================================= #
57
+ # === LAST_UPDATED
58
+ #
59
+ # When this class was last updated/releasted. This is not a hugely
60
+ # important constat, so do not worry too much if this may be heavily
61
+ # outdated eventually.
62
+ # ========================================================================= #
63
+ LAST_UPDATED = '08.10.2021'
64
+
65
+ # ========================================================================= #
66
+ # === TEMP_DIR
67
+ #
68
+ # Set the temp dir here.
69
+ # ========================================================================= #
70
+ if ENV['MY_TEMP']
71
+ TEMP_DIR = ENV['MY_TEMP'].to_s+'/'
72
+ else
73
+ # ======================================================================= #
74
+ # If this environment variable is unavailable then use a conservative
75
+ # default value.
76
+ # ======================================================================= #
77
+ TEMP_DIR = '/tmp/'
78
+ end
79
+
80
+ # ========================================================================= #
81
+ # === GEM_UNPACK_COMMAND
82
+ #
83
+ # The command to use to unpack ruby .gems.
84
+ # We can pass the ---target=DIR syntax to extract to a specific location.
85
+ # ========================================================================= #
86
+ GEM_UNPACK_COMMAND = 'gem unpack'
87
+
88
+ # ========================================================================= #
89
+ # === UNPACK_COMMAND_TO_USE_ON_WINDOWS
90
+ #
91
+ # The full commandline will look like this:
92
+ #
93
+ # 7z x -so C:\home\x\src\htop\htop-3.0.5.tar.xz | 6z x -si -ttar
94
+ #
95
+ # ========================================================================= #
96
+ UNPACK_COMMAND_TO_USE_ON_WINDOWS = '7z x -so '
97
+
98
+ # ========================================================================= #
99
+ # === SECOND_UNPACK_COMMAND_TO_USE_ON_WINDOWS
100
+ # ========================================================================= #
101
+ SECOND_UNPACK_COMMAND_TO_USE_ON_WINDOWS = '7z x -si -ttar'
102
+
103
+ # ========================================================================= #
104
+ # === COMMAND_TO_EXTRACT_BSDTAR_ARCHIVES
105
+ #
106
+ # This command is to specifically extract rpm-archives.
107
+ # ========================================================================= #
108
+ COMMAND_TO_EXTRACT_BSDTAR_ARCHIVES = 'bsdtar xfv'
109
+
110
+ # ========================================================================= #
111
+ # === COMMAND_TO_EXTRACT_TAR_BZ2_FILES
112
+ # ========================================================================= #
113
+ COMMAND_TO_EXTRACT_TAR_BZ2_FILES = 'tar -xjvf'
114
+
115
+ # ========================================================================= #
116
+ # === COMMAND_TO_EXTRACT_JAR_ARCHIVES
117
+ # ========================================================================= #
118
+ COMMAND_TO_EXTRACT_JAR_ARCHIVES = 'jar xvf'
119
+
120
+ # ========================================================================= #
121
+ # === COMMAND_TO_EXTRACT_TGZ_FILES
122
+ #
123
+ # This is specifically for .tgz files.
124
+ # ========================================================================= #
125
+ COMMAND_TO_EXTRACT_TGZ_FILES = 'tar zxvf'
126
+
127
+ # ========================================================================= #
128
+ # === COMMAND_TO_EXTRACT_LZ_FILES
129
+ # ========================================================================= #
130
+ COMMAND_TO_EXTRACT_LZ_FILES = 'tar --lzip -xvf'
131
+
132
+ # ========================================================================= #
133
+ # === COMMAND_TO_EXTRACT_TAR_XZ_FILES
134
+ # ========================================================================= #
135
+ COMMAND_TO_EXTRACT_TAR_XZ_FILES = 'tar -xvf'
136
+
137
+ # ========================================================================= #
138
+ # === COMMAND_TO_EXTRACT_LZMA_FILES
139
+ # ========================================================================= #
140
+ COMMAND_TO_EXTRACT_LZMA_FILES = 'unlzma'
141
+
142
+ # ========================================================================= #
143
+ # === COMMAND_TO_EXTRACT_DEB_FILES
144
+ # ========================================================================= #
145
+ COMMAND_TO_EXTRACT_DEB_FILES = 'ar -x'
146
+
147
+ # ========================================================================= #
148
+ # === COMMAND_TO_EXTRACT_ZST_ARCHIVES
149
+ # ========================================================================= #
150
+ COMMAND_TO_EXTRACT_ZST_ARCHIVES = 'tar -I zstd -xvf'
151
+
152
+ # ========================================================================= #
153
+ # === COMMAND_TO_EXTRACT_TAR_FILES
154
+ # ========================================================================= #
155
+ COMMAND_TO_EXTRACT_TAR_FILES = 'tar -xvf'
156
+
157
+ end
@@ -0,0 +1,240 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === Extracter::ExtractIt
6
+ #
7
+ # If no input was provided to this class, but a .zip file exists in
8
+ # the current working directory, then that .zip file will be used.
9
+ #
10
+ # Usage example:
11
+ #
12
+ # Extracter::ExtractIt.new(ARGV)
13
+ #
14
+ # =========================================================================== #
15
+ # require 'extracter/extract_it/extract_it.rb'
16
+ # =========================================================================== #
17
+ require 'extracter/base/base.rb'
18
+
19
+ module Extracter
20
+
21
+ class ExtractIt < ::Extracter::Base # === Extracter::ExtractIt
22
+
23
+ require 'extracter/class/extracter.rb' # This file will pull in some other .rb files.
24
+ require 'extracter/constants/constants.rb'
25
+ require 'extracter/toplevel_methods/misc.rb'
26
+
27
+ # ========================================================================= #
28
+ # === ExtractIt::NAMESPACE
29
+ # ========================================================================= #
30
+ NAMESPACE = inspect
31
+
32
+ # ========================================================================= #
33
+ # === ExtractIt::ARRAY_ARCHIVE_TYPES
34
+ #
35
+ # Register the available (and handled) archive types here.
36
+ # ========================================================================= #
37
+ ARRAY_ARCHIVE_TYPES = ::Extracter::ARRAY_REGISTERED_ARCHIVES
38
+
39
+ # ========================================================================= #
40
+ # === initialize
41
+ # ========================================================================= #
42
+ def initialize(
43
+ optional_set_input = nil,
44
+ run_already = true
45
+ )
46
+ reset
47
+ set_input(optional_set_input)
48
+ run if run_already
49
+ end
50
+
51
+ # ========================================================================= #
52
+ # === reset (reset tag)
53
+ # ========================================================================= #
54
+ def reset
55
+ super()
56
+ # ======================================================================= #
57
+ # === @debug
58
+ # ======================================================================= #
59
+ @debug = false
60
+ end
61
+
62
+ # ========================================================================= #
63
+ # === show_help
64
+ # ========================================================================= #
65
+ def show_help
66
+ e 'We will show a little bit help, then exit.'
67
+ e
68
+ e 'To extract .tar.xz, do:'
69
+ e
70
+ efancy ' → tar -xJf *.tar.xz'
71
+ end
72
+
73
+ # ========================================================================= #
74
+ # === set_input
75
+ #
76
+ # We will work on an Array as value to @input, at the end of this
77
+ # method.
78
+ # ========================================================================= #
79
+ def set_input(i = N)
80
+ case i
81
+ # ======================================================================= #
82
+ # === extract_it --help
83
+ # ======================================================================= #
84
+ when /-?-?help$/i # Show some help stuff here.
85
+ show_help
86
+ exit
87
+ end
88
+ i = [i] if i.is_a? String # Need an Array.
89
+ if @debug
90
+ opn; e 'The input given to us is: `'+sfile(i)+'`'
91
+ end
92
+ if i.is_a?(Array) and i.empty?
93
+ # ===================================================================== #
94
+ # In this case, try to see if the current directory has a .zip
95
+ # file. We will use this in that case.
96
+ # ===================================================================== #
97
+ is_there_a_zip_file = Dir['*.zip']
98
+ unless is_there_a_zip_file.empty?
99
+ use_this_zip_file = is_there_a_zip_file.first
100
+ notify_the_user_that_no_input_was_given_but_this_file_was_found(use_this_zip_file)
101
+ i << use_this_zip_file
102
+ end
103
+ is_there_at_the_least_one_tar_xz_file = Dir['*.tar.xz']
104
+ unless is_there_at_the_least_one_tar_xz_file.empty?
105
+ i << is_there_at_the_least_one_tar_xz_file.first
106
+ end
107
+ end
108
+ @input = i # Should be an array, always.
109
+ end
110
+
111
+ # ========================================================================= #
112
+ # === be_silent
113
+ # ========================================================================= #
114
+ def be_silent
115
+ @be_silent = true
116
+ end
117
+
118
+ # ========================================================================= #
119
+ # === be_verbose
120
+ # ========================================================================= #
121
+ def be_verbose
122
+ @be_silent = false
123
+ end; alias show_commands_used be_verbose # === show_commands_used
124
+
125
+ # ========================================================================= #
126
+ # === notify_the_user_that_no_input_was_given_but_this_file_was_found
127
+ # ========================================================================= #
128
+ def notify_the_user_that_no_input_was_given_but_this_file_was_found(
129
+ this_file
130
+ )
131
+ opn; e "No input was given to #{sfancy(NAMESPACE)} but a "\
132
+ ".zip file was"
133
+ opn; e 'found in this directory ('+sdir(Dir.pwd)+'): '+
134
+ sfancy(this_file)
135
+ opn; e 'We will use this zip file.'
136
+ end
137
+
138
+ # ========================================================================= #
139
+ # === try_to_glob_on
140
+ # ========================================================================= #
141
+ def try_to_glob_on(i)
142
+ result = Dir["#{i}*"]
143
+ # ======================================================================= #
144
+ # Next, sort this result to put archives on the beginning of the Array.
145
+ # ======================================================================= #
146
+ result = result.partition {|entry| is_archive?(entry) }
147
+ result.flatten!
148
+ unless result.empty?
149
+ # ===================================================================== #
150
+ # Ok, we grab the first entry next.
151
+ # ===================================================================== #
152
+ i = result.first
153
+ opn; e "No result could be found for the given input, thus "\
154
+ "using #{sfancy(i)} instead."
155
+ end
156
+ i
157
+ end
158
+
159
+ # ========================================================================= #
160
+ # === extract_input
161
+ # ========================================================================= #
162
+ def extract_input
163
+ pp @input if @debug
164
+ @input.each {|entry|
165
+ to_this_dir = Dir.pwd
166
+ to_this_dir << '/' unless to_this_dir.end_with? '/'
167
+ unless File.exist? entry
168
+ entry = try_to_glob_on(entry)
169
+ end
170
+ # ===================================================================== #
171
+ # Delegate to class Extracter next.
172
+ # ===================================================================== #
173
+ Extracter.extract_what_to(
174
+ entry,
175
+ to_this_dir
176
+ ) {{ be_verbose: @be_silent }}
177
+ _ = ::Extracter.remove_file_suffix(entry)
178
+ if File.exist? entry
179
+ # =================================================================== #
180
+ # Must also check whether the extracted directory exists.
181
+ # =================================================================== #
182
+ name_of_the_extracted_archive = to_this_dir+_
183
+ ARRAY_ARCHIVE_TYPES.each {|extension_name|
184
+ if name_of_the_extracted_archive.include? extension_name
185
+ quoted = Regexp.quote(extension_name)
186
+ name_of_the_extracted_archive.sub!(/#{quoted}$/,'')
187
+ end
188
+ }
189
+ if File.exist?(name_of_the_extracted_archive) and
190
+ # ================================================================= #
191
+ # The following check ensures that we really have another name
192
+ # for the extracted directory.
193
+ # ================================================================= #
194
+ !(entry == name_of_the_extracted_archive)
195
+ opn; e "Finished extracting #{sfile(_)} to `#{sdir(to_this_dir)}`."
196
+ else
197
+ opn; e "No file called `#{sfile(name_of_the_extracted_archive)}"\
198
+ "` appears to exist."
199
+ end
200
+ end
201
+ }
202
+ end
203
+
204
+ # ========================================================================= #
205
+ # === is_archive?
206
+ # ========================================================================= #
207
+ def is_archive?(i)
208
+ ARRAY_ARCHIVE_TYPES.include?(
209
+ File.extname(File.basename(i))
210
+ )
211
+ end
212
+
213
+ # ========================================================================= #
214
+ # === run (run tag)
215
+ # ========================================================================= #
216
+ def run
217
+ extract_input
218
+ end
219
+
220
+ # ========================================================================= #
221
+ # === Extracter::ExtractIt[]
222
+ # ========================================================================= #
223
+ def self.[](i = '')
224
+ new(i)
225
+ end
226
+
227
+ end
228
+
229
+ # =========================================================================== #
230
+ # === Extracter.extract_it
231
+ # =========================================================================== #
232
+ def self.extract_it(i = ARGV, run_already = true)
233
+ ::Extracter::ExtractIt.new(i, run_already)
234
+ end
235
+
236
+ end
237
+
238
+ if __FILE__ == $PROGRAM_NAME
239
+ Extracter::ExtractIt.new(ARGV)
240
+ end # extractitrb
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'extracter/requires/require_the_extracter_project.rb'
6
+ # =========================================================================== #
7
+ require 'extracter/class/extracter.rb'
8
+ require 'extracter/extract_it/extract_it.rb'
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'extracter/toplevel_methods/is_this_a_valid_archive.rb'
6
+ # Extracter.is_this_a_valid_archive?
7
+ # =========================================================================== #
8
+ module Extracter
9
+
10
+ require 'extracter/constants/constants.rb'
11
+
12
+ # ========================================================================= #
13
+ # === Extracter.is_this_a_valid_archive?
14
+ #
15
+ # Query whether the input given to this method is a valid archive.
16
+ # This allows us to determine whether the Extracter project can
17
+ # deal with the given archive at hand or whether it can not.
18
+ #
19
+ # The registered formats are stored in the constant
20
+ # ARRAY_REGISTERED_ARCHIVES.
21
+ # ========================================================================= #
22
+ def self.is_this_a_valid_archive?(
23
+ i, # The given input, such as "foobar.zip".
24
+ array_registered_archives = ARRAY_REGISTERED_ARCHIVES
25
+ )
26
+ if i.is_a? Array
27
+ i = i.first
28
+ end
29
+ return_value = false
30
+ array_registered_archives.each {|entry|
31
+ return_value = true if i =~ /#{entry}$/i
32
+ }
33
+ return return_value
34
+ end; self.instance_eval { alias is_archive? is_this_a_valid_archive? } # === Extracter.is_archive?
35
+ self.instance_eval { alias is_this_a_valid_archive? is_this_a_valid_archive? } # === Extracter.is_this_a_valid_archive?
36
+
37
+ end
38
+
39
+ if __FILE__ == $PROGRAM_NAME
40
+ pp Extracter.is_this_a_valid_archive?(ARGV)
41
+ end
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === require 'extracter/toplevel_methods/misc.rb'
6
+ # =========================================================================== #
7
+ module Extracter
8
+
9
+ # ========================================================================= #
10
+ # === Extracter.remove_archive_type
11
+ # ========================================================================= #
12
+ def self.remove_archive_type(i)
13
+ return i.delete_suffix('.xz').
14
+ delete_suffix('.tgz').
15
+ delete_suffix('.bz2').
16
+ delete_suffix('.gz').
17
+ delete_suffix('.tar').
18
+ delete_suffix('.zip').
19
+ delete_suffix('.gem')
20
+ end; self.instance_eval { alias remove_file_suffix remove_archive_type } # === Extracter.remove_file_suffix
21
+
22
+ # ========================================================================= #
23
+ # === Extracter.are_we_on_windows?
24
+ # ========================================================================= #
25
+ def self.are_we_on_windows?
26
+ RUBY_PLATFORM.include?('win') or
27
+ RUBY_PLATFORM.include?('mingw')
28
+ end
29
+
30
+ end
31
+
32
+ if __FILE__ == $PROGRAM_NAME
33
+ puts Extracter.are_we_on_windows?
34
+ end
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'extracter/version/version.rb'
6
+ # =========================================================================== #
7
+ module Extracter
8
+
9
+ # ========================================================================= #
10
+ # === VERSION
11
+ #
12
+ # Which specific version to use for class Extracter.
13
+ # ========================================================================= #
14
+ VERSION = '1.2.21'
15
+
16
+ # ========================================================================= #
17
+ # === LAST_UPDATE
18
+ # ========================================================================= #
19
+ LAST_UPATE = '22.09.2022'
20
+
21
+ end
data/lib/extracter.rb ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'extracter/requires/require_the_extracter_project.rb'
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ if __FILE__ == $PROGRAM_NAME
6
+ require 'fileutils'
7
+ require 'extracter'
8
+ require 'colours/colours_e_autoinclude.rb'
9
+ extract_to = '/home/Temp/'
10
+ e 'Now testing class Extracter - some will fail, do not worry:'
11
+ e
12
+ e Colours.orange('1) Testing Extracter.is_this_a_valid_archive?() functionality:')
13
+ e
14
+ e Extracter.is_this_a_valid_archive? 'foo.php'
15
+ # Extracter.new(ARGV)
16
+ FileUtils.cp('/home/x/src/recode/recode-3.7.1.tar.xz','/Depot/j')
17
+ Extracter.what_to '/Depot/j/recode-3.7.1.tar.xzg', '/Depot/jj' # This line is deliberately wrong.
18
+ Extracter.what_to '/Depot/j/recode-3.7.1.tar.xz', '/Depot/jj'
19
+ Extracter.what_to '/Depot/j/recode-3.7.1.gzip', '/Depot/jj'
20
+ e Colours.orange("2) Next testing "+sfancy("Extracter['/home/x/src/htop/']"))
21
+ Extracter['/home/x/src/htop/']
22
+ e Colours.orange("3) Next testing "+sfancy("Extracter['/home/x/src/libzip/']"))
23
+ Extracter['/home/x/src/libzip/', to: extract_to]
24
+ # Test the strip-components part next:
25
+ end # testextracter
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # This file will only test Extracter.extract_what_to().
6
+ # =========================================================================== #
7
+ require 'extracter/class/extracter.rb'
8
+
9
+ Extracter.extract_what_to('/home/x/src/php/php-8.1.5.tar.xz', '/home/Temp/')
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: extracter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.21
5
+ platform: ruby
6
+ authors:
7
+ - Robert A. Heiler
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: opn
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: "\nThis fairly small project can be used to extract different\narchive
28
+ formats such as .tar.bz2 or .tbz - archives such\nas .gem and .lzma will also work.\n\nYou
29
+ can also extract audio, by making use of class ExtractAudio\n(part of the multimedia_paradise
30
+ gem. The latter is - and should\nbe - optional, though. If you have no such use
31
+ case then you \nwon't need to install the multimedia_paradise gem.\n\nUsage example:\n\n
32
+ \ require 'extracter'\n\n Extracter.new('/foo/bla-1.0.tar.bz2')\n\nThe second
33
+ argument that can be passed to the method new()\nspecifies where this should be
34
+ extract to.\n\nFor example:\n\n Extracter.new('/foo/bla-1.0.tar.bz2', '/opt')\n\nThis
35
+ would extract to the /opt directory.\n\nYou can query whether input is an archive
36
+ or not via:\n\n Extracter.is_archive? 'foo.tar.xz'\n\nAs of April 2014 we also
37
+ provide a bin/extract file, so that\nyou can simply extract something from the commandline.\n\nSince
38
+ as of November 2018, class Extracter can also \"extract\"\n.iso files. (The .iso
39
+ will be mounted to a directory that\nwill be created, actually.)\n\n"
40
+ email: shevy@inbox.lt
41
+ executables: []
42
+ extensions: []
43
+ extra_rdoc_files: []
44
+ files:
45
+ - README.md
46
+ - bin/extract
47
+ - bin/extract_it
48
+ - doc/README.gen
49
+ - extracter.gemspec
50
+ - lib/extracter.rb
51
+ - lib/extracter/base/base.rb
52
+ - lib/extracter/class/extract_this_archive.rb
53
+ - lib/extracter/class/extracter.rb
54
+ - lib/extracter/constants/constants.rb
55
+ - lib/extracter/extract_it/extract_it.rb
56
+ - lib/extracter/requires/require_the_extracter_project.rb
57
+ - lib/extracter/toplevel_methods/is_this_a_valid_archive.rb
58
+ - lib/extracter/toplevel_methods/misc.rb
59
+ - lib/extracter/version/version.rb
60
+ - test/testing_class_extracter.rb
61
+ - test/testing_class_method_extract_what_to.rb
62
+ homepage: https://rubygems.org/gems/extracter
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message: "\n class Extracter can be used to extract archives, such as
67
+ .tar.gz or\n .zip.\n\n If you need some help, you can invoke bin/extract via:\n\n
68
+ \ extract --help\n\n In general, the syntax for extract is kept simple. Just
69
+ pass in the\n archive that has to be extracted as the first argument to \n extract
70
+ ( bin/extract) , and class Extracter will try to extract\n it, if it is a registered
71
+ archive format.\n\n In ruby code, you may be able to use class Extracter in this
72
+ manner:\n\n require 'extracter'\n Extracter[file_path_here]\n\n or\n\n
73
+ \ require 'extracter'\n Extracter.new(file_path_here)\n\n Specific example:\n\n
74
+ \ require 'extracter'\n Extracter.new('htop-2.2.0.tar.xz')\n\n See the
75
+ --help option.\n\n"
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 2.7.6
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 3.3.22
89
+ requirements: []
90
+ rubygems_version: 3.3.22
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: 'This fairly small project can be used to extract different archive formats
94
+ such as .tar.bz2 or .tbz - archives such as .gem and .lzma will also work. You
95
+ can also extract audio, by making use of class ExtractAudio (part of the multimedia_paradise
96
+ gem. The latter is - and should be - optional, though. If you have no such use case
97
+ then you won''t need to install the multimedia_paradise gem. Usage example: require
98
+ ''extracter'' Extracter.new(''/foo/bla-1.0.tar.bz2'') The second argument that
99
+ can be passed to the method new() specifies where this should be extract to. For
100
+ example: Extracter.new(''/foo/bla-1.0.tar.bz2'', ''/opt'') This would extract
101
+ to the /opt directory. You can query whether input is an archive or not via: Extracter.is_archive?
102
+ ''foo.tar.xz'' As of April 2014 we also provide a bin/extract file, so that you
103
+ can simply extract something from the commandline. Since as of November 2018, class
104
+ Extracter can also "extract" .iso files. (The .iso will be mounted to a directory
105
+ that will be created, actually.)'
106
+ test_files: []