console_utils 0.2.1 → 0.2.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfc695ee09f05cefe834a9aacb4bc1725f923e0a
|
4
|
+
data.tar.gz: 6cf231b7ba03c3d14d4b893836938969d6b84f32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7eea9de0af66cb899fc6f7bd64f196383054852750c14908140b520fd4b433aa95fe0a46d9bd6483759cdc447c28ac1c76b45cadf5defcd61a43174575446f2f
|
7
|
+
data.tar.gz: c24230444dcdd36451ef6cfd86d085a897bb389f4654e0a7232d4fecea44348a526badf748d93d6d872fb8c16aa526333157bfdcad2bc238909642a9653cd908
|
@@ -8,7 +8,12 @@ module ConsoleUtils::RequestUtils
|
|
8
8
|
|
9
9
|
# Prints formatted JSON to stdout.
|
10
10
|
def call(body)
|
11
|
-
|
11
|
+
formatted = format(body)
|
12
|
+
if block_given?
|
13
|
+
yield(formatted)
|
14
|
+
else
|
15
|
+
puts formatted
|
16
|
+
end
|
12
17
|
end
|
13
18
|
|
14
19
|
# Formats a given JSON string
|
@@ -16,15 +16,25 @@ module ConsoleUtils::RequestUtils #:nodoc:
|
|
16
16
|
|
17
17
|
def preview(mth = nil)
|
18
18
|
if output = to_s.presence
|
19
|
-
JSONOutput.formatter.(output)
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
JSONOutput.formatter.(output) do |formatted|
|
20
|
+
@formatted = formatted
|
21
|
+
puts @formatted
|
22
|
+
show_complete_in!
|
23
|
+
show_transfered!
|
24
|
+
yield(self) if block_given?
|
25
|
+
end
|
23
26
|
else
|
24
27
|
puts NO_RESPONSE
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
31
|
+
# Copies to pasteboard
|
32
|
+
def pbcopy(content = nil)
|
33
|
+
content ||= @formatted
|
34
|
+
IO.popen('pbcopy', 'w') { |io| io << content.to_s }
|
35
|
+
puts PBCOPY_MESSAGE
|
36
|
+
end
|
37
|
+
|
28
38
|
def print_info
|
29
39
|
tap { printf(INFO_FORMAT, to_info_hash) }
|
30
40
|
end
|
@@ -59,13 +69,6 @@ module ConsoleUtils::RequestUtils #:nodoc:
|
|
59
69
|
to_a
|
60
70
|
end
|
61
71
|
|
62
|
-
# Copies to pasteboard
|
63
|
-
def pbcopy(content = nil)
|
64
|
-
content ||= to_body
|
65
|
-
IO.popen('pbcopy', 'w') { |io| io << content.to_s }
|
66
|
-
puts PBCOPY_MESSAGE
|
67
|
-
end
|
68
|
-
|
69
72
|
private
|
70
73
|
|
71
74
|
def show_complete_in!(reset = true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: console_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05
|
11
|
+
date: 2015-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
version: '0'
|
172
172
|
requirements: []
|
173
173
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.4.
|
174
|
+
rubygems_version: 2.4.8
|
175
175
|
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: Groovy tools for Rails Console.
|