ruco 0.2.0.beta6 → 0.2.0.beta7

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -23,7 +23,7 @@ Features:
23
23
  - (optional) line numbers
24
24
 
25
25
  ![ruco with railscasts theme](http://dl.dropbox.com/u/2670385/Web/ruco-with-railscasts-theme.png)<br/>
26
- (to get colors on ruby 1.8, install oniguruma [OsX](http://blog.pastie.org/2010/01/oniguruma-on-snow-leopard.html) / [Ubuntu](http://blog.loftninjas.org/2008/09/25/installing-the-oniguruma-gem-on-debianubuntu/))
26
+ [Colors in Ruby 1.8](#colors)
27
27
 
28
28
  Install
29
29
  =======
@@ -89,6 +89,19 @@ TIPS
89
89
  - [ssh vs clipboard] access your desktops clipboard by installing `xauth` on the server and then using `ssh -X`
90
90
  - [Alt key] if Alt does not work try your Meta/Win/Cmd key
91
91
 
92
+ <a name="colors"/>
93
+ ### Colors in Ruby 1.8
94
+
95
+ # OSX via brew OR port
96
+ brew install oniguruma
97
+ port install oniguruma5
98
+
99
+ # Ubuntu
100
+ sudo apt-get -y install libonig-dev
101
+
102
+ gem install oniguruma
103
+
104
+
92
105
  TODO
93
106
  =====
94
107
  - only do syntax parsing for changed lines + selected lines <-> will not be redrawn anyhow
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0.beta6
1
+ 0.2.0.beta7
data/bin/ruco CHANGED
@@ -45,17 +45,23 @@ def log(stuff)
45
45
  File.open('ruco.log','ab'){|f| f.puts stuff }
46
46
  end
47
47
 
48
- options = parse_options
49
-
50
48
  # do not use colors if told so or the terminal does not support colors
51
- $ruco_colors = (
52
- not options[:no_colors] and
53
- RbConfig::CONFIG['host_os'] !~ /mswin|mingw/ and # no windows
54
- ENV['TERM'] != 'rxvt' and
55
- (ENV['TERM'] != 'xterm' or ENV['COLORTERM']) and # xterm can be converted into xterm-256colors if COLORTERM is given
56
- ENV['TERM'] !~ /-color$/ # would only support 16 colors
57
- )
49
+ # so far the only terminal that supports it is xterm-256color
50
+ # but just setting ENV['TERM'] to it will crash un-rescue-able
51
+ def activate_256_colors
52
+ (
53
+ RbConfig::CONFIG['host_os'] !~ /mswin|mingw/ and # and not windows
54
+ # and its possible to open xterm-256color
55
+ Ruco::FileStore.new('~/.ruco/cache').cache('color_possible'){
56
+ system(%{TERM=xterm-256color ruby -r curses -e 'Curses.noecho' > /dev/null 2>&1})
57
+ }
58
+ ) and ENV['TERM'] = 'xterm-256color' # finally switch terminal
59
+ end
60
+
61
+ options = parse_options
58
62
 
63
+ require 'ruco/file_store'
64
+ $ruco_colors = activate_256_colors unless options[:no_colors]
59
65
  require 'ruco'
60
66
 
61
67
  # draw app and redraw after each keystroke (or paste)
@@ -80,7 +80,7 @@ module Ruco
80
80
  end
81
81
 
82
82
  def download_into_file(url)
83
- theme_store = FileStore.new(File.expand_path('~/.ruco/themes'), :keep => 5, :string => true)
83
+ theme_store = FileStore.new('~/.ruco/cache', :string => true)
84
84
  theme_store.cache(url) do
85
85
  require 'open-uri'
86
86
  require 'openssl'
@@ -1,9 +1,10 @@
1
1
  require "digest/md5"
2
2
  require "fileutils"
3
+ require "ruco/core_ext/file"
3
4
 
4
5
  module Ruco
5
6
  class FileStore
6
- def initialize(folder, options)
7
+ def initialize(folder, options={})
7
8
  @folder = folder
8
9
  @options = options
9
10
  end
@@ -11,7 +12,7 @@ module Ruco
11
12
  def set(key, value)
12
13
  FileUtils.mkdir_p @folder unless File.exist? @folder
13
14
  File.write(file(key), serialize(value))
14
- cleanup
15
+ cleanup if @options[:keep]
15
16
  end
16
17
 
17
18
  def get(key)
data/lib/ruco/screen.rb CHANGED
@@ -12,9 +12,6 @@ module Ruco
12
12
  end
13
13
 
14
14
  def open(&block)
15
- if $ruco_colors and ENV['TERM'] == 'xterm'
16
- ENV['TERM'] += '-256color' # activate 256 colors
17
- end
18
15
  Curses.noecho # do not show typed chars
19
16
  Curses.nonl # turn off newline translation
20
17
  Curses.stdscr.keypad(true) # enable arrow keys
data/ruco.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruco}
8
- s.version = "0.2.0.beta6"
8
+ s.version = "0.2.0.beta7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2011-09-27}
12
+ s.date = %q{2011-09-28}
13
13
  s.default_executable = %q{ruco}
14
14
  s.email = %q{michael@grosser.it}
15
15
  s.executables = ["ruco"]
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruco
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196367
4
+ hash: 62196365
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - 0
10
10
  - beta
11
- - 6
12
- version: 0.2.0.beta6
11
+ - 7
12
+ version: 0.2.0.beta7
13
13
  platform: ruby
14
14
  authors:
15
15
  - Michael Grosser
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-09-27 00:00:00 +02:00
20
+ date: 2011-09-28 00:00:00 +02:00
21
21
  default_executable: ruco
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency