beniya 0.3.0 → 0.5.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 +4 -4
- data/CHANGELOG.md +124 -0
- data/CHANGELOG_v0.4.0.md +146 -0
- data/CHANGELOG_v0.5.0.md +26 -0
- data/README.md +44 -38
- data/README_EN.md +17 -38
- data/lib/beniya/bookmark.rb +115 -0
- data/lib/beniya/config.rb +4 -4
- data/lib/beniya/directory_listing.rb +14 -0
- data/lib/beniya/file_opener.rb +3 -3
- data/lib/beniya/keybind_handler.rb +547 -84
- data/lib/beniya/terminal_ui.rb +8 -7
- data/lib/beniya/version.rb +1 -1
- data/publish_gem.zsh +131 -0
- data/test_delete/test1.txt +1 -0
- data/test_delete/test2.txt +1 -0
- metadata +9 -2
data/lib/beniya/terminal_ui.rb
CHANGED
@@ -131,22 +131,22 @@ module Beniya
|
|
131
131
|
if @keybind_handler && @keybind_handler.instance_variable_get(:@base_directory)
|
132
132
|
base_dir = @keybind_handler.instance_variable_get(:@base_directory)
|
133
133
|
selected_count = @keybind_handler.selected_items.length
|
134
|
-
base_info = "📋
|
134
|
+
base_info = "📋 Base Directory: #{base_dir}"
|
135
135
|
|
136
136
|
# 選択されたアイテム数を表示
|
137
137
|
if selected_count > 0
|
138
|
-
base_info += " |
|
138
|
+
base_info += " | Selected: #{selected_count} item(s)"
|
139
139
|
end
|
140
140
|
else
|
141
141
|
# keybind_handlerがない場合、またはbase_directoryが設定されていない場合
|
142
|
-
base_info = "📋
|
142
|
+
base_info = "📋 Base Directory: #{Dir.pwd}"
|
143
143
|
end
|
144
144
|
|
145
145
|
# 長すぎる場合は省略
|
146
146
|
if base_info.length > @screen_width - 2
|
147
|
-
if base_info.include?(" |
|
148
|
-
selected_part = base_info.split(" |
|
149
|
-
available_length = @screen_width - 20 - " |
|
147
|
+
if base_info.include?(" | Selected:")
|
148
|
+
selected_part = base_info.split(" | Selected:").last
|
149
|
+
available_length = @screen_width - 20 - " | Selected:#{selected_part}".length
|
150
150
|
else
|
151
151
|
available_length = @screen_width - 20
|
152
152
|
end
|
@@ -163,6 +163,7 @@ module Beniya
|
|
163
163
|
print "\e[2;1H\e[44m\e[37m#{base_info.ljust(@screen_width)}\e[0m"
|
164
164
|
end
|
165
165
|
|
166
|
+
|
166
167
|
def draw_directory_list(entries, width, height)
|
167
168
|
start_index = [@keybind_handler.current_index - height / 2, 0].max
|
168
169
|
[start_index + height - 1, entries.length - 1].min
|
@@ -473,7 +474,7 @@ module Beniya
|
|
473
474
|
input = STDIN.getch
|
474
475
|
rescue Errno::ENOTTY, Errno::ENODEV
|
475
476
|
# ターミナルでない環境(IDE等)では標準入力を使用
|
476
|
-
print "\
|
477
|
+
print "\nOperation: "
|
477
478
|
input = STDIN.gets
|
478
479
|
return 'q' if input.nil?
|
479
480
|
input = input.chomp.downcase
|
data/lib/beniya/version.rb
CHANGED
data/publish_gem.zsh
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
#!/bin/zsh
|
2
|
+
|
3
|
+
# Gem Build & Push Script
|
4
|
+
# Usage: ./publish_gem.zsh [version]
|
5
|
+
|
6
|
+
set -e # Exit on any error
|
7
|
+
|
8
|
+
# Colors for output
|
9
|
+
RED='\033[0;31m'
|
10
|
+
GREEN='\033[0;32m'
|
11
|
+
YELLOW='\033[1;33m'
|
12
|
+
BLUE='\033[0;34m'
|
13
|
+
NC='\033[0m' # No Color
|
14
|
+
|
15
|
+
# Function to print colored output
|
16
|
+
print_status() {
|
17
|
+
echo -e "${BLUE}[INFO]${NC} $1"
|
18
|
+
}
|
19
|
+
|
20
|
+
print_success() {
|
21
|
+
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
22
|
+
}
|
23
|
+
|
24
|
+
print_warning() {
|
25
|
+
echo -e "${YELLOW}[WARNING]${NC} $1"
|
26
|
+
}
|
27
|
+
|
28
|
+
print_error() {
|
29
|
+
echo -e "${RED}[ERROR]${NC} $1"
|
30
|
+
}
|
31
|
+
|
32
|
+
# Check if we're in the correct directory
|
33
|
+
if [[ ! -f "beniya.gemspec" ]]; then
|
34
|
+
print_error "beniya.gemspec not found. Please run this script from the project root directory."
|
35
|
+
exit 1
|
36
|
+
fi
|
37
|
+
|
38
|
+
# Get current version from version.rb
|
39
|
+
CURRENT_VERSION=$(ruby -r ./lib/beniya/version -e "puts Beniya::VERSION")
|
40
|
+
print_status "Current version: $CURRENT_VERSION"
|
41
|
+
|
42
|
+
# Use provided version or current version
|
43
|
+
VERSION=${1:-$CURRENT_VERSION}
|
44
|
+
print_status "Publishing version: $VERSION"
|
45
|
+
|
46
|
+
# Confirm before proceeding
|
47
|
+
echo
|
48
|
+
read "REPLY?Do you want to proceed with publishing version $VERSION? (y/N): "
|
49
|
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
50
|
+
print_warning "Aborted by user."
|
51
|
+
exit 0
|
52
|
+
fi
|
53
|
+
|
54
|
+
echo
|
55
|
+
print_status "Starting gem publication process..."
|
56
|
+
|
57
|
+
# Step 1: Run tests
|
58
|
+
print_status "Running tests..."
|
59
|
+
if ! bundle exec rake test; then
|
60
|
+
print_error "Tests failed. Aborting publication."
|
61
|
+
exit 1
|
62
|
+
fi
|
63
|
+
print_success "All tests passed!"
|
64
|
+
|
65
|
+
# Step 2: Clean up old gem files
|
66
|
+
print_status "Cleaning up old gem files..."
|
67
|
+
rm -f *.gem
|
68
|
+
print_success "Cleanup completed."
|
69
|
+
|
70
|
+
# Step 3: Build gem
|
71
|
+
print_status "Building gem..."
|
72
|
+
if ! bundle exec gem build beniya.gemspec; then
|
73
|
+
print_error "Gem build failed."
|
74
|
+
exit 1
|
75
|
+
fi
|
76
|
+
|
77
|
+
# Find the built gem file
|
78
|
+
GEM_FILE=$(ls beniya-*.gem | head -n 1)
|
79
|
+
if [[ -z "$GEM_FILE" ]]; then
|
80
|
+
print_error "No gem file found after build."
|
81
|
+
exit 1
|
82
|
+
fi
|
83
|
+
|
84
|
+
print_success "Gem built successfully: $GEM_FILE"
|
85
|
+
|
86
|
+
# Step 4: Verify gem contents (optional)
|
87
|
+
print_status "Gem contents:"
|
88
|
+
gem contents $GEM_FILE | head -10
|
89
|
+
echo "..."
|
90
|
+
|
91
|
+
# Step 5: Final confirmation
|
92
|
+
echo
|
93
|
+
read "REPLY?Push $GEM_FILE to RubyGems? (y/N): "
|
94
|
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
95
|
+
print_warning "Gem build completed but not published."
|
96
|
+
print_status "You can manually push later with: gem push $GEM_FILE"
|
97
|
+
exit 0
|
98
|
+
fi
|
99
|
+
|
100
|
+
# Step 6: Push to RubyGems
|
101
|
+
print_status "Pushing gem to RubyGems..."
|
102
|
+
if ! gem push $GEM_FILE; then
|
103
|
+
print_error "Gem push failed."
|
104
|
+
exit 1
|
105
|
+
fi
|
106
|
+
|
107
|
+
print_success "Gem published successfully!"
|
108
|
+
|
109
|
+
# Step 7: Create git tag if version was provided
|
110
|
+
if [[ -n "$1" ]]; then
|
111
|
+
print_status "Creating git tag v$VERSION..."
|
112
|
+
if git tag "v$VERSION" 2>/dev/null; then
|
113
|
+
print_success "Tag v$VERSION created."
|
114
|
+
read "REPLY?Push tag to remote? (y/N): "
|
115
|
+
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
116
|
+
git push origin "v$VERSION"
|
117
|
+
print_success "Tag pushed to remote."
|
118
|
+
fi
|
119
|
+
else
|
120
|
+
print_warning "Tag v$VERSION already exists or failed to create."
|
121
|
+
fi
|
122
|
+
fi
|
123
|
+
|
124
|
+
# Step 8: Cleanup
|
125
|
+
print_status "Cleaning up gem file..."
|
126
|
+
rm -f $GEM_FILE
|
127
|
+
|
128
|
+
echo
|
129
|
+
print_success "Publication completed!"
|
130
|
+
print_status "Gem should be available at: https://rubygems.org/gems/beniya"
|
131
|
+
print_status "Install with: gem install beniya"
|
@@ -0,0 +1 @@
|
|
1
|
+
test content 1
|
@@ -0,0 +1 @@
|
|
1
|
+
test content 2
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beniya
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- masisz
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-09-
|
10
|
+
date: 2025-09-20 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: io-console
|
@@ -116,6 +116,9 @@ executables:
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
+
- CHANGELOG.md
|
120
|
+
- CHANGELOG_v0.4.0.md
|
121
|
+
- CHANGELOG_v0.5.0.md
|
119
122
|
- README.md
|
120
123
|
- README_EN.md
|
121
124
|
- beniya.gemspec
|
@@ -123,6 +126,7 @@ files:
|
|
123
126
|
- config_example.rb
|
124
127
|
- lib/beniya.rb
|
125
128
|
- lib/beniya/application.rb
|
129
|
+
- lib/beniya/bookmark.rb
|
126
130
|
- lib/beniya/color_helper.rb
|
127
131
|
- lib/beniya/config.rb
|
128
132
|
- lib/beniya/config_loader.rb
|
@@ -133,6 +137,9 @@ files:
|
|
133
137
|
- lib/beniya/keybind_handler.rb
|
134
138
|
- lib/beniya/terminal_ui.rb
|
135
139
|
- lib/beniya/version.rb
|
140
|
+
- publish_gem.zsh
|
141
|
+
- test_delete/test1.txt
|
142
|
+
- test_delete/test2.txt
|
136
143
|
homepage: https://github.com/masisz/beniya
|
137
144
|
licenses:
|
138
145
|
- MIT
|