pra 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/{ChangeLog.md → CHANGELOG.md} +5 -0
- data/README.md +9 -2
- data/lib/pra/config.rb +2 -2
- data/lib/pra/curses_window_system.rb +70 -18
- data/lib/pra/github_pull_source.rb +4 -2
- data/lib/pra/version.rb +1 -1
- data/pra.gemspec +8 -8
- metadata +22 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 628ec63b7b6715945d212db42ded43948f96cfe621bf5ed1b3bfe8f48a41c1dd
|
4
|
+
data.tar.gz: 8a3ce401aa27302455cff5aaf71736961fed6cdf9f6c36abb7bdcca99ddfc2c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cac38d7aaaefa5d6ed64db23c8be9faa2f31413d6d0802ad88a8fdf318c63bdae8b0621feb853eb55b45f58f0f7191601e1a6e0f119bbe83dfd52682297ecdb4
|
7
|
+
data.tar.gz: 1fccbbd25588d6252f18035a239d6394f8de7d5cda848c07483e88cdcbf48b5ae1430bed4fc231e7f40d9b9c74a3b898dd5127f9ba4a0d7b3ac4d5b23388c3ca
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.3.3
|
@@ -6,7 +6,12 @@ versions as well as provide a rough history.
|
|
6
6
|
|
7
7
|
#### Next Release
|
8
8
|
|
9
|
+
#### v2.1.0
|
10
|
+
|
11
|
+
* Added filtering of current list of pull requests
|
12
|
+
|
9
13
|
#### v2.0.0
|
14
|
+
|
10
15
|
* Added ability to refresh pull requests
|
11
16
|
* Added pagination when there are more pull requests than can be displayed
|
12
17
|
* Added support for github organizations
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ purposes when pra starts.
|
|
23
23
|
|
24
24
|
## Configuration
|
25
25
|
|
26
|
-
`pra` requires one configuration, `~/.pra.json`, to exist in your home
|
26
|
+
`pra` requires one configuration, `~/.pra/config.json`, to exist in your home
|
27
27
|
directory. The following is an example config that can be used as a starter.
|
28
28
|
*Note:* You will need to replace **your.username**, **your.password**,
|
29
29
|
**your.stash.server**, and the **repositories** and **organizations** sections
|
@@ -130,7 +130,7 @@ authentication enabled.
|
|
130
130
|
Simply go to your GitHub **Account Settings**, select **Applications**, click
|
131
131
|
the **Create new token** button in the **Personal Access Token** section. Give
|
132
132
|
it the name "Pra" and submit. This will generate your personal access token.
|
133
|
-
Then simply put your personal access token in the `~/.pra.json` as your GitHub
|
133
|
+
Then simply put your personal access token in the `~/.pra/config.json` as your GitHub
|
134
134
|
username and "x-oauth-basic" as your GitHub password.
|
135
135
|
|
136
136
|
## Usage
|
@@ -167,6 +167,13 @@ To force a refresh press the `r` key.
|
|
167
167
|
To move between pages press `n` to go to the next page, and `p` to go to the
|
168
168
|
previous page.
|
169
169
|
|
170
|
+
### Filter
|
171
|
+
|
172
|
+
To filter the list of you pull requests you can press `/` and start typing. The
|
173
|
+
list will start filtering as you type. Once you have completed typing your
|
174
|
+
filter you can press `Return` and go back to interacting with the list of pull
|
175
|
+
requests. Refreshing by pressing `r` will clear out the filter.
|
176
|
+
|
170
177
|
### Quit
|
171
178
|
|
172
179
|
If you decide you have had enough and want to exit `pra` press the `q` key.
|
data/lib/pra/config.rb
CHANGED
@@ -26,7 +26,7 @@ module Pra
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.config_path
|
29
|
-
if File.
|
29
|
+
if File.exist?(File.join(self.users_home_directory, '.pra', 'config.json'))
|
30
30
|
return File.join(self.users_home_directory, '.pra', 'config.json')
|
31
31
|
else
|
32
32
|
return File.join(self.users_home_directory, '.pra.json')
|
@@ -34,7 +34,7 @@ module Pra
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.log_path
|
37
|
-
unless Dir.
|
37
|
+
unless Dir.exist?(File.join(self.users_home_directory, '.pra', 'logs'))
|
38
38
|
FileUtils.mkdir_p(File.join(self.users_home_directory, '.pra', 'logs'))
|
39
39
|
end
|
40
40
|
return File.join(self.users_home_directory, '.pra', 'logs', '.pra.log')
|
@@ -8,6 +8,8 @@ require 'thread'
|
|
8
8
|
module Pra
|
9
9
|
class CursesWindowSystem < Pra::WindowSystem
|
10
10
|
ENTER_KEY = 10
|
11
|
+
ESC_KEY = 27
|
12
|
+
BACKSPACE_KEY = 127
|
11
13
|
|
12
14
|
def initialize
|
13
15
|
@selected_pull_request_page_index = 0
|
@@ -19,6 +21,8 @@ module Pra
|
|
19
21
|
@last_updated_access_lock = Mutex.new
|
20
22
|
@force_update = true
|
21
23
|
@force_update_access_lock = Mutex.new
|
24
|
+
@filter_mode = false
|
25
|
+
@filter_string = ""
|
22
26
|
end
|
23
27
|
|
24
28
|
def last_updated
|
@@ -72,23 +76,55 @@ module Pra
|
|
72
76
|
def run_loop
|
73
77
|
c = Curses.getch()
|
74
78
|
while (c != 'q') do
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
79
|
+
if @filter_mode
|
80
|
+
case c
|
81
|
+
when ESC_KEY
|
82
|
+
@filter_mode = false
|
83
|
+
@filter_string = ""
|
84
|
+
Curses.setpos(5, 0)
|
85
|
+
Curses.clrtoeol
|
86
|
+
@current_pull_requests = @original_pull_requests.dup
|
87
|
+
@original_pull_requests = nil
|
88
|
+
draw_current_pull_requests
|
89
|
+
when ENTER_KEY
|
90
|
+
@filter_mode = false
|
91
|
+
@filter_string = ""
|
92
|
+
when "\b", BACKSPACE_KEY, Curses::KEY_BACKSPACE
|
93
|
+
@filter_string.chop!
|
94
|
+
output_string(5, 0, "Filter: #{@filter_string}")
|
95
|
+
clear_pull_requests
|
96
|
+
filter_current_pull_requests(@filter_string)
|
97
|
+
when String
|
98
|
+
@filter_string += c
|
99
|
+
output_string(5, 0, "Filter: #{@filter_string}")
|
100
|
+
clear_pull_requests
|
101
|
+
filter_current_pull_requests(@filter_string)
|
102
|
+
end
|
103
|
+
else
|
104
|
+
case c
|
105
|
+
when 'j', Curses::Key::DOWN
|
106
|
+
move_selection_down
|
107
|
+
draw_current_pull_requests
|
108
|
+
when 'k', Curses::Key::UP
|
109
|
+
move_selection_up
|
110
|
+
draw_current_pull_requests
|
111
|
+
when 'r'
|
112
|
+
@force_update = true
|
113
|
+
Curses.setpos(5, 0)
|
114
|
+
Curses.clrtoeol
|
115
|
+
when 'o', ENTER_KEY
|
116
|
+
@state_lock.synchronize {
|
117
|
+
Launchy.open(@current_pull_requests[selected_pull_request_loc].link)
|
118
|
+
}
|
119
|
+
when 'n'
|
120
|
+
load_next_page
|
121
|
+
when 'p'
|
122
|
+
load_prev_page
|
123
|
+
when '/'
|
124
|
+
@filter_mode = true
|
125
|
+
@original_pull_requests = @current_pull_requests.dup
|
126
|
+
output_string(5, 0, "Filter: #{@filter_string}")
|
127
|
+
end
|
92
128
|
end
|
93
129
|
c = Curses.getch()
|
94
130
|
end
|
@@ -123,7 +159,7 @@ module Pra
|
|
123
159
|
|
124
160
|
def display_instructions
|
125
161
|
output_string(0, 0, "Pra: Helping you own pull requests")
|
126
|
-
output_string(1, 0, "quit: q, up: k|#{"\u25B2".encode("UTF-8")}, down: j|#{"\u25BC".encode("UTF-8")}, open: o|#{"\u21A9".encode("UTF-8")}, refresh: r, next page: n, prev page: p")
|
162
|
+
output_string(1, 0, "quit: q, up: k|#{"\u25B2".encode("UTF-8")}, down: j|#{"\u25BC".encode("UTF-8")}, open: o|#{"\u21A9".encode("UTF-8")}, refresh: r, next page: n, prev page: p, filter: /")
|
127
163
|
end
|
128
164
|
|
129
165
|
def move_selection_up
|
@@ -212,6 +248,22 @@ module Pra
|
|
212
248
|
Curses.refresh
|
213
249
|
end
|
214
250
|
|
251
|
+
def filter_current_pull_requests(input_string)
|
252
|
+
pull_reqs = @original_pull_requests.dup.keep_if do |pr|
|
253
|
+
columns.any? do |col|
|
254
|
+
presenter = Pra::CursesPullRequestPresenter.new(pr)
|
255
|
+
pr_attr_value = presenter.send(col[:name])
|
256
|
+
if input_string == input_string.downcase
|
257
|
+
pr_attr_value.to_s.downcase.include?(input_string)
|
258
|
+
else
|
259
|
+
pr_attr_value.to_s.include?(input_string)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
refresh_pull_requests(pull_reqs)
|
265
|
+
end
|
266
|
+
|
215
267
|
def draw_current_pull_requests
|
216
268
|
@state_lock.synchronize {
|
217
269
|
output_string(3, 0, "#{@current_pull_requests.length} Pull Requests @ #{@last_updated} : Page #{@current_page} of #{pull_request_pages}")
|
@@ -19,8 +19,10 @@ module Pra
|
|
19
19
|
|
20
20
|
def fetch_pull_requests
|
21
21
|
pull_requests_json = "[]"
|
22
|
-
conn = Faraday.new
|
23
|
-
|
22
|
+
conn = Faraday.new do |faraday|
|
23
|
+
faraday.request :authorization, :basic, @config['username'], @config['password']
|
24
|
+
end
|
25
|
+
# conn.basic_auth(@config['username'], @config['password'])
|
24
26
|
resp = conn.get do |req|
|
25
27
|
req.url rest_api_search_issues_url
|
26
28
|
req.params['q'] = "is:pr is:open sort:updated-desc #{repos_for_query}"
|
data/lib/pra/version.rb
CHANGED
data/pra.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["cyphactor@gmail.com"]
|
11
11
|
spec.description = %q{Command Line utility to make you aware of open pull-requests across systems at all times.}
|
12
12
|
spec.summary = %q{CLI tool that shows open pull-requests across systems.}
|
13
|
-
spec.homepage = "http://github.com/
|
13
|
+
spec.homepage = "http://github.com/drewdeponte/pra"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -19,13 +19,13 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_development_dependency "bundler", "~>
|
23
|
-
spec.add_development_dependency "rake", "~>
|
24
|
-
spec.add_development_dependency "rspec", "~> 3.
|
25
|
-
spec.add_development_dependency "timecop", "~> 0.
|
22
|
+
spec.add_development_dependency "bundler", "~> 2.5"
|
23
|
+
spec.add_development_dependency "rake", "~> 13.2"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.13"
|
25
|
+
spec.add_development_dependency "timecop", "~> 0.9"
|
26
26
|
|
27
|
-
spec.add_dependency "faraday", "~>
|
28
|
-
spec.add_dependency "launchy", "~>
|
29
|
-
spec.add_dependency "curses", "~> 1.
|
27
|
+
spec.add_dependency "faraday", "~> 2.11"
|
28
|
+
spec.add_dependency "launchy", "~> 3.0"
|
29
|
+
spec.add_dependency "curses", "~> 1.4"
|
30
30
|
spec.add_dependency "time-lord", "~> 1.0"
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew De Ponte
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,98 +16,98 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.5'
|
20
20
|
type: :development
|
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: '
|
26
|
+
version: '2.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.2'
|
34
34
|
type: :development
|
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: '
|
40
|
+
version: '13.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.13'
|
48
48
|
type: :development
|
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: '3.
|
54
|
+
version: '3.13'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: timecop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.9'
|
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
|
-
version: '0.
|
68
|
+
version: '0.9'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: faraday
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '2.11'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '2.11'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: launchy
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '3.0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '3.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: curses
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
103
|
+
version: '1.4'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1.
|
110
|
+
version: '1.4'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: time-lord
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,8 +133,8 @@ extra_rdoc_files: []
|
|
133
133
|
files:
|
134
134
|
- ".gitignore"
|
135
135
|
- ".ruby-version"
|
136
|
+
- CHANGELOG.md
|
136
137
|
- CODE_OF_CONDUCT.md
|
137
|
-
- ChangeLog.md
|
138
138
|
- Gemfile
|
139
139
|
- LICENSE.txt
|
140
140
|
- README.md
|
@@ -159,11 +159,11 @@ files:
|
|
159
159
|
- lib/pra/window_system.rb
|
160
160
|
- lib/pra/window_system_factory.rb
|
161
161
|
- pra.gemspec
|
162
|
-
homepage: http://github.com/
|
162
|
+
homepage: http://github.com/drewdeponte/pra
|
163
163
|
licenses:
|
164
164
|
- MIT
|
165
165
|
metadata: {}
|
166
|
-
post_install_message:
|
166
|
+
post_install_message:
|
167
167
|
rdoc_options: []
|
168
168
|
require_paths:
|
169
169
|
- lib
|
@@ -178,9 +178,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
|
-
|
182
|
-
|
183
|
-
signing_key:
|
181
|
+
rubygems_version: 3.5.14
|
182
|
+
signing_key:
|
184
183
|
specification_version: 4
|
185
184
|
summary: CLI tool that shows open pull-requests across systems.
|
186
185
|
test_files: []
|