stats_lite 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b8a327301624d9bf4d2a6a3af222ce41d9c8ae28bdc77f0fbd5ddb649e4f4859
4
+ data.tar.gz: 31dcb6eedb5215b8e0899ec330275b24ec568d842658055ac06486ec41a286d8
5
+ SHA512:
6
+ metadata.gz: 646cec4392f419b4114441c3153c88fda6b85998f3df01d8303ce897f859e9910753cf086cced60c779abaab33d888a01293f8d378ba2ba3c6e4f5d71e43a03e
7
+ data.tar.gz: e6b027183ad224e19291e3e8a9df003286db1096e837047a4bf65716948991349732f1d93e1cb65674c57791494fb3daa46ac06a367e1e75104e42fbbf991902
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .idea/
data/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,3 @@
1
+ inherit_gem:
2
+ rubocop-rails_config:
3
+ - config/rails.yml
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 2.0.2
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in stats_lite.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,134 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ stats_lite (0.1.0)
5
+ filewatcher (~> 1.1.1)
6
+ puma (>= 4.0.0, < 5.0.0)
7
+ rack (>= 2.0.0, < 3.0.0)
8
+ sinatra (>= 2.0.0, < 3.0.0)
9
+ vidibus-sysinfo (~> 1.2.0)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ actionpack (6.0.0)
15
+ actionview (= 6.0.0)
16
+ activesupport (= 6.0.0)
17
+ rack (~> 2.0)
18
+ rack-test (>= 0.6.3)
19
+ rails-dom-testing (~> 2.0)
20
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
21
+ actionview (6.0.0)
22
+ activesupport (= 6.0.0)
23
+ builder (~> 3.1)
24
+ erubi (~> 1.4)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
27
+ activesupport (6.0.0)
28
+ concurrent-ruby (~> 1.0, >= 1.0.2)
29
+ i18n (>= 0.7, < 2)
30
+ minitest (~> 5.1)
31
+ tzinfo (~> 1.1)
32
+ zeitwerk (~> 2.1, >= 2.1.8)
33
+ ast (2.4.0)
34
+ builder (3.2.3)
35
+ concurrent-ruby (1.1.5)
36
+ crass (1.0.4)
37
+ diff-lcs (1.3)
38
+ erubi (1.9.0)
39
+ filewatcher (1.1.1)
40
+ optimist (~> 3.0)
41
+ i18n (1.7.0)
42
+ concurrent-ruby (~> 1.0)
43
+ jaro_winkler (1.5.3)
44
+ loofah (2.3.0)
45
+ crass (~> 1.0.2)
46
+ nokogiri (>= 1.5.9)
47
+ method_source (0.9.2)
48
+ mini_portile2 (2.4.0)
49
+ minitest (5.12.2)
50
+ mustermann (1.0.3)
51
+ nio4r (2.5.2)
52
+ nokogiri (1.10.4)
53
+ mini_portile2 (~> 2.4.0)
54
+ optimist (3.0.0)
55
+ parallel (1.17.0)
56
+ parser (2.6.5.0)
57
+ ast (~> 2.4.0)
58
+ puma (4.2.0)
59
+ nio4r (~> 2.0)
60
+ rack (2.0.7)
61
+ rack-protection (2.0.7)
62
+ rack
63
+ rack-test (1.1.0)
64
+ rack (>= 1.0, < 3)
65
+ rails-dom-testing (2.0.3)
66
+ activesupport (>= 4.2.0)
67
+ nokogiri (>= 1.6)
68
+ rails-html-sanitizer (1.2.0)
69
+ loofah (~> 2.2, >= 2.2.2)
70
+ railties (6.0.0)
71
+ actionpack (= 6.0.0)
72
+ activesupport (= 6.0.0)
73
+ method_source
74
+ rake (>= 0.8.7)
75
+ thor (>= 0.20.3, < 2.0)
76
+ rainbow (3.0.0)
77
+ rake (10.5.0)
78
+ rspec (3.7.0)
79
+ rspec-core (~> 3.7.0)
80
+ rspec-expectations (~> 3.7.0)
81
+ rspec-mocks (~> 3.7.0)
82
+ rspec-core (3.7.1)
83
+ rspec-support (~> 3.7.0)
84
+ rspec-expectations (3.7.0)
85
+ diff-lcs (>= 1.2.0, < 2.0)
86
+ rspec-support (~> 3.7.0)
87
+ rspec-mocks (3.7.0)
88
+ diff-lcs (>= 1.2.0, < 2.0)
89
+ rspec-support (~> 3.7.0)
90
+ rspec-support (3.7.1)
91
+ rubocop (0.75.0)
92
+ jaro_winkler (~> 1.5.1)
93
+ parallel (~> 1.10)
94
+ parser (>= 2.6)
95
+ rainbow (>= 2.2.2, < 4.0)
96
+ ruby-progressbar (~> 1.7)
97
+ unicode-display_width (>= 1.4.0, < 1.7)
98
+ rubocop-performance (1.5.0)
99
+ rubocop (>= 0.71.0)
100
+ rubocop-rails (2.3.2)
101
+ rack (>= 1.1)
102
+ rubocop (>= 0.72.0)
103
+ rubocop-rails_config (0.7.2)
104
+ railties (>= 3.0)
105
+ rubocop (~> 0.74)
106
+ rubocop-performance (~> 1.3)
107
+ rubocop-rails (~> 2.0)
108
+ ruby-progressbar (1.10.1)
109
+ sinatra (2.0.7)
110
+ mustermann (~> 1.0)
111
+ rack (~> 2.0)
112
+ rack-protection (= 2.0.7)
113
+ tilt (~> 2.0)
114
+ thor (0.20.3)
115
+ thread_safe (0.3.6)
116
+ tilt (2.0.10)
117
+ tzinfo (1.2.5)
118
+ thread_safe (~> 0.1)
119
+ unicode-display_width (1.6.0)
120
+ vidibus-sysinfo (1.2.0)
121
+ zeitwerk (2.1.10)
122
+
123
+ PLATFORMS
124
+ ruby
125
+
126
+ DEPENDENCIES
127
+ bundler (~> 2.0)
128
+ rake (~> 10.0)
129
+ rspec (~> 3.0)
130
+ rubocop-rails_config (~> 0.7.2)
131
+ stats_lite!
132
+
133
+ BUNDLED WITH
134
+ 2.0.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 sebi
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # StatsLite
2
+
3
+ Simple way to get server information as json. Easy to extend with a `config.rb` file.
4
+ Embeddable in Rails
5
+
6
+ ### Standalone usage
7
+
8
+ Requirements ruby, min version 2
9
+
10
+ ```shell script
11
+ gem install stats_lite
12
+ stats-lite
13
+ curl http://localhost:9111
14
+ ```
15
+
16
+ ![demo](https://raw.githubusercontent.com/sebyx07/stats-lite/master/docs/example.png)
17
+
18
+ create a `config.rb` then `stats-lite`
19
+
20
+ ```ruby
21
+ # example config.rb
22
+ # basic usage
23
+
24
+ StatsLite.configure do |s|
25
+ s.password "1234" # password protection
26
+ s.port 9111 # listening port
27
+ end
28
+ ```
29
+
30
+ ```shell script
31
+ # now it's protected by passowrd
32
+ curl http://localhost:9111?password=1234
33
+ ```
34
+
35
+ ### Rails usage
36
+
37
+ `gem "stats_lite"`
38
+
39
+ ```ruby
40
+ # routes.rb
41
+ mount StatsLite::App => "/server-stats"
42
+ ```
43
+
44
+ ### Advanced configuration
45
+
46
+ ```ruby
47
+
48
+ StatsLite.configure do |s, h|
49
+ s.password ENV["STATS_LITE_PASS"] # defaults to nil, unprotected
50
+ s.port ENV["STATS_LITE_PORT"], defaults to 9111
51
+
52
+ s.data -> (data) do # add more data
53
+ data[:ruby_current_time] = Time.now #simple value
54
+ data[:linux_time] = h.command("date") # bash command, supports {cache: true, expires_in: 60}
55
+
56
+ data[:slow_command] = h.fetch :slow_command, -> {
57
+ sleep 1
58
+ "slow command"
59
+ }, expires_in: 5 # cached ruby value
60
+ end
61
+
62
+ s.app do |sinatra| # extend the app, add multiple routes, which are protected by the password
63
+ sinatra.get("/another_route") do
64
+ content_type :json
65
+
66
+ { cpus: h.command("nproc", { cache: true }) }.to_json
67
+ end
68
+ end
69
+ end
70
+ ```
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
9
+
10
+ desc "test"
11
+ task :test do
12
+ sh "gem uninstall stats_lite -a -x"
13
+ sh "rm pkg/*"
14
+ sh "rake build"
15
+ sh "gem install pkg/*"
16
+ end
17
+
18
+ desc "integration"
19
+ task "integration" do
20
+ sh "rake test"
21
+ sh "cd integration_test && stats-lite"
22
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "stats_lite"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/docs/example.png ADDED
Binary file
data/exe/stats-lite ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "stats_lite"
5
+ require "rack/handler/puma"
6
+ require "filewatcher"
7
+
8
+ print StatsLite::Log.yellow("\nStarting stats-lite\n")
9
+ config = "./config.rb"
10
+
11
+ load_config = -> do
12
+ if File.exist?(config)
13
+ print StatsLite::Log.red "\nFound config.rb\n"
14
+ load config
15
+ end
16
+ end
17
+
18
+ load_config.call
19
+ Thread.new do
20
+ Filewatcher.new(StatsLite.configure.watch).watch do |filename, event|
21
+ load_config.call
22
+ end
23
+ end
24
+
25
+ app = Rack::Builder.new do
26
+ use StatsLite::App
27
+ run lambda { |env| [404, {}, []] }
28
+ end
29
+
30
+ Rack::Handler::Puma.run(app, Port: 3000)
File without changes
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ StatsLite.configure do |s, h|
4
+ s.password "1234"
5
+ s.port 3000
6
+
7
+ s.data -> (data) do
8
+ data[:ruby_current_time] = Time.now
9
+ data[:linux_time] = h.command("date")
10
+
11
+ data[:slow_command] = h.fetch :slow_command, -> {
12
+ sleep 1
13
+ "SLOW1233"
14
+ }, expires_in: 5
15
+ end
16
+
17
+ s.app do |sinatra|
18
+ sinatra.get("/another_route") do
19
+ content_type :json
20
+
21
+ { cpus: h.command("nproc") }.to_json
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StatsLite
4
+ class App < Sinatra::Base
5
+ before do
6
+ password = params[:password]
7
+ conf_pass = StatsLite.configure.password
8
+
9
+ if conf_pass && conf_pass != password
10
+ halt 404, { "Content-Type" => "text/plain" }, ""
11
+ end
12
+ end
13
+
14
+ get "/" do
15
+ content_type :json
16
+
17
+ result.to_json
18
+ end
19
+
20
+ private
21
+ def result
22
+ default = Default
23
+ result = {
24
+ time_utc: Time.now.utc.strftime("%e %b %Y %H:%M:%S%p").strip,
25
+ host: default.host,
26
+ cpu: default.cpu,
27
+ ram: default.ram,
28
+ hdd: default.hdd
29
+ }
30
+
31
+ data = StatsLite.configure.data
32
+ data.call(result) if data
33
+ result
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StatsLite
4
+ class Cache
5
+ attr_reader :map
6
+
7
+ def initialize
8
+ @map = {}
9
+ end
10
+
11
+ class << self
12
+ def fetch(name, proc, expires_s)
13
+ @cache ||= new
14
+
15
+ existing = @cache.map[name] if @cache.map.has_key?(name)
16
+
17
+ if existing
18
+ if existing.is_a?(Hash) && existing.has_key?(:timestamp)
19
+ if Time.now - existing[:timestamp] > expires_s
20
+ _handle_expires(name, proc)
21
+ else
22
+ existing[:value]
23
+ end
24
+ elsif expires_s > 0
25
+ _handle_expires(name, proc)
26
+ else
27
+ _gey_key(name)
28
+ end
29
+ else
30
+ if expires_s > 0
31
+ _handle_expires(name, proc)
32
+ else
33
+ _set_key(name, proc)
34
+ end
35
+ end
36
+ end
37
+
38
+ def _handle_expires(name, proc)
39
+ @cache.map[name] = { timestamp: Time.now, value: proc.call }
40
+ @cache.map[name][:value]
41
+ end
42
+
43
+ def _set_key(name, proc)
44
+ @cache.map[name] = proc.call
45
+ end
46
+
47
+ def _gey_key(name)
48
+ @cache.map[name]
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StatsLite
4
+ class Configuration
5
+ def initialize
6
+ @port = 9111
7
+ @watch = ["config.rb"]
8
+ end
9
+
10
+ def port(_port = nil)
11
+ _port ? @port = _port : @port
12
+ end
13
+
14
+ def app
15
+ _app = StatsLite::App
16
+ if block_given?
17
+ yield app
18
+ else
19
+ _app
20
+ end
21
+ end
22
+
23
+ def watch(_paths = nil)
24
+ _paths ? @watch = _paths : @watch
25
+ end
26
+
27
+ def password(_pass = nil)
28
+ _pass ? @password = _pass : @password
29
+ end
30
+
31
+ def data(_data = nil)
32
+ _data ? @data = _data : @data
33
+ end
34
+ end
35
+
36
+ class << self
37
+ def configure
38
+ config = @configuration ||= Configuration.new
39
+ if block_given?
40
+ yield config, StatsLite::Helper
41
+ else
42
+ config
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StatsLite
4
+ module Default
5
+ class << self
6
+ def host
7
+ {
8
+ hostname: h.command("hostname", cache: true),
9
+ ip: ip
10
+ }
11
+ end
12
+ def cpu
13
+ {
14
+ model: h.command("lscpu | grep 'Model name' | cut -f 2 -d \":\" | awk '{$1=$1}1'", cache: true),
15
+ cores: h.command("nproc", cache: true),
16
+ usage: _cpu_usage
17
+ }
18
+ end
19
+
20
+ def ip
21
+ {
22
+ public: h.command("curl -s ifconfig.me", cache: true)
23
+ }
24
+ end
25
+
26
+ def ram
27
+ result = -> do
28
+ map = Vidibus::Sysinfo.memory.to_h
29
+ map.map do |k, v|
30
+ map[k] = "#{(v / 1024.to_f).round(2)}GB"
31
+ end
32
+ map
33
+ end
34
+
35
+ { usage: h.fetch(:ram, result, expires_in: 10) }
36
+ end
37
+
38
+ def _cpu_usage
39
+ total = <<-CMD
40
+ (grep 'cpu ' /proc/stat;sleep 0.1;grep 'cpu ' /proc/stat)|awk -v RS="" '{print ""($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)"%"}'
41
+ CMD
42
+ {
43
+ total: fmt_nr(h.command(total))
44
+ }
45
+ end
46
+
47
+ def hdd
48
+ result = -> do
49
+ map = Vidibus::Sysinfo.storage.to_h
50
+ map.map do |k, v|
51
+ map[k] = "#{v}GB"
52
+ end
53
+ end
54
+
55
+ { usage: h.fetch(:hdd, result, expires_in: 60) }
56
+ end
57
+
58
+ def fmt_nr(number)
59
+ "#{number.gsub("%", "").to_i}%"
60
+ end
61
+
62
+ def h
63
+ StatsLite::Helper
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StatsLite
4
+ module Helper
5
+ class << self
6
+ def raw_command(command, options)
7
+ proc = -> { _sys_command(command) }
8
+
9
+ _cache(options, command, proc)
10
+ end
11
+
12
+ def command(command, options = {})
13
+ proc = -> { _prepare_command(command) }
14
+
15
+ _cache(options, command, proc)
16
+ end
17
+
18
+ def fetch(name, proc, expires_in: 0)
19
+ _cache({ cache: true, expires_in: expires_in }, name, proc)
20
+ end
21
+
22
+ def _cache(options, command, proc)
23
+ expires_s = options[:expires_in] || 0
24
+
25
+ options[:cache] ? Cache.fetch(command, proc, expires_s) : proc.call
26
+ end
27
+
28
+ def _sys_command(command)
29
+ %x(#{command})
30
+ end
31
+
32
+ def _prepare_command(command)
33
+ _sys_command(command).gsub("\n", " ").strip
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StatsLite
4
+ module Log
5
+ class << self
6
+ def colorize(str, color_code)
7
+ "\e[#{color_code}m#{str}\e[0m"
8
+ end
9
+
10
+ def red(str)
11
+ colorize(str, 31)
12
+ end
13
+
14
+ def green(str)
15
+ colorize(str, 32)
16
+ end
17
+
18
+ def yellow(str)
19
+ colorize(str, 33)
20
+ end
21
+
22
+ def blue(str)
23
+ colorize(str, 34)
24
+ end
25
+
26
+ def pink(str)
27
+ colorize(str, 35)
28
+ end
29
+
30
+ def light_blue(str)
31
+ colorize(str, 36)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StatsLite
4
+ VERSION = "0.1.0"
5
+ end
data/lib/stats_lite.rb ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sinatra/base"
4
+ require "json"
5
+ require "vidibus-sysinfo"
6
+
7
+ Dir[File.join(__dir__, "stats_lite", "**/*.rb")].each { |file| require file }
8
+
9
+ module StatsLite
10
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "stats_lite/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "stats_lite"
9
+ spec.version = StatsLite::VERSION
10
+ spec.authors = ["sebi"]
11
+ spec.email = ["sebyx07.pro@gmail.com"]
12
+
13
+ spec.summary = "Simple web server to get linux system information. Rails compatible engine"
14
+ spec.description = %{ Get system information for linux hosts. Standalone or rails engine }
15
+ spec.homepage = "https://github.com/sebyx07/stats-lite"
16
+ spec.license = "MIT"
17
+
18
+ spec.metadata["allowed_push_host"] = ""
19
+
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] = spec.homepage
22
+
23
+ if spec.respond_to?(:metadata)
24
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
25
+ else
26
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
27
+ 'public gem pushes.'
28
+ end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
33
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ end
35
+ spec.bindir = "exe"
36
+ spec.executables = "stats-lite"
37
+ spec.require_paths = ["lib"]
38
+
39
+ spec.add_development_dependency "bundler", "~> 2.0"
40
+ spec.add_development_dependency "rake", "~> 10.0"
41
+ spec.add_development_dependency "rspec", "~> 3.0"
42
+ spec.add_development_dependency "rubocop-rails_config", "~> 0.7.2"
43
+
44
+ spec.add_dependency "rack", ">= 2.0.0", "< 3.0.0"
45
+ spec.add_dependency "puma", ">= 4.0.0", "< 5.0.0"
46
+ spec.add_dependency "sinatra", ">= 2.0.0", "< 3.0.0"
47
+ spec.add_dependency "vidibus-sysinfo", "~> 1.2.0"
48
+ spec.add_dependency "filewatcher", "~> 1.1.1"
49
+ end
metadata ADDED
@@ -0,0 +1,216 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stats_lite
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - sebi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-10-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-rails_config
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.7.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.7.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: rack
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 2.0.0
76
+ - - "<"
77
+ - !ruby/object:Gem::Version
78
+ version: 3.0.0
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 2.0.0
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: 3.0.0
89
+ - !ruby/object:Gem::Dependency
90
+ name: puma
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 4.0.0
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: 5.0.0
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 4.0.0
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: 5.0.0
109
+ - !ruby/object:Gem::Dependency
110
+ name: sinatra
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 2.0.0
116
+ - - "<"
117
+ - !ruby/object:Gem::Version
118
+ version: 3.0.0
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 2.0.0
126
+ - - "<"
127
+ - !ruby/object:Gem::Version
128
+ version: 3.0.0
129
+ - !ruby/object:Gem::Dependency
130
+ name: vidibus-sysinfo
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - "~>"
134
+ - !ruby/object:Gem::Version
135
+ version: 1.2.0
136
+ type: :runtime
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - "~>"
141
+ - !ruby/object:Gem::Version
142
+ version: 1.2.0
143
+ - !ruby/object:Gem::Dependency
144
+ name: filewatcher
145
+ requirement: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - "~>"
148
+ - !ruby/object:Gem::Version
149
+ version: 1.1.1
150
+ type: :runtime
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - "~>"
155
+ - !ruby/object:Gem::Version
156
+ version: 1.1.1
157
+ description: " Get system information for linux hosts. Standalone or rails engine "
158
+ email:
159
+ - sebyx07.pro@gmail.com
160
+ executables:
161
+ - stats-lite
162
+ extensions: []
163
+ extra_rdoc_files: []
164
+ files:
165
+ - ".gitignore"
166
+ - ".rakeTasks"
167
+ - ".rspec"
168
+ - ".rubocop.yml"
169
+ - ".travis.yml"
170
+ - Gemfile
171
+ - Gemfile.lock
172
+ - LICENSE.txt
173
+ - README.md
174
+ - Rakefile
175
+ - bin/console
176
+ - bin/setup
177
+ - docs/example.png
178
+ - exe/stats-lite
179
+ - integration_test/ | awk '{=}1'}
180
+ - integration_test/config.rb
181
+ - lib/stats_lite.rb
182
+ - lib/stats_lite/app.rb
183
+ - lib/stats_lite/cache.rb
184
+ - lib/stats_lite/configure.rb
185
+ - lib/stats_lite/default.rb
186
+ - lib/stats_lite/helper.rb
187
+ - lib/stats_lite/log.rb
188
+ - lib/stats_lite/version.rb
189
+ - stats_lite.gemspec
190
+ homepage: https://github.com/sebyx07/stats-lite
191
+ licenses:
192
+ - MIT
193
+ metadata:
194
+ allowed_push_host: https://rubygems.org
195
+ homepage_uri: https://github.com/sebyx07/stats-lite
196
+ source_code_uri: https://github.com/sebyx07/stats-lite
197
+ post_install_message:
198
+ rdoc_options: []
199
+ require_paths:
200
+ - lib
201
+ required_ruby_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ required_rubygems_version: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: '0'
211
+ requirements: []
212
+ rubygems_version: 3.0.6
213
+ signing_key:
214
+ specification_version: 4
215
+ summary: Simple web server to get linux system information. Rails compatible engine
216
+ test_files: []