sys-proc 1.0.5 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b275dfa40aae0cadab2ef0ab886de7f569b78cb640cc94c74b655f68e45a40f
4
- data.tar.gz: 3bfea024129dbdd12fbc113851f43fff15d883dbf3342c5049ae7db20b6f5123
3
+ metadata.gz: c1c2cdf6c827f4aea36a948b1b7cd2e872e430ae64fa164705f5dc6e5e276bbb
4
+ data.tar.gz: b0ad47a922f9f5f64dde8fe6bd33d5aec98116d4a22923aa6d6032597f69e3c9
5
5
  SHA512:
6
- metadata.gz: 26c00d1ee9cf5fd7d3acf0c50593ae2c14072498edba8278c44187c2d617453fe5cde489e810dd50c5a44cb371eafd3db608aa4a8801b49f309aa7f8bab4434d
7
- data.tar.gz: 9005b9dca1aec9bb9d5ffacb1a9a6224bb685d5de98f9ce1af7bcb0938241ab614b0b1128ad7babf8552e6890f8a20c886590283af445e3c8c24f6373452bcfc
6
+ metadata.gz: 83ba2d092b49c79076f0d9ce2bfd3737c440ada78342b0ef0234552b386ab0683016fb84e8e30c0475aa645004ad35bb42764224d8d3e2be85ce89f8ee8e0c63
7
+ data.tar.gz: 6e9f71aa3f610082174da4dfbd479b41792b642a482160fcfe3b2052db91c6f3a791b11de94732341c14d68ae21cadef2177b0581840eb981942afca03763d3b
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
  # rubocop:enable Style/FileName
4
4
 
5
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
5
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
6
6
  # License GPLv3+: GNU GPL version 3 or later
7
7
  # <http://www.gnu.org/licenses/gpl.html>.
8
8
  # This is free software: you are free to change and redistribute it.
@@ -15,37 +15,8 @@ lock = Dir.chdir("#{__dir__}/..") do
15
15
  .map { |m| Dir.glob(m).size >= 2 }
16
16
  .include?(true)
17
17
  end
18
- mode = (ENV['PROJECT_MODE'] || lock ? 'development' : 'production').to_sym
19
18
 
20
19
  if lock
21
20
  require 'rubygems'
22
21
  require 'bundler/setup'
23
22
  end
24
-
25
- if lock and :development == mode
26
- require 'pp'
27
- begin
28
- require 'coderay'
29
- require 'pry/color_printer'
30
- rescue LoadError => e
31
- # rubocop:disable Performance/Caller
32
- warn('%s: %s' % [caller[0], e.message])
33
- # rubocop:enable Performance/Caller
34
- end
35
-
36
- # Outputs obj to out in pretty printed format of width columns in width.
37
- #
38
- # If out is omitted, ``STDOUT`` is assumed.
39
- # If width is omitted, ``79`` is assumed.
40
- #
41
- # @param [Object] obj
42
- # @param [IO] out
43
- # @param [Fixnum] width
44
- # @see http://ruby-doc.org/stdlib-2.2.0/libdoc/pp/rdoc/PP.html
45
- def pp(obj, out = STDOUT, width = 79)
46
- args = [obj, out, width].compact
47
- colorable = (out.isatty and Kernel.const_defined?('Pry::ColorPrinter'))
48
-
49
- (colorable ? Pry::ColorPrinter : PP).pp(*args)
50
- end
51
- end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -10,6 +10,15 @@ require 'English'
10
10
 
11
11
  # The Sys module is only used as a namespace
12
12
  module Sys
13
+ # rubocop:disable Style/Documentation
14
+
15
+ class Proc
16
+ require_relative 'proc/version'
17
+
18
+ VERSION = Version.new.freeze
19
+ end
20
+
21
+ # rubocop:enable Style/Documentation
13
22
  end
14
23
 
15
24
  # Operations on current process
@@ -18,11 +27,10 @@ end
18
27
  # @see http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html
19
28
  class Sys::Proc
20
29
  require 'singleton'
21
- %i{versionable system static_instance}.each do |req|
30
+ %i{system static_instance}.each do |req|
22
31
  require "sys/proc/concern/#{req}"
23
32
  end
24
33
 
25
- include Concern::Versionable
26
34
  include Concern::StaticInstance
27
35
  include Concern::System
28
36
 
@@ -55,7 +63,7 @@ class Sys::Proc
55
63
  #
56
64
  # @see https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way/
57
65
  # @return [Float]
58
- def uptime
66
+ def time
59
67
  Process.clock_gettime(Process::CLOCK_MONOTONIC)
60
68
  end
61
69
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
4
  # License GPLv3+: GNU GPL version 3 or later
5
5
  # <http://www.gnu.org/licenses/gpl.html>.
6
6
  # This is free software: you are free to change and redistribute it.
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
4
+ # License GPLv3+: GNU GPL version 3 or later
5
+ # <http://www.gnu.org/licenses/gpl.html>.
6
+ # This is free software: you are free to change and redistribute it.
7
+ # There is NO WARRANTY, to the extent permitted by law.
8
+
9
+ require_relative '../proc'
10
+
11
+ require 'yaml'
12
+ require 'pathname'
13
+ require 'dry/inflector'
14
+
15
+ # Describe version using a YAML file.
16
+ #
17
+ # @see https://github.com/jcangas/version_info
18
+ class Sys::Proc::Version
19
+ # Get filepath used to parse version (YAML file).
20
+ #
21
+ # @return [Pathname|String]
22
+ attr_reader :file_name
23
+
24
+ # @param [String] file_name
25
+ def initialize(file_name = self.class.file_name)
26
+ @file_name = file_name.freeze
27
+
28
+ self.load_file
29
+ .map { |k, v| self.attr_set(k, v) }
30
+ .yield_self { |loaded| @data_loaded = loaded.to_h }
31
+ end
32
+
33
+ # Denote version has enough (mninimal) attributes defined.
34
+ #
35
+ # @return [Boolean]
36
+ def valid?
37
+ ![:major, :minor, :patch]
38
+ .map { |method| public_send(method) }
39
+ .map { |v| v.to_s.empty? ? nil : v }
40
+ .include?(nil)
41
+ rescue NameError
42
+ false
43
+ end
44
+
45
+ # @return [String]
46
+ def to_s
47
+ [major, minor, patch].join('.')
48
+ end
49
+
50
+ # @return [Hash]
51
+ def to_h
52
+ data_loaded.clone.freeze
53
+ end
54
+
55
+ # Return the path as a String.
56
+ #
57
+ # @see https://ruby-doc.org/stdlib-2.5.0/libdoc/pathname/rdoc/Pathname.html#method-i-to_path
58
+ # @return [String]
59
+ def to_path
60
+ file_name.to_s
61
+ end
62
+
63
+ class << self
64
+ # Get default filename.
65
+ #
66
+ # @return [Pathname]
67
+ def file_name
68
+ Pathname.new(__dir__).join('version.yml')
69
+ end
70
+ end
71
+
72
+ protected
73
+
74
+ attr_reader :data_loaded
75
+
76
+ # @return [Hash]
77
+ def load_file
78
+ YAML.load_file(file_name).yield_self do |data|
79
+ data == false ? {} : data
80
+ end
81
+ rescue Errno::ENOENT
82
+ {}
83
+ end
84
+
85
+ # Define attribute (as ``ro`` attr) and set value.
86
+ #
87
+ # @param [String|Symbol] attr_name
88
+ # @param [Object] attr_value
89
+ # @return [Array]
90
+ def attr_set(attr_name, attr_value)
91
+ inflector = Dry::Inflector.new
92
+ attr_name = inflector.underscore(attr_name.to_s)
93
+
94
+ self.singleton_class.class_eval do
95
+ attr_accessor attr_name
96
+
97
+ protected "#{attr_name}="
98
+ end
99
+
100
+ self.__send__("#{attr_name}=", attr_value.freeze)
101
+
102
+ [attr_name, attr_value.freeze].freeze
103
+ end
104
+ end
metadata CHANGED
@@ -1,22 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sys-proc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Arrigoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-12 00:00:00.000000000 Z
11
+ date: 2018-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-inflector
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
18
- - !ruby/object:Gem::Version
19
- version: '0.2'
20
17
  - - "~>"
21
18
  - !ruby/object:Gem::Version
22
19
  version: '0.1'
@@ -24,209 +21,10 @@ dependencies:
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "<"
28
- - !ruby/object:Gem::Version
29
- version: '0.2'
30
24
  - - "~>"
31
25
  - !ruby/object:Gem::Version
32
26
  version: '0.1'
33
- - !ruby/object:Gem::Dependency
34
- name: version_info
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1.9'
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '1.9'
47
- - !ruby/object:Gem::Dependency
48
- name: rake
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '12.0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '12.0'
61
- - !ruby/object:Gem::Dependency
62
- name: pry
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '0.10'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '0.10'
75
- - !ruby/object:Gem::Dependency
76
- name: dotenv
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '2.2'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '2.2'
89
- - !ruby/object:Gem::Dependency
90
- name: cliver
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - '='
94
- - !ruby/object:Gem::Version
95
- version: 0.3.2
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - '='
101
- - !ruby/object:Gem::Version
102
- version: 0.3.2
103
- - !ruby/object:Gem::Dependency
104
- name: rubocop
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '0.49'
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '0.49'
117
- - !ruby/object:Gem::Dependency
118
- name: gemspec_deps_gen
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - '='
122
- - !ruby/object:Gem::Version
123
- version: 1.1.2
124
- type: :development
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - '='
129
- - !ruby/object:Gem::Version
130
- version: 1.1.2
131
- - !ruby/object:Gem::Dependency
132
- name: tenjin
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: '0.7'
138
- type: :development
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: '0.7'
145
- - !ruby/object:Gem::Dependency
146
- name: rainbow
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "~>"
150
- - !ruby/object:Gem::Version
151
- version: '2.2'
152
- type: :development
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "~>"
157
- - !ruby/object:Gem::Version
158
- version: '2.2'
159
- - !ruby/object:Gem::Dependency
160
- name: tty-editor
161
- requirement: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - "~>"
164
- - !ruby/object:Gem::Version
165
- version: '0.2'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: '0.2'
173
- - !ruby/object:Gem::Dependency
174
- name: yard
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '0.9'
180
- type: :development
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: '0.9'
187
- - !ruby/object:Gem::Dependency
188
- name: redcarpet
189
- requirement: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - "~>"
192
- - !ruby/object:Gem::Version
193
- version: '3.4'
194
- type: :development
195
- prerelease: false
196
- version_requirements: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - "~>"
199
- - !ruby/object:Gem::Version
200
- version: '3.4'
201
- - !ruby/object:Gem::Dependency
202
- name: github-markup
203
- requirement: !ruby/object:Gem::Requirement
204
- requirements:
205
- - - "~>"
206
- - !ruby/object:Gem::Version
207
- version: '1.6'
208
- type: :development
209
- prerelease: false
210
- version_requirements: !ruby/object:Gem::Requirement
211
- requirements:
212
- - - "~>"
213
- - !ruby/object:Gem::Version
214
- version: '1.6'
215
- - !ruby/object:Gem::Dependency
216
- name: rspec
217
- requirement: !ruby/object:Gem::Requirement
218
- requirements:
219
- - - "~>"
220
- - !ruby/object:Gem::Version
221
- version: '3.6'
222
- type: :development
223
- prerelease: false
224
- version_requirements: !ruby/object:Gem::Requirement
225
- requirements:
226
- - - "~>"
227
- - !ruby/object:Gem::Version
228
- version: '3.6'
229
- description: A cross-platform interface to customize the process name
27
+ description: A cross-platform interface to customize process name
230
28
  email: dimitri@arrigoni.me
231
29
  executables: []
232
30
  extensions: []
@@ -242,7 +40,6 @@ files:
242
40
  - lib/sys/proc/concern/system/freebsd.rb
243
41
  - lib/sys/proc/concern/system/generic.rb
244
42
  - lib/sys/proc/concern/system/linux_gnu.rb
245
- - lib/sys/proc/concern/versionable.rb
246
43
  - lib/sys/proc/helper.rb
247
44
  - lib/sys/proc/helper/inflector.rb
248
45
  - lib/sys/proc/helper/lib_c.rb
@@ -253,7 +50,7 @@ files:
253
50
  - lib/sys/proc/system/freebsd/lib_c.rb
254
51
  - lib/sys/proc/system/linux_gnu.rb
255
52
  - lib/sys/proc/system/linux_gnu/prctl.rb
256
- - lib/sys/proc/version_info.yml
53
+ - lib/sys/proc/version.rb
257
54
  homepage: https://github.com/SwagDevOps/sys-proc
258
55
  licenses:
259
56
  - GPL-3.0
@@ -277,5 +74,5 @@ rubyforge_project:
277
74
  rubygems_version: 2.7.6
278
75
  signing_key:
279
76
  specification_version: 4
280
- summary: A cross-platform interface to customize the process name
77
+ summary: Cross-platform interface to customize process name
281
78
  test_files: []
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
4
- # License GPLv3+: GNU GPL version 3 or later
5
- # <http://www.gnu.org/licenses/gpl.html>.
6
- # This is free software: you are free to change and redistribute it.
7
- # There is NO WARRANTY, to the extent permitted by law.
8
-
9
- require_relative '../concern'
10
- require 'pathname'
11
- require 'version_info'
12
-
13
- # Provides a standardized way to use ``VersionInfo``
14
- module Sys::Proc::Concern::Versionable
15
-
16
-
17
- class << self
18
- def included(base)
19
- base.extend(ClassMethods)
20
-
21
- base.version_info
22
- end
23
- end
24
-
25
- module ClassMethods
26
- def version_info
27
- unless const_defined?(:VERSION)
28
- require 'version_info'
29
- include VersionInfo
30
- # @todo deternmine format from extension?
31
- VersionInfo.file_format = :yaml
32
-
33
- self.VERSION.file_name = version_basedir.join('version_info.yml')
34
- self.VERSION.load
35
- end
36
-
37
- self.VERSION.to_hash.freeze
38
- end
39
-
40
- protected
41
-
42
- # Extract basedir from ``caller``
43
- #
44
- # @raise [Errno::ENOENT]
45
- # @return [Pathname]
46
- def version_basedir
47
- basedir = caller.grep(/in `include'/)
48
- .fetch(0)
49
- .split(/\.rb:[0-9]+:in\s+/).fetch(0)
50
-
51
- Pathname.new(basedir).realpath
52
- end
53
- end
54
- end
@@ -1,16 +0,0 @@
1
- ---
2
- major: 1
3
- minor: 0
4
- patch: 5
5
- authors: ['Dimitri Arrigoni']
6
- email: 'dimitri@arrigoni.me'
7
- date: '2018-05-12'
8
- summary: 'A cross-platform interface to customize the process name'
9
- description: 'A cross-platform interface to customize the process name'
10
- licenses: ['GPL-3.0']
11
- license_header: 'Copyright (C) 2017 Dimitri Arrigoni <dimitri@arrigoni.me>
12
- License GPLv3+: GNU GPL version 3 or later
13
- <http://www.gnu.org/licenses/gpl.html>.
14
- This is free software: you are free to change and redistribute it.
15
- There is NO WARRANTY, to the extent permitted by law.'
16
- homepage: 'https://github.com/SwagDevOps/sys-proc'