Permalink
Browse files

Merge branch 'db_improve' of git@github.com:jugyo/termtter into db_im…

…prove
  • Loading branch information...
2 parents 0a2029c + 4427a3f commit d6d710dfe7a53396d5ee364155e1f9d947af6be8 @sorah sorah committed Jan 16, 2010
Showing with 48 additions and 14 deletions.
  1. +30 −0 lib/plugins/defaults/irb.rb
  2. +1 −1 lib/plugins/defaults/stdout.rb
  3. +0 −6 lib/plugins/irb.rb
  4. +0 −1 lib/termtter/api.rb
  5. +17 −6 lib/termtter/system_extensions.rb
@@ -0,0 +1,30 @@
+require 'irb'
+
+module IRB
+ def self.start_session(binding)
+ unless @__irb_initialized
+ IRB.setup(nil)
+ @__irb_initialized = true
+ end
+
+ workspace = WorkSpace.new(binding)
+
+ irb = Irb.new(workspace)
+
+ @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
+ @CONF[:MAIN_CONTEXT] = irb.context
+
+ catch(:IRB_EXIT) do
+ irb.eval_input
+ end
+ end
+end
+
+Termtter::Client.register_command(:irb) do |arg|
+ begin
+ completion_proc = Readline.completion_proc
+ IRB.start_session(binding)
+ ensure
+ Readline.completion_proc = completion_proc
+ end
+end
@@ -27,7 +27,7 @@
config.plugins.stdout.set_default(:typable_id_prefix, '$')
config.plugins.stdout.set_default(:show_reply_chain, true)
config.plugins.stdout.set_default(:indent_format, %q("#{' ' * (indent - 1)} → "))
-config.plugins.stdout.set_default(:max_indent_level, 3)
+config.plugins.stdout.set_default(:max_indent_level, 1)
module Termtter
class TypableIdGenerator
View
@@ -1,6 +0,0 @@
-require 'irb'
-Termtter::Client.register_command(:irb) do |*args|
- args.unshift('irb')
- args.delete_if{|i| i == ""}
- system *args
-end
View
@@ -68,7 +68,6 @@ def try_auth
twitter.verify_credentials
return twitter
rescue Rubytter::APIError
- config.__clear__(:user_name)
config.__clear__(:password)
end
return nil
@@ -61,13 +61,24 @@ def $stdin.getc; getbyte
end
def open_browser(url)
- case RUBY_PLATFORM
- when /linux/
- system 'firefox', url
- when /mswin(?!ce)|mingw|bccwin/
- system 'start', url
+ if ENV['KDE_FULL_SESSION'] == 'true'
+ system 'kfmclient', 'exec', url
+ elsif ENV['GNOME_DESKTOP_SESSION_ID']
+ system 'gnome-open', url
+ elsif !(/not found/ =~ `which exo-open`)
+ # FIXME: is fungible system('exo-open').nil? for lambda {...}
+ system 'exo-open', url
else
- system 'open', url
+ case RUBY_PLATFORM.downcase
+ when /linux/
+ system 'firefox', url
+ when /darwin/
+ system 'open', url
+ when /mswin(?!ce)|mingw|bccwin/
+ system 'start', url
+ else
+ system 'firefox', url
+ end
end
end

0 comments on commit d6d710d

Please sign in to comment.