twat 0.4.10 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source :rubygems
2
2
 
3
3
  gem "twitter"
4
4
  gem "oauth"
5
+ gem "rack", '1.3.3'
data/TODO CHANGED
@@ -9,6 +9,9 @@ Refactor tweet printing code, unify throughout
9
9
  TODO
10
10
  ====
11
11
 
12
+ Output needs to live in it's own gem (since evidently more of these
13
+ tools will be written soon)
14
+
12
15
  (which carries with it warnings if it's too short.. which means a warn
13
16
  method.. which means abstracting it's output..)
14
17
 
@@ -16,3 +19,12 @@ On the upside, it'll make unit testing similar.
16
19
  (Add unit tests)
17
20
 
18
21
  Split config and options out into submodules
22
+
23
+ Wrap all of the exception handling into a submodule, ie
24
+ with_handled_exceptions do
25
+ <perform actions assuming everything went well>
26
+ end
27
+
28
+ (With handled exceptions contains the logic for yelling at the user for
29
+ being stupid, etc)
30
+
data/lib/twat.rb CHANGED
@@ -45,7 +45,7 @@ end
45
45
  module Twat
46
46
  VERSION_MAJOR = 0
47
47
  VERSION_MINOR = 4
48
- VERSION_PATCH = 10
48
+ VERSION_PATCH = 11
49
49
 
50
50
  VERSION = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_PATCH}"
51
51
  class Twat
@@ -85,6 +85,8 @@ module Twat
85
85
  puts "Invalid value, must be an integer"
86
86
  rescue Errno::ECONNRESET
87
87
  puts "Connection was reset by third party."
88
+ rescue TweetTooLong
89
+ puts "Twitter enforces a maximum status length of 140 characters"
88
90
  end
89
91
  end
90
92
  end
data/lib/twat/actions.rb CHANGED
@@ -8,6 +8,8 @@ module Twat
8
8
  def tweet
9
9
  twitter_auth
10
10
 
11
+ raise TweetTooLong if opts.msg.length > 140
12
+
11
13
  Twitter.update(opts.msg)
12
14
  #puts opts.msg
13
15
  end
@@ -10,4 +10,5 @@ module Twat
10
10
  class InvalidSetOpt < Exception; end
11
11
  class InvalidBool < Exception; end
12
12
  class InvalidInt < Exception; end
13
+ class TweetTooLong < Exception; end
13
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.4.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: twitter
16
- requirement: &16294500 !ruby/object:Gem::Requirement
16
+ requirement: &22683660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16294500
24
+ version_requirements: *22683660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: oauth
27
- requirement: &16294000 !ruby/object:Gem::Requirement
27
+ requirement: &22683160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *16294000
35
+ version_requirements: *22683160
36
36
  description: Command line tool for tweeting and whatnot
37
37
  email:
38
38
  - richo@psych0tik.net