s3grep 0.1.8 → 0.1.9

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: 804681319bd1ddfd4ff89ab54f21f9cff854b06d3a254ed7870da7be8dcfb059
4
- data.tar.gz: f615b79c46f460a73f530fbe075e16f9c9ee9dd4c778cf26eee9ad63eea15ae7
3
+ metadata.gz: d88e4a4103d7d4263d025c54f4a5be65349961caf01026b510b3f16ba056e23c
4
+ data.tar.gz: a60b92d47715a38252c9a903c2f95c11841fbaa876ef1f8ccee3a99d92c90d2f
5
5
  SHA512:
6
- metadata.gz: 6ac540deed47a2e02ab396b0f92c018ae1ec608b4824b4adb13e2d9e5fe4631366879fdfb176cd2dfe7bbee7ec040ce53d74a95f92e30994d1b1e87120d09e6a
7
- data.tar.gz: 8eaa9a8e01415551c0e0770ac59b4cf8e5374f75317fbf2a9ee60f3bd16766b072acd4b0d440a79af6013a2dd221b06c7ced8a1ffbcecd8973e95397225f6695
6
+ metadata.gz: 989e6da04b302d4fe68f4d8ed52c8f813d45ba359d7e270414b9602020d017380d1e611e50958fc5a4ee8edb6356e1c5a5243dd66d1182f899bc71825926e420
7
+ data.tar.gz: 89d12dd7fc507b998b4f1bdafa62b9a012650ed7aec71dd08df729ee0b2d215295e9eb8f02558f3122e0c50ee789192cfe53f5399d3b2d169cd975276750bb21
data/bin/s3info CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'pathname'
4
+ BASE_DIR = Pathname.new(File.expand_path('..', __dir__))
5
+ $LOAD_PATH << "#{BASE_DIR}/lib"
6
+
3
7
  require 'optparse'
4
8
  require 's3grep'
5
9
  require 'aws-sdk-s3'
@@ -17,7 +21,9 @@ stats = {
17
21
  last_modified: info.last_modified,
18
22
  newest_file: info.newest_file,
19
23
  first_modified: info.first_modified,
20
- first_file: info.first_file
24
+ first_file: info.first_file,
25
+ num_files_by_storage_class: info.num_files_by_storage_class,
26
+ total_size_by_storage_class: info.total_size_by_storage_class
21
27
  }
22
28
 
23
29
  print JSON.pretty_generate(stats) + "\n"
@@ -5,7 +5,9 @@ module S3Grep
5
5
  :total_size,
6
6
  :num_files,
7
7
  :newest_content,
8
- :oldest_content
8
+ :oldest_content,
9
+ :num_files_by_storage_class,
10
+ :total_size_by_storage_class
9
11
 
10
12
  def self.get(directory)
11
13
  info = new(directory)
@@ -15,6 +17,8 @@ module S3Grep
15
17
  def initialize(directory)
16
18
  @total_size = 0
17
19
  @num_files = 0
20
+ @num_files_by_storage_class = Hash.new(0)
21
+ @total_size_by_storage_class = Hash.new(0)
18
22
  set_path(directory)
19
23
  end
20
24
 
@@ -23,6 +27,9 @@ module S3Grep
23
27
  @num_files += 1
24
28
  @total_size += content[:size]
25
29
 
30
+ @num_files_by_storage_class[content[:storage_class]] += 1
31
+ @total_size_by_storage_class[content[:storage_class]] += content[:size]
32
+
26
33
  set_newest(content)
27
34
  set_oldest(content)
28
35
  end
data/s3grep.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 's3grep'
5
- s.version = '0.1.8'
5
+ s.version = '0.1.9'
6
6
  s.licenses = ['MIT']
7
7
  s.summary = 'Search through S3 files'
8
8
  s.description = 'Tools for searching files on S3'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3grep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-23 00:00:00.000000000 Z
11
+ date: 2024-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3