irb-benchmark 0.1.2 → 0.1.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 +5 -5
- data/.rubocop.yml +3 -0
- data/Gemfile +8 -3
- data/Gemfile.lock +43 -37
- data/LICENSE.txt +1 -1
- data/README.md +18 -7
- data/Rakefile +17 -17
- data/VERSION +1 -1
- data/irb-benchmark.gemspec +17 -16
- data/lib/irb-benchmark.rb +1 -1
- data/lib/irb_benchmark.rb +2 -5
- data/lib/irb_benchmark/irb_ext.rb +4 -3
- data/test/test_irb_benchmark.rb +2 -2
- metadata +10 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a7907af47a2f8abe7a0a3a2391a36b125eca042245e6308b05dbef5e376679f6
|
|
4
|
+
data.tar.gz: 037024a2501d20bdd78c92003bd94ed30e789be2b4888bbf8084dc49def163f2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9be1b93dda14a5a73816742b9f4037a13e64321772b718a488689ed97dbfb648edc8905c653bba0cff4240cd83659086cba5afbe9259890b4b4398b6eb5cef28
|
|
7
|
+
data.tar.gz: 148b32a69610e44ae5eb711d9171e0dc21a3e018752222262210d72cf18c95201e0922382a603d5df52d96c1a08b5aac622656306ce13c4ddb5a264195d0eeec
|
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
source
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
git_source(:github) do |repo_name|
|
|
4
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
|
|
5
|
+
"https://github.com/#{repo_name}.git"
|
|
6
|
+
end
|
|
4
7
|
|
|
5
|
-
gem
|
|
8
|
+
gem 'minitest', group: :test
|
|
9
|
+
|
|
10
|
+
gem 'jeweler', group: :development
|
data/Gemfile.lock
CHANGED
|
@@ -1,55 +1,61 @@
|
|
|
1
1
|
GEM
|
|
2
|
-
remote:
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
addressable (2.
|
|
5
|
-
builder (3.2.
|
|
6
|
-
descendants_tracker (0.0.
|
|
7
|
-
|
|
4
|
+
addressable (2.4.0)
|
|
5
|
+
builder (3.2.3)
|
|
6
|
+
descendants_tracker (0.0.4)
|
|
7
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
8
|
+
faraday (0.9.2)
|
|
8
9
|
multipart-post (>= 1.2, < 3)
|
|
9
|
-
git (1.
|
|
10
|
-
github_api (0.
|
|
11
|
-
addressable (~> 2.
|
|
12
|
-
descendants_tracker (~> 0.0.
|
|
10
|
+
git (1.3.0)
|
|
11
|
+
github_api (0.16.0)
|
|
12
|
+
addressable (~> 2.4.0)
|
|
13
|
+
descendants_tracker (~> 0.0.4)
|
|
13
14
|
faraday (~> 0.8, < 0.10)
|
|
14
|
-
hashie (>=
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
jeweler (2.0.1)
|
|
15
|
+
hashie (>= 3.4)
|
|
16
|
+
mime-types (>= 1.16, < 3.0)
|
|
17
|
+
oauth2 (~> 1.0)
|
|
18
|
+
hashie (3.5.6)
|
|
19
|
+
highline (1.7.10)
|
|
20
|
+
jeweler (2.3.7)
|
|
21
21
|
builder
|
|
22
|
-
bundler (>= 1
|
|
22
|
+
bundler (>= 1)
|
|
23
23
|
git (>= 1.2.5)
|
|
24
|
-
github_api
|
|
24
|
+
github_api (~> 0.16.0)
|
|
25
25
|
highline (>= 1.6.15)
|
|
26
26
|
nokogiri (>= 1.5.10)
|
|
27
|
+
psych (~> 2.2)
|
|
27
28
|
rake
|
|
28
29
|
rdoc
|
|
29
|
-
|
|
30
|
-
jwt (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
minitest (5.
|
|
34
|
-
multi_json (1.
|
|
35
|
-
multi_xml (0.
|
|
30
|
+
semver2
|
|
31
|
+
jwt (1.5.6)
|
|
32
|
+
mime-types (2.99.3)
|
|
33
|
+
mini_portile2 (2.3.0)
|
|
34
|
+
minitest (5.10.3)
|
|
35
|
+
multi_json (1.12.2)
|
|
36
|
+
multi_xml (0.6.0)
|
|
36
37
|
multipart-post (2.0.0)
|
|
37
|
-
nokogiri (1.
|
|
38
|
-
|
|
39
|
-
oauth2 (
|
|
40
|
-
faraday (>= 0.8, < 0.
|
|
41
|
-
jwt (~>
|
|
38
|
+
nokogiri (1.8.1)
|
|
39
|
+
mini_portile2 (~> 2.3.0)
|
|
40
|
+
oauth2 (1.4.0)
|
|
41
|
+
faraday (>= 0.8, < 0.13)
|
|
42
|
+
jwt (~> 1.0)
|
|
42
43
|
multi_json (~> 1.3)
|
|
43
44
|
multi_xml (~> 0.5)
|
|
44
|
-
rack (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
rack (>= 1.2, < 3)
|
|
46
|
+
psych (2.2.4)
|
|
47
|
+
rack (2.0.3)
|
|
48
|
+
rake (12.3.0)
|
|
49
|
+
rdoc (6.0.0)
|
|
50
|
+
semver2 (3.4.2)
|
|
51
|
+
thread_safe (0.3.6)
|
|
49
52
|
|
|
50
53
|
PLATFORMS
|
|
51
54
|
ruby
|
|
52
55
|
|
|
53
56
|
DEPENDENCIES
|
|
54
|
-
jeweler
|
|
55
|
-
minitest
|
|
57
|
+
jeweler
|
|
58
|
+
minitest
|
|
59
|
+
|
|
60
|
+
BUNDLED WITH
|
|
61
|
+
1.16.0
|
data/LICENSE.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c) 2012-
|
|
1
|
+
Copyright (c) 2012-2017 Maurizio De Santis <desantis.maurizio@gmail.com>
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# [IrbBenchmark](https://github.com/mdesantis/irb-benchmark)
|
|
2
2
|
|
|
3
|
-
[IrbBenchmark](https://github.com/mdesantis/irb-benchmark) wraps `irb` commands
|
|
3
|
+
[IrbBenchmark](https://github.com/mdesantis/irb-benchmark) wraps `irb` commands
|
|
4
|
+
evaluations in a `Benchmark.measure{ ... }` block and displays the results after
|
|
5
|
+
the command execution. Example:
|
|
4
6
|
|
|
5
7
|
```
|
|
6
8
|
irb(main):001:0> sleep 1
|
|
@@ -36,7 +38,8 @@ require 'irb-benchmark'
|
|
|
36
38
|
Irbtools.add_library :irb_benchmark, late: true
|
|
37
39
|
```
|
|
38
40
|
|
|
39
|
-
Note that the former option can be used with irbtools too, so it is the
|
|
41
|
+
Note that the former option can be used with irbtools too, so it is the
|
|
42
|
+
preferred.
|
|
40
43
|
|
|
41
44
|
### Enabling / disabling
|
|
42
45
|
|
|
@@ -44,9 +47,13 @@ Note that the former option can be used with irbtools too, so it is the preferre
|
|
|
44
47
|
IrbBenchmark.enabled = true / false
|
|
45
48
|
```
|
|
46
49
|
|
|
47
|
-
## [Wirb](https://github.com/janlelis/wirb) /
|
|
50
|
+
## [Wirb](https://github.com/janlelis/wirb) /
|
|
51
|
+
[irbtools](https://github.com/janlelis/irbtools) integration
|
|
48
52
|
|
|
49
|
-
It auto-detects [Wirb](https://github.com/janlelis/wirb) presence and
|
|
53
|
+
It auto-detects [Wirb](https://github.com/janlelis/wirb) presence and
|
|
54
|
+
[FancyIrb](https://github.com/janlelis/fancy_irb) configuration for colorized
|
|
55
|
+
output (both are used by the well-known
|
|
56
|
+
[irbtools](https://github.com/janlelis/irbtools) gem).
|
|
50
57
|
|
|
51
58
|
## Known issues
|
|
52
59
|
|
|
@@ -54,11 +61,15 @@ The usage with FancyIrb alters the benchmark measures adding a small overhead.
|
|
|
54
61
|
|
|
55
62
|
## Bugs, feature requests, pull requests
|
|
56
63
|
|
|
57
|
-
Fell free to open an
|
|
64
|
+
Fell free to open an
|
|
65
|
+
[issue](https://github.com/ProGNOMmers/irb-benchmark/issues) for bugs or
|
|
66
|
+
feature requests, or fork it and make a pull request.
|
|
58
67
|
|
|
59
68
|
## Thanks to
|
|
60
|
-
[janlelis](https://github.com/janlelis) and its
|
|
69
|
+
[janlelis](https://github.com/janlelis) and its
|
|
70
|
+
[fancy_irb](https://github.com/janlelis/fancy_irb) which saved me from spending
|
|
71
|
+
time to discover how to monkey-patch `Irb` :-)
|
|
61
72
|
|
|
62
73
|
## License
|
|
63
74
|
|
|
64
|
-
Copyright (c) 2012-
|
|
75
|
+
Copyright (c) 2012-2017 Maurizio De Santis. [MIT license](LICENSE.txt)
|
data/Rakefile
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
1
|
require 'rubygems'
|
|
4
2
|
require 'bundler'
|
|
5
3
|
begin
|
|
6
4
|
Bundler.setup(:default, :development)
|
|
7
5
|
rescue Bundler::BundlerError => e
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
warn e.message
|
|
7
|
+
warn 'Run `bundle install` to install missing gems'
|
|
10
8
|
exit e.status_code
|
|
11
9
|
end
|
|
12
10
|
require 'rake'
|
|
13
11
|
|
|
14
12
|
require 'jeweler'
|
|
15
13
|
Jeweler::Tasks.new do |gem|
|
|
16
|
-
# gem is a Gem::Specification...
|
|
17
|
-
|
|
18
|
-
gem.
|
|
19
|
-
gem.
|
|
20
|
-
gem.
|
|
21
|
-
gem.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
# gem is a Gem::Specification...
|
|
15
|
+
# see http://guides.rubygems.org/specification-reference/ for more options
|
|
16
|
+
gem.name = 'irb-benchmark'
|
|
17
|
+
gem.homepage = 'http://github.com/mdesantis/irb-benchmark'
|
|
18
|
+
gem.license = 'MIT'
|
|
19
|
+
gem.summary = %(irb commands auto-benchmarking)
|
|
20
|
+
gem.description =
|
|
21
|
+
'irb-benchmark wraps irb commands in a Benchmark.measure { ... } block ' \
|
|
22
|
+
'and displays the results after the command execution'
|
|
23
|
+
gem.email = 'desantis.maurizio@gmail.com'
|
|
24
|
+
gem.authors = ['Maurizio De Santis']
|
|
25
25
|
# dependencies defined in Gemfile
|
|
26
26
|
end
|
|
27
27
|
Jeweler::RubygemsDotOrgTasks.new
|
|
@@ -33,17 +33,17 @@ Rake::TestTask.new(:test) do |test|
|
|
|
33
33
|
test.verbose = true
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
desc
|
|
36
|
+
desc 'Code coverage detail'
|
|
37
37
|
task :simplecov do
|
|
38
|
-
ENV['COVERAGE'] =
|
|
38
|
+
ENV['COVERAGE'] = 'true'
|
|
39
39
|
Rake::Task['test'].execute
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
task :
|
|
42
|
+
task default: :test
|
|
43
43
|
|
|
44
44
|
require 'rdoc/task'
|
|
45
45
|
Rake::RDocTask.new do |rdoc|
|
|
46
|
-
version = File.exist?('VERSION') ? File.read('VERSION') :
|
|
46
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
|
47
47
|
|
|
48
48
|
rdoc.rdoc_dir = 'rdoc'
|
|
49
49
|
rdoc.title = "irb-benchmark #{version}"
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.3
|
data/irb-benchmark.gemspec
CHANGED
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: irb-benchmark 0.1.
|
|
5
|
+
# stub: irb-benchmark 0.1.3 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
|
-
s.name = "irb-benchmark"
|
|
9
|
-
s.version = "0.1.
|
|
8
|
+
s.name = "irb-benchmark".freeze
|
|
9
|
+
s.version = "0.1.3"
|
|
10
10
|
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
12
|
-
s.require_paths = ["lib"]
|
|
13
|
-
s.authors = ["Maurizio De Santis"]
|
|
14
|
-
s.date = "
|
|
15
|
-
s.description = "irb-benchmark wraps irb commands in a Benchmark.measure{ ... } block and displays
|
|
16
|
-
s.email = "desantis.maurizio@gmail.com"
|
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
|
+
s.require_paths = ["lib".freeze]
|
|
13
|
+
s.authors = ["Maurizio De Santis".freeze]
|
|
14
|
+
s.date = "2017-12-07"
|
|
15
|
+
s.description = "irb-benchmark wraps irb commands in a Benchmark.measure { ... } block and displays the results after the command execution".freeze
|
|
16
|
+
s.email = "desantis.maurizio@gmail.com".freeze
|
|
17
17
|
s.extra_rdoc_files = [
|
|
18
18
|
"LICENSE.txt",
|
|
19
19
|
"README.md"
|
|
20
20
|
]
|
|
21
21
|
s.files = [
|
|
22
|
+
".rubocop.yml",
|
|
22
23
|
"Gemfile",
|
|
23
24
|
"Gemfile.lock",
|
|
24
25
|
"LICENSE.txt",
|
|
@@ -31,21 +32,21 @@ Gem::Specification.new do |s|
|
|
|
31
32
|
"lib/irb_benchmark/irb_ext.rb",
|
|
32
33
|
"test/test_irb_benchmark.rb"
|
|
33
34
|
]
|
|
34
|
-
s.homepage = "http://github.com/mdesantis/irb-benchmark"
|
|
35
|
-
s.licenses = ["MIT"]
|
|
36
|
-
s.rubygems_version = "2.
|
|
37
|
-
s.summary = "irb commands auto-benchmarking"
|
|
35
|
+
s.homepage = "http://github.com/mdesantis/irb-benchmark".freeze
|
|
36
|
+
s.licenses = ["MIT".freeze]
|
|
37
|
+
s.rubygems_version = "2.7.2".freeze
|
|
38
|
+
s.summary = "irb commands auto-benchmarking".freeze
|
|
38
39
|
|
|
39
40
|
if s.respond_to? :specification_version then
|
|
40
41
|
s.specification_version = 4
|
|
41
42
|
|
|
42
43
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
43
|
-
s.add_development_dependency(%q<jeweler
|
|
44
|
+
s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
|
|
44
45
|
else
|
|
45
|
-
s.add_dependency(%q<jeweler
|
|
46
|
+
s.add_dependency(%q<jeweler>.freeze, [">= 0"])
|
|
46
47
|
end
|
|
47
48
|
else
|
|
48
|
-
s.add_dependency(%q<jeweler
|
|
49
|
+
s.add_dependency(%q<jeweler>.freeze, [">= 0"])
|
|
49
50
|
end
|
|
50
51
|
end
|
|
51
52
|
|
data/lib/irb-benchmark.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require 'irb_benchmark'
|
|
1
|
+
require 'irb_benchmark' # rubocop:disable Naming/FileName
|
data/lib/irb_benchmark.rb
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
+
# Main IrbBenchmark module, which has to be injected into IRB::Context.
|
|
1
2
|
module IrbBenchmark
|
|
2
|
-
|
|
3
3
|
VERSION = File.read(File.expand_path('../../VERSION', __FILE__)).chomp.freeze
|
|
4
4
|
|
|
5
5
|
@enabled = true
|
|
6
6
|
|
|
7
7
|
class << self
|
|
8
|
-
|
|
9
8
|
attr_accessor :enabled
|
|
10
9
|
|
|
11
10
|
def print(bm)
|
|
12
|
-
if defined?(Wirb)
|
|
11
|
+
if defined?(Wirb) && (!defined?(FancyIrb) || FancyIrb[:colorize, :output])
|
|
13
12
|
$stdout.print Wirb.colorize_result bm.to_s
|
|
14
13
|
else
|
|
15
14
|
$stdout.print bm.to_s
|
|
16
15
|
end
|
|
17
16
|
end
|
|
18
|
-
|
|
19
17
|
end
|
|
20
|
-
|
|
21
18
|
end
|
|
22
19
|
|
|
23
20
|
require 'irb_benchmark/irb_ext'
|
|
@@ -2,17 +2,18 @@ require 'irb'
|
|
|
2
2
|
require 'benchmark'
|
|
3
3
|
|
|
4
4
|
module IRB
|
|
5
|
+
# IRB::Context monkeypatch. Injects benchmark measurements into
|
|
6
|
+
# IRB evaluations.
|
|
5
7
|
class Context
|
|
6
|
-
|
|
7
8
|
alias evaluate_non_benchmarked evaluate
|
|
8
9
|
|
|
9
10
|
def evaluate(*args)
|
|
10
11
|
if IrbBenchmark.enabled
|
|
11
|
-
|
|
12
|
+
bm = Benchmark.measure { evaluate_non_benchmarked(*args) }
|
|
13
|
+
IrbBenchmark.print(bm)
|
|
12
14
|
else
|
|
13
15
|
evaluate_non_benchmarked(*args)
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
|
-
|
|
17
18
|
end
|
|
18
19
|
end
|
data/test/test_irb_benchmark.rb
CHANGED
metadata
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: irb-benchmark
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maurizio De Santis
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-12-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jeweler
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: '0'
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
27
|
-
description:
|
|
28
|
-
and displays
|
|
26
|
+
version: '0'
|
|
27
|
+
description: irb-benchmark wraps irb commands in a Benchmark.measure { ... } block
|
|
28
|
+
and displays the results after the command execution
|
|
29
29
|
email: desantis.maurizio@gmail.com
|
|
30
30
|
executables: []
|
|
31
31
|
extensions: []
|
|
@@ -33,6 +33,7 @@ extra_rdoc_files:
|
|
|
33
33
|
- LICENSE.txt
|
|
34
34
|
- README.md
|
|
35
35
|
files:
|
|
36
|
+
- ".rubocop.yml"
|
|
36
37
|
- Gemfile
|
|
37
38
|
- Gemfile.lock
|
|
38
39
|
- LICENSE.txt
|
|
@@ -64,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
64
65
|
version: '0'
|
|
65
66
|
requirements: []
|
|
66
67
|
rubyforge_project:
|
|
67
|
-
rubygems_version: 2.
|
|
68
|
+
rubygems_version: 2.7.2
|
|
68
69
|
signing_key:
|
|
69
70
|
specification_version: 4
|
|
70
71
|
summary: irb commands auto-benchmarking
|