gibil 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. data/bin/gibil +13 -0
  2. data/lib/gibil.rb +34 -0
  3. metadata +114 -0
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ require 'gibil'
5
+
6
+ args = ARGV.dup
7
+ if args[0] == 'schedule'
8
+ `whenever --update-crontab`
9
+ puts 'Chrontab updated:'
10
+ `crontab -l`
11
+ else
12
+ Gibil::Notification.notify
13
+ end
@@ -0,0 +1,34 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'libnotify'
3
+
4
+ module Gibil
5
+ # Temperature Sensor interface.
6
+ # Currently works/tested only on Linux
7
+ module Sensor
8
+ # == Returns:
9
+ # A float value of the system's temperature
10
+ def self.temperature
11
+ `cat /sys/class/hwmon/hwmon0/temp1_input`.to_f / 1000
12
+ end
13
+ end
14
+
15
+ # Uses system notification to notify of current temperature.
16
+ # Currently works/tested only on Linux
17
+ module Notification
18
+ def self.notify
19
+ temp = Sensor.temperature
20
+
21
+ n = Libnotify.new(
22
+ summary: 'Temperature',
23
+ body: "Your computer's temperature is now #{temp} °C",
24
+ timeout: 1.5,
25
+ append: true
26
+ )
27
+
28
+ n.urgency = :normal if temp.between?(60, 79)
29
+ n.urgency = :critical if temp > 79
30
+
31
+ n.show!
32
+ end
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gibil
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Fernando Briano
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-03-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: libnotify
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: whenever
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: minitest
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rubocop
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Show a notification of your computer's temperature. It can be programmed
79
+ as a cronjob, so you can be notified when the temperature is high.
80
+ email: fernando@picandocodigo.net
81
+ executables:
82
+ - gibil
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - lib/gibil.rb
87
+ - bin/gibil
88
+ homepage: https://github.com/picandocodigo/gibil
89
+ licenses:
90
+ - GPL-3
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 1.8.23
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: A gem to notify you of system temperature
113
+ test_files: []
114
+ has_rdoc: