4 require("irb/completion")
8 gem('twitter4r', '>0.3.0')
10 require("twitter/console")
13 gem("mbbx6spp-twitter4r", '>=0.3.1')
15 require("twitter/console")
17 abort("Error: You must install either twitter4r gem from Rubyforge with version 0.3.1 or greater or the mbbx6spp-twitter4r gem from GitHub's servers with version 0.3.1 or greater (and make sure it is a recent version of the gem).")
25 result
= ENV["T4R_CONFIG"]
26 file_name
= File
.expand_path('twitter.yml')
27 result
||= file_name
if File
.exists
?(file_name
)
28 file_name
= File
.expand_path('twitter.yml', 'config')
29 result
||= file_name
if File
.exists
?(file_name
)
30 file_name
= File
.expand_path('~/.twitter.yml')
31 result
||= file_name
if File
.exists
?(file_name
)
36 ENV["T4R_ENV"] || ENV["MERB_ENV"] || ENV["RAILS_ENV"]
42 IRB
.conf
[:IRB_NAME] = "t4rsh"
43 IRB
.conf
[:VERSION] = Twitter
::Version.to_version
44 IRB
.conf
[:USE_READLINE] = true
45 IRB
.conf
[:PROMPT_MODE] = :T4RSH
46 IRB
.conf
[:PROMPT][:T4RSH] = {
47 :PROMPT_I => "%N[%3n:%i]> ", # top level prompt
48 :PROMPT_C => "%N[%3n:%i]* ", # after conditional like "if"
49 :PROMPT_S => "%N[%3n:%i]* ", # during continuing string
50 :RETURN => "=> %s\n", # return value
60 config_file
= Twitter
::Console.config_file
61 account
= Twitter
::Console.account
63 if config_file
&& account
64 @twitter = Twitter
::Client.from_config(config_file
, account
)
65 puts
"Used #{config_file} to create client for #{account} account."
66 puts
"Access @twitter for instantiated client."
67 Twitter
::Console.run(__FILE__
)
69 abort("Please make sure #{config_file} exists and contains your Twitter credentials (separated by account/environment) and that you specify the account/environment to use, e.g. if you have a 'test' section in your configuration file that you want to use set/export T4R_ENV=test as an environment variable or RAILS_ENV=test or MERB_ENV=test")