greenhat 0.7.4 → 0.8.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a519d68faaec2994665e8c6e442923578d6a0f165a2213f3a5ef0e7e45b65903
4
- data.tar.gz: 1a9f905cf1d9f8738a1658f932b5d14d8ef9964a0bb2360a5438460330e868d1
3
+ metadata.gz: e7caec2b171d012ac284044e1064b665f42aeddf026a56267d4e8fe6ae44c394
4
+ data.tar.gz: 24ec9744a8d27b56a6576d1f49edf22d1365349f86f6470f5f3c53cfac53bafc
5
5
  SHA512:
6
- metadata.gz: 6e9f31443fdb9917069831fc89e39b97f198c3b298bb06b2331dc0788d2f7ca31e4ce65b1f69e0a89e82d6788e810fe0d344a5cb2c74b30aa53d3b7577442f96
7
- data.tar.gz: 3534f35919122f6b01aaa1570429faf852dc4c91c3e170a55e693cc84207fa391cfb7ad2c85af4cca46a0d83adcbbfaa24ecf1db52bcfa76d08bf38d8c42ad83
6
+ metadata.gz: 978d6fc74f1adb0fbab249a41d26efc01d0e0b9c1c1cccf4e5ef143c0405db02ad285c3ed20c6bcfd36432a1d3ecfc31b93325990a333123ea4ec271be4f8e6e
7
+ data.tar.gz: 72e3417a4011b35c0c3a4a9552d0ccf4321334ca901e74b4c7ae33b21d649644739bb08845cea1a9c5621e96aa40e641ff8a566f3d18d735fd4461d083651927
data/README.md CHANGED
@@ -29,6 +29,8 @@ greenhat production_json.log
29
29
  >> help # the program is self-documented through the builtin help command
30
30
  ```
31
31
 
32
+ [Watch an introductory tutorial](https://www.youtube.com/watch?v=xyVQiKFgeP4) (recorded March 5, 2024, with Green Hat v0.7.3)
33
+
32
34
  ## Testing
33
35
 
34
36
  ```
@@ -50,23 +50,29 @@ module GreenHat
50
50
 
51
51
  # Handle Different Types of Archives
52
52
  def self.unpack(archive_path, path)
53
+ decompressed_successfully = false
54
+
53
55
  case File.extname archive_path
54
- when '.tgz'
55
- base_path = archive_path.gsub(File.basename(archive_path), '')
56
- `bsdtar -xzf "#{archive_path}" -C #{base_path}`
57
- FileUtils.rm(archive_path)
58
- when '.tar'
56
+ when '.tgz', '.tar'
59
57
  base_path = archive_path.gsub(File.basename(archive_path), '')
60
58
  `bsdtar -xf "#{archive_path}" -C #{base_path}`
61
- FileUtils.rm(archive_path)
59
+
60
+ decompressed_successfully = $CHILD_STATUS.success?
61
+ FileUtils.rm(archive_path) if decompressed_successfully
62
62
  when '.gz'
63
63
  `gzip -d "#{archive_path}"`
64
+
65
+ decompressed_successfully = $CHILD_STATUS.success?
64
66
  when '.zip'
65
67
  base_path = archive_path.gsub(File.basename(archive_path), '')
66
68
  `unzip -o -d "#{base_path}" #{archive_path}`
67
- FileUtils.rm(archive_path)
69
+
70
+ decompressed_successfully = $CHILD_STATUS.success?
71
+ FileUtils.rm(archive_path) if decompressed_successfully
68
72
  when '.bz2'
69
73
  `bzip2 -d #{archive_path}`
74
+
75
+ decompressed_successfully = $CHILD_STATUS.success?
70
76
  when '.s'
71
77
  # Find Original Directory, Split Path, Rename to .gz
72
78
  base_path = archive_path.gsub(File.basename(archive_path), '')
@@ -74,6 +80,15 @@ module GreenHat
74
80
  else
75
81
  FileUtils.cp(archive_path, "#{path}/#{archive_path}")
76
82
  end
83
+
84
+ # if the archive is corrupt and doesn't uncompress properly, greenhat will keep looping on it endlessly,
85
+ # trying to decompress it. let's rename it on failure so it stops trying, but the SE can still try and
86
+ # extract it themselves.
87
+ return if decompressed_successfully
88
+
89
+ puts "#{'Decompress failed'.pastel(:red)}: #{archive_path.pastel(:green)}"
90
+ puts 'Renaming file so we can continue.'.pastel(:yellow)
91
+ FileUtils.mv(archive_path, "#{archive_path}.broken")
77
92
  end
78
93
 
79
94
  def self.archive?(file_name)
@@ -1,3 +1,3 @@
1
1
  module GreenHat
2
- VERSION = '0.7.4'.freeze
2
+ VERSION = '0.8.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: greenhat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davin Walker
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-03-05 00:00:00.000000000 Z
10
+ date: 2025-03-04 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: actionview
@@ -66,20 +65,34 @@ dependencies:
66
65
  - - "~>"
67
66
  - !ruby/object:Gem::Version
68
67
  version: '4.1'
68
+ - !ruby/object:Gem::Dependency
69
+ name: concurrent-ruby
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '='
73
+ - !ruby/object:Gem::Version
74
+ version: 1.3.4
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '='
80
+ - !ruby/object:Gem::Version
81
+ version: 1.3.4
69
82
  - !ruby/object:Gem::Dependency
70
83
  name: did_you_mean
71
84
  requirement: !ruby/object:Gem::Requirement
72
85
  requirements:
73
86
  - - "~>"
74
87
  - !ruby/object:Gem::Version
75
- version: '1.6'
88
+ version: '2.0'
76
89
  type: :runtime
77
90
  prerelease: false
78
91
  version_requirements: !ruby/object:Gem::Requirement
79
92
  requirements:
80
93
  - - "~>"
81
94
  - !ruby/object:Gem::Version
82
- version: '1.6'
95
+ version: '2.0'
83
96
  - !ruby/object:Gem::Dependency
84
97
  name: dotenv
85
98
  requirement: !ruby/object:Gem::Requirement
@@ -531,7 +544,6 @@ licenses:
531
544
  - MIT
532
545
  metadata:
533
546
  rubygems_mfa_required: 'true'
534
- post_install_message:
535
547
  rdoc_options: []
536
548
  require_paths:
537
549
  - lib
@@ -546,8 +558,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
546
558
  - !ruby/object:Gem::Version
547
559
  version: '0'
548
560
  requirements: []
549
- rubygems_version: 3.3.26
550
- signing_key:
561
+ rubygems_version: 3.6.2
551
562
  specification_version: 4
552
563
  summary: GitLab SOS Tool
553
564
  test_files: []