hardware_information 1.0.71

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.

Potentially problematic release.


This version of hardware_information might be problematic. Click here for more details.

Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +65 -0
  3. data/bin/hardware_information +12 -0
  4. data/doc/README.gen +25 -0
  5. data/hardware_information.gemspec +44 -0
  6. data/lib/hardware_information/class/colours.rb +82 -0
  7. data/lib/hardware_information/class/constants.rb +145 -0
  8. data/lib/hardware_information/class/hardware_information.rb +32 -0
  9. data/lib/hardware_information/class/initialize.rb +24 -0
  10. data/lib/hardware_information/class/make_line.rb +55 -0
  11. data/lib/hardware_information/class/menu.rb +52 -0
  12. data/lib/hardware_information/class/misc.rb +275 -0
  13. data/lib/hardware_information/class/obtain.rb +255 -0
  14. data/lib/hardware_information/class/reset.rb +54 -0
  15. data/lib/hardware_information/class/run.rb +48 -0
  16. data/lib/hardware_information/css/project.css +3 -0
  17. data/lib/hardware_information/gui/gtk2/purchased_hardware/purchased_hardware.rb +34 -0
  18. data/lib/hardware_information/gui/gtk2/show_input_devices/show_input_devices.rb +34 -0
  19. data/lib/hardware_information/gui/gtk3/mounted_harddiscs/mounted_harddiscs.rb +103 -0
  20. data/lib/hardware_information/gui/gtk3/purchased_hardware/purchased_hardware.rb +34 -0
  21. data/lib/hardware_information/gui/gtk3/show_input_devices/show_input_devices.rb +34 -0
  22. data/lib/hardware_information/gui/libui/mounted_harddiscs/mounted_harddiscs.rb +88 -0
  23. data/lib/hardware_information/gui/shared_code/mounted_harddiscs/mounted_harddiscs_module.rb +107 -0
  24. data/lib/hardware_information/gui/shared_code/purchased_hardware/purchased_hardware_module.rb +291 -0
  25. data/lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb +187 -0
  26. data/lib/hardware_information/misc/purchased_hardware/README.md +7 -0
  27. data/lib/hardware_information/misc/purchased_hardware/purchased_hardware.rb +169 -0
  28. data/lib/hardware_information/monitor/README.md +6 -0
  29. data/lib/hardware_information/monitor/monitor.rb +36 -0
  30. data/lib/hardware_information/project/project.rb +29 -0
  31. data/lib/hardware_information/version/version.rb +19 -0
  32. data/lib/hardware_information/www/embeddable_interface.rb +52 -0
  33. data/lib/hardware_information/www/my_hardware.cgi +7 -0
  34. data/lib/hardware_information/www/my_hardware.rb +462 -0
  35. data/lib/hardware_information/www/my_hardware_for_sinatra.rb +65 -0
  36. data/lib/hardware_information/yaml/colours_for_the_hardware_information_project.yml +30 -0
  37. data/lib/hardware_information/yaml/usb_errors/usb_errors.yml +2 -0
  38. data/lib/hardware_information.rb +7 -0
  39. metadata +95 -0
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === HardwareInformation::GUI::Gtk::ShowInputDevices
6
+ # =========================================================================== #
7
+ # require 'hardware_information/gui/gtk2/show_input_devices/show_input_devices.rb'
8
+ # HardwareInformation::GUI::Gtk::ShowInputDevices.new
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk2'
11
+
12
+ class HardwareInformation
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class ShowInputDevices < ::Gtk::VBox
19
+
20
+ require 'hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb'
21
+ include ::HardwareInformation::GUI::Gtk::ShowInputDevicesModule
22
+
23
+ # ========================================================================= #
24
+ # === HardwareInformation::GUI::Gtk::ShowInputDevices.run
25
+ # ========================================================================= #
26
+ def self.run
27
+ ::HardwareInformation::GUI::Gtk::ShowInputDevicesModule.run
28
+ end
29
+
30
+ end; end; end; end
31
+
32
+ if __FILE__ == $PROGRAM_NAME
33
+ HardwareInformation::GUI::Gtk::ShowInputDevices.run
34
+ end # showinputdevices
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === HardwareInformation::GUI::Gtk::MountedHarddiscs
6
+ # =========================================================================== #
7
+ # require 'hardware_information/gui/gtk3/gtk3_standalone/gtk3_standalone.rb'
8
+ # HardwareInformation::GUI::Gtk::MountedHarddiscs.run
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk3'
11
+
12
+ module HardwareInformation
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class MountedHarddiscs < ::Gtk::Box # === HardwareInformation::GUI::Gtk::MountedHarddiscs
19
+
20
+ require 'gtk_paradise/requires/require_the_base_module.rb'
21
+ include ::Gtk::BaseModule
22
+
23
+ require 'hardware_information/gui/shared_code/mounted_harddiscs/mounted_harddiscs_module.rb'
24
+ include HardwareInformation::GUI::MountedHarddiscsModule
25
+
26
+ # ========================================================================= #
27
+ # === initialize
28
+ # ========================================================================= #
29
+ def initialize(
30
+ commandline_arguments = ARGV,
31
+ run_already = true
32
+ )
33
+ super(:vertical)
34
+ reset
35
+ set_commandline_arguments(
36
+ commandline_arguments
37
+ )
38
+ run if run_already
39
+ end
40
+
41
+ # ========================================================================= #
42
+ # === reset (reset tag)
43
+ # ========================================================================= #
44
+ def reset
45
+ reset_the_internal_variables
46
+ infer_the_namespace
47
+ # ======================================================================= #
48
+ # === @configuration
49
+ # ======================================================================= #
50
+ @configuration = [true, __dir__, namespace?]
51
+ # ======================================================================= #
52
+ # === Set the title, width, height and the font in use.
53
+ # ======================================================================= #
54
+ title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
55
+ use_gtk_paradise_project_css_file
56
+ infer_the_size_automatically
57
+ reset_the_shared_module
58
+ end
59
+
60
+ # ========================================================================= #
61
+ # === create_skeleton (create tag, skeleton tag)
62
+ # ========================================================================= #
63
+ def create_skeleton
64
+ end
65
+
66
+ # ========================================================================= #
67
+ # === connect_skeleton (connect tag)
68
+ # ========================================================================= #
69
+ def connect_skeleton
70
+ abort_on_exception
71
+ minimal(
72
+ gtk_left_aligned_label('Available harddiscs:')
73
+ )
74
+ end
75
+
76
+ # ========================================================================= #
77
+ # === run (run tag)
78
+ # ========================================================================= #
79
+ def run
80
+ super()
81
+ do_capture_and_analyse_the_output_determining_which_harddiscs_are_available
82
+ end
83
+
84
+ # ========================================================================= #
85
+ # === HardwareInformation::GUI::Gtk::MountedHarddiscs.run
86
+ # ========================================================================= #
87
+ def self.run(
88
+ i = ARGV
89
+ )
90
+ require 'gtk_paradise/app/app.rb'
91
+ _ = ::HardwareInformation::GUI::Gtk::MountedHarddiscs.new(i)
92
+ r = ::Gtk.run
93
+ r << _
94
+ r.automatic_size_then_automatic_title
95
+ r.enable_quick_exit
96
+ r.top_left_then_run
97
+ end
98
+
99
+ end; end; end; end
100
+
101
+ if __FILE__ == $PROGRAM_NAME
102
+ HardwareInformation::GUI::Gtk::MountedHarddiscs.run
103
+ end
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === HardwareInformation::GUI::Gtk::PurchasedHardware
6
+ # =========================================================================== #
7
+ # require 'hardware_information/gui/gtk3/purchased_hardware/purchased_hardware.rb'
8
+ # HardwareInformation::GUI::Gtk::PurchasedHardware.new
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk3'
11
+
12
+ class HardwareInformation
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class PurchasedHardware < ::Gtk::Box
19
+
20
+ require 'hardware_information/gui/shared_code/purchased_hardware/purchased_hardware_module.rb'
21
+ include ::HardwareInformation::GUI::Gtk::PurchasedHardwareModule
22
+
23
+ # ========================================================================= #
24
+ # === HardwareInformation::GUI::Gtk::PurchasedHardware.run
25
+ # ========================================================================= #
26
+ def self.run
27
+ ::HardwareInformation::GUI::Gtk::PurchasedHardwareModule.run
28
+ end
29
+
30
+ end; end; end; end
31
+
32
+ if __FILE__ == $PROGRAM_NAME
33
+ HardwareInformation::GUI::Gtk::PurchasedHardware.run
34
+ end
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === HardwareInformation::GUI::Gtk::ShowInputDevices
6
+ # =========================================================================== #
7
+ # require 'hardware_information/gui/gtk3/show_input_devices/show_input_devices.rb'
8
+ # HardwareInformation::GUI::Gtk::ShowInputDevices.new
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk3'
11
+
12
+ class HardwareInformation
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class ShowInputDevices < ::Gtk::Box
19
+
20
+ require 'hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb'
21
+ include ::HardwareInformation::GUI::Gtk::ShowInputDevicesModule
22
+
23
+ # ========================================================================= #
24
+ # === HardwareInformation::GUI::Gtk::ShowInputDevices.run
25
+ # ========================================================================= #
26
+ def self.run
27
+ ::HardwareInformation::GUI::Gtk::ShowInputDevicesModule.run
28
+ end
29
+
30
+ end; end; end; end
31
+
32
+ if __FILE__ == $PROGRAM_NAME
33
+ HardwareInformation::GUI::Gtk::ShowInputDevices.run
34
+ end # showinputdevices
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === HardwareInformation::GUI::LibUI::MountedHarddiscs
6
+ # =========================================================================== #
7
+ module HardwareInformation
8
+
9
+ module GUI
10
+
11
+ module LibUI
12
+
13
+ class MountedHarddiscs # === HardwareInformation::GUI::LibUI::MountedHarddiscs
14
+
15
+ alias e puts
16
+
17
+ require 'libui_paradise'
18
+ include LibuiParadise::Extensions
19
+
20
+ require 'hardware_information/gui/shared_code/mounted_harddiscs/mounted_harddiscs_module.rb'
21
+ include HardwareInformation::GUI::MountedHarddiscsModule
22
+
23
+ # ========================================================================= #
24
+ # === initialize
25
+ # ========================================================================= #
26
+ def initialize(
27
+ run_already = true
28
+ )
29
+ reset
30
+ run if run_already
31
+ end
32
+
33
+ # ========================================================================= #
34
+ # === reset (reset tag)
35
+ # ========================================================================= #
36
+ def reset
37
+ title_width_height(TITLE, WIDTH, HEIGHT)
38
+ end
39
+
40
+ # ========================================================================= #
41
+ # === create_skeleton (create tag, skeleton tag)
42
+ # ========================================================================= #
43
+ def create_skeleton
44
+ # ======================================================================= #
45
+ # === @window
46
+ # ======================================================================= #
47
+ @window = ui_padded_main_window(title?, width?, height?, 0)
48
+ end
49
+
50
+ # ========================================================================= #
51
+ # === run
52
+ # ========================================================================= #
53
+ def run
54
+ create_skeleton_then_connect_skeleton
55
+ outer_vbox = padded_vbox
56
+ do_capture_and_analyse_the_output_determining_which_harddiscs_are_available
57
+ # ======================================================================= #
58
+ # First add the two buttons on top:
59
+ # ======================================================================= #
60
+ outer_vbox.add_hsep
61
+
62
+ grid = ui_padded_grid
63
+ # widget, left, top, xspan, yspan, hexpand, halign, vexpand, valign
64
+ grid.hash_grid(
65
+ text('Available harddiscs:'), left: 0, top: 0, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
66
+ )
67
+
68
+ hbox1 = hbox
69
+ hbox1.minimal( text('Mounted on <b>'+@mounted_on+'</b> ') )
70
+ hbox1.minimal(text('Percentage occupied: '+@percentage_value.to_s+'% '))
71
+ hbox1.minimal(return_the_progress_bar)
72
+ grid.hash_grid(
73
+ hbox1, left: 0, top: 1, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
74
+ )
75
+
76
+ grid.hash_grid(
77
+ quit_button, left: 0, top: 2, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 0, valign: 0
78
+ )
79
+ outer_vbox.maximal(grid)
80
+ @window.add(outer_vbox)
81
+ @window.intelligent_exit
82
+ end
83
+
84
+ end; end; end; end
85
+
86
+ if __FILE__ == $PROGRAM_NAME
87
+ HardwareInformation::GUI::LibUI::MountedHarddiscs.new
88
+ end
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === HardwareInformation::GUI::MountedHarddiscsModule
6
+ # =========================================================================== #
7
+ # require 'hardware_information/gui/shared_code/mounted_harddiscs/mounted_harddiscs_module.rb'
8
+ # include HardwareInformation::GUI::MountedHarddiscsModule
9
+ # =========================================================================== #
10
+ module HardwareInformation
11
+
12
+ module GUI
13
+
14
+ module MountedHarddiscsModule
15
+
16
+ # ========================================================================= #
17
+ # === TITLE
18
+ # ========================================================================= #
19
+ TITLE = 'Mounted Harddiscs'
20
+
21
+ # ========================================================================= #
22
+ # === WIDTH
23
+ # ========================================================================= #
24
+ WIDTH = '55% or minimum 520px'
25
+
26
+ # ========================================================================= #
27
+ # === HEIGHT
28
+ # ========================================================================= #
29
+ HEIGHT = '15% or minimum 100px'
30
+
31
+ # ========================================================================= #
32
+ # === USE_THIS_FONT
33
+ # ========================================================================= #
34
+ USE_THIS_FONT = :dejavu_condensed_19
35
+
36
+ # ========================================================================= #
37
+ # === reset_the_shared_module
38
+ # ========================================================================= #
39
+ def reset_the_shared_module
40
+ # ======================================================================= #
41
+ # === @percentage_value
42
+ # ======================================================================= #
43
+ @percentage_value = 0
44
+ end
45
+
46
+ # ========================================================================= #
47
+ # === run_the_main_system_command
48
+ # ========================================================================= #
49
+ def run_the_main_system_command
50
+ `df -l`
51
+ end
52
+
53
+ # ========================================================================= #
54
+ # === return_the_progress_bar
55
+ # ========================================================================= #
56
+ def return_the_progress_bar
57
+ progress_bar1 = progress_bar
58
+ progress_bar1.fraction = (@percentage_value.to_f / 100.0)
59
+ progress_bar1.set_text('Occupied disc space in %')
60
+ return progress_bar1
61
+ end
62
+
63
+ # ========================================================================= #
64
+ # === padding?
65
+ # ========================================================================= #
66
+ def padding?
67
+ 8
68
+ end
69
+
70
+ # ========================================================================= #
71
+ # === border_size?
72
+ # ========================================================================= #
73
+ def border_size?
74
+ 4
75
+ end
76
+
77
+ # ========================================================================= #
78
+ # === do_capture_and_analyse_the_output_determining_which_harddiscs_are_available
79
+ # ========================================================================= #
80
+ def do_capture_and_analyse_the_output_determining_which_harddiscs_are_available
81
+ result = run_the_main_system_command
82
+ if result
83
+ splitted = result.split("\n").select {|entry| entry.include?('/') }
84
+ results = splitted.select {|inner_entry|
85
+ inner_split = inner_entry.strip.split(' ')
86
+ last_element = inner_split.last
87
+ last_element == '/'
88
+ }
89
+ if results and !results.empty?
90
+ results = results.first if results.is_a? Array
91
+ if results.include? '%' # "/dev/root 2882176320 491973144 2243723560 18% /"
92
+ splitted = results.split(' ')
93
+ @mounted_on = splitted.first.strip
94
+ @percentage_value = results.scan(/(\d{1,2})%/).flatten.first.to_i
95
+ if is_on_gtk?
96
+ hbox1 = hbox
97
+ hbox1.minimal(text('Mounted on <b>'+@mounted_on+'</b>'), 10)
98
+ hbox1.minimal(text('Percentage occupied: <b>'+@percentage_value.to_s+'%</b>'), 10)
99
+ hbox1.minimal(return_the_progress_bar, 12)
100
+ minimal(hbox1, 5)
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
106
+
107
+ end; end; end