Created
March 18, 2009 01:47
-
-
Save takai/80883 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/twitty-console.rb b/lib/twitty-console.rb | |
index 363b537..8ee0cdf 100644 | |
--- a/lib/twitty-console.rb | |
+++ b/lib/twitty-console.rb | |
@@ -21,4 +21,4 @@ require 'twitty-console/handler.rb' | |
require 'twitty-console/runner.rb' | |
require 'twitty-console/status.rb' | |
require 'twitty-console/proxy-patch.rb' | |
- | |
+require 'twitty-console/readline-patch.rb' | |
diff --git a/lib/twitty-console/account.rb b/lib/twitty-console/account.rb | |
index 7efd3e7..634c46f 100644 | |
--- a/lib/twitty-console/account.rb | |
+++ b/lib/twitty-console/account.rb | |
@@ -22,7 +22,7 @@ module TwittyConsole | |
rate = hash['hourly_limit'] | |
rate.to_i | |
rescue | |
- 60 | |
+ 30 | |
end | |
end | |
end | |
diff --git a/lib/twitty-console/cui.rb b/lib/twitty-console/cui.rb | |
index f9d010e..15fb8c0 100644 | |
--- a/lib/twitty-console/cui.rb | |
+++ b/lib/twitty-console/cui.rb | |
@@ -35,7 +35,7 @@ module TwittyConsole #:nodoc: | |
screen_name = status.user.screen_name | |
text = Iconv.conv(@@encoding, 'UTF-8', status.text) | |
- puts "%s: %s" % [blue(screen_name), text] | |
+ puts "%s: %s" % [cyan(screen_name), text] | |
end | |
prompt | |
end | |
@@ -62,6 +62,7 @@ module TwittyConsole #:nodoc: | |
def prompt | |
print PROMPT | |
STDOUT.flush | |
+ Readline.refresh_line | |
end | |
end | |
end | |
diff --git a/lib/twitty-console/proxy-patch.rb b/lib/twitty-console/proxy-patch.rb | |
index 3ba38b7..cf74efc 100644 | |
--- a/lib/twitty-console/proxy-patch.rb | |
+++ b/lib/twitty-console/proxy-patch.rb | |
@@ -41,7 +41,7 @@ module ActiveResource | |
end | |
http = http_class.new(@site.host, @site.port) | |
http.use_ssl = @site.is_a?(URI::HTTPS) | |
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl | |
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl? | |
http | |
end | |
end | |
diff --git a/lib/twitty-console/readline-patch.rb b/lib/twitty-console/readline-patch.rb | |
new file mode 100644 | |
index 0000000..a623caa | |
--- /dev/null | |
+++ b/lib/twitty-console/readline-patch.rb | |
@@ -0,0 +1,26 @@ | |
+require 'readline' | |
+require 'dl/import' | |
+ | |
+module Readline | |
+ module LIBREADLINE | |
+ if RUBY_VERSION < '1.9.0' | |
+ extend DL::Importable | |
+ else | |
+ extend DL::Importer | |
+ end | |
+ | |
+ case RUBY_PLATFORM | |
+ when /mswin(?!ce)|mingw|cygwin|bccwin/ | |
+ dlload 'readline.dll' | |
+ when /darwin/ | |
+ dlload 'libreadline.dylib' | |
+ else | |
+ dlload 'libreadline.so' | |
+ end | |
+ extern 'int rl_refresh_line(int, int)' | |
+ end | |
+ | |
+ def self.refresh_line | |
+ LIBREADLINE.rl_refresh_line(0, 0) | |
+ end | |
+end | |
diff --git a/twitty-console.gemspec b/twitty-console.gemspec | |
new file mode 100644 | |
index 0000000..20924f1 | |
--- /dev/null | |
+++ b/twitty-console.gemspec | |
@@ -0,0 +1,33 @@ | |
+# -*- mode: ruby; coding: utf-8-unix -*- | |
+ | |
+Gem::Specification.new do |spec| | |
+ spec.name = "twitty-console" | |
+ spec.summary = "Console-based Twitter Client" | |
+ spec.version = "0.3.0" | |
+ spec.author = "Naoto Takai" | |
+ spec.email = "[email protected]" | |
+ | |
+ spec.files = %w{ | |
+ LICENSE.txt | |
+ README.rdoc | |
+ bin/twitty-console | |
+ lib/twitty-console | |
+ lib/twitty-console.rb | |
+ lib/twitty-console/account.rb | |
+ lib/twitty-console/config.rb | |
+ lib/twitty-console/cui.rb | |
+ lib/twitty-console/handler.rb | |
+ lib/twitty-console/proxy-patch.rb | |
+ lib/twitty-console/readline-patch.rb | |
+ lib/twitty-console/runner.rb | |
+ lib/twitty-console/status.rb | |
+ twitty-console.gemspec | |
+ } | |
+ spec.executables = ['twitty-console'] | |
+ | |
+ spec.homepage = "http://github.com/takai/twitty-console/" | |
+ spec.description = "TwittyConsole is a console based client for Twitter." | |
+ | |
+ spec.add_dependency('activeresource') | |
+ spec.add_dependency('term-ansicolor') | |
+end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment