bigsister 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bigsister.yml +49 -0
- data/.travis.yml +8 -0
- data/GHANGELOG.md +7 -1
- data/README.md +3 -1
- data/bigsister.gemspec +2 -0
- data/exe/bigsister +15 -0
- data/lib/bigsister.rb +17 -0
- data/lib/bigsister/application.rb +32 -0
- data/lib/bigsister/configuration.rb +53 -0
- data/lib/bigsister/monitor.rb +14 -0
- data/lib/bigsister/monitors/local.rb +6 -0
- data/lib/bigsister/monitors/springcm.rb +6 -0
- data/lib/bigsister/version.rb +1 -1
- metadata +39 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 801cec260afc76e68534a6eb2a927af3ded0e4a3127b87288cc7129ca11fb643
|
4
|
+
data.tar.gz: ee112f0f35496f9c96271e57774c9cbb814a704d2d97f5bba7f59b156fbf99b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cab071a5a1faf95f92221df55e7bcef07b75ee8220d241572a4fc624a2b150d2260882802ed2d1e8032e0ac54974ee72d18bd4f188968080b5d70d3b8f7699c0
|
7
|
+
data.tar.gz: 82720dfdfcb3d29abbd233f8ad0c2a51a6b2e0e3b12b289d485366c3a206baf6bc9712f01cdbb632fb747f1eabb88f8d5852aab25d0c73b214228ab39b2ae0f4
|
data/.bigsister.yml
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
monitor:
|
2
|
+
- type: local
|
3
|
+
path: /Users/paul
|
4
|
+
- type: springcm
|
5
|
+
path: /Human Resources Records
|
6
|
+
credentials:
|
7
|
+
client_id: client_id
|
8
|
+
client_secret: client_secret
|
9
|
+
data_center: data_center
|
10
|
+
generate:
|
11
|
+
- type: csv
|
12
|
+
path: ./detail.csv
|
13
|
+
format: detail
|
14
|
+
mode: write
|
15
|
+
include:
|
16
|
+
- directories
|
17
|
+
- files
|
18
|
+
columns:
|
19
|
+
- title: Timestamp
|
20
|
+
type: timestamp
|
21
|
+
- title: Path
|
22
|
+
type: path
|
23
|
+
- title: File Size
|
24
|
+
type: size
|
25
|
+
- title: File Type
|
26
|
+
type: type
|
27
|
+
- title: Created
|
28
|
+
type: created_at
|
29
|
+
- title: Modified
|
30
|
+
type: modified_at
|
31
|
+
- title: Customer
|
32
|
+
type: literal
|
33
|
+
value: KHSD
|
34
|
+
- type: csv
|
35
|
+
path: ./summary.csv
|
36
|
+
format: summary
|
37
|
+
mode: append
|
38
|
+
include:
|
39
|
+
- directories
|
40
|
+
- files
|
41
|
+
columns:
|
42
|
+
- title: Timestamp
|
43
|
+
type: timestamp
|
44
|
+
- title: File Count
|
45
|
+
type: file_count
|
46
|
+
- title: Directory Count
|
47
|
+
type: directory_count
|
48
|
+
- title: File Size
|
49
|
+
type: file_size
|
data/.travis.yml
CHANGED
@@ -5,3 +5,11 @@ cache: bundler
|
|
5
5
|
rvm:
|
6
6
|
- 2.5.1
|
7
7
|
before_install: gem install bundler -v 2.0.2
|
8
|
+
before_script:
|
9
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
10
|
+
- chmod +x ./cc-test-reporter
|
11
|
+
- ./cc-test-reporter before-build
|
12
|
+
script:
|
13
|
+
- bundle exec rspec
|
14
|
+
after_script:
|
15
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/GHANGELOG.md
CHANGED
@@ -4,4 +4,10 @@ All notable changes to BigSister will be documented in this file.
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
-
[
|
7
|
+
## [0.1.1] - Nov 8, 2019
|
8
|
+
### Added
|
9
|
+
* Basic Application object
|
10
|
+
* CLI tool
|
11
|
+
|
12
|
+
[Unreleased]: https://github.com/paulholden2/bigsister/compare/0.1.1...HEAD
|
13
|
+
[0.1.1]: https://github.com/paulholden2/bigsister/releases/tag/0.1.1
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# BigSister
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/paulholden2/bigsister.svg?branch=master)](https://travis-ci.org/paulholden2/bigsister) [![Maintainability](https://api.codeclimate.com/v1/badges/5c5e63e8a1c0f3830129/maintainability)](https://codeclimate.com/github/paulholden2/bigsister/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/5c5e63e8a1c0f3830129/test_coverage)](https://codeclimate.com/github/paulholden2/bigsister/test_coverage)
|
4
|
+
|
3
5
|
A gem for generating reports on the contents of local and remote files for monitoring purposes. Above-board monitoring purposes.
|
4
6
|
|
5
7
|
## Installation
|
@@ -21,7 +23,7 @@ Or install it yourself as:
|
|
21
23
|
## Usage
|
22
24
|
|
23
25
|
```ruby
|
24
|
-
|
26
|
+
$ bigsister
|
25
27
|
```
|
26
28
|
|
27
29
|
## Development
|
data/bigsister.gemspec
CHANGED
@@ -28,8 +28,10 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
30
|
spec.add_dependency "springcm-sdk", "~> 0.3"
|
31
|
+
spec.add_dependency "os", "~> 1.0"
|
31
32
|
|
32
33
|
spec.add_development_dependency "bundler", "~> 2.0"
|
33
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
34
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
spec.add_development_dependency "simplecov", "~> 0.17"
|
35
37
|
end
|
data/exe/bigsister
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "bigsister"
|
5
|
+
require "bigsister/application"
|
6
|
+
require "springcm-sdk"
|
7
|
+
|
8
|
+
begin
|
9
|
+
application = BigSister::Application.new
|
10
|
+
application.run
|
11
|
+
rescue BigSister::Error => e
|
12
|
+
puts "ERROR: #{e.message}"
|
13
|
+
rescue Springcm::Error => e
|
14
|
+
puts e.inspect
|
15
|
+
end
|
data/lib/bigsister.rb
CHANGED
@@ -2,5 +2,22 @@ require "bigsister/version"
|
|
2
2
|
|
3
3
|
module BigSister
|
4
4
|
class Error < StandardError
|
5
|
+
def initialize(exception)
|
6
|
+
@exception = exception
|
7
|
+
end
|
8
|
+
|
9
|
+
def message
|
10
|
+
@exception
|
11
|
+
end
|
12
|
+
|
13
|
+
def inspect
|
14
|
+
%(#<#{self.class} @exception=#{@exception}>)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class NoConfigurationFound < Error
|
19
|
+
def initialize(checked_paths)
|
20
|
+
super("No configuration files found. Looked in: #{checked_paths.join(', ')}")
|
21
|
+
end
|
5
22
|
end
|
6
23
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "os"
|
2
|
+
require "yaml"
|
3
|
+
require "bigsister/configuration"
|
4
|
+
|
5
|
+
module BigSister
|
6
|
+
class Application
|
7
|
+
DEFAULT_CONFIG_PATHS = ["./.bigsister.yml", "~/.bigsister/config.yml"].freeze
|
8
|
+
|
9
|
+
attr_reader :config
|
10
|
+
|
11
|
+
def initialize(opts = {})
|
12
|
+
@config_paths = opts[:config_paths] || DEFAULT_CONFIG_PATHS
|
13
|
+
|
14
|
+
load_config!
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def load_config!
|
23
|
+
yaml = @config_paths.map { |path|
|
24
|
+
File.exists?(path) && YAML.load(File.open(path).read)
|
25
|
+
}.select(&:itself).first
|
26
|
+
if yaml.nil?
|
27
|
+
raise BigSister::NoConfigurationFound.new(@config_paths)
|
28
|
+
end
|
29
|
+
@config = Configuration.new(yaml)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "bigsister/monitors/local"
|
2
|
+
require "bigsister/monitors/springcm"
|
3
|
+
|
4
|
+
module BigSister
|
5
|
+
class Configuration
|
6
|
+
MONITOR_TYPES = %w(local springcm).freeze
|
7
|
+
|
8
|
+
attr_reader :monitors
|
9
|
+
|
10
|
+
def initialize(data)
|
11
|
+
@monitors = []
|
12
|
+
@config_errors = []
|
13
|
+
|
14
|
+
load_monitoring(data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def valid?
|
18
|
+
@config_errors.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def load_monitoring(data)
|
24
|
+
@monitoring = data.fetch("monitor", [])
|
25
|
+
if @monitoring.empty?
|
26
|
+
config_error("No monitoring locations configured")
|
27
|
+
end
|
28
|
+
@monitoring.each_with_index { |location, i|
|
29
|
+
# Validate monitoring type
|
30
|
+
type = location.fetch("type", nil)
|
31
|
+
if type.nil?
|
32
|
+
config_error("No monitoring type specified for location #{i}")
|
33
|
+
elsif !MONITOR_TYPES.include?(type)
|
34
|
+
config_error("Invalid monitoring type specified for location #{i}")
|
35
|
+
else
|
36
|
+
@monitors.push(load_monitor(type, location, i))
|
37
|
+
end
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def load_monitor(type, location, i)
|
42
|
+
if type == "local"
|
43
|
+
BigSister::LocalMonitor.new(location, i)
|
44
|
+
elsif type == "springcm"
|
45
|
+
BigSister::SpringcmMonitor.new(location, i)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def config_error(message)
|
50
|
+
@config_errors.push(message)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/bigsister/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigsister
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Holden
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: springcm-sdk
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: os
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,13 +80,29 @@ dependencies:
|
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.17'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.17'
|
69
97
|
description:
|
70
98
|
email:
|
71
99
|
- pholden@stria.com
|
72
|
-
executables:
|
100
|
+
executables:
|
101
|
+
- bigsister
|
73
102
|
extensions: []
|
74
103
|
extra_rdoc_files: []
|
75
104
|
files:
|
105
|
+
- ".bigsister.yml"
|
76
106
|
- ".gitignore"
|
77
107
|
- ".rspec"
|
78
108
|
- ".travis.yml"
|
@@ -84,7 +114,13 @@ files:
|
|
84
114
|
- bigsister.gemspec
|
85
115
|
- bin/console
|
86
116
|
- bin/setup
|
117
|
+
- exe/bigsister
|
87
118
|
- lib/bigsister.rb
|
119
|
+
- lib/bigsister/application.rb
|
120
|
+
- lib/bigsister/configuration.rb
|
121
|
+
- lib/bigsister/monitor.rb
|
122
|
+
- lib/bigsister/monitors/local.rb
|
123
|
+
- lib/bigsister/monitors/springcm.rb
|
88
124
|
- lib/bigsister/version.rb
|
89
125
|
homepage: https://github.com/paulholden2/bigsister
|
90
126
|
licenses:
|