ruco 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 906292a945bfa6f268ee461f69e3f9dc698864cc777ca9a6fabc48db2009c427
4
- data.tar.gz: e2bf50d323b6f807c60fa70006e6b2d153e604929aa6bfff2d13ac2f67794db2
3
+ metadata.gz: 91fa339b648dbf0d088ca4e252f70dd045d32c0b5fba7fcaf01d61451a12fa12
4
+ data.tar.gz: 07e5fa48a8b76da387cba90c09b3c62845b7673a16cfc166f8c7aeff5be22e5d
5
5
  SHA512:
6
- metadata.gz: 1d825c984c209ba1b547136c0a2b1b4618c82d85c05e0b407d78f0967751dcde25f2b22cc27647aa9264d1f8e6818d1f58d865e4b29114c6d09299ea3cc73098
7
- data.tar.gz: b6ae20158834cccfeef78a9ed48f27d3a950adadd2cd6c0975e4cd80df13b778c2697f3e3f86eb73f9770e3d5243cd8a4f64bd78dde9298c6c2af12c6e7d8f03
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(stuff)
47
- File.open('ruco.log','ab') { |f| f.puts stuff }
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] = if options[:no_colors]
53
- false
54
- elsif options[:colors]
55
- true
56
- else
57
- # so far the only terminal that supports it:
58
- # - xterm-256color on osx
59
- # - xterm on ubuntu 10.04+
60
- if RbConfig::CONFIG['host_os'] !~ /mswin|mingw/
61
- if ENV["TERM"] == 'xterm-256color'
62
- true
63
- else
64
- require 'ruco/file_store'
65
- if ENV['TERM'] == 'xterm'
66
- # switch terminal, so curses knows we want colors
67
- # setting ENV['TERM'] will sometimes crash un-rescue-able -> test if it works
68
- possible = Ruco::FileStore.new('~/.ruco/cache').cache('color_possible') do
69
- system(%{TERM=xterm-256color ruby -r curses -e 'Curses.noecho' > /dev/null 2>&1})
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
- :convert_tabs => options[:convert_tabs],
87
- :undo_stack_size => options[:undo_stack_size],
88
- :lines => screen.lines, :columns => screen.columns
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
@@ -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', :string => true)
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/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ruco
2
- VERSION = Version = "0.4.0"
2
+ VERSION = Version = "0.5.0"
3
3
  end
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.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-25 00:00:00.000000000 Z
11
+ date: 2025-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard