mind_control 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3387bd0d4264b1f56556f6325a477dbc3a3a647a
4
- data.tar.gz: fc405c6695559bd21de347f980ea6aec51155fff
3
+ metadata.gz: 408670db6d43fa79d9c5527f9ef6acebd53b2dae
4
+ data.tar.gz: 604b6656104952cf3a5464ac263fe30ea3ec3922
5
5
  SHA512:
6
- metadata.gz: f1d554f97d2573faeb5e10b37e9c0807df76e22c8c1b63faf2b8badef12435ceede9ed67cec3f956f124ac9128fbe52c16e3c3dea415a0f70668c0857b73980b
7
- data.tar.gz: e597799462a43cce744b68399452f545d93f19c2a5c58fbb1e3cc6d83f36907ea31a7e7374e5edf5f2088a45126ef5f63f0fa12f08fbe3c2a73fe40138e160df
6
+ metadata.gz: 438737657db7b1163469122b6c637059ef38af438d3346d6f6e3069b975bbaa8f5055800f6e803f23cbaf0951ff0ece8fe97d56d5b46d746ef54be9e7bbec362
7
+ data.tar.gz: 6fe12b4c8cb32b0eaf34d4bd4bfdf63eb26516cd6d3b504c852d53de918876a5ffa14fe311ff02b0413c6261fbd2f9791e0b47e9a5ca30b36077c7ae7fefb1d5
@@ -1,16 +1,54 @@
1
1
  # encoding: utf-8
2
2
  require "pry/pager"
3
3
 
4
- ::Pry::Pager.instance_eval do
5
- alias :vanilla_page :page
6
-
7
- # Redefine standard paging method, so it will always write text to current MindControl
8
- # output instead of calling system pager or writing to host program $stdout.
9
- def self.page( text, pager = nil )
10
- if pry_instance = Pry.current[ :mind_control_pry_instance ]
11
- pry_instance.output.puts( text )
4
+ class Pry::Pager
5
+ alias :vanilla_best_available :best_available
6
+
7
+ def best_available
8
+ # If we inside mind-control session
9
+ if _pry_ == Pry.current[ :mind_control_pry_instance ]
10
+ # Use our custom pager
11
+ MindControlPager.new( _pry_.input, _pry_.output )
12
12
  else
13
- vanilla_page( text, pager )
13
+ vanilla_best_available
14
+ end
15
+ end
16
+
17
+ ##
18
+ # Custom SimplePager based pager that uses MindConrol's IO (not host).
19
+ #
20
+ class MindControlPager < NullPager
21
+ ##
22
+ # @param [IO] input console input
23
+ # @param [IO] output console output
24
+ #
25
+ def initialize( input, output )
26
+ super( output )
27
+
28
+ @in = input
29
+ @tracker = PageTracker.new( height - 3, width )
30
+ end
31
+
32
+ ##
33
+ # Writes string to console with pagination.
34
+ # @param [String] str
35
+ #
36
+ def write( str )
37
+ str.lines.each do |line|
38
+ @out.print line
39
+ @tracker.record line
40
+
41
+ if @tracker.page?
42
+ @out.print "\n"
43
+ @out.print "\e[0m"
44
+ @out.print "<page break> --- Press enter to continue " \
45
+ "( q<enter> to break ) --- <page break>\n"
46
+
47
+ raise StopPaging if @in.readline( "" ).chomp == "q"
48
+
49
+ @tracker.reset
50
+ end
51
+ end
14
52
  end
15
53
  end
16
54
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module MindControl
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
data/mind_control.gemspec CHANGED
@@ -17,9 +17,9 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep( %r{^(test|spec|features)/} )
18
18
  spec.require_paths = [ "lib" ]
19
19
 
20
- spec.add_dependency "highline", "~> 1.6"
21
- spec.add_dependency "pry", ">= 0.9.11"
22
- spec.add_dependency "coolline", "~> 0.4"
20
+ spec.add_dependency "highline", "~> 1.7"
21
+ spec.add_dependency "pry", "~> 0.10"
22
+ spec.add_dependency "coolline", "~> 0.5"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
25
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mind_control
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Diachkov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-31 00:00:00.000000000 Z
11
+ date: 2017-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '1.7'
20
20
  type: :runtime
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: '1.6'
26
+ version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.11
33
+ version: '0.10'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.9.11
40
+ version: '0.10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coolline
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.4'
47
+ version: '0.5'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.4'
54
+ version: '0.5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mocha
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: eventmachine
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description:
@@ -130,7 +130,7 @@ executables:
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
- - .gitignore
133
+ - ".gitignore"
134
134
  - Gemfile
135
135
  - LICENSE.txt
136
136
  - README.md
@@ -158,17 +158,17 @@ require_paths:
158
158
  - lib
159
159
  required_ruby_version: !ruby/object:Gem::Requirement
160
160
  requirements:
161
- - - '>='
161
+ - - ">="
162
162
  - !ruby/object:Gem::Version
163
163
  version: '0'
164
164
  required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  requirements:
166
- - - '>='
166
+ - - ">="
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
170
  rubyforge_project:
171
- rubygems_version: 2.0.0
171
+ rubygems_version: 2.5.1
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Embeddable runtime Pry-based REPL console