webmat-tweet 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/LICENSE +22 -0
  2. data/README.rdoc +16 -0
  3. data/bin/tweet +7 -0
  4. data/lib/tweet.rb +27 -0
  5. data/test/test_helper.rb +2 -0
  6. metadata +66 -0
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2008 James Golick, GiraffeSoft Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,16 @@
1
+ = Tweet
2
+
3
+ This is a CLI for sending tweets to twitter.
4
+
5
+ == Configuration:
6
+
7
+ Add a file at ~/.tweet that contains your tempo credentials in YAML form.
8
+
9
+ i.e.
10
+
11
+ username: james
12
+ password: swordfish
13
+
14
+ == Usage:
15
+
16
+ $ tweet "going to walk the dog"
data/bin/tweet ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ abort("Usage: tweet 'command'") unless ARGV.length >= 1
4
+
5
+ require File.dirname(__FILE__)+'/../lib/tweet'
6
+
7
+ Tweet.create_status(ARGV.join(' '))
data/lib/tweet.rb ADDED
@@ -0,0 +1,27 @@
1
+ $LOAD_PATH << File.dirname(__FILE__)
2
+ require 'rubygems'
3
+ require 'activesupport'
4
+ require 'rest_client'
5
+
6
+ module Tweet
7
+ CONFIG_FILE = ENV['HOME']+'/.tweet'
8
+
9
+ class << self
10
+ attr_accessor :username, :password
11
+
12
+ def create_status(status)
13
+ len = status.length
14
+ abort "Message limit is 140 characters. You currently have #{len}" if len > 140
15
+ get_credentials!
16
+ resource = RestClient::Resource.new 'http://twitter.com/statuses/update.xml', username, password
17
+ resource.post(:status => status, :source => 'tweetgem', :content_type => 'application/xml', :accept => 'application/xml')
18
+ puts "#{len} chars" + (len == 140 ? "!\nYou rock!" : '.')
19
+ end
20
+
21
+ def get_credentials!
22
+ abort "You must create a #{CONFIG_FILE} file to use this CLI." unless File.exist?(CONFIG_FILE)
23
+ config = YAML.load(File.read(CONFIG_FILE)).symbolize_keys
24
+ @username, @password = config[:username], config[:password]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__)+'/../lib/tweet'
2
+ require 'expectations'
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: webmat-tweet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - James Golick
8
+ - Mathieu Martin
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2008-12-19 00:00:00 -08:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: technoweenie-rest-client
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: ""
26
+ email: james@giraffesoft.ca
27
+ executables:
28
+ - tweet
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - lib/tweet.rb
35
+ - bin/tweet
36
+ - README.rdoc
37
+ - LICENSE
38
+ - test/test_helper.rb
39
+ has_rdoc: false
40
+ homepage: http://twitter.com
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ requirements: []
59
+
60
+ rubyforge_project:
61
+ rubygems_version: 1.2.0
62
+ signing_key:
63
+ specification_version: 2
64
+ summary: Update your twitter status from the command line.
65
+ test_files: []
66
+