ruco 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b020114e69b37e9bc135f16e267ece5bc502fa32
4
- data.tar.gz: 5dc7e130cbed60540752f03cff9c9d1515ec4a00
2
+ SHA256:
3
+ metadata.gz: 906292a945bfa6f268ee461f69e3f9dc698864cc777ca9a6fabc48db2009c427
4
+ data.tar.gz: e2bf50d323b6f807c60fa70006e6b2d153e604929aa6bfff2d13ac2f67794db2
5
5
  SHA512:
6
- metadata.gz: ef8c19741fd5bc747cd09dc44c698f60cc0cf9b96e37f9c2338a9ba9921fe383c297d31ea4b4c469c9ac3d13ce530a4975ce92b7eeaa7d7aa02dcd15c75e4a94
7
- data.tar.gz: bba1ab56310242d048792a9969fdc06167c2c3b3ea8393fe21308dd43a148e62d4a94015b05a1ca7f0e188cbe6c3e46266695588cd38cc444f3a4ef725939c25
6
+ metadata.gz: 1d825c984c209ba1b547136c0a2b1b4618c82d85c05e0b407d78f0967751dcde25f2b22cc27647aa9264d1f8e6818d1f58d865e4b29114c6d09299ea3cc73098
7
+ data.tar.gz: b6ae20158834cccfeef78a9ed48f27d3a950adadd2cd6c0975e4cd80df13b778c2697f3e3f86eb73f9770e3d5243cd8a4f64bd78dde9298c6c2af12c6e7d8f03
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 File.exist?(@file) and File.size(@file) > (1024 * 1024)
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 = (File.exist?(@file) ? File.binary_read(@file) : '')
24
- @options[:language] ||= LanguageSniffer.detect(@file, :content => content).language
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
@@ -1,3 +1,3 @@
1
1
  module Ruco
2
- VERSION = Version = "0.3.0"
2
+ VERSION = Version = "0.4.0"
3
3
  end
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.3.0
4
+ version: 0.4.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: 2015-10-17 00:00:00.000000000 Z
11
+ date: 2023-05-25 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.0.0
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
- rubyforge_project:
130
- rubygems_version: 2.4.5.1
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
+ ...