sandi_meter 1.0.2 → 1.0.3
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 +8 -8
- data/README.md +2 -0
- data/lib/sandi_meter/cli.rb +22 -0
- data/lib/sandi_meter/file_scanner.rb +10 -1
- data/lib/sandi_meter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjQ3NGNjZTlkNjIxYWQxYWMxZmZkOTg5NTZjYjdjYmEyNDQyNTkyMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzEyNzM3MjRjYWZlNmE5N2M4YmUyOTY5N2M3YzExNTg2ZmVjN2I3Yg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmU5NzY1ZmYwNWVkMjUzNWYxN2RkODEzMzUyMzdmODVhNDk0MzRhOGE0MDMz
|
10
|
+
MjBlM2ViYjBiOWZjNzViYTNhMDI5MjkwMGYyYTgzZjE2YTc5NzNjYWVmZjVh
|
11
|
+
ZTk0YjhkYzY2MTViNDgzODVhOTJkNzdmNjM4NmNkNmQ2NmRiNjc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTA4OWE3NWI5Y2E0YWMyODk3MGM3MDExNjdlMTk1YzIxODM4NTk4NjE3NTRk
|
14
|
+
ZDI3NDc5MjZiZGNiYjkwNTM3YzhhNjNjZmEwZWJiMzU5NDcwOTQwNmMyNjAz
|
15
|
+
MTlmZGE4ZmRmZmZkZWU0ODQxNzg4MWYyM2JiZjA0NmQ5OTk1NWQ=
|
data/README.md
CHANGED
@@ -68,6 +68,8 @@ Try using gem with `-g (--graph)` option, so it will create a folder with beauti
|
|
68
68
|

|
69
69
|

|
70
70
|
|
71
|
+
Add ignore files and folders in `sandi_meter/.sandi_meter` file.
|
72
|
+
|
71
73
|
## Ruby script mode
|
72
74
|
|
73
75
|
~~~ruby
|
data/lib/sandi_meter/cli.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require 'mixlib/cli'
|
2
3
|
require 'sandi_meter/file_scanner'
|
3
4
|
require 'sandi_meter/formatter'
|
4
5
|
require 'sandi_meter/logger'
|
6
|
+
require 'sandi_meter/version'
|
5
7
|
require 'sandi_meter/html_generator'
|
6
8
|
|
7
9
|
module SandiMeter
|
@@ -32,6 +34,12 @@ module SandiMeter
|
|
32
34
|
description: "HTML mode. Create folder, log data and output stats to HTML file.",
|
33
35
|
boolean: true
|
34
36
|
|
37
|
+
option :version,
|
38
|
+
short: "-v",
|
39
|
+
long: "--version",
|
40
|
+
description: "Gem version",
|
41
|
+
boolean: true
|
42
|
+
|
35
43
|
option :help,
|
36
44
|
short: "-h",
|
37
45
|
long: "--help",
|
@@ -53,6 +61,12 @@ module SandiMeter
|
|
53
61
|
cli = CommandParser.new
|
54
62
|
cli.parse_options
|
55
63
|
|
64
|
+
if cli.config[:version]
|
65
|
+
# stolen from gem 'bubs' :)
|
66
|
+
puts "SandiMeter ".tr('A-Za-z1-90', 'Ⓐ-Ⓩⓐ-ⓩ①-⑨⓪').split('').join(' ') + SandiMeter::VERSION
|
67
|
+
exit 0
|
68
|
+
end
|
69
|
+
|
56
70
|
if cli.config[:rules]
|
57
71
|
show_sandi_rules
|
58
72
|
exit 0
|
@@ -75,6 +89,14 @@ module SandiMeter
|
|
75
89
|
html_generator.generate_data!(cli.config[:path])
|
76
90
|
html_generator.generate_details!(cli.config[:path], data)
|
77
91
|
|
92
|
+
# put ignore file
|
93
|
+
ignore_file_path = File.join(cli.config[:path], 'sandi_meter', '.sandi_meter')
|
94
|
+
if File.directory?(cli.config[:path]) && !File.exists?(ignore_file_path)
|
95
|
+
File.open(ignore_file_path, "w") do |file|
|
96
|
+
file.write %w(db vendor).join("\n")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
78
100
|
index_html_path = File.join(cli.config[:path], 'sandi_meter/index.html')
|
79
101
|
system "open #{index_html_path}"
|
80
102
|
else
|
@@ -9,6 +9,8 @@ module SandiMeter
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def scan(path, store_details = false)
|
12
|
+
read_ignore_file(path) unless @exclude_patterns
|
13
|
+
|
12
14
|
if File.directory?(path)
|
13
15
|
scan_dir(path)
|
14
16
|
else
|
@@ -20,11 +22,18 @@ module SandiMeter
|
|
20
22
|
|
21
23
|
private
|
22
24
|
def scan_dir(path)
|
23
|
-
Dir["#{path}/**/*.rb"].each do |file|
|
25
|
+
Dir["#{path}/**/*.rb"].reject { |f| @exclude_patterns && f =~ /#{@exclude_patterns}/ }.each do |file|
|
24
26
|
scan_file(file)
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
30
|
+
def read_ignore_file(path)
|
31
|
+
ignore_file_path = File.join(path, 'sandi_meter', '.sandi_meter')
|
32
|
+
if File.exists?(ignore_file_path)
|
33
|
+
@exclude_patterns ||= File.read(ignore_file_path).split("\n").join("|")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
28
37
|
def scan_file(path)
|
29
38
|
begin
|
30
39
|
analyzer = SandiMeter::Analyzer.new
|
data/lib/sandi_meter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sandi_meter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anatoli Makarevich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|