remove_file_suffix 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7058f59852485f2a85ef9b764692e27845da7e5dd3f3889cb30cd48d990c30f6
4
+ data.tar.gz: 70a50df7eaf9cf19e053cfc7321a4c4c70ff3d0177433bd47a79d2322390a3d0
5
+ SHA512:
6
+ metadata.gz: e9ac6b1c0d701e51e4ad3eabf633aa84b761ced476beb710d55ac5f453fa4c2825f2fc91269a258a1e001c5a1544c55891679903b354fac9cc54af3a6345f408
7
+ data.tar.gz: f289aebcb744800243769469ee4a326c390ae7b2b894473184923547cc05268815c9895eae254936961e7e451948d3783b7ee760befa0a79c5e118c77d352233
@@ -0,0 +1 @@
1
+ require 'remove_file_suffix/remove_file_suffix.rb'
@@ -0,0 +1,17 @@
1
+ #!/System/Index/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'remove_file_suffix/constants.rb'
6
+ # =========================================================================== #
7
+ module RemoveFileSuffix
8
+
9
+ # ========================================================================= #
10
+ # === REMOVE_UNUSUAL_SUFFIXES
11
+ #
12
+ # If the following constant is set to true, then we will also get rid
13
+ # of e. g. "-source" names.
14
+ # ========================================================================= #
15
+ REMOVE_UNUSUAL_SUFFIXES = true
16
+
17
+ end
@@ -0,0 +1,74 @@
1
+ #!/System/Index/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === RemoveFileSuffix
6
+ #
7
+ # To use this module in your project, try something like the following:
8
+ #
9
+ # require 'remove_file_suffix'
10
+ # RemoveFileSuffix[i]
11
+ #
12
+ # =========================================================================== #
13
+ # require 'remove_file_suffix/remove_file_suffix.rb'
14
+ # =========================================================================== #
15
+ require 'remove_file_suffix/constants.rb'
16
+
17
+ module RemoveFileSuffix
18
+
19
+ # ========================================================================= #
20
+ # === RemoveFileSuffix.remove_file_suffix(i)
21
+ #
22
+ # Class method here. The order should be kept, IMO. We get rid of the
23
+ # file suffix.
24
+ #
25
+ # Note that .sub() for .tar should come after .gz and .xz, because
26
+ # .tar is typically coming before these two as well, such as in a
27
+ # ".tar.gz" file. Hence we first eliminate .gz in the following
28
+ # batch .sub listing.
29
+ #
30
+ # Would it not be easier to just use File.basename() instead? We will
31
+ # try this since Jan 2014. Hmm nope, won't work.
32
+ # ========================================================================= #
33
+ def self.remove_file_suffix(i)
34
+ i = i.dup if i.frozen?
35
+ i = i.sub(/\.bz2$/, ''). # Get rid of .bz2
36
+ sub(/\.gz$/, ''). # Get rid of .gz
37
+ sub(/\.zip$/, ''). # Get rid of .zip
38
+ sub(/\.xz$/, ''). # Get rid of .xz
39
+ sub(/\.Z$/, ''). # Get rid of .Z
40
+ sub(/\.tar$/, ''). # Get rid of .tar
41
+ sub(/\.tgz$/, ''). # Get rid of .tgz
42
+ sub(/\.gem$/, ''). # Get rid of .gem
43
+ sub(/\.yml$/, ''). # Get rid of .yml
44
+ sub(/\.js$/, '') # Get rid of .js
45
+ if REMOVE_UNUSUAL_SUFFIXES
46
+ i.sub!(/-source/,'')
47
+ end
48
+ return i
49
+ end
50
+
51
+ # ========================================================================= #
52
+ # === remove_file_suffix
53
+ #
54
+ # This method will properly remove a file suffix.
55
+ # ========================================================================= #
56
+ def remove_file_suffix(i)
57
+ RemoveFileSuffix.remove_file_suffix(i)
58
+ end
59
+
60
+ # ========================================================================= #
61
+ # === RemoveFileSuffix[]
62
+ # ========================================================================= #
63
+ def self.[](i)
64
+ remove_file_suffix(i)
65
+ end
66
+
67
+ end
68
+
69
+ # =========================================================================== #
70
+ # Testing this module next:
71
+ # =========================================================================== #
72
+ if __FILE__ == $PROGRAM_NAME
73
+ p RemoveFileSuffix['foobar-1.2.0.tar.xz']
74
+ end # rb remove_file_suffix.rb
@@ -0,0 +1,40 @@
1
+ # =========================================================================== #
2
+ # Gemspec for Project RemoveFileSuffix.
3
+ # =========================================================================== #
4
+ Gem::Specification.new { |s|
5
+
6
+ s.name = 'remove_file_suffix'
7
+ s.version = '1.0.6'
8
+ s.date = Time.now.strftime('%Y-%m-%d')
9
+
10
+ DESCRIPTION = <<-EOF
11
+
12
+ This simple module allows you to remove file suffixes
13
+ from a given input.
14
+
15
+ Example for this:
16
+ RemoveFileSuffix['foobar-1.0.0.tar.xz']
17
+
18
+ If you have specific suggestions to make this gem more
19
+ useful for others, please drop me an email at:
20
+
21
+ shevegen@gmail.com
22
+
23
+ Thank you.
24
+
25
+ EOF
26
+
27
+ s.summary = DESCRIPTION
28
+ s.description = DESCRIPTION
29
+
30
+ s.authors = ['Robert A. Heiler']
31
+ s.email = 'shevegen@gmail.com'
32
+ s.files = Dir['**/*']
33
+ s.license = 'GPL-2.0'
34
+ s.homepage = 'http://rubygems.org/gems/remove_file_suffix'
35
+
36
+ s.required_ruby_version = '>= '+RUBY_VERSION
37
+ s.required_rubygems_version = '>= '+Gem::VERSION
38
+ s.rubygems_version = '>= '+Gem::VERSION
39
+
40
+ }
@@ -0,0 +1,7 @@
1
+ require 'alias_e/autoinclude'
2
+ require 'remove_file_suffix'
3
+ e RemoveFileSuffix['foobar-1.2.0.tar.xz']
4
+ e RemoveFileSuffix['barbla-1.2.0.bz2']
5
+ e RemoveFileSuffix['librep-0.92.5.tar.xz']
6
+ e RemoveFileSuffix['librep-0.92.5']
7
+ e RemoveFileSuffix['http://www.cups.org/software/2.1.3/cups-2.1.3-source.tar.bz2']
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: remove_file_suffix
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.6
5
+ platform: ruby
6
+ authors:
7
+ - Robert A. Heiler
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-11-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |2+
14
+
15
+ This simple module allows you to remove file suffixes
16
+ from a given input.
17
+
18
+ Example for this:
19
+ RemoveFileSuffix['foobar-1.0.0.tar.xz']
20
+
21
+ If you have specific suggestions to make this gem more
22
+ useful for others, please drop me an email at:
23
+
24
+ shevegen@gmail.com
25
+
26
+ Thank you.
27
+
28
+ email: shevegen@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/remove_file_suffix.rb
34
+ - lib/remove_file_suffix/constants.rb
35
+ - lib/remove_file_suffix/remove_file_suffix.rb
36
+ - remove_file_suffix.gemspec
37
+ - test/testing_remove_file_suffix.rb
38
+ homepage: http://rubygems.org/gems/remove_file_suffix
39
+ licenses:
40
+ - GPL-2.0
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 2.6.5
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 3.0.6
56
+ requirements: []
57
+ rubygems_version: 3.0.6
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: 'This simple module allows you to remove file suffixes from a given input. Example
61
+ for this: RemoveFileSuffix[''foobar-1.0.0.tar.xz''] If you have specific suggestions
62
+ to make this gem more useful for others, please drop me an email at: shevegen@gmail.com Thank
63
+ you.'
64
+ test_files: []