total 0.0.0 → 0.1.0

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: a922796cbf2dbef8b797b83e792d1a31d9457492342fce801050534abb0f0545
4
- data.tar.gz: 16dbb7101e57b44fad5c55a4a95534c783cb9d18abd7f766afd85338fb7250c4
3
+ metadata.gz: 1cdbfc5d8ebb43ace58469f0e7fb57770d1bfc3a284665ce0de834a2dccfdf63
4
+ data.tar.gz: 7ea6c9a7d856eedf0636a23cb9001f87bc614dc3cd3e08e64d7e78ebffd2f51b
5
5
  SHA512:
6
- metadata.gz: f1e1ae21fa68bcfd1ef06db6092702d3467db9e99893061e3cbcd8e73f6d14de21d9b0bfeabf5c75f9a8ec72a6bf3c7abfe85bbaad5aa6524330b8ea8850498a
7
- data.tar.gz: de5729586ed6fde57c9088ece7db6af3c872d79540dfa0092fc0b7b1b92f3c55c070e68fb9127e4899c3500316931b4c9cc241728eac78cf265659ef908399d3
6
+ metadata.gz: 5a9e423a957d3321a681cf8c992bd11b81ed77bb2ff5bb4692297515e25d74857aaf35afa0fe1acc1467b8e11ff848decc7b81e3c3408cd15743837dbb908baa
7
+ data.tar.gz: c89699e9c027e1a6ca3bb0d6b3a89f680a7454e9e4ff784a623f8f7b1bb9fe81281576b6b01eb98739f6c5c23c846a6f3f463d29af0845ac59ddba94b002f9a6
data/.gitignore CHANGED
@@ -3,4 +3,3 @@ Gemfile.lock
3
3
  .bundle/
4
4
  .DS_Store
5
5
  rdoc/
6
- coverage/
data/.rubocop.yml CHANGED
@@ -1,8 +1,6 @@
1
1
  AllCops:
2
- NewCops: enable
3
2
  DisplayCopNames: true
4
- TargetRubyVersion: 2.3
5
- SuggestExtensions: false
3
+ TargetRubyVersion: 2.3.3
6
4
 
7
5
  Layout/EmptyLineAfterGuardClause:
8
6
  Enabled: false
@@ -18,5 +16,5 @@ Metrics/PerceivedComplexity:
18
16
  Max: 10
19
17
  Metrics/ParameterLists:
20
18
  Max: 10
21
- Layout/ParameterAlignment:
19
+ Layout/AlignParameters:
22
20
  Enabled: false
data/.rultor.yml CHANGED
@@ -1,19 +1,26 @@
1
- docker:
2
- image: yegor256/rultor-image:1.9.1
3
1
  assets:
4
- rubygems.yml: yegor256/home#assets/rubygems.yml
5
- install: |
6
- pdd -f /dev/null
7
- sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
2
+ rubygems.yml: zerocracy/home#assets/rubygems.yml
3
+ install: |-
4
+ export GEM_HOME=~/.ruby
5
+ export GEM_PATH=$GEM_HOME:$GEM_PATH
8
6
  release:
9
7
  script: |-
10
- bundle exec rake clean test rubocop copyright
11
- sed -i "s/0\.0\.0/${tag}/g" lib/total/version.rb
12
- git add lib/total/version.rb
13
- git commit -m "version set to ${tag}"
8
+ bundle install
9
+ rake
10
+ rm -rf *.gem
11
+ sed -i "s/0\.0\.0/${tag}/g" total.gemspec
12
+ git add total.gemspec
13
+ git commit -m "Version set to ${tag}"
14
14
  gem build total.gemspec
15
15
  chmod 0600 ../rubygems.yml
16
16
  gem push *.gem --config-file ../rubygems.yml
17
+ commanders:
18
+ - yegor256
19
+ architect:
20
+ - yegor256
17
21
  merge:
22
+ commanders: []
18
23
  script: |-
19
- bundle exec rake clean test rubocop copyright
24
+ bundle install
25
+ bundle exec rake
26
+ deploy: {}
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.3
4
+ branches:
5
+ only:
6
+ - master
7
+ install:
8
+ - bundle install
9
+ script:
10
+ - set -e
11
+ - rake
12
+
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Yegor Bugayenko
3
+ # Copyright (c) 2018 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/README.md CHANGED
@@ -1,17 +1,11 @@
1
- <img src="/logo.svg" width="64px"/>
2
-
3
- [![Managed by Zerocracy](https://www.0crat.com/badge/C3RFVLU72.svg)](https://www.0crat.com/p/C3RFVLU72)
4
- [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
1
+ [![EO principles respected here](http://www.elegantobjects.org/badge.svg)](http://www.elegantobjects.org)
5
2
  [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/total)](http://www.rultor.com/p/yegor256/total)
6
- [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
3
+ [![We recommend RubyMine](http://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
7
4
 
8
- [![rake](https://github.com/yegor256/total/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/total/actions/workflows/rake.yml)
5
+ [![Build Status](https://travis-ci.org/yegor256/total.svg)](https://travis-ci.org/yegor256/total)
9
6
  [![Gem Version](https://badge.fury.io/rb/total.svg)](http://badge.fury.io/rb/total)
10
- [![Maintainability](https://api.codeclimate.com/v1/badges/6e08ce63e597f241ccc7/maintainability)](https://codeclimate.com/github/yegor256/total/maintainability)
7
+ [![Maintainability](https://api.codeclimate.com/v1/badges/5528e182bb5e4a2ecc1f/maintainability)](https://codeclimate.com/github/yegor256/total/maintainability)
11
8
  [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/total/master/frames)
12
- [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/total/sibit/master/LICENSE.txt)
13
- [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/total.svg)](https://codecov.io/github/yegor256/total?branch=master)
14
- [![Hits-of-Code](https://hitsofcode.com/github/yegor256/total)](https://hitsofcode.com/view/github/yegor256/total)
15
9
 
16
10
  Total is a Ruby gem to detect the total amount of memory in the system.
17
11
 
@@ -28,30 +22,9 @@ require 'total'
28
22
  puts Total::Mem.new.bytes
29
23
  ```
30
24
 
31
- The following platforms are supported:
32
-
33
- * MacOSX
34
- * Linux
35
- * FreeBSD
36
- * <del>Windows</del> ([help wanted](https://github.com/yegor256/total/issues/3))
37
-
38
- If the platform is not recognized or is not supported, `Total::CantDetect` exception
39
- will be raised. You should catch it and proceed accordingly, for example:
40
-
41
- ```ruby
42
- def total_mb
43
- Total::Mem.new.bytes / (1024 * 1024)
44
- rescue Total::CantDetect
45
- 512
46
- end
47
- ```
48
-
49
- This code will return the actual memory size in Mb, if it can be detected,
50
- or 512 otherwise.
51
-
52
25
  That's it.
53
26
 
54
- ## How to contribute
27
+ # How to contribute
55
28
 
56
29
  Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
57
30
  Make sure you build is green before you contribute
@@ -64,3 +37,27 @@ $ bundle exec rake
64
37
  ```
65
38
 
66
39
  If it's clean and you don't see any error messages, submit your pull request.
40
+
41
+ # License
42
+
43
+ (The MIT License)
44
+
45
+ Copyright (c) 2018 Yegor Bugayenko
46
+
47
+ Permission is hereby granted, free of charge, to any person obtaining a copy
48
+ of this software and associated documentation files (the 'Software'), to deal
49
+ in the Software without restriction, including without limitation the rights
50
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
51
+ copies of the Software, and to permit persons to whom the Software is
52
+ furnished to do so, subject to the following conditions:
53
+
54
+ The above copyright notice and this permission notice shall be included in all
55
+ copies or substantial portions of the Software.
56
+
57
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
61
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
62
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
63
+ SOFTWARE.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Yegor Bugayenko
3
+ # Copyright (c) 2018 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -57,11 +57,3 @@ RuboCop::RakeTask.new(:rubocop) do |task|
57
57
  task.fail_on_error = true
58
58
  task.requires << 'rubocop-rspec'
59
59
  end
60
-
61
- task :copyright do
62
- sh "grep -q -r '2018-#{Date.today.strftime('%Y')}' \
63
- --include '*.rb' \
64
- --include '*.txt' \
65
- --include 'Rakefile' \
66
- ."
67
- end
data/lib/total/linux.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
5
+ # Copyright (c) 2018 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -25,18 +25,17 @@
25
25
  # Linux specific.
26
26
  #
27
27
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
28
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
28
+ # Copyright:: Copyright (c) 2018 Yegor Bugayenko
29
29
  # License:: MIT
30
30
  module Total
31
31
  # Linux specifics.
32
32
  class Linux
33
33
  # Get the total in bytes
34
34
  def memory
35
- raise CantDetect unless File.exist?('/proc/meminfo')
36
- File.readlines('/proc/meminfo').each do |t|
35
+ IO.readlines('/proc/meminfo').each do |t|
37
36
  return t.split(/ +/)[1].to_i * 1024 if t.start_with?('MemTotal:')
38
37
  end
39
- raise CantDetect, 'Can\'t detect memory size at /proc/meminfo'
38
+ raise 'Can\'t detect memory size at /proc/meminfo'
40
39
  end
41
40
  end
42
41
  end
data/lib/total/osx.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
5
+ # Copyright (c) 2018 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -25,21 +25,17 @@
25
25
  # OSX specific.
26
26
  #
27
27
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
28
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
28
+ # Copyright:: Copyright (c) 2018 Yegor Bugayenko
29
29
  # License:: MIT
30
30
  module Total
31
31
  # OSX specifics.
32
32
  class OSX
33
33
  # Get the total in bytes
34
34
  def memory
35
- begin
36
- `sysctl -a`.split("\n").each do |t|
37
- return t.split[1].to_i if t.start_with?('hw.memsize:')
38
- end
39
- rescue Errno::ENOENT => e
40
- raise CantDetect, e.message
35
+ `sysctl -a`.split("\n").each do |t|
36
+ return t.split(' ')[1].to_i if t.start_with?('hw.memsize:')
41
37
  end
42
- raise CantDetect, 'Can\'t detect memory size via sysctl'
38
+ raise 'Can\'t detect memory size via sysctl'
43
39
  end
44
40
  end
45
41
  end
data/lib/total.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
5
+ # Copyright (c) 2018 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -23,7 +23,6 @@
23
23
  # SOFTWARE.
24
24
 
25
25
  require_relative 'total/linux'
26
- require_relative 'total/freebsd'
27
26
  require_relative 'total/osx'
28
27
 
29
28
  # Total is a simple class to detect the total amount of memory in the system.
@@ -35,12 +34,9 @@ require_relative 'total/osx'
35
34
  # {README}[https://github.com/yegor256/total/blob/master/README.md] file.
36
35
  #
37
36
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
38
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
37
+ # Copyright:: Copyright (c) 2018 Yegor Bugayenko
39
38
  # License:: MIT
40
39
  module Total
41
- # When it's impossible to detect something.
42
- class CantDetect < StandardError; end
43
-
44
40
  # Memory specifics.
45
41
  class Mem
46
42
  # Get it in bytes.
@@ -54,8 +50,7 @@ module Total
54
50
  def target
55
51
  return Total::OSX.new if RUBY_PLATFORM.include?('darwin')
56
52
  return Total::Linux.new if RUBY_PLATFORM.include?('linux')
57
- return Total::FreeBSD.new if RUBY_PLATFORM.include?('freebsd')
58
- raise CantDetect, "Can't detect operating system: #{RUBY_PLATFORM}"
53
+ raise "Can\'t detect operating system: #{RUBY_PLATFORM}"
59
54
  end
60
55
  end
61
56
  end
data/test/test_total.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
5
+ # Copyright (c) 2018 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,7 +27,7 @@ require_relative '../lib/total'
27
27
 
28
28
  # Total test.
29
29
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
30
+ # Copyright:: Copyright (c) 2018 Yegor Bugayenko
31
31
  # License:: MIT
32
32
  class TotalTest < Minitest::Test
33
33
  def test_simple_fetch
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
5
+ # Copyright (c) 2018 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,7 +27,7 @@ require_relative '../../lib/total/linux'
27
27
 
28
28
  # Linux test.
29
29
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
30
+ # Copyright:: Copyright (c) 2018 Yegor Bugayenko
31
31
  # License:: MIT
32
32
  class LinuxTest < Minitest::Test
33
33
  def test_fetch_memory_size
@@ -36,11 +36,4 @@ class LinuxTest < Minitest::Test
36
36
  assert(!linux.memory.nil?)
37
37
  assert(linux.memory > 1024 * 1024)
38
38
  end
39
-
40
- def test_crashes_when_cant_detect
41
- skip if RUBY_PLATFORM.include?('linux')
42
- assert_raises Total::CantDetect do
43
- Total::Linux.new.memory
44
- end
45
- end
46
39
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
5
+ # Copyright (c) 2018 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,7 +27,7 @@ require_relative '../../lib/total/osx'
27
27
 
28
28
  # OSX test.
29
29
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
30
+ # Copyright:: Copyright (c) 2018 Yegor Bugayenko
31
31
  # License:: MIT
32
32
  class OSXTest < Minitest::Test
33
33
  def test_fetch_memory_size
@@ -36,11 +36,4 @@ class OSXTest < Minitest::Test
36
36
  assert(!linux.memory.nil?)
37
37
  assert(linux.memory > 1024 * 1024)
38
38
  end
39
-
40
- def test_crashes_when_cant_detect
41
- skip if RUBY_PLATFORM.include?('darwin')
42
- assert_raises Total::CantDetect do
43
- Total::OSX.new.memory
44
- end
45
- end
46
39
  end
data/total.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
5
+ # Copyright (c) 2018 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -24,10 +24,14 @@
24
24
 
25
25
  require 'English'
26
26
  Gem::Specification.new do |s|
27
- s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
27
+ s.specification_version = 2 if s.respond_to? :specification_version=
28
+ if s.respond_to? :required_rubygems_version=
29
+ s.required_rubygems_version = Gem::Requirement.new('>= 0')
30
+ end
31
+ s.rubygems_version = '2.3.3'
28
32
  s.required_ruby_version = '>=2.3'
29
33
  s.name = 'total'
30
- s.version = '0.0.0'
34
+ s.version = '0.1.0'
31
35
  s.license = 'MIT'
32
36
  s.summary = 'Total memory calculator in Ruby'
33
37
  s.description = 'Get total memory size of the system'
@@ -35,13 +39,12 @@ Gem::Specification.new do |s|
35
39
  s.email = 'yegor256@gmail.com'
36
40
  s.homepage = 'http://github.com/yegor256/total'
37
41
  s.files = `git ls-files`.split($RS)
42
+ s.test_files = s.files.grep(%r{^(test)/})
38
43
  s.rdoc_options = ['--charset=UTF-8']
39
44
  s.extra_rdoc_files = ['README.md']
40
- s.add_development_dependency 'codecov', '0.6.0'
41
- s.add_development_dependency 'minitest', '5.18.0'
42
- s.add_development_dependency 'rake', '13.0.6'
43
- s.add_development_dependency 'rdoc', '6.5.0'
44
- s.add_development_dependency 'rubocop', '1.48.1'
45
- s.add_development_dependency 'rubocop-rspec', '2.19.0'
46
- s.metadata['rubygems_mfa_required'] = 'true'
45
+ s.add_development_dependency 'minitest', '5.11.3'
46
+ s.add_development_dependency 'rake', '12.3.1'
47
+ s.add_development_dependency 'rdoc', '4.3.0'
48
+ s.add_development_dependency 'rubocop', '0.60.0'
49
+ s.add_development_dependency 'rubocop-rspec', '1.30.1'
47
50
  end
metadata CHANGED
@@ -1,99 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: total
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-17 00:00:00.000000000 Z
11
+ date: 2018-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: codecov
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 0.6.0
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 0.6.0
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: minitest
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - '='
32
18
  - !ruby/object:Gem::Version
33
- version: 5.18.0
19
+ version: 5.11.3
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - '='
39
25
  - !ruby/object:Gem::Version
40
- version: 5.18.0
26
+ version: 5.11.3
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rake
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - '='
46
32
  - !ruby/object:Gem::Version
47
- version: 13.0.6
33
+ version: 12.3.1
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - '='
53
39
  - !ruby/object:Gem::Version
54
- version: 13.0.6
40
+ version: 12.3.1
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rdoc
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - '='
60
46
  - !ruby/object:Gem::Version
61
- version: 6.5.0
47
+ version: 4.3.0
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - '='
67
53
  - !ruby/object:Gem::Version
68
- version: 6.5.0
54
+ version: 4.3.0
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rubocop
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - '='
74
60
  - !ruby/object:Gem::Version
75
- version: 1.48.1
61
+ version: 0.60.0
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - '='
81
67
  - !ruby/object:Gem::Version
82
- version: 1.48.1
68
+ version: 0.60.0
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rubocop-rspec
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - '='
88
74
  - !ruby/object:Gem::Version
89
- version: 2.19.0
75
+ version: 1.30.1
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - '='
95
81
  - !ruby/object:Gem::Version
96
- version: 2.19.0
82
+ version: 1.30.1
97
83
  description: Get total memory size of the system
98
84
  email: yegor256@gmail.com
99
85
  executables: []
@@ -102,35 +88,25 @@ extra_rdoc_files:
102
88
  - README.md
103
89
  files:
104
90
  - ".0pdd.yml"
105
- - ".github/workflows/codecov.yml"
106
- - ".github/workflows/pdd.yml"
107
- - ".github/workflows/rake.yml"
108
- - ".github/workflows/xcop.yml"
109
91
  - ".gitignore"
110
92
  - ".pdd"
111
93
  - ".rubocop.yml"
112
94
  - ".rultor.yml"
95
+ - ".travis.yml"
113
96
  - Gemfile
114
- - LICENSE.txt
115
97
  - README.md
116
98
  - Rakefile
117
99
  - lib/total.rb
118
- - lib/total/freebsd.rb
119
100
  - lib/total/linux.rb
120
101
  - lib/total/osx.rb
121
- - lib/total/version.rb
122
- - logo.svg
123
- - test/test__helper.rb
124
102
  - test/test_total.rb
125
- - test/total/test_freebsd.rb
126
103
  - test/total/test_linux.rb
127
104
  - test/total/test_osx.rb
128
105
  - total.gemspec
129
106
  homepage: http://github.com/yegor256/total
130
107
  licenses:
131
108
  - MIT
132
- metadata:
133
- rubygems_mfa_required: 'true'
109
+ metadata: {}
134
110
  post_install_message:
135
111
  rdoc_options:
136
112
  - "--charset=UTF-8"
@@ -147,8 +123,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
123
  - !ruby/object:Gem::Version
148
124
  version: '0'
149
125
  requirements: []
150
- rubygems_version: 3.1.2
126
+ rubyforge_project:
127
+ rubygems_version: 2.7.6
151
128
  signing_key:
152
- specification_version: 4
129
+ specification_version: 2
153
130
  summary: Total memory calculator in Ruby
154
- test_files: []
131
+ test_files:
132
+ - test/test_total.rb
133
+ - test/total/test_linux.rb
134
+ - test/total/test_osx.rb
@@ -1,20 +0,0 @@
1
- ---
2
- name: codecov
3
- on:
4
- push:
5
- branches:
6
- - master
7
- jobs:
8
- codecov:
9
- runs-on: ubuntu-20.04
10
- steps:
11
- - uses: actions/checkout@v3
12
- - uses: actions/setup-ruby@v1
13
- with:
14
- ruby-version: 2.7
15
- - run: bundle update
16
- - run: bundle exec rake
17
- - uses: codecov/codecov-action@v3
18
- with:
19
- file: coverage/.resultset.json
20
- fail_ci_if_error: true
@@ -1,15 +0,0 @@
1
- ---
2
- name: pdd
3
- "on":
4
- push:
5
- branches:
6
- - master
7
- pull_request:
8
- branches:
9
- - master
10
- jobs:
11
- pdd:
12
- runs-on: ubuntu-20.04
13
- steps:
14
- - uses: actions/checkout@v3
15
- - uses: g4s8/pdd-action@master
@@ -1,24 +0,0 @@
1
- ---
2
- name: rake
3
- on:
4
- push:
5
- branches:
6
- - master
7
- pull_request:
8
- branches:
9
- - master
10
- jobs:
11
- test:
12
- name: test
13
- strategy:
14
- matrix:
15
- os: [ubuntu-20.04]
16
- ruby: [2.6]
17
- runs-on: ${{ matrix.os }}
18
- steps:
19
- - uses: actions/checkout@v3
20
- - uses: ruby/setup-ruby@v1
21
- with:
22
- ruby-version: ${{ matrix.ruby }}
23
- - run: bundle update
24
- - run: bundle exec rake
@@ -1,17 +0,0 @@
1
- ---
2
- name: xcop
3
- "on":
4
- push:
5
- branches:
6
- - master
7
- pull_request:
8
- branches:
9
- - master
10
- jobs:
11
- xcop:
12
- runs-on: ubuntu-20.04
13
- steps:
14
- - uses: actions/checkout@v3
15
- - uses: g4s8/xcop-action@master
16
- with:
17
- files: '**/*.xml'
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- (The MIT License)
2
-
3
- Copyright (c) 2019-2022 Yegor Bugayenko
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the 'Software'), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
data/lib/total/freebsd.rb DELETED
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # (The MIT License)
4
- #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the 'Software'), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in all
15
- # copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- # SOFTWARE.
24
-
25
- # FreeBSD specific.
26
- #
27
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
28
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
29
- # License:: MIT
30
- module Total
31
- # FreeBSD specifics.
32
- class FreeBSD
33
- # Get the total in bytes
34
- def memory
35
- begin
36
- `sysctl -a`.split("\n").each do |t|
37
- return t.split[1].to_i if t.start_with?('hw.physmem:')
38
- end
39
- rescue Errno::ENOENT => e
40
- raise CantDetect, e.message
41
- end
42
- raise CantDetect, 'Can\'t detect memory size via sysctl'
43
- end
44
- end
45
- end
data/lib/total/version.rb DELETED
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # (The MIT License)
4
- #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the 'Software'), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in all
15
- # copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- # SOFTWARE.
24
-
25
- # Version of it.
26
- #
27
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
28
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
29
- # License:: MIT
30
- module Total
31
- # Current version of the library.
32
- VERSION = '0.4.0'
33
- end
data/logo.svg DELETED
@@ -1,19 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg width="314px" height="314px" viewBox="0 0 314 314" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
4
- <title>Group 2</title>
5
- <desc>Created with Sketch.</desc>
6
- <defs></defs>
7
- <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
- <g id="Group-2">
9
- <g id="Group">
10
- <circle id="Oval" fill="#053C5E" cx="157" cy="157" r="157"></circle>
11
- <rect id="Rectangle" fill="#2B2B2B" x="0" y="234" width="200" height="68"></rect>
12
- <text id="total" font-family="CourierNewPS-BoldMT, Courier New" font-size="50" font-weight="bold" fill="#FFFFFF">
13
- <tspan x="28" y="282">total</tspan>
14
- </text>
15
- <path d="M135.676765,111.215287 C135.211714,113.540467 132.770932,120.688823 130.252813,127.100603 C127.734621,133.512383 125.2898,140.431445 124.819828,142.476214 C123.6868,147.405663 121.517836,147.185477 119.69487,141.95608 C116.899865,133.938362 105.171362,111.043501 103.859129,111.043501 C100.420089,111.043501 101.508757,114.986149 109.1771,130.30227 C113.739327,139.414532 118.032086,147.448041 118.716515,148.15443 C120.694817,150.196115 120.172626,154.319657 117.358599,158.877992 C113.567467,165.019055 107.570942,183.721189 108.054206,187.896804 C108.804956,194.383204 112.436054,192.210274 113.355359,184.724515 C114.48376,175.535577 120.945556,159.641154 124.897459,156.333653 C127.109021,154.482778 128.268636,151.905536 128.573284,148.163978 C128.818001,145.157747 131.906711,135.560972 135.437115,126.837819 C138.96752,118.114666 141.511492,110.079835 141.090434,108.982574 C139.755727,105.504315 136.554941,106.824333 135.676765,111.215287 M174.714659,126.841564 C169.37392,129.699438 169.197653,130.049915 167.452978,141.283475 C165.577352,153.360398 165.225112,168.513913 166.548289,180.203784 L167.566817,189.202501 L161.346213,191.9541 C154.601949,194.937416 150.91195,200.302465 153.156708,203.861146 C155.104824,206.949562 157.09025,206.70198 157.571826,203.310532 C158.083734,199.706169 166.097413,193.204052 170.29418,192.987978 C172.116999,192.894116 173.522874,191.717021 173.97823,189.903529 C174.383277,188.290613 177.740353,184.944554 181.438431,182.467858 C188.546172,177.707551 194.317883,170.450278 194.317883,166.273341 C194.317883,162.684548 189.493165,158.361603 185.487795,158.361603 C180.701636,158.361603 180.027195,155.239403 183.731222,150.229385 C188.308065,144.038966 188.284856,130.867646 183.690534,127.147387 C179.896537,124.075276 179.885006,124.074836 174.714659,126.841564 M182.67318,134.240439 C184.752542,140.153164 174.808961,161.185104 171.588639,157.68562 C169.868715,155.81653 172.863122,135.012708 175.266374,132.134564 C177.872553,129.013319 181.163896,129.949075 182.67318,134.240439 M184.854262,162.269586 C190.589839,163.855621 189.673839,167.881335 181.645765,176.371155 C177.281618,180.986262 173.904933,183.573859 173.371946,182.711474 C172.876636,181.91012 172.127869,176.711937 171.707987,171.159972 L170.944531,161.065463 L176.209475,161.200234 C179.105172,161.274339 182.995308,161.755548 184.854262,162.269586 M132.642184,172.492256 C131.593837,175.224098 133.152917,177.288844 136.264027,177.288844 C139.014965,177.288844 139.431396,176.221769 138.067531,172.667568 C137.039234,169.987871 133.645289,169.878218 132.642184,172.492256 M203.781503,185.840798 C203.781503,187.657595 209.264724,193.512152 210.966361,193.512152 C212.534035,193.512152 211.991059,187.391138 210.270768,185.670847 C208.092403,183.492409 203.781503,183.605293 203.781503,185.840798" id="Fill-6" fill="#427B8A" fill-rule="nonzero"></path>
16
- </g>
17
- </g>
18
- </g>
19
- </svg>
data/test/test__helper.rb DELETED
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2018-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
- $stdout.sync = true
24
-
25
- require 'simplecov'
26
- SimpleCov.start
27
- if ENV['CI'] == 'true'
28
- require 'codecov'
29
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
30
- end
31
-
32
- require 'minitest/autorun'
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # (The MIT License)
4
- #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the 'Software'), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in all
15
- # copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- # SOFTWARE.
24
-
25
- require 'minitest/autorun'
26
- require_relative '../../lib/total/freebsd'
27
-
28
- # FreeBSD test.
29
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
31
- # License:: MIT
32
- class FreeBSDTest < Minitest::Test
33
- def test_fetch_memory_size
34
- skip unless RUBY_PLATFORM.include?('freebsd')
35
- freebsd = Total::FreeBSD.new
36
- assert(!freebsd.memory.nil?)
37
- assert(freebsd.memory > 1024 * 1024)
38
- end
39
-
40
- def test_crashes_when_cant_detect
41
- skip if RUBY_PLATFORM.include?('freebsd')
42
- assert_raises Total::CantDetect do
43
- Total::FreeBSD.new.memory
44
- end
45
- end
46
- end