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 +4 -4
- data/config/schedule.rb +3 -1
- data/exe/batalert +2 -1
- data/lib/batalert.rb +15 -6
- data/lib/batalert/version.rb +3 -1
- metadata +33 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90f7e95bc0d736c97ba866e387c98c0f7e054bdd47e77903712fc37a31793682
|
4
|
+
data.tar.gz: 0ca74e1b57339870488486ef4dbe73fbe23eea7f45a25b545f84d7e80986a651
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0371a17d5ad12ec8396fdaa16243ef07eaed5c04405cf11f948d9ac3e1c19312acee6e4d2da7d758fbdc95e59b5fc4089b8163cac25b15613e1e949faf799fe
|
7
|
+
data.tar.gz: 6108c137802675a274be42ab0fad7fa203f4ff7248c422df8f70ee0ddf072062f4cb6ad869b86eda7ad570d8ec7fd78c0a2381bb4016255b98e6719b48a17d70
|
data/config/schedule.rb
CHANGED
data/exe/batalert
CHANGED
data/lib/batalert.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
-
|
2
|
-
require "espeak"
|
3
|
-
require "libnotify"
|
1
|
+
# frozen_string_literal: true
|
4
2
|
|
5
|
-
|
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:
|
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:
|
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
|
data/lib/batalert/version.rb
CHANGED
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.
|
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-
|
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:
|
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:
|
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:
|
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
|
- - ">="
|