giraffesoft-tweet 0.0.1

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 +24 -0
  5. data/test/test_helper.rb +2 -0
  6. metadata +65 -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.
@@ -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"
@@ -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.first)
@@ -0,0 +1,24 @@
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
+ get_credentials!
14
+ resource = RestClient::Resource.new 'http://twitter.com/statuses/update.xml', username, password
15
+ resource.post(:status => status, :content_type => 'application/xml', :accept => 'application/xml')
16
+ end
17
+
18
+ def get_credentials!
19
+ abort "You must create a #{CONFIG_FILE} file to use this CLI." unless File.exist?(CONFIG_FILE)
20
+ config = YAML.load(File.read(CONFIG_FILE)).symbolize_keys
21
+ @username, @password = config[:username], config[:password]
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__)+'/../lib/tweet'
2
+ require 'expectations'
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: giraffesoft-tweet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - James Golick
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-07-28 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: technoweenie-rest-client
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ version:
24
+ description: ""
25
+ email: james@giraffesoft.ca
26
+ executables:
27
+ - tweet
28
+ extensions: []
29
+
30
+ extra_rdoc_files: []
31
+
32
+ files:
33
+ - lib/tweet.rb
34
+ - bin/tweet
35
+ - README.rdoc
36
+ - LICENSE
37
+ - test/test_helper.rb
38
+ has_rdoc: false
39
+ homepage: http://twitter.com
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.2.0
61
+ signing_key:
62
+ specification_version: 2
63
+ summary: Update your twitter status from the command line.
64
+ test_files: []
65
+