twitterpunch 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c881f24bd1e7cc981175e5f5fb52f80a7725e12f
4
- data.tar.gz: 7516403fe3be89a85cf8ac0a11427857a28119a7
3
+ metadata.gz: 7cb13b290389bd6f3b20b57181852594cf5bfcd0
4
+ data.tar.gz: a23c5888916326fd00d7e5bf21d30659b43d9358
5
5
  SHA512:
6
- metadata.gz: 2e2a4303a64a59f3cee1c582b74706fdbff6f7095ea60b3b4adcbc2c3c85c404f384f07d1b94e7c9abaed2c6ee340f2dcd1f8292ccbc67602b7f19e58110ebe1
7
- data.tar.gz: 6c147d09131b4393231a97d531fe029fa3101299aff4e0dc154c3223c49b9407f684020559bd1102d1f0ebbb48f7faa8a111661da831ad1045d96197b7c1b420
6
+ metadata.gz: 1c47fa244a2615e42532731e7a5c56076ca4b885058bf66613e2836d86150684d960fcb9f8ffb1add623aea146e3f458b6b2696519b8206981c7f9327eccb939
7
+ data.tar.gz: 5e7893d78b0c84c6d804e5d091996edb3b689a306a2e48ade06a51379e56190be1a7f2a97d082b5282b62af10df0861922cce21808a763b0ecfa47b1cfef6b3d
@@ -12,19 +12,19 @@ configfile = File.expand_path('~/.twitterpunch.yaml')
12
12
  config = YAML.load_file(configfile) rescue {}
13
13
 
14
14
  optparse = OptionParser.new { |opts|
15
- opts.banner = "Usage : twitterpunch [--debug] [--stream] [--install] [--version] [filename]
15
+ opts.banner = "Usage : twitterpunch [options] [filename]
16
16
 
17
17
  Twitterpunch is designed to work with PhotoBooth and OS X Folder Actions.
18
18
  When this script is called with the name of an image file, it will post the
19
19
  image to Twitter, along with a randomly chosen message and a hashtag.
20
20
 
21
21
  If you call the script with the --stream argument instead, it will listen
22
- for tweets to that hashtag and download them to a specified directory. If
23
- the tweet came from another user, Twitterpunch will speak it aloud.
22
+ for tweets to that hashtag and display them in a slideshow. If the tweet
23
+ came from another user, Twitterpunch will speak it aloud.
24
24
 
25
25
  "
26
26
 
27
- opts.on("-d", "--debug", "Choose an alternate provisioning backend.") do
27
+ opts.on("-d", "--debug", "Display extra debugging information.") do
28
28
  config[:debug] = true
29
29
  end
30
30
 
@@ -32,11 +32,15 @@ optparse = OptionParser.new { |opts|
32
32
  config[:action] = :stream
33
33
  end
34
34
 
35
- opts.on("--view", "Run photo viewer only.") do
35
+ opts.on("--view", "Run photo slideshow viewer only.") do
36
36
  config[:action] = :view
37
37
  end
38
38
 
39
- opts.on("-g", "--genconfig", "Create a default configuration file.") do
39
+ opts.on("-a", "--authorize", "Authorize Twitterpunch with Twitter and write out a configuration file.") do
40
+ config[:action] = :configure
41
+ end
42
+ opts.on("-g", "--genconfig", "Deprecated config generation. Use --authorize instead.") do
43
+ puts 'NOTICE: [-g|--genconfig\ are deprecated. Please use --authorize instead'
40
44
  config[:action] = :configure
41
45
  end
42
46
 
@@ -1,3 +1,7 @@
1
1
  module Twitterpunch
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
+
4
+ # Twitter application credentials
5
+ API_KEY = 'STurW17Tj7HuoZ7dSzS0uSoIP'
6
+ API_SECRET = 'wTCOhbc2BDAWULHEILaBuXKoEMjbhTOhl0edPIxlTP6bUkie3C'
3
7
  end
@@ -8,17 +8,9 @@ module Twitterpunch
8
8
  def initialize(file)
9
9
  @configfile = file
10
10
 
11
- puts "Set up your application at https://twitter.com/apps/"
12
- puts "then enter your 'Consumer key' and 'Consumer secret':"
13
-
14
- print "Consumer key: "
15
- @consumer_key = STDIN.readline.chomp
16
- print "Consumer secret: "
17
- @consumer_secret = STDIN.readline.chomp
18
-
19
11
  consumer = OAuth::Consumer.new(
20
- @consumer_key,
21
- @consumer_secret,
12
+ Twitterpunch::API_KEY,
13
+ Twitterpunch::API_SECRET,
22
14
  {
23
15
  :site => 'https://api.twitter.com/',
24
16
  :scheme => :header,
@@ -26,7 +18,8 @@ module Twitterpunch
26
18
 
27
19
  request_token = consumer.get_request_token
28
20
 
29
- puts "Visit #{request_token.authorize_url} in your browser to authorize the app"
21
+ puts 'Please authorize Twitterpunch to post to your Twitter account.'
22
+ puts "Visit #{request_token.authorize_url} in your browser."
30
23
  # if we're on a Mac, open the page automatically
31
24
  system("open #{request_token.authorize_url} 2>/dev/null")
32
25
 
@@ -40,10 +33,10 @@ module Twitterpunch
40
33
  config = YAML.load_file(@configfile) rescue defaults
41
34
 
42
35
  config[:twitter] = {
43
- :consumer_key => "#{@consumer_key}",
44
- :consumer_secret => "#{@consumer_secret}",
45
- :access_token => "#{@access_token.token}",
46
- :access_token_secret => "#{@access_token.secret}"
36
+ :consumer_key => Twitterpunch::API_KEY,
37
+ :consumer_secret => Twitterpunch::API_SECRET,
38
+ :access_token => @access_token.token,
39
+ :access_token_secret => @access_token.secret
47
40
  }
48
41
 
49
42
  File.open(@configfile, 'w') {|f| f.write(config.to_yaml) }
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'yaml'
3
3
  require 'twitter'
4
- require "net/http"
4
+ require 'net/http'
5
5
 
6
6
  require 'twitterpunch/logger'
7
7
 
@@ -9,11 +9,20 @@ module Twitterpunch
9
9
  class Streamer
10
10
  def initialize(config)
11
11
  @config = config
12
+ @viewer = config[:display]
12
13
  @client = Twitter::Streaming::Client.new(config[:twitter])
13
14
  @logger = Twitterpunch::Logger.new(config)
14
15
  @output = File.expand_path(config[:photodir])
15
- @handle = Twitter::REST::Client.new(config[:twitter]).current_user.screen_name
16
- @viewer = config[:display]
16
+
17
+ begin
18
+ @handle = Twitter::REST::Client.new(config[:twitter]).current_user.screen_name
19
+ rescue Twitter::Error => e
20
+ puts "Cannot retrieve Twitter username."
21
+ puts "It's likely that you're on Windows and your SSL environment isn't complete"
22
+ puts "Download http://curl.haxx.se/ca/cacert.pem and set the environment variable"
23
+ puts "SSL_CERT_FILE to point to it."
24
+ puts e.message
25
+ end
17
26
 
18
27
  FileUtils.mkdir_p(@output) unless File.directory?(@output)
19
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitterpunch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Ford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-01 00:00:00.000000000 Z
11
+ date: 2014-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: twitter
@@ -131,13 +131,13 @@ files:
131
131
  - LICENSE
132
132
  - README.md
133
133
  - bin/twitterpunch
134
- - lib/twitterpunch.rb
135
134
  - lib/twitterpunch/configuration.rb
136
135
  - lib/twitterpunch/logger.rb
137
136
  - lib/twitterpunch/poster.rb
138
137
  - lib/twitterpunch/sprite.rb
139
138
  - lib/twitterpunch/streamer.rb
140
139
  - lib/twitterpunch/viewer.rb
140
+ - lib/twitterpunch.rb
141
141
  - resources/Tahoma Bold.ttf
142
142
  - resources/Twitterpunch.workflow/Contents/Info.plist
143
143
  - resources/Twitterpunch.workflow/Contents/QuickLook/Thumbnail.png
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  requirements: []
174
174
  rubyforge_project:
175
- rubygems_version: 2.2.2
175
+ rubygems_version: 2.0.14
176
176
  signing_key:
177
177
  specification_version: 4
178
178
  summary: A simple tool to automate the posting and streaming of PhotoBooth shots over