Sha256: 6824fe011e7f5dbd2f0d5527fa48d300cbd02893070ec0966e5c36c08e5f0065

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require 'optparse'
require File.dirname(__FILE__) + '/rdoc_readme'

class Logger
  def format_message(severity, timestamp, progname, msg)
    "#{msg}\n"
  end
end

module TwitterArchive
  class Runner
    def self.runner
      ta = TwitterArchive::Base.new
      ta.load_config

      parse_options 

      puts ta.get_latest
      ta.save_config
    end

    def self.parse_options
      OptionParser.new do |opts|
        opts.summary_width = 25

        opts.on('-v', '--version') do 
          puts "twitter_archive (#{TwitterArchive::VERSION})\n\n"
          exit
        end
        opts.on('-h', '--help') do
          #RDoc::usage() #exits app 
          RDocReadme.rdoc_usage('usage', 'options')
          exit
        end
        opts.on('-V', '--verbose') do
          puts "Verbose!"
        end
        opts.on('-I', '--install') do
          puts "Installing example .twitter_archive.yml to your home directory"
          require "ftools"
          if File.exists? ENV['HOME'] + '/.twitter_archive.yml'
            puts " - #{ENV['HOME']}/.twitter_archive.yml already exists, skipping"
          else
            File.copy( File.dirname(__FILE__) + '/../../config/example.yml', ENV['HOME'] + '/.twitter_archive.yml')
          end
          exit
        end

      end.parse!
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
csexton-twitter_archive-0.0.3 lib/twitter_archive/runner.rb
csexton-twitter_archive-0.0.4 lib/twitter_archive/runner.rb