bundler-browse 0.1.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 +7 -0
- data/.rubocop.yml +8 -0
- data/CHANGELOG.md +5 -0
- data/CLAUDE.md +33 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE.txt +21 -0
- data/README.md +54 -0
- data/Rakefile +12 -0
- data/lib/bundler/browse/command.rb +28 -0
- data/lib/bundler/browse/ui.rb +197 -0
- data/lib/bundler/browse/updater.rb +48 -0
- data/lib/bundler/browse/version.rb +7 -0
- data/lib/bundler/browse.rb +10 -0
- data/plugins.rb +6 -0
- data/sig/bundler/browse.rbs +6 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b308a785300ffeeff9f0204bb21adf647dcb0834127d51d0594648c9a1ec9682
|
4
|
+
data.tar.gz: af0c69147ba0ac5701c4e2d04685ed716098505756c350e9b789f6826468a940
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7f7b1e307c6612fe7cd070d5ca7c1cf0ff77ba25f43324e4b3665abfb64d5186e44867a2f86dfba1117e371a254dbee92326113d6a2f4da8d7821d43c5f13915
|
7
|
+
data.tar.gz: 4c8a1282af827d9db5dff6ea9732651e0aa85dfa4e320e7993d0e9693554b9a024ad9f826cdf0bde0369ee9dac337e58f8ce34be693a6317a967e9c4b2438cba
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/CLAUDE.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# bundler-browse
|
2
|
+
|
3
|
+
This is a Bundler plugin that provides an interactive CLI to browse gems in your Gemfile, view their details, open their repositories, and update them individually.
|
4
|
+
|
5
|
+
## Architecture Overview
|
6
|
+
|
7
|
+
The plugin consists of three main components:
|
8
|
+
|
9
|
+
1. **Command** (`lib/bundler/browse/command.rb`): Entry point that filters direct dependencies from Gemfile
|
10
|
+
2. **UI** (`lib/bundler/browse/ui.rb`): Interactive terminal UI with real-time gem selection display
|
11
|
+
3. **Updater** (`lib/bundler/browse/updater.rb`): Handles individual gem updates with confirmation
|
12
|
+
|
13
|
+
## Key Design Decisions
|
14
|
+
|
15
|
+
- **Direct Dependencies Only**: Filters to show only gems explicitly declared in Gemfile, not transitive dependencies
|
16
|
+
- **Real-time Display**: Shows gem information inline as you navigate, rather than requiring separate screens
|
17
|
+
- **Keyboard Navigation**: Uses arrow keys for navigation and single-key shortcuts for actions
|
18
|
+
- **Terminal Control**: Uses tty-cursor and tty-screen for proper terminal manipulation without relying on tty-prompt's limitations
|
19
|
+
|
20
|
+
## Implementation Notes
|
21
|
+
|
22
|
+
- Uses `Bundler.definition.dependencies` to get direct dependencies
|
23
|
+
- Filters specs using a Set for efficient lookup
|
24
|
+
- Handles terminal cleanup properly on exit (clears screen, shows cursor)
|
25
|
+
- Uses Open3 for gem updates to show real-time output from `bundle update`
|
26
|
+
|
27
|
+
## Testing
|
28
|
+
|
29
|
+
When running tests, ensure the plugin is properly installed:
|
30
|
+
```bash
|
31
|
+
bundle plugin uninstall bundler-browse
|
32
|
+
bundle plugin install bundler-browse --path .
|
33
|
+
```
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
* Public or private harassment
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at
|
63
|
+
[INSERT CONTACT METHOD].
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
65
|
+
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
reporter of any incident.
|
68
|
+
|
69
|
+
## Enforcement Guidelines
|
70
|
+
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73
|
+
|
74
|
+
### 1. Correction
|
75
|
+
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
unprofessional or unwelcome in the community.
|
78
|
+
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
82
|
+
|
83
|
+
### 2. Warning
|
84
|
+
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
86
|
+
actions.
|
87
|
+
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
93
|
+
ban.
|
94
|
+
|
95
|
+
### 3. Temporary Ban
|
96
|
+
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
98
|
+
sustained inappropriate behavior.
|
99
|
+
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
communication with the community for a specified period of time. No public or
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104
|
+
Violating these terms may lead to a permanent ban.
|
105
|
+
|
106
|
+
### 4. Permanent Ban
|
107
|
+
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
111
|
+
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
113
|
+
community.
|
114
|
+
|
115
|
+
## Attribution
|
116
|
+
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118
|
+
version 2.1, available at
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
120
|
+
|
121
|
+
Community Impact Guidelines were inspired by
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
123
|
+
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
127
|
+
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Takayuki Nagatomi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Bundler::Browse
|
2
|
+
|
3
|
+
An interactive Bundler plugin that allows you to browse gems in your Gemfile, view their details, open their repositories, and update them individually.
|
4
|
+
|
5
|
+
<img width="1440" height="789" alt="image" src="https://github.com/user-attachments/assets/e8b9cf49-5776-4f83-82d4-3adf2f5696e5" />
|
6
|
+
|
7
|
+
## Keyboard shortcuts:
|
8
|
+
- `↑/↓/j/k`: Navigate through gems
|
9
|
+
- `h`: Open homepage
|
10
|
+
- `s`: Open source repository
|
11
|
+
- `u`: Update the selected gem (with confirmation)
|
12
|
+
- `q`: Quit
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Install the plugin using Bundler:
|
17
|
+
|
18
|
+
```bash
|
19
|
+
bundle plugin install bundler-browse
|
20
|
+
```
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Once installed, simply run this in the directory where your Gemfile is located:
|
25
|
+
|
26
|
+
```bash
|
27
|
+
bundle browse
|
28
|
+
```
|
29
|
+
|
30
|
+
This will display an interactive list of all gems directly specified in your Gemfile. Navigate with arrow keys, and use the keyboard shortcuts to perform actions.
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
34
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
35
|
+
|
36
|
+
To test the plugin locally:
|
37
|
+
|
38
|
+
```bash
|
39
|
+
bundle plugin uninstall bundler-browse
|
40
|
+
bundle plugin install bundler-browse --path .
|
41
|
+
bundle browse
|
42
|
+
```
|
43
|
+
|
44
|
+
## Contributing
|
45
|
+
|
46
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tnagatomi/bundler-browse. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/tnagatomi/bundler-browse/blob/main/CODE_OF_CONDUCT.md).
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
51
|
+
|
52
|
+
## Code of Conduct
|
53
|
+
|
54
|
+
Everyone interacting in the Bundler::Browse project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/tnagatomi/bundler-browse/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/plugin/api"
|
4
|
+
require_relative "ui"
|
5
|
+
require_relative "updater"
|
6
|
+
|
7
|
+
module Bundler
|
8
|
+
module Browse
|
9
|
+
class Command
|
10
|
+
def exec(command_name, args)
|
11
|
+
ui = UI.new
|
12
|
+
updater = Updater.new
|
13
|
+
|
14
|
+
direct_dependency_names = Bundler.definition.dependencies.map(&:name).to_set
|
15
|
+
|
16
|
+
gems = Bundler.definition.specs.select do |spec|
|
17
|
+
direct_dependency_names.include?(spec.name)
|
18
|
+
end
|
19
|
+
|
20
|
+
ui.run(gems, updater)
|
21
|
+
rescue StandardError => e
|
22
|
+
Bundler.ui.error "Error: #{e.message}"
|
23
|
+
Bundler.ui.debug e.backtrace.join("\n")
|
24
|
+
1
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,197 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tty-cursor"
|
4
|
+
require "tty-screen"
|
5
|
+
require "launchy"
|
6
|
+
require "io/console"
|
7
|
+
|
8
|
+
module Bundler
|
9
|
+
module Browse
|
10
|
+
class UI
|
11
|
+
def initialize
|
12
|
+
@cursor = TTY::Cursor
|
13
|
+
@selected_index = 0
|
14
|
+
@gems = []
|
15
|
+
@viewport_offset = 0
|
16
|
+
end
|
17
|
+
|
18
|
+
def run(gems, updater)
|
19
|
+
@gems = gems
|
20
|
+
@updater = updater
|
21
|
+
|
22
|
+
# Enter alternate screen buffer
|
23
|
+
print "\e[?1049h"
|
24
|
+
print @cursor.clear_screen
|
25
|
+
print @cursor.hide
|
26
|
+
|
27
|
+
begin
|
28
|
+
loop do
|
29
|
+
render_ui
|
30
|
+
handle_input
|
31
|
+
end
|
32
|
+
ensure
|
33
|
+
cleanup_screen
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def cleanup_screen
|
40
|
+
print @cursor.show
|
41
|
+
print @cursor.clear_screen
|
42
|
+
print @cursor.move_to(0, 0)
|
43
|
+
# Leave alternate screen buffer
|
44
|
+
print "\e[?1049l"
|
45
|
+
end
|
46
|
+
|
47
|
+
def calculate_viewport_dimensions
|
48
|
+
header_lines = 2 # "Gems in Gemfile:" + separator
|
49
|
+
footer_lines = 9 # gem info (5) + separator (1) + controls (1) + separators (2)
|
50
|
+
available_lines = TTY::Screen.height - header_lines - footer_lines
|
51
|
+
[available_lines, 5].max # Minimum 5 lines for gem list
|
52
|
+
end
|
53
|
+
|
54
|
+
def update_viewport_offset(available_lines)
|
55
|
+
if @selected_index < @viewport_offset
|
56
|
+
@viewport_offset = @selected_index
|
57
|
+
elsif @selected_index >= @viewport_offset + available_lines
|
58
|
+
@viewport_offset = @selected_index - available_lines + 1
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def render_header
|
63
|
+
puts "Gems in Gemfile:"
|
64
|
+
puts "─" * TTY::Screen.width
|
65
|
+
end
|
66
|
+
|
67
|
+
def render_gem_list
|
68
|
+
available_lines = calculate_viewport_dimensions
|
69
|
+
update_viewport_offset(available_lines)
|
70
|
+
|
71
|
+
visible_gems = @gems[@viewport_offset, available_lines]
|
72
|
+
visible_gems.each_with_index do |gem, index|
|
73
|
+
actual_index = @viewport_offset + index
|
74
|
+
prefix = actual_index == @selected_index ? "▶ " : " "
|
75
|
+
puts "#{prefix}#{gem.name} (#{gem.version})"
|
76
|
+
end
|
77
|
+
|
78
|
+
# Fill remaining lines
|
79
|
+
(available_lines - visible_gems.size).times { puts }
|
80
|
+
|
81
|
+
render_scroll_indicator if @gems.size > available_lines
|
82
|
+
end
|
83
|
+
|
84
|
+
def render_scroll_indicator
|
85
|
+
indicator = " [#{@selected_index + 1}/#{@gems.size}]"
|
86
|
+
print @cursor.save
|
87
|
+
print @cursor.move_to(TTY::Screen.width - indicator.length, 2)
|
88
|
+
print indicator
|
89
|
+
print @cursor.restore
|
90
|
+
end
|
91
|
+
|
92
|
+
def render_footer
|
93
|
+
puts "─" * TTY::Screen.width
|
94
|
+
render_gem_info(@gems[@selected_index]) if @selected_gem = @gems[@selected_index]
|
95
|
+
puts "─" * TTY::Screen.width
|
96
|
+
puts "[↑↓/jk] Navigate [h] Homepage [s] Source [u] Update [q] Quit"
|
97
|
+
end
|
98
|
+
|
99
|
+
def render_ui
|
100
|
+
print @cursor.move_to(0, 0)
|
101
|
+
print @cursor.clear_screen_down
|
102
|
+
|
103
|
+
render_header
|
104
|
+
render_gem_list
|
105
|
+
render_footer
|
106
|
+
end
|
107
|
+
|
108
|
+
def render_gem_info(gem)
|
109
|
+
metadata = gem.metadata || {}
|
110
|
+
|
111
|
+
puts "Current Selection:"
|
112
|
+
puts " Name: #{gem.name}"
|
113
|
+
puts " Version: #{gem.version}"
|
114
|
+
puts " Homepage: #{gem.homepage || "N/A"}"
|
115
|
+
puts " Source: #{metadata["source_code_uri"] || extract_source_uri(gem) || "N/A"}"
|
116
|
+
end
|
117
|
+
|
118
|
+
def extract_source_uri(gem)
|
119
|
+
return unless gem.homepage&.match?(%r{https?://github\.com/[\w-]+/[\w-]+})
|
120
|
+
|
121
|
+
gem.homepage
|
122
|
+
end
|
123
|
+
|
124
|
+
def handle_input
|
125
|
+
case read_key
|
126
|
+
when "\e[A", "k" # Up arrow or k
|
127
|
+
@selected_index = (@selected_index - 1) % @gems.size
|
128
|
+
when "\e[B", "j" # Down arrow or j
|
129
|
+
@selected_index = (@selected_index + 1) % @gems.size
|
130
|
+
when "h"
|
131
|
+
open_homepage(@gems[@selected_index])
|
132
|
+
when "s"
|
133
|
+
open_source(@gems[@selected_index])
|
134
|
+
when "u"
|
135
|
+
update_gem(@gems[@selected_index])
|
136
|
+
when "q", "\u0003" # q or Ctrl+C
|
137
|
+
cleanup_screen
|
138
|
+
exit
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def read_key
|
143
|
+
$stdin.raw do |io|
|
144
|
+
input = io.getc
|
145
|
+
if input == "\e"
|
146
|
+
begin
|
147
|
+
input << io.read_nonblock(2)
|
148
|
+
rescue StandardError
|
149
|
+
nil
|
150
|
+
end
|
151
|
+
end
|
152
|
+
input
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def open_homepage(gem)
|
157
|
+
if gem.homepage
|
158
|
+
Launchy.open(gem.homepage)
|
159
|
+
message = "Opening homepage: #{gem.homepage}"
|
160
|
+
else
|
161
|
+
message = "No homepage available for #{gem.name}"
|
162
|
+
end
|
163
|
+
|
164
|
+
show_message(message)
|
165
|
+
end
|
166
|
+
|
167
|
+
def open_source(gem)
|
168
|
+
metadata = gem.metadata || {}
|
169
|
+
source_uri = metadata["source_code_uri"] || extract_source_uri(gem)
|
170
|
+
|
171
|
+
if source_uri
|
172
|
+
Launchy.open(source_uri)
|
173
|
+
message = "Opening source: #{source_uri}"
|
174
|
+
else
|
175
|
+
message = "No source code URI available for #{gem.name}"
|
176
|
+
end
|
177
|
+
|
178
|
+
show_message(message)
|
179
|
+
end
|
180
|
+
|
181
|
+
def update_gem(gem)
|
182
|
+
print @cursor.show
|
183
|
+
@updater.update_gem(gem.name)
|
184
|
+
print @cursor.hide
|
185
|
+
end
|
186
|
+
|
187
|
+
def show_message(message)
|
188
|
+
print @cursor.save
|
189
|
+
print @cursor.move_to(0, TTY::Screen.height - 2)
|
190
|
+
print @cursor.clear_line
|
191
|
+
print message
|
192
|
+
sleep 2
|
193
|
+
print @cursor.restore
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "open3"
|
4
|
+
require "tty-prompt"
|
5
|
+
require "io/console"
|
6
|
+
|
7
|
+
module Bundler
|
8
|
+
module Browse
|
9
|
+
class Updater
|
10
|
+
def initialize
|
11
|
+
@prompt = TTY::Prompt.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def update_gem(gem_name)
|
15
|
+
puts "\n"
|
16
|
+
|
17
|
+
confirmed = @prompt.yes?("Update #{gem_name}?")
|
18
|
+
|
19
|
+
return unless confirmed
|
20
|
+
|
21
|
+
puts "\nUpdating #{gem_name}..."
|
22
|
+
|
23
|
+
command = "bundle update #{gem_name}"
|
24
|
+
|
25
|
+
success = false
|
26
|
+
Open3.popen2e(command) do |stdin, stdout_stderr, wait_thread|
|
27
|
+
stdout_stderr.each_line do |line|
|
28
|
+
puts line
|
29
|
+
end
|
30
|
+
success = wait_thread.value.success?
|
31
|
+
end
|
32
|
+
|
33
|
+
if success
|
34
|
+
puts "\nSuccessfully updated #{gem_name}"
|
35
|
+
else
|
36
|
+
puts "\nFailed to update #{gem_name}"
|
37
|
+
end
|
38
|
+
|
39
|
+
puts "\nPress any key to continue..."
|
40
|
+
$stdin.getch
|
41
|
+
rescue StandardError => e
|
42
|
+
puts "\nError updating #{gem_name}: #{e.message}"
|
43
|
+
puts "\nPress any key to continue..."
|
44
|
+
$stdin.getch
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/plugins.rb
ADDED
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bundler-browse
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Takayuki Nagatomi
|
8
|
+
bindir: exe
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: launchy
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '3.1'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '3.1'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: tty-cursor
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0.7'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.7'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: tty-prompt
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.23'
|
47
|
+
type: :runtime
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.23'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: tty-screen
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0.8'
|
61
|
+
type: :runtime
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0.8'
|
68
|
+
description: A bundler plugin that provides an interactive CLI to browse gems in your
|
69
|
+
Gemfile, view their details, open their repositories, and update them individually.
|
70
|
+
email:
|
71
|
+
- tnagatomi@okweird.net
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".rubocop.yml"
|
77
|
+
- CHANGELOG.md
|
78
|
+
- CLAUDE.md
|
79
|
+
- CODE_OF_CONDUCT.md
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- lib/bundler/browse.rb
|
84
|
+
- lib/bundler/browse/command.rb
|
85
|
+
- lib/bundler/browse/ui.rb
|
86
|
+
- lib/bundler/browse/updater.rb
|
87
|
+
- lib/bundler/browse/version.rb
|
88
|
+
- plugins.rb
|
89
|
+
- sig/bundler/browse.rbs
|
90
|
+
homepage: https://github.com/tnagatomi/bundler-browse
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata:
|
94
|
+
homepage_uri: https://github.com/tnagatomi/bundler-browse
|
95
|
+
source_code_uri: https://github.com/tnagatomi/bundler-browse
|
96
|
+
changelog_uri: https://github.com/tnagatomi/bundler-browse/blob/main/CHANGELOG.md
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 3.1.0
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubygems_version: 3.6.9
|
112
|
+
specification_version: 4
|
113
|
+
summary: Browse and update gems interactively from your Gemfile
|
114
|
+
test_files: []
|