tweety 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +55 -0
- data/Rakefile +26 -0
- data/lib/tweety.rb +85 -0
- data/lib/tweety/version.rb +3 -0
- data/tweety.gemspec +25 -0
- metadata +93 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
TweeTY
|
2
|
+
======
|
3
|
+
|
4
|
+
Tweety is a command line app for Twitter. (Work in progress)
|
5
|
+
|
6
|
+
|
7
|
+
Installation
|
8
|
+
------------
|
9
|
+
|
10
|
+
gem install tweety
|
11
|
+
|
12
|
+
Usage
|
13
|
+
-----
|
14
|
+
|
15
|
+
user: Displays extensive information about the Twitter user.
|
16
|
+
|
17
|
+
tweety user
|
18
|
+
|
19
|
+
update: Updates your twitter status.
|
20
|
+
|
21
|
+
tweety update "status"
|
22
|
+
|
23
|
+
mentions: Displays the most recent tweets that mention you.
|
24
|
+
|
25
|
+
tweety mentions
|
26
|
+
|
27
|
+
favorites: Displays your favorite tweets
|
28
|
+
|
29
|
+
tweety favorites
|
30
|
+
|
31
|
+
search: Search for tweets
|
32
|
+
|
33
|
+
tweety search 'query'
|
34
|
+
|
35
|
+
More coming soon...
|
36
|
+
|
37
|
+
Authentication
|
38
|
+
--------------
|
39
|
+
|
40
|
+
You will need to [register](https://dev.twitter.com) an application with Twitter to authenticate tweety with OAuth. Then copy the consumer key, consumer secret, OAuth token, and OAuth secret to the `.tweety` configuration file in your home directory.
|
41
|
+
|
42
|
+
~/.tweety
|
43
|
+
----------
|
44
|
+
|
45
|
+
consumer_key: 'INSERT_CONSUMER_KEY'
|
46
|
+
consumer_secret: 'INSERT_CONSUMER_SECRET'
|
47
|
+
oauth_token: 'INSERT_OAUTH_TOKEN'
|
48
|
+
oauth_token_secret: 'INSERT_OAUTH_SECRET'
|
49
|
+
|
50
|
+
|
51
|
+
Bugs
|
52
|
+
----
|
53
|
+
|
54
|
+
<https://github.com/mattsears/tweety/issues>
|
55
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rake/testtask'
|
5
|
+
task :default => :test
|
6
|
+
|
7
|
+
desc 'Run tests (default)'
|
8
|
+
Rake::TestTask.new(:test) do |t|
|
9
|
+
t.test_files = FileList['test/**/*_test.rb']
|
10
|
+
t.ruby_opts = ['-Itest -W0']
|
11
|
+
t.libs << "lib" << "test"
|
12
|
+
t.ruby_opts << '-rubygems' if defined? Gem
|
13
|
+
end
|
14
|
+
|
15
|
+
if ENV['RAILS_ENV']=='development' # yard gem is only in development
|
16
|
+
YARD::Rake::YardocTask.new do |t|
|
17
|
+
t.files = ['lib/**/*.rb']
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
namespace :docs do
|
22
|
+
desc 'Generate documentation for the appliaction with Yard'
|
23
|
+
task :yard do
|
24
|
+
system("yardoc 'lib/**/*.rb' - README.md")
|
25
|
+
end
|
26
|
+
end
|
data/lib/tweety.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'awesome_print'
|
3
|
+
require "twitter"
|
4
|
+
require "tweety/version"
|
5
|
+
require "tweety/config"
|
6
|
+
require "tweety/tweets"
|
7
|
+
require "tweety/profile"
|
8
|
+
|
9
|
+
# Boom! The main Tweety module. You can use this module to call methods with
|
10
|
+
# the upmost ease:
|
11
|
+
#
|
12
|
+
# >> Tweety profile
|
13
|
+
# Returns information about your Twitter profile
|
14
|
+
#
|
15
|
+
# >> Tweety.update(status)
|
16
|
+
# Creates a new tweet
|
17
|
+
#
|
18
|
+
module Tweety
|
19
|
+
extend self
|
20
|
+
extend Tweety::Tweets
|
21
|
+
extend Tweety::Profile
|
22
|
+
|
23
|
+
# Parses command line arguments and does what needs to be done.
|
24
|
+
def execute(*args)
|
25
|
+
@options = parse_options(*args)
|
26
|
+
|
27
|
+
# No args, print help.
|
28
|
+
if args.empty?
|
29
|
+
puts @options
|
30
|
+
exit
|
31
|
+
end
|
32
|
+
self.send(args[0])
|
33
|
+
end
|
34
|
+
|
35
|
+
# Return a new or existing instance of the config variables
|
36
|
+
#
|
37
|
+
def config
|
38
|
+
@config ||= Tweety::Config.new
|
39
|
+
end
|
40
|
+
|
41
|
+
# Returns a new or existing instance of the Twitter client
|
42
|
+
#
|
43
|
+
def twitter
|
44
|
+
@twitter ||= Twitter.configure do |conf|
|
45
|
+
conf.consumer_key = config[:consumer_key]
|
46
|
+
conf.consumer_secret = config[:consumer_secret]
|
47
|
+
conf.oauth_token = config[:oauth_token]
|
48
|
+
conf.oauth_token_secret = config[:oauth_token_secret]
|
49
|
+
end
|
50
|
+
Twitter
|
51
|
+
end
|
52
|
+
|
53
|
+
# Prints the output in a nice pretty format
|
54
|
+
def say(key, string = '', newline = true)
|
55
|
+
# print(newline ? string.to_s + "\n" : string)
|
56
|
+
print("\n#{prepend}: #{string}\n")
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
# Set configuration variables to values passed in the command line options
|
62
|
+
#
|
63
|
+
def parse_options(*args)
|
64
|
+
options = OptionParser.new do |opts|
|
65
|
+
opts.banner = "\nUsage: tweety [options] [command]"
|
66
|
+
opts.separator ""
|
67
|
+
opts.separator "Commands:"
|
68
|
+
opts.separator " profile Your Twitter profile stats"
|
69
|
+
opts.separator " update Updates your status"
|
70
|
+
opts.separator ""
|
71
|
+
opts.separator "Options:"
|
72
|
+
opts.on('-h', '--help', 'Display this screen') do
|
73
|
+
puts opts
|
74
|
+
exit
|
75
|
+
end
|
76
|
+
opts.on('-v', '--version', 'Display the current version') do
|
77
|
+
puts Tweety::VERSION
|
78
|
+
exit
|
79
|
+
end
|
80
|
+
end
|
81
|
+
options.parse!(args)
|
82
|
+
options
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
data/tweety.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "tweety/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "tweety"
|
7
|
+
s.version = Tweety::VERSION
|
8
|
+
s.authors = ["Matt Sears"]
|
9
|
+
s.email = ["matt@mattsears.com"]
|
10
|
+
s.homepage = "http://mattsears.com"
|
11
|
+
s.summary = %q{TweeTY: Possibly the best command line twitter app on the planet }
|
12
|
+
s.description = %q{Tweety is a command line app for Twitter}
|
13
|
+
|
14
|
+
s.rubyforge_project = "tweety"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_development_dependency "awesome_print"
|
23
|
+
s.add_development_dependency "mocha"
|
24
|
+
s.add_runtime_dependency "twitter"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tweety
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Matt Sears
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-10-08 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: awesome_print
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :development
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: mocha
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: twitter
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id003
|
48
|
+
description: Tweety is a command line app for Twitter
|
49
|
+
email:
|
50
|
+
- matt@mattsears.com
|
51
|
+
executables: []
|
52
|
+
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files: []
|
56
|
+
|
57
|
+
files:
|
58
|
+
- .gitignore
|
59
|
+
- Gemfile
|
60
|
+
- README.md
|
61
|
+
- Rakefile
|
62
|
+
- lib/tweety.rb
|
63
|
+
- lib/tweety/version.rb
|
64
|
+
- tweety.gemspec
|
65
|
+
homepage: http://mattsears.com
|
66
|
+
licenses: []
|
67
|
+
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: "0"
|
85
|
+
requirements: []
|
86
|
+
|
87
|
+
rubyforge_project: tweety
|
88
|
+
rubygems_version: 1.8.10
|
89
|
+
signing_key:
|
90
|
+
specification_version: 3
|
91
|
+
summary: "TweeTY: Possibly the best command line twitter app on the planet"
|
92
|
+
test_files: []
|
93
|
+
|