batalert 0.3.0 → 0.4.0

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: 4b9da8a7685d06ef84a2a30b52ef1fc63be738baba33ba740664de3d3ff17819
4
- data.tar.gz: dcd2abc5614b1eaa422fe6d93e77aace8ab58149621f5456f550fca642141c43
3
+ metadata.gz: 90f7e95bc0d736c97ba866e387c98c0f7e054bdd47e77903712fc37a31793682
4
+ data.tar.gz: 0ca74e1b57339870488486ef4dbe73fbe23eea7f45a25b545f84d7e80986a651
5
5
  SHA512:
6
- metadata.gz: bd42d40df5609329a3be43362c11261c9d320c31bce447579a0e463f7825e554115eb639a095b1ee2d9345633aaa6bbe9e418f7fceeb33fa515c1744872ce7ff
7
- data.tar.gz: 0c52a0ad0de25dea261260be295a0ceb983dce0a80fdb3555dcfc57b621b06f300bfd2c36a4b30575112e0f90c03b1f92a20fe60db70c59c64e02c79fd5af741
6
+ metadata.gz: c0371a17d5ad12ec8396fdaa16243ef07eaed5c04405cf11f948d9ac3e1c19312acee6e4d2da7d758fbdc95e59b5fc4089b8163cac25b15613e1e949faf799fe
7
+ data.tar.gz: 6108c137802675a274be42ab0fad7fa203f4ff7248c422df8f70ee0ddf072062f4cb6ad869b86eda7ad570d8ec7fd78c0a2381bb4016255b98e6719b48a17d70
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # env :PATH, ENV['PATH']
2
4
  # env :GEM_PATH, ENV['GEM_PATH']
3
5
 
@@ -21,5 +23,5 @@
21
23
  # end
22
24
 
23
25
  every 15.minute do
24
- command "/usr/local/bin/batalert"
26
+ command '/usr/local/bin/batalert'
25
27
  end
@@ -1,4 +1,5 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "batalert"
4
+ require 'batalert'
4
5
  Batalert::Runner.new.main
@@ -1,9 +1,15 @@
1
- require_relative "batalert/version"
2
- require "espeak"
3
- require "libnotify"
1
+ # frozen_string_literal: true
4
2
 
5
- module Batalert
3
+ require_relative 'batalert/version'
4
+ require 'espeak'
5
+ require 'libnotify'
6
+
7
+ module Batalert # :nodoc:
8
+ # This is the main Runner class, inside which is the driving code.
6
9
  class Runner
10
+ # This is the main and the only method which will drive the
11
+ # entire application and the binary.
12
+ # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Style/GuardClause
7
13
  def main
8
14
  capacity = File.open('/sys/class/power_supply/BAT0/capacity', &:readline)
9
15
  capacity = capacity.to_i
@@ -12,18 +18,21 @@ module Batalert
12
18
  status = status.chomp
13
19
 
14
20
  if capacity < 10 && status == 'Discharging'
15
- notify = Libnotify.new(summary: "PUT ON CHARGING, YOUR BATTERY IS AT #{capacity}%.", timeout: 3, urgency: :critical)
21
+ notify = Libnotify.new(summary: 'PUT ON CHARGING, YOUR BATTERY IS AT ' \
22
+ "#{capacity}%.", timeout: 3, urgency: :critical)
16
23
  notify.update
17
24
  speech = ESpeak::Speech.new("put on charging, your battery is at #{capacity}%.")
18
25
  speech.speak
19
26
  end
20
27
 
21
28
  if capacity > 90 && status == 'Charging'
22
- notify = Libnotify.new(summary: "REMOVE CHARGING, YOUR BATTERY IS AT #{capacity}%.", timeout: 3, urgency: :critical)
29
+ notify = Libnotify.new(summary: 'REMOVE CHARGING, YOUR BATTERY IS AT ' \
30
+ "#{capacity}%.", timeout: 3, urgency: :critical)
23
31
  notify.update
24
32
  speech = ESpeak::Speech.new("remove charging, your battery is at #{capacity}%.")
25
33
  speech.speak
26
34
  end
27
35
  end
36
+ # rubocop:enable Metrics/AbcSize,Metrics/MethodLength,Style/GuardClause
28
37
  end
29
38
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Batalert
2
- VERSION = "0.3.0"
4
+ VERSION = '0.4.0'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batalert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Utkarsh Gupta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-28 00:00:00.000000000 Z
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: espeak-ruby
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: whenever
42
+ name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: minitest
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,35 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-packaging
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: whenever
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
101
  - - ">="