working_set 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,40 @@
1
+ class WorkingSetItem
2
+ attr_accessor :file_path, :row, :column, :pinned, :match_line, :pre_match_lines, :post_match_lines
3
+
4
+ def initialize(props = {})
5
+ self.file_path = props[:file_path]
6
+ self.row = (props[:row] || 0).to_i
7
+ self.column = (props[:column] || 0).to_i
8
+ self.pre_match_lines = props[:pre_match_lines] || []
9
+ self.match_line = props[:match_line] || ""
10
+ self.post_match_lines = props[:post_match_lines] || []
11
+ self.pinned = !!props[:pinned]
12
+ end
13
+
14
+ def inspect
15
+ str = "#{file_path}\n"
16
+ pre_match_lines.each_with_index do |line, idx|
17
+ str += "#{row - pre_match_lines.size + idx}- #{line}\n"
18
+ end
19
+ str += "#{row}: #{match_line}\n"
20
+ offset = column + row.to_s.length + 1
21
+ str += sprintf "%#{offset}s%s", " ", "^\n"
22
+ post_match_lines.each_with_index do |line, idx|
23
+ str += "#{row + 1 + idx}- #{line}\n"
24
+ end
25
+ str
26
+ end
27
+
28
+ def ==(other)
29
+ other &&
30
+ file_path == other.file_path &&
31
+ row == other.row &&
32
+ column == other.column &&
33
+ match_line == other.match_line
34
+ end
35
+
36
+ def full_body
37
+ (pre_match_lines + [match_line] + post_match_lines).join("\n")
38
+ end
39
+
40
+ end
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'working_set'
5
+
6
+ Gem::Specification.new do |spec|
7
+
8
+ spec.name = "working_set"
9
+ spec.version = WorkingSet::VERSION
10
+ spec.authors = ["Jim Garvin"]
11
+ spec.email = ["jim@thegarvin.com"]
12
+ spec.summary = %q{Companion for your terminal-based text editor.}
13
+ spec.description = %q{Working Set is a multithreaded custom protocol server with an ncurses-based terminal interface that displays search results with context for better comprehension and easy navigation.}
14
+ spec.homepage = "https://github.com/coderifous/working_set"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 2.1"
23
+ spec.add_development_dependency "rake", "~> 13.0"
24
+
25
+ spec.add_dependency "zeitwerk", "~> 2.4"
26
+ spec.add_dependency "celluloid", "~> 0.17"
27
+ spec.add_dependency "celluloid-io", "~> 0.17"
28
+ spec.add_dependency "celluloid-supervision", "~> 0.20.6"
29
+ spec.add_dependency "ncurses-ruby", "~> 1.2"
30
+ spec.add_dependency "listen", "~> 3.2"
31
+ spec.add_dependency "clipboard", "~> 1.3"
32
+ spec.add_dependency "tty-option", "~> 0.1"
33
+ spec.add_dependency "tty-logger", "~> 0.4"
34
+
35
+ end
metadata ADDED
@@ -0,0 +1,226 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: working_set
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jim Garvin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-09-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.1'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '13.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: zeitwerk
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.4'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: celluloid
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.17'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.17'
69
+ - !ruby/object:Gem::Dependency
70
+ name: celluloid-io
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.17'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.17'
83
+ - !ruby/object:Gem::Dependency
84
+ name: celluloid-supervision
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.20.6
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.20.6
97
+ - !ruby/object:Gem::Dependency
98
+ name: ncurses-ruby
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.2'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.2'
111
+ - !ruby/object:Gem::Dependency
112
+ name: listen
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.2'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: clipboard
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.3'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.3'
139
+ - !ruby/object:Gem::Dependency
140
+ name: tty-option
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.1'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.1'
153
+ - !ruby/object:Gem::Dependency
154
+ name: tty-logger
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.4'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '0.4'
167
+ description: Working Set is a multithreaded custom protocol server with an ncurses-based
168
+ terminal interface that displays search results with context for better comprehension
169
+ and easy navigation.
170
+ email:
171
+ - jim@thegarvin.com
172
+ executables:
173
+ - working_set
174
+ extensions: []
175
+ extra_rdoc_files: []
176
+ files:
177
+ - ".gitignore"
178
+ - ".ruby-version"
179
+ - API_FOR_EDITOR_INTEGRATION.md
180
+ - CHANGELOG.md
181
+ - Gemfile
182
+ - LICENSE.txt
183
+ - README.md
184
+ - Rakefile
185
+ - bin/working_set
186
+ - lib/api_input_actor.rb
187
+ - lib/basic_actor.rb
188
+ - lib/colors.rb
189
+ - lib/live_updater_actor.rb
190
+ - lib/set_builder_actor.rb
191
+ - lib/set_builder_adapter.rb
192
+ - lib/set_builder_adapter/ag.rb
193
+ - lib/set_viewer_actor.rb
194
+ - lib/user_input_actor.rb
195
+ - lib/view/base.rb
196
+ - lib/view/help.rb
197
+ - lib/view/welcome_user.rb
198
+ - lib/view/working_set.rb
199
+ - lib/working_set.rb
200
+ - lib/working_set_cli.rb
201
+ - lib/working_set_item.rb
202
+ - working_set.gemspec
203
+ homepage: https://github.com/coderifous/working_set
204
+ licenses:
205
+ - MIT
206
+ metadata: {}
207
+ post_install_message:
208
+ rdoc_options: []
209
+ require_paths:
210
+ - lib
211
+ required_ruby_version: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ required_rubygems_version: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ">="
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
221
+ requirements: []
222
+ rubygems_version: 3.1.2
223
+ signing_key:
224
+ specification_version: 4
225
+ summary: Companion for your terminal-based text editor.
226
+ test_files: []