pry-larry 0.4.0 → 0.5.0
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 +4 -4
- data/.pryrc +2 -0
- data/CHANGELOG.md +12 -0
- data/README.md +9 -5
- data/lib/pry-larry.rb +16 -9
- data/lib/pry-larry/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5411b812c1ade155971851027706a2914203f934
|
4
|
+
data.tar.gz: ca77139c4f200f7d04844ab13fef1919011b72e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7dd0869fd4f495b6e8a63c4000bf7cfe15e328813bba1c434f8d7c0ad8e8ad39cb325122b166e691eca3281174809d15da3f057431fbcd11944a7bc78568766
|
7
|
+
data.tar.gz: 1ac45234921b20cc3c0555d51ea2930bb6bd02049f5f3a8103d1ea04e60bd522dd4df89e0b66a4899d352014c64d1dad29069cc52b4fa6756d2838a558078f8b
|
data/.pryrc
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
+
__v0.5.0__
|
2
|
+
|
3
|
+
* Pass instance of "Pry" to speak_if lambda.
|
4
|
+
* Add "larry-stop" and "larry-start" alias commands.
|
5
|
+
* Add "pry.config.larry.speaker"
|
6
|
+
|
7
|
+
__v0.4.0__
|
8
|
+
|
9
|
+
* By default Larry will speak when the elapsed time is greater than 0.
|
10
|
+
* Add "screenshots/" directory
|
11
|
+
|
1
12
|
__v0.3.0__
|
13
|
+
|
2
14
|
* The Larry command aliases "start" as "wakeup", and "stop" as "chill".
|
3
15
|
* Add a 'banner' to the 'larry' command.
|
4
16
|
* Print confirmation when running the 'larry start' and 'larry stop' commands.
|
data/README.md
CHANGED
@@ -9,15 +9,19 @@ you ran took to complete.
|
|
9
9
|
__Configuration__
|
10
10
|
|
11
11
|
The `.pryrc` file in your home directory or in the current working directory can be used
|
12
|
-
to change the defaults of Larry.
|
13
|
-
|
12
|
+
to change the defaults of Larry. Larry can work without any custom configuration, but you
|
13
|
+
might find it useful to tweak the default configuration. The example uses an API from Pry that
|
14
|
+
might not be released yet(`Pry.configure`) but the old way is [still supported](https://github.com/pry/pry/pull/1502).
|
14
15
|
|
15
16
|
```ruby
|
16
17
|
Pry.configure do |config|
|
17
|
-
config.larry.auto_start = false
|
18
|
-
config.larry.speak_if = ->(walltime) { # default is speak if walltime is > 0
|
18
|
+
config.larry.auto_start = false # default is true
|
19
|
+
config.larry.speak_if = ->(pry, walltime) { # default is speak if walltime is > 0
|
19
20
|
walltime > 0.5
|
20
21
|
}
|
22
|
+
config.larry.speaker = ->(pry, walltime) { # default is to print "Larry says: X.XXs"
|
23
|
+
pry.pager.page sprintf("Elapsed time: %.2fs", walltime)
|
24
|
+
}
|
21
25
|
end
|
22
26
|
```
|
23
27
|
|
@@ -38,7 +42,7 @@ gem install pry-larry
|
|
38
42
|
* Gemfile
|
39
43
|
|
40
44
|
```ruby
|
41
|
-
gem "pry-larry", "~> 0.
|
45
|
+
gem "pry-larry", "~> 0.5"
|
42
46
|
```
|
43
47
|
|
44
48
|
__License__
|
data/lib/pry-larry.rb
CHANGED
@@ -1,18 +1,12 @@
|
|
1
1
|
require 'pry' if not defined?(Pry::ClassCommand)
|
2
2
|
module Pry::Larry
|
3
|
-
MESSAGE_FORMAT = "%{LarrySays} %{WallTime}s"
|
4
3
|
MEMORY = Hash.new{|h,k| h[k] = [] }
|
5
4
|
BEFORE_EVAL = ->(_, pry) do
|
6
5
|
MEMORY[pry.hash].push Time.now.to_f
|
7
6
|
end
|
8
7
|
AFTER_EVAL = ->(_, pry) do
|
9
8
|
walltime = Time.now.to_f - MEMORY[pry.hash][-1]
|
10
|
-
if pry.config.larry.speak_if.call(walltime)
|
11
|
-
pry.pager.page MESSAGE_FORMAT % {
|
12
|
-
:LarrySays => Pry::Helpers::Text.green("Larry says:"),
|
13
|
-
:WallTime => sprintf("%.2f", walltime)
|
14
|
-
}
|
15
|
-
end
|
9
|
+
pry.config.larry.speaker.call(pry, walltime) if pry.config.larry.speak_if.call(pry, walltime)
|
16
10
|
end
|
17
11
|
BEFORE_SESSION = ->(_,_, pry) do
|
18
12
|
Pry::Larry.start(pry) if pry.config.larry.auto_start
|
@@ -45,7 +39,6 @@ module Pry::Larry
|
|
45
39
|
match /larry (start|wakeup|stop|chill)\z/
|
46
40
|
group 'pry-larry'
|
47
41
|
description 'Ask larry to start or stop counting wall-clock time.'
|
48
|
-
command_options argument_required: true
|
49
42
|
banner <<-CMDBANNER
|
50
43
|
Usage: larry [start|stop]
|
51
44
|
Ask Larry to start or stop counting wall clock time.
|
@@ -70,7 +63,21 @@ module Pry::Larry
|
|
70
63
|
end
|
71
64
|
end
|
72
65
|
end
|
66
|
+
|
73
67
|
Pry::Commands.add_command(LarryCommand)
|
68
|
+
Pry::Commands.alias_command "larry-stop", "larry stop"
|
69
|
+
Pry::Commands.alias_command "larry-start", "larry start"
|
74
70
|
Pry.config.hooks.add_hook :before_session, BEFORE_SESSION.hash, BEFORE_SESSION
|
75
|
-
Pry.config.larry = Pry::Config.from_hash({
|
71
|
+
Pry.config.larry = Pry::Config.from_hash({
|
72
|
+
auto_start: true,
|
73
|
+
speak_if: ->(pry, walltime) {
|
74
|
+
walltime > 0
|
75
|
+
},
|
76
|
+
speaker: ->(pry, walltime) {
|
77
|
+
pry.pager.page "%{LarrySays} %{WallTime}s" % {
|
78
|
+
:LarrySays => Pry::Helpers::Text.green("Larry says:"),
|
79
|
+
:WallTime => sprintf("%.2f", walltime)
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}, nil)
|
76
83
|
end
|
data/lib/pry-larry/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-larry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jazzonmymind
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -32,6 +32,7 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- ".gitignore"
|
35
|
+
- ".pryrc"
|
35
36
|
- CHANGELOG.md
|
36
37
|
- Gemfile
|
37
38
|
- README.md
|
@@ -64,4 +65,3 @@ signing_key:
|
|
64
65
|
specification_version: 4
|
65
66
|
summary: Larry is a plugin for Pry that tracks wall clock time.
|
66
67
|
test_files: []
|
67
|
-
has_rdoc:
|