irb-kit 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +31 -17
- data/irb-kit.gemspec +2 -2
- data/lib/irb/kit/helpers/clip.rb +4 -3
- data/lib/irb/kit/helpers/constant_source.rb +2 -2
- data/lib/irb/kit/helpers/method_source.rb +2 -2
- data/lib/irb/kit/helpers/paste.rb +7 -4
- data/lib/irb/kit/helpers/search.rb +2 -2
- data/lib/irb/kit/loader.rb +2 -2
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c77d7eb5845448c9e3050a2106ba4fd1a032f4027f7de2ee1209dfaa12aef203
|
4
|
+
data.tar.gz: '0281f3ab1ab7f7f3d9f0da865b795b8d6d65703d1d70eac18b047269c9345fab'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68577f28ddbadd851506efd218f4f8fa9fb755fa80a92b1617712d75494c081bc0251bc087dbe72161a6171ac48a10efb7e6c116d06ffbf63466c89f19f334b4
|
7
|
+
data.tar.gz: 7a1e64278796fa5b7685eae916f5b44b078501b38f89ea124dc0d103b2ffaeb20118486d33132f29aa4e192c802aecfea7256f3a4b39f53bae7e3c9112cb5414
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -65,10 +65,14 @@ To use, add the following to your `~/.config/irb/irbrc` configuration (or `~/.ir
|
|
65
65
|
|
66
66
|
[source,ruby]
|
67
67
|
----
|
68
|
-
|
68
|
+
begin
|
69
|
+
require "irb/kit"
|
70
|
+
rescue LoadError => error
|
71
|
+
puts "ERROR: #{error.message.capitalize}."
|
72
|
+
end
|
69
73
|
----
|
70
74
|
|
71
|
-
This ensures this gem is fully loaded in order to enhance {irb_link} further. To customize, read on.
|
75
|
+
This ensures this gem is fully loaded in order to enhance {irb_link} further. Otherwise, an error is displayed if you are in a Ruby project that doesn't have this gem as a dependency. To customize, read on.
|
72
76
|
|
73
77
|
=== Quick Start
|
74
78
|
|
@@ -76,19 +80,25 @@ If you'd like all the bells and whistles fully enabled, add the following to you
|
|
76
80
|
|
77
81
|
[source,ruby]
|
78
82
|
----
|
79
|
-
|
83
|
+
begin
|
84
|
+
require "irb/kit"
|
80
85
|
|
81
|
-
IRB::Kit.register_helpers :all
|
86
|
+
IRB::Kit.register_helpers :all
|
82
87
|
|
83
|
-
IRB.conf[:PROMPT]
|
84
|
-
PROMPT_I: "[#{IRB::Kit.prompt}]> ",
|
85
|
-
PROMPT_N: "[#{IRB::Kit.prompt}]| ",
|
86
|
-
PROMPT_C: "[#{IRB::Kit.prompt}]| ",
|
87
|
-
PROMPT_S: "[#{IRB::Kit.prompt}]%l ",
|
88
|
-
RETURN: "=> %s\n"
|
89
|
-
}
|
88
|
+
IRB.conf[:PROMPT] ||= {}
|
90
89
|
|
91
|
-
IRB.conf[:
|
90
|
+
IRB.conf[:PROMPT][:DEMO] = {
|
91
|
+
PROMPT_I: "[#{IRB::Kit.prompt}]> ",
|
92
|
+
PROMPT_N: "[#{IRB::Kit.prompt}]| ",
|
93
|
+
PROMPT_C: "[#{IRB::Kit.prompt}]| ",
|
94
|
+
PROMPT_S: "[#{IRB::Kit.prompt}]%l ",
|
95
|
+
RETURN: "=> %s\n"
|
96
|
+
}
|
97
|
+
|
98
|
+
IRB.conf[:PROMPT_MODE] = :DEMO
|
99
|
+
rescue LoadError => error
|
100
|
+
puts "ERROR: #{error.message.capitalize}."
|
101
|
+
end
|
92
102
|
----
|
93
103
|
|
94
104
|
The above enables all helpers and configures your prompt for {ruby_link}, {hanami_link}, and {rails_link} environments.
|
@@ -241,19 +251,23 @@ The following screenshots demonstrate what the prompt looks like in different en
|
|
241
251
|
|
242
252
|
*Ruby (with Git)*
|
243
253
|
|
244
|
-
image::https://alchemists.io/images/projects/irb-kit/screenshots/prompt-with_git.png[Screenshot,
|
254
|
+
image::https://alchemists.io/images/projects/irb-kit/screenshots/prompt-with_git.png[Screenshot,651,150,role=focal_point]
|
245
255
|
|
246
256
|
*Ruby (without Git)*
|
247
257
|
|
248
|
-
image::https://alchemists.io/images/projects/irb-kit/screenshots/prompt-without_git.png[Screenshot,
|
258
|
+
image::https://alchemists.io/images/projects/irb-kit/screenshots/prompt-without_git.png[Screenshot,400,146,role=focal_point]
|
259
|
+
|
260
|
+
*Hanami (development)*
|
261
|
+
|
262
|
+
image::https://alchemists.io/images/projects/irb-kit/screenshots/prompt-hanami-development.png[Screenshot,690,146,role=focal_point]
|
249
263
|
|
250
|
-
*Hanami*
|
264
|
+
*Hanami (production)*
|
251
265
|
|
252
|
-
image::https://alchemists.io/images/projects/irb-kit/screenshots/prompt-hanami.png[Screenshot,
|
266
|
+
image::https://alchemists.io/images/projects/irb-kit/screenshots/prompt-hanami-production.png[Screenshot,910,169,role=focal_point]
|
253
267
|
|
254
268
|
*Rails*
|
255
269
|
|
256
|
-
image::https://alchemists.io/images/projects/irb-kit/screenshots/prompt-rails.png[Screenshot,
|
270
|
+
image::https://alchemists.io/images/projects/irb-kit/screenshots/prompt-rails.png[Screenshot,756,170,role=focal_point]
|
257
271
|
|
258
272
|
== Development
|
259
273
|
|
data/irb-kit.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "irb-kit"
|
5
|
-
spec.version = "0.
|
5
|
+
spec.version = "0.1.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/irb-kit"
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
"changelog_uri" => "https://alchemists.io/projects/irb-kit/versions",
|
15
15
|
"documentation_uri" => "https://alchemists.io/projects/irb-kit",
|
16
16
|
"funding_uri" => "https://github.com/sponsors/bkuhlmann",
|
17
|
-
"label" => "
|
17
|
+
"label" => "IRB Kit",
|
18
18
|
"rubygems_mfa_required" => "true",
|
19
19
|
"source_code_uri" => "https://github.com/bkuhlmann/irb-kit"
|
20
20
|
}
|
data/lib/irb/kit/helpers/clip.rb
CHANGED
@@ -5,11 +5,10 @@ module IRB
|
|
5
5
|
module Helpers
|
6
6
|
# Copies input to macOS clipboard.
|
7
7
|
class Clip < IRB::HelperMethod::Base
|
8
|
-
|
8
|
+
MONIKER = :clip
|
9
9
|
|
10
|
-
|
10
|
+
description "Copy input to macOS clipboard."
|
11
11
|
|
12
|
-
# :nocov:
|
13
12
|
def initialize io = IO
|
14
13
|
super()
|
15
14
|
@io = io
|
@@ -17,6 +16,8 @@ module IRB
|
|
17
16
|
|
18
17
|
def execute(*lines)
|
19
18
|
io.popen("pbcopy", "w") { |clipboard| clipboard.write lines.join("\n") }
|
19
|
+
rescue Errno::ENOENT
|
20
|
+
"ERROR: Unable to copy since `pbcopy` is only supported on macOS."
|
20
21
|
end
|
21
22
|
|
22
23
|
private
|
@@ -5,9 +5,9 @@ module IRB
|
|
5
5
|
module Helpers
|
6
6
|
# Finds constant's source location.
|
7
7
|
class ConstantSource < IRB::HelperMethod::Base
|
8
|
-
|
8
|
+
MONIKER = :csource
|
9
9
|
|
10
|
-
|
10
|
+
description "Find a constant's source location."
|
11
11
|
|
12
12
|
def initialize object = Object
|
13
13
|
super()
|
@@ -5,9 +5,9 @@ module IRB
|
|
5
5
|
module Helpers
|
6
6
|
# Find an object method's source location.
|
7
7
|
class MethodSource < IRB::HelperMethod::Base
|
8
|
-
|
8
|
+
MONIKER = :msource
|
9
9
|
|
10
|
-
|
10
|
+
description "Find an object method's source location."
|
11
11
|
|
12
12
|
def execute object, name
|
13
13
|
object.method(name).source_location
|
@@ -5,17 +5,20 @@ module IRB
|
|
5
5
|
module Helpers
|
6
6
|
# Pastes last entry from macOS clipboard.
|
7
7
|
class Paste < IRB::HelperMethod::Base
|
8
|
-
|
8
|
+
MONIKER = :paste
|
9
9
|
|
10
|
-
|
10
|
+
description "Paste last entry from macOS clipboard."
|
11
11
|
|
12
|
-
# :nocov:
|
13
12
|
def initialize io = IO
|
14
13
|
super()
|
15
14
|
@io = io
|
16
15
|
end
|
17
16
|
|
18
|
-
def execute
|
17
|
+
def execute
|
18
|
+
io.popen "pbpaste", "r", &:read
|
19
|
+
rescue Errno::ENOENT
|
20
|
+
"ERROR: Unable to paste since `pbpaste` is only supported on macOS."
|
21
|
+
end
|
19
22
|
|
20
23
|
private
|
21
24
|
|
@@ -5,9 +5,9 @@ module IRB
|
|
5
5
|
module Helpers
|
6
6
|
# Search an object's methods by pattern.
|
7
7
|
class Search < IRB::HelperMethod::Base
|
8
|
-
|
8
|
+
MONIKER = :search
|
9
9
|
|
10
|
-
|
10
|
+
description "Search an object's methods by pattern."
|
11
11
|
|
12
12
|
def initialize regex = Regexp
|
13
13
|
super()
|
data/lib/irb/kit/loader.rb
CHANGED
@@ -18,10 +18,10 @@ module IRB
|
|
18
18
|
|
19
19
|
attr_reader :registrar, :namespace, :all
|
20
20
|
|
21
|
-
def register_all = helpers.each { |helper| registrar.register helper
|
21
|
+
def register_all = helpers.each { |helper| registrar.register helper::MONIKER, helper }
|
22
22
|
|
23
23
|
def register_selected(*monikers)
|
24
|
-
helpers.select { |helper| monikers.include? helper
|
24
|
+
helpers.select { |helper| monikers.include? helper::MONIKER }
|
25
25
|
.then { |selected| monikers.zip selected }
|
26
26
|
.each { |moniker, helper| registrar.register moniker, helper }
|
27
27
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irb-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2024-05-
|
38
|
+
date: 2024-05-23 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: irb
|
@@ -93,7 +93,7 @@ metadata:
|
|
93
93
|
changelog_uri: https://alchemists.io/projects/irb-kit/versions
|
94
94
|
documentation_uri: https://alchemists.io/projects/irb-kit
|
95
95
|
funding_uri: https://github.com/sponsors/bkuhlmann
|
96
|
-
label:
|
96
|
+
label: IRB Kit
|
97
97
|
rubygems_mfa_required: 'true'
|
98
98
|
source_code_uri: https://github.com/bkuhlmann/irb-kit
|
99
99
|
post_install_message:
|
metadata.gz.sig
CHANGED
Binary file
|