nub 0.0.21 → 0.0.23

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: 102f1cf06e8b45889dd60b7372e5111f492a97fdf8ed8caafd30b3dac5690dd3
4
- data.tar.gz: e921565b8a4ab7ef8644a1e0993d7187105840f38d73d21c6145cb420d7d8952
3
+ metadata.gz: 2d1f52ad1711edbf971ab19153089cc15697b097e89dc4c81e56ff04342d5037
4
+ data.tar.gz: c35dc79b738286eb79a40d4f0ae183799f729640b2127739f51f3fec4c4227a2
5
5
  SHA512:
6
- metadata.gz: 27f89bc3db8382e91415a3009d2cc76136734cf4f25685a5f40797b0cfdebabfc3fd5ff808eb4f84366c949bea3a5eebf38e8d333fcda2d58242f6716eb868f2
7
- data.tar.gz: 5110db336085570bb0ec25497f4f61edc0f5d063de501e6edbbd01401846eb9c52a667d14b124f8363a7f853d94e0f8f71843b7be4e8653e832f5520ac127357
6
+ metadata.gz: 15d57c7911a96b7a3292bc802e5eea5755d6096c9bb770154d7c32c6aa1c84af7f53e710295cba5bc96f1a4253929d158b45cbaa406b3c430eda6816f40c09e2
7
+ data.tar.gz: ba00b64e92031dbb0d9633e7d55ea3fdc1cad627cdb610b65200ac5d2587dee8ac41244eb17a20a1c7baee62ce9869b41534cf561575bd520f0f82df8b3fce39
data/lib/nub.rb CHANGED
@@ -20,6 +20,7 @@
20
20
  #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  #SOFTWARE.
22
22
 
23
+ # Nub is the top level module useful for requiring all sub-modules at once.
23
24
  module Nub
24
25
  require 'nub/cmds'
25
26
  require 'nub/config'
data/lib/nub/config.rb CHANGED
@@ -32,8 +32,8 @@ end
32
32
  require_relative 'user'
33
33
  require_relative 'log'
34
34
 
35
- # Simple YAML configuration for an application
36
- # uses singleton pattern for single source of truth
35
+ # Simple YAML configuration for an application.
36
+ # Uses singleton pattern for single source of truth
37
37
  module Config
38
38
 
39
39
  # Private properties
data/lib/nub/log.rb CHANGED
@@ -51,13 +51,11 @@ LogLevel = OpenStruct.new({
51
51
  debug: 3
52
52
  })
53
53
 
54
- # Singleton logger for use with both console and gtk+ apps
55
- # logs to both a file and the console/queue for shell/UI apps
56
- # uses Mutex.synchronize where required to provide thread safty
54
+ # Singleton logger for use with both console and gtk+ apps.
55
+ # Logs to both a file and the console/queue for shell/UI apps.
56
+ # Uses Mutex.synchronize where required to provide thread safety.
57
57
  module Log
58
58
  extend self
59
-
60
- # Private properties
61
59
  @@_level = 3
62
60
  @@_queue = nil
63
61
  @@_stdout = true
@@ -68,8 +66,7 @@ module Log
68
66
  attr_reader(:id, :path)
69
67
  end
70
68
 
71
- # Singleton new alternate initialize
72
- # Can be called multiple times to reset
69
+ # Singleton's init method can be called multiple times to reset.
73
70
  # @param path [String] path to log file
74
71
  # @param queue [Bool] use a queue as well
75
72
  # @param stdout [Bool] turn on or off stdout
data/lib/nub/net.rb CHANGED
@@ -21,6 +21,7 @@
21
21
  #SOFTWARE.
22
22
  require 'ostruct'
23
23
 
24
+ # Collection of simply network related helpers
24
25
  module Net
25
26
  @@_proxy = nil
26
27
  @@_agents = OpenStruct.new({
data/lib/nub/string.rb CHANGED
@@ -21,6 +21,8 @@
21
21
 
22
22
  # Monkey patch string with some useful methods
23
23
  class String
24
+
25
+ # Convert the string to ascii, stripping out or converting all non-ascii characters
24
26
  def to_ascii
25
27
  options = {
26
28
  :invalid => :replace,
data/lib/nub/sys.rb ADDED
@@ -0,0 +1,39 @@
1
+ #MIT License
2
+ #Copyright (c) 2018 phR0ze
3
+ #
4
+ #Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ #of this software and associated documentation files (the "Software"), to deal
6
+ #in the Software without restriction, including without limitation the rights
7
+ #to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ #copies of the Software, and to permit persons to whom the Software is
9
+ #furnished to do so, subject to the following conditions:
10
+ #
11
+ #The above copyright notice and this permission notice shall be included in all
12
+ #copies or substantial portions of the Software.
13
+ #
14
+ #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ #IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ #FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ #AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ #LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ #SOFTWARE.
21
+
22
+ require 'io/console'
23
+
24
+ class Sys
25
+
26
+ # Wait for any key to be pressed
27
+ def any_key?
28
+ begin
29
+ state = `stty -g`
30
+ `stty raw -echo -icanon isig`
31
+ STDIN.getc.chr
32
+ ensure
33
+ `stty #{state}`
34
+ end
35
+
36
+ end
37
+ end
38
+
39
+ # vim: ft=ruby:ts=2:sw=2:sts=2
data/lib/nub/user.rb CHANGED
@@ -20,6 +20,7 @@
20
20
  #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  #SOFTWARE.
22
22
 
23
+ # Some user related helper methods
23
24
  module User
24
25
 
25
26
  # Check if the current user has root privileges
metadata CHANGED
@@ -1,16 +1,86 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Crummett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-22 00:00:00.000000000 Z
12
- dependencies: []
13
- description: Collection of useful utilities
11
+ date: 2018-03-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: colorize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
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
+ description:
14
84
  email:
15
85
  executables: []
16
86
  extensions: []
@@ -22,6 +92,7 @@ files:
22
92
  - lib/nub/log.rb
23
93
  - lib/nub/net.rb
24
94
  - lib/nub/string.rb
95
+ - lib/nub/sys.rb
25
96
  - lib/nub/thread_comm.rb
26
97
  - lib/nub/user.rb
27
98
  homepage: https://github.com/phR0ze/ruby-nub
@@ -44,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
115
  version: '0'
45
116
  requirements: []
46
117
  rubyforge_project:
47
- rubygems_version: 2.7.3
118
+ rubygems_version: 2.7.6
48
119
  signing_key:
49
120
  specification_version: 4
50
121
  summary: Collection of useful utilities