log_analyzer 0.1.5 → 0.1.6

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
  SHA1:
3
- metadata.gz: bbb66a793c6b6c55af9babe00eba4212980858ab
4
- data.tar.gz: 0fe03b724b5727c1b410a88a0276d456e10af800
3
+ metadata.gz: 2a7d0498d34ec406651952a710ae56890b702554
4
+ data.tar.gz: 95431b32fd3962ee0e02e81865bc6bdc827bc459
5
5
  SHA512:
6
- metadata.gz: 40aedbef25daf98e33b2a3904edf40867c00fd588cd1c73e5d5dc26936e0601fec58afe7c30e202fa128a24aff34639df5e557bbfc2e943b1fad4323a91d67fa
7
- data.tar.gz: 3022606d6ed63cbd3482b5eb01daaf32ed4e02239d44d6ecfd1f77b7ba9a5c7eef45ec1e9f3140ee7c7c5c2d5c9311f026aefdef24b790ebb2237bd9933d97b2
6
+ metadata.gz: f0ec3c9d14dd5c3555fba87638445100bddf5b23fc7c8a1e0146c2efd66cb9df6647ec595db67064ac7094d0621bb973f47725e324d7828b08a9e8f934528851
7
+ data.tar.gz: 3d2246398ab3fb555fa6f6c941d0d4a78ab8ff9bd46cb0b63b55eae3eb4abaeab1cb8595b8ce2614b1feb59a4a10e340cb0c61b26fae7e71836a59066b90f394
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in log_analyzer.gemspec
4
- gemspec
4
+ gemspec
5
+
6
+ gem 'simplecov', require: false, group: :test
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- log_analyzer (0.1.5)
4
+ log_analyzer (0.1.6)
5
5
  colorize
6
6
  rake
7
7
  terminal-table
@@ -13,6 +13,8 @@ GEM
13
13
  coderay (1.1.2)
14
14
  colorize (0.8.1)
15
15
  diff-lcs (1.3)
16
+ docile (1.1.5)
17
+ json (2.0.3)
16
18
  method_source (0.9.0)
17
19
  pry (0.11.3)
18
20
  coderay (~> 1.1.0)
@@ -31,6 +33,11 @@ GEM
31
33
  diff-lcs (>= 1.2.0, < 2.0)
32
34
  rspec-support (~> 3.7.0)
33
35
  rspec-support (3.7.1)
36
+ simplecov (0.13.0)
37
+ docile (~> 1.1.0)
38
+ json (>= 1.8, < 3)
39
+ simplecov-html (~> 0.10.0)
40
+ simplecov-html (0.10.0)
34
41
  terminal-table (1.8.0)
35
42
  unicode-display_width (~> 1.1, >= 1.1.1)
36
43
  thor (0.20.0)
@@ -44,6 +51,7 @@ DEPENDENCIES
44
51
  log_analyzer!
45
52
  pry
46
53
  rspec (~> 3.0)
54
+ simplecov
47
55
 
48
56
  BUNDLED WITH
49
57
  1.14.6
data/README.md CHANGED
@@ -11,8 +11,8 @@ You can see columns:
11
11
  * View - name of view
12
12
  * Count - number of renders
13
13
  * Avg - average time of rendering (in milliseconds)
14
- * Max - maximum number of rendering
15
- * Min - minimum number of rendering
14
+ * Max - maximum time of rendering
15
+ * Min - minimum time of rendering
16
16
 
17
17
 
18
18
  ## Installation
@@ -35,7 +35,7 @@ Or install it yourself as:
35
35
 
36
36
  ## Usage
37
37
 
38
- After instalation run in console command `log_analyzer -f log/development.log`. You can change the file or sorting (time, count, name).
38
+ After installation run in console command `log_analyzer -f log/development.log`. You can change the file or sorting (time, count, name).
39
39
  Samples:
40
40
 
41
41
  * `log_analyzer log/development.log -s count`
@@ -46,13 +46,13 @@ Samples:
46
46
 
47
47
  **Based on results you can get an idea what to optimize. For example optimizing most often rendering view could give huge benefit. Now with this tool you can find out what are the numbers.**
48
48
 
49
- Based on the observations I suggest to run this tool for files less than 1Gb. If you have enough RAM - download log file to local machine and then run the tool.
49
+ Based on the observations I suggest to run this tool for files less than 1Gb. If you have enough RAM - download the log file to local machine and then run the tool.
50
50
 
51
51
  ## Development
52
52
 
53
53
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
54
54
 
55
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
55
+ To install this gem on your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
56
56
 
57
57
  ## Contributing
58
58
 
@@ -61,7 +61,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/varyfo
61
61
  ## TODO
62
62
 
63
63
  * more analytics
64
- * specs
64
+ * more specs
65
65
 
66
66
  ## License
67
67
 
@@ -1,15 +1,12 @@
1
1
  module LogAnalyzer
2
2
  class Stat
3
- attr_reader :count
4
3
  attr_reader :data
5
4
 
6
5
  def initialize
7
- @data = []
8
- @count = 0
6
+ @data = []
9
7
  end
10
8
 
11
9
  def push(time)
12
- @count += 1
13
10
  @data << time.to_f
14
11
  end
15
12
 
@@ -17,12 +14,11 @@ module LogAnalyzer
17
14
  @avg ||= (sum.to_f / count.to_f).round(2)
18
15
  end
19
16
 
17
+ def count; @count ||= @data.count; end
20
18
  def max; @max ||= @data.max; end
21
19
  def min; @min ||= @data.min; end
22
20
 
23
21
  private
24
- def sum
25
- @sum ||= @data.inject(nil) { |total, x| total ? total + x : x }
26
- end
22
+ def sum; @sum ||= @data.reduce(:+); end
27
23
  end
28
- end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module LogAnalyzer
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
data/lib/log_analyzer.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require "terminal-table"
2
+ require "colorize"
1
3
  require "log_analyzer/version"
2
4
  require "log_analyzer/stat"
3
5
  require "log_analyzer/analyzer"
data/log_analyzer.gemspec CHANGED
@@ -30,4 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "bundler", "> 1.14"
31
31
  spec.add_development_dependency "rspec", "~> 3.0"
32
32
  spec.add_development_dependency "pry"
33
+ spec.add_development_dependency "simplecov"
33
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: log_analyzer gem is created to get statistics about your views rendering
112
126
  performance.
113
127
  email: