ruco 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 +5 -5
- data/bin/ruco +36 -30
- data/lib/ruco/editor/colors.rb +3 -3
- data/lib/ruco/editor.rb +7 -3
- data/lib/ruco/version.rb +1 -1
- data/lib/ruco.rb +0 -3
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 91fa339b648dbf0d088ca4e252f70dd045d32c0b5fba7fcaf01d61451a12fa12
|
4
|
+
data.tar.gz: 07e5fa48a8b76da387cba90c09b3c62845b7673a16cfc166f8c7aeff5be22e5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0adeffa4e2005fe239ad2ddf7c303727141a6a447b21a74fd7ce415c72d3b28e6d9be8ab8cefea63c595ab4b13d8543fabeab8cbcf68effbf2d0dd89894e4ff5
|
7
|
+
data.tar.gz: 045c8dbeeaddbfd4d957bb51ac3b06488202762591ef7d66ed10cbbe32e5bf4848fdac8a95b0ce608f292db131db193744c24ce710bf54e6b084b8d0543c82c5
|
data/bin/ruco
CHANGED
@@ -23,10 +23,10 @@ def parse_options
|
|
23
23
|
opts.on("-c", "--convert-tabs","Convert tabs to spaces") { options[:convert_tabs] = true }
|
24
24
|
opts.on("-u", "--undo-stack-size SIZE","Maximum size of the undo stack. 0 allows for a complete undo stack.") { |size| options[:undo_stack_size] = size.to_i }
|
25
25
|
opts.on("-n", "--no-colors","No colors -- helps performance / broken terminals") { options[:no_colors] = true }
|
26
|
-
opts.on("--colors","Force colors -- everything could be black") { options[:colors] = true }
|
27
|
-
opts.on("--debug-cache","Show caching in action") { options[:debug_cache] = true }
|
26
|
+
opts.on("--colors", "Force colors -- everything could be black") { options[:colors] = true }
|
27
|
+
opts.on("--debug-cache", "Show caching in action") { options[:debug_cache] = true }
|
28
28
|
opts.on("--debug-keys", "Show pressed keys") { options[:debug_keys] = true }
|
29
|
-
opts.on("-v", "--version","Show Version") do
|
29
|
+
opts.on("-v", "--version", "Show Version") do
|
30
30
|
require 'ruco/version'
|
31
31
|
puts Ruco::VERSION
|
32
32
|
exit
|
@@ -40,39 +40,44 @@ def parse_options
|
|
40
40
|
exit
|
41
41
|
end
|
42
42
|
|
43
|
+
if ARGV.size != 1
|
44
|
+
puts parser
|
45
|
+
exit 1
|
46
|
+
end
|
47
|
+
|
43
48
|
options
|
44
49
|
end
|
45
50
|
|
46
|
-
def log(
|
47
|
-
File.open('ruco.log','ab') { |f| f.puts
|
51
|
+
def log(message)
|
52
|
+
File.open('ruco.log','ab') { |f| f.puts message }
|
48
53
|
end
|
49
54
|
|
50
55
|
options = parse_options
|
51
56
|
|
52
|
-
options[:colors] =
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
#
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
ENV['TERM'] = 'xterm-256color' if possible
|
72
|
-
end
|
57
|
+
options[:colors] =
|
58
|
+
if options[:no_colors]
|
59
|
+
false
|
60
|
+
elsif options[:colors]
|
61
|
+
true
|
62
|
+
# windows does not support colors, so disable it
|
63
|
+
elsif RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
64
|
+
false
|
65
|
+
# this mostly is osx and works fine
|
66
|
+
elsif ENV["TERM"] == 'xterm-256color'
|
67
|
+
true
|
68
|
+
# xterm on ubuntu 10.04+ also supports colors, but ot might crash if we force it
|
69
|
+
elsif ENV['TERM'] == 'xterm'
|
70
|
+
require 'ruco/file_store'
|
71
|
+
# switch terminal, so curses knows we want colors
|
72
|
+
# setting ENV['TERM'] will sometimes crash un-rescue-able -> test if it works
|
73
|
+
possible = Ruco::FileStore.new('~/.ruco/cache').cache('color_possible') do
|
74
|
+
system(%{TERM=xterm-256color ruby -r curses -e 'Curses.noecho' > /dev/null 2>&1})
|
73
75
|
end
|
76
|
+
ENV['TERM'] = 'xterm-256color' if possible
|
77
|
+
possible
|
78
|
+
else
|
79
|
+
false
|
74
80
|
end
|
75
|
-
end
|
76
81
|
$ruco_colors = options[:colors]
|
77
82
|
|
78
83
|
require 'ruco'
|
@@ -83,9 +88,10 @@ Dispel::Screen.open(options) do |screen|
|
|
83
88
|
|
84
89
|
app = Ruco::Application.new(
|
85
90
|
ARGV[0],
|
86
|
-
:
|
87
|
-
:
|
88
|
-
:
|
91
|
+
convert_tabs: options[:convert_tabs],
|
92
|
+
undo_stack_size: options[:undo_stack_size],
|
93
|
+
lines: screen.lines,
|
94
|
+
columns: screen.columns
|
89
95
|
)
|
90
96
|
|
91
97
|
screen.draw *app.display_info
|
data/lib/ruco/editor/colors.rb
CHANGED
@@ -84,17 +84,17 @@ module Ruco
|
|
84
84
|
memoize :theme
|
85
85
|
|
86
86
|
def download_into_file(url)
|
87
|
-
theme_store = FileStore.new('~/.ruco/cache', :
|
87
|
+
theme_store = FileStore.new('~/.ruco/cache', string: true)
|
88
88
|
theme_store.cache(url) do
|
89
89
|
require 'open-uri'
|
90
90
|
require 'openssl'
|
91
91
|
OpenURI.without_ssl_verification do
|
92
|
-
open(url).read
|
92
|
+
URI.open(url).read
|
93
93
|
end
|
94
94
|
end
|
95
95
|
File.expand_path(theme_store.file(url))
|
96
96
|
rescue => e
|
97
|
-
STDERR.puts "Could not download #{url} -- #{e}"
|
97
|
+
STDERR.puts "Could not download #{url} set via :color_theme option -- #{e}"
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
data/lib/ruco/editor.rb
CHANGED
@@ -14,14 +14,15 @@ module Ruco
|
|
14
14
|
def initialize(file, options)
|
15
15
|
@file = file
|
16
16
|
@options = options
|
17
|
+
handle = (File.exist?(file) ? File.open(file, 'rb') : nil)
|
17
18
|
|
18
19
|
# check for size (10000 lines * 100 chars should be enough for everybody !?)
|
19
|
-
if
|
20
|
+
if handle&.size.to_i > 1024 * 1024
|
20
21
|
raise "#{@file} is larger than 1MB, did you really want to open that with Ruco?"
|
21
22
|
end
|
22
23
|
|
23
|
-
content =
|
24
|
-
@options[:language] ||= LanguageSniffer.detect(@file, :
|
24
|
+
content = handle&.read || ''
|
25
|
+
@options[:language] ||= LanguageSniffer.detect(@file, content: content).language
|
25
26
|
content.tabs_to_spaces! if @options[:convert_tabs]
|
26
27
|
|
27
28
|
# cleanup newline formats
|
@@ -33,6 +34,9 @@ module Ruco
|
|
33
34
|
@text_area = EditorArea.new(content, @options)
|
34
35
|
@history = @text_area.history
|
35
36
|
restore_session
|
37
|
+
|
38
|
+
# git and kubectl wait for the file to be closed, so give them that event
|
39
|
+
at_exit { handle&.close }
|
36
40
|
end
|
37
41
|
|
38
42
|
def find(text)
|
data/lib/ruco/version.rb
CHANGED
data/lib/ruco.rb
CHANGED
@@ -26,9 +26,6 @@ require 'ruco/application'
|
|
26
26
|
|
27
27
|
if $ruco_colors
|
28
28
|
begin
|
29
|
-
# this can fail on ruby 1.8 <-> oniguruma is complicated to install
|
30
|
-
require 'oniguruma' if RUBY_VERSION < '1.9.0'
|
31
|
-
|
32
29
|
# there are some other gems out there like spox-textpow etc, so be picky
|
33
30
|
gem 'plist'
|
34
31
|
require 'plist'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.0.7
|
69
|
-
description:
|
69
|
+
description:
|
70
70
|
email: michael@grosser.it
|
71
71
|
executables:
|
72
72
|
- ruco
|
@@ -119,17 +119,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
119
|
requirements:
|
120
120
|
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 2.
|
122
|
+
version: 2.7.0
|
123
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
125
|
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
|
-
|
130
|
-
|
131
|
-
signing_key:
|
129
|
+
rubygems_version: 3.4.10
|
130
|
+
signing_key:
|
132
131
|
specification_version: 4
|
133
132
|
summary: Desktop-style, Intuitive, Commandline Editor in Ruby. 'Better than nano,
|
134
133
|
simpler than vim.'
|
135
134
|
test_files: []
|
135
|
+
...
|