sandi_meter 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzVlYjg2ZmU3ZDdjMjhhMjQ2ZDZjZjZiMGM0ZTIwNGNlZDBlZWY1Nw==
4
+ NjQ3NGNjZTlkNjIxYWQxYWMxZmZkOTg5NTZjYjdjYmEyNDQyNTkyMA==
5
5
  data.tar.gz: !binary |-
6
- OGFjMmE3NzUyNWIxZjA1NTMxZDIwNmMxOGMwMzljZjc1NWFlNWE2YQ==
6
+ YzEyNzM3MjRjYWZlNmE5N2M4YmUyOTY5N2M3YzExNTg2ZmVjN2I3Yg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YmNjNzA0OWRmODU4OTJkNDMwZGYyZjI4ZTNiMTI4ZTA4MjI2MzU5MjQxYzhl
10
- NTE0MGIyZThjMzlhNTkxODFhYWU5Zjk3ZDg3ZjJiNGJlNzA1M2ZjYmQ4NDM3
11
- OTU1ODZiMGE4MmNkNjgyNWQyNDRjYzczZTNhNGI5ZjBjNTUwNGY=
9
+ ZmU5NzY1ZmYwNWVkMjUzNWYxN2RkODEzMzUyMzdmODVhNDk0MzRhOGE0MDMz
10
+ MjBlM2ViYjBiOWZjNzViYTNhMDI5MjkwMGYyYTgzZjE2YTc5NzNjYWVmZjVh
11
+ ZTk0YjhkYzY2MTViNDgzODVhOTJkNzdmNjM4NmNkNmQ2NmRiNjc=
12
12
  data.tar.gz: !binary |-
13
- NDRjOWQ5ZTQ2ODA2Njc3OGQwZjllZDdjMzkyNzQ2NGM0NzM2MTdlNWYyMDQ4
14
- YWRjNmM2ODAwYzJjM2I4Y2JmNDViODA1MGU5ODNkYmM2NWI4NTI5YmY0ZmMz
15
- YWFlOWZmN2U3YmQ4YjNkZTM0MzlhOWNlODBlNzA5NzZlNGU4MzA=
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
  ![SandiMeter HTML mode pie charts](http://imageshack.us/a/img823/7653/hns3.png)
69
69
  ![SandiMeter HTML mode details](http://imageshack.us/a/img820/8711/bygo.png)
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module SandiMeter
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
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.2
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-10 00:00:00.000000000 Z
11
+ date: 2013-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler