### Home Classes Methods

### In Files

- lib/termtter/config_setup.rb

### Methods

- #reauth
- #run

### Files

- ChangeLog
- README.rdoc

### Class/Module Index

Quicksearch

- Termtter
- Termtter::API
- Termtter::ActiveRubytter
- Termtter::Client
- Termtter::Client::DirectMessage
- Termtter::Client::Jakigan
- Termtter::Client::SearchEvent
- Termtter::Client::UserSearchEvent
- Termtter::Command
- Termtter::CommandCanceled
- Termtter::CommandLine
- Termtter::CommandNotFound
- Termtter::Config
- Termtter::ConfigSetup
- Termtter::Crypt
- Termtter::English
- Termtter::Event
- Termtter::HTTPpool
- Termtter::Hook
- Termtter::HookCanceled
- Termtter::Hookable
- Termtter::JSONError
- Termtter::MemoryCache
- Termtter::MemoryCache::MemCacheMock
- Termtter::OptParser
- Termtter::Plugin
- Termtter::Plugin::Screen
- Termtter::Plugins
- Termtter::Plugins::Haml
- Termtter::Plugins::ListSwitch
- Termtter::RubytterProxy
- Termtter::RubytterProxy::FrequentAccessError
- Termtter::RubytterProxy::LimitManager
- Termtter::Status
- Termtter::StdOut
- Termtter::Storage
- Termtter::Storage::SQLite3
- Termtter::Storage::Status
- Termtter::Task
- Termtter::TaskManager
- Termtter::TypableIdGenerator
- Termtter::UserStreamReceiver
- Yharian
- Yharian::Alex
- Yharian::Jenifer
- Yharian::Remark
- Yharian::Speaker
- Yharian::Vicki
- Yharian::Yhara
- HatenaKeywordHaiku
- HatenaKeywordHaiku::Word
- OAuth
- OAuth::AccessToken
- Readline
- Readline::LIBREADLINE
- AAMaker
- Array
- BrowserNotFound
- Growl
- IRB
- Object
- Status
- String
- Symbol
- TermColor
- TermtterIrcGateway
- User

No matching classes.

# Termtter::ConfigSetup

### Public Instance Methods

reauth() click to toggle source

    # File lib/termtter/config_setup.rb, line 35
    def reauth
      token_and_secret = Termtter::API.authorize_by_oauth
      token = token_and_secret[:token]
      secret = token_and_secret[:secret]

      File.open(Termtter::CONF_FILE, 'a+') do |file|
        file << "\nconfig.dmsg_permission = true\n"
      end

      puts "Setup is completed. Enjoy!"
    rescue OAuth::Unauthorized
      puts 'Failed to authenticate!'
      exit!
    end

run() click to toggle source

    # File lib/termtter/config_setup.rb, line 8
    def run

      plugins = Dir.glob(File.expand_path(File.dirname(__FILE__) + "/../plugins/*.rb")).map  {|f|
        f.match(%lib/plugins/(.*?).rb$|)[1]
      }
      standard_plugins = ]stdout standard_commands auto_reload defaults]

      template = open(File.dirname(__FILE__) + '/config_template.erb').read
      config = ERB.new(template, nil, '-').result(binding) # trim_mode => '-'

      Dir.mkdir(Termtter::CONF_DIR) unless File.exists?(Termtter::CONF_DIR)
      File.open(Termtter::CONF_FILE, 'w', 0600) {|io|
        io << config
      }

      puts "generated: ~/.termtter/config"

      token_and_secret = Termtter::API.authorize_by_oauth
      token = token_and_secret[:token]
      secret = token_and_secret[:secret]

      puts "Setup is completed. Enjoy!"
    rescue OAuth::Unauthorized
      puts 'Failed to authenticate!'
      exit!
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.