startle 0.0.1

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/startle.rb +38 -0
  3. metadata +46 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 344482ee987de40cd2a79489e1842aac4818e26f
4
+ data.tar.gz: a50192373662bba1e46f9f91fba50cd5f236199c
5
+ SHA512:
6
+ metadata.gz: 77a01d663f992c72ee40fa7728f582398be165029bc370de49b5f108bfe008d90689333c3daf9c483994e225bf78858aaf18ed6b6ffa6d31c2e076783c6cff1e
7
+ data.tar.gz: 67fe7b90a1498cfd8f4e5245d9caa0c8fbb96c544fdc4235c30d7ad542122f8240552c97ba1480d846645a2dfd10e7d9832c0a4cc56dc5ae65d6bf59c39b9633
@@ -0,0 +1,38 @@
1
+ class Startle
2
+ attr_reader :file
3
+
4
+ def initialize(log_file)
5
+ @file = log_file
6
+ end
7
+
8
+ def what_size?
9
+ File.size?(file).to_f
10
+ end
11
+
12
+ def convert_to_megabytes(file_size_in_bytes)
13
+ file_size_in_bytes / 1_048_576
14
+ end
15
+
16
+ def over_one_gigabyte?
17
+ convert_to_megabytes(what_size?) >= 1024 ? true : false
18
+ end
19
+
20
+ def display_size
21
+ convert_to_megabytes(what_size?) / 1000
22
+ end
23
+
24
+ def log_file_status
25
+ if self.over_one_gigabyte?
26
+ #STUB for mailer
27
+ puts "OMG YOU'RE LOG FILE IS AT OR OVER A GIGABYTE! Log Size: #{display_size} GB"
28
+ else
29
+ puts "You're still good, homie. Log Size: #{display_size} GB"
30
+ end
31
+ end
32
+
33
+ end
34
+
35
+
36
+
37
+ check = FileSizeChecker.new(ARGV[0])
38
+ check.log_file_status
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: startle
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Brian Fu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A gem that will check your log files and send you an email notification
14
+ if a file reaches a gigabyte or higher.
15
+ email: bfu@selectrehab.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/startle.rb
21
+ homepage: http://rubygems.org/gems/startle
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.4.5
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Startle
45
+ test_files: []
46
+ has_rdoc: