tweetlr 0.0.4 → 0.0.5

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.
Files changed (5) hide show
  1. data/README.md +4 -2
  2. data/Rakefile +1 -1
  3. data/bin/tweetlr +19 -18
  4. data/lib/tweetlr.rb +1 -1
  5. metadata +2 -2
data/README.md CHANGED
@@ -27,9 +27,11 @@ It's essential that you have a directory called `config` in the directory you ar
27
27
 
28
28
  ## Usage
29
29
 
30
- Make sure you put the configuration file in it's proper place as mentiones above, then:
30
+ Make sure you put the configuration file in it's proper place as mentioned above, then:
31
31
 
32
32
  start/stop tweetlr using `tweetlr start`/`tweetlr stop`. Run `tweetlr` without arguments for a list of options concerning the daemon's options.
33
33
 
34
- enjoy!
34
+ For further details on the configuration part, check out the [tweetlr_demo](http://github.com/5v3n/tweetlr_demo).
35
+
36
+ Enjoy!
35
37
 
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/testtask'
7
7
 
8
8
  spec = Gem::Specification.new do |s|
9
9
  s.name = 'tweetlr'
10
- s.version = '0.0.4'
10
+ s.version = '0.0.5'
11
11
  s.has_rdoc = true
12
12
  s.extra_rdoc_files = ['README.md', 'LICENSE']
13
13
  s.summary = 'an unholy alliance between twitter and tumblr'
data/bin/tweetlr CHANGED
@@ -8,40 +8,41 @@ require_relative '../lib/tweetlr.rb'
8
8
 
9
9
  begin
10
10
  config_file = File.join( Dir.pwd, 'config', 'tweetlr.yml')
11
+ @log_file = File.join( Dir.pwd, 'tweetlr.log')
11
12
  CONFIG = YAML.load_file(config_file)
12
13
  TERM = CONFIG['search_term']
13
14
  USER = CONFIG['tumblr_username']
14
15
  PW = CONFIG['tumblr_password']
15
16
  TIMESTAMP = CONFIG['twitter_timestamp']
16
17
  UPDATE_PERIOD = CONFIG['update_period']
18
+ @tweetlr = Tweetlr.new(USER, PW, nil, TIMESTAMP, TERM, config_file)
17
19
  rescue SystemCallError
18
20
  $stderr.puts "Ooops - looks like there is no ./config/tweetlr.yml found. I'm affraid tweetlr won't work properly until you introduced that configuration file."
19
21
  exit(1)
20
22
  end
21
23
 
22
24
  Daemons.run_proc('tweetlr') do
23
- @log = Logger.new('tweetlr.log')
25
+ @log = Logger.new(@log_file)
24
26
  @log.info('starting tweetlr daemon...')
25
- @log.info "createing a new tweetlr instance using this config: #{CONFIG.inspect}"
27
+ @log.info "creating a new tweetlr instance using this config: #{CONFIG.inspect}"
26
28
  EventMachine::run {
27
- tweetlr = Tweetlr.new(USER, PW, nil, TIMESTAMP, TERM, config_file)
28
- EventMachine::add_periodic_timer( UPDATE_PERIOD ) {
29
- @log.info('starting tweetlr crawl...')
30
- response = tweetlr.lazy_search_twitter
31
- tweets = response.parsed_response['results']
32
- if tweets
33
- tweets.each do |tweet|
34
- tumblr_post = tweetlr.generate_tumblr_photo_post tweet
35
- if tumblr_post.nil? || tumblr_post[:source].nil?
36
- @log.error "could not get image source: #{tumblr_post.inspect}"
37
- else
38
- @log.debug tumblr_post
39
- @log.debug tweetlr.post_to_tumblr tumblr_post
40
- end
29
+ EventMachine::add_periodic_timer( UPDATE_PERIOD ) {
30
+ @log.info('starting tweetlr crawl...')
31
+ response = @tweetlr.lazy_search_twitter
32
+ tweets = response.parsed_response['results']
33
+ if tweets
34
+ tweets.each do |tweet|
35
+ tumblr_post = @tweetlr.generate_tumblr_photo_post tweet
36
+ if tumblr_post.nil? || tumblr_post[:source].nil?
37
+ @log.error "could not get image source: #{tumblr_post.inspect}"
38
+ else
39
+ @log.debug tumblr_post
40
+ @log.debug @tweetlr.post_to_tumblr tumblr_post
41
41
  end
42
42
  end
43
- @log.info('finished tweetlr crawl.')
44
- }
43
+ end
44
+ @log.info('finished tweetlr crawl.')
45
+ }
45
46
  }
46
47
 
47
48
  end
data/lib/tweetlr.rb CHANGED
@@ -8,7 +8,7 @@ class Tweetlr
8
8
  GENERATOR = %{tweetlr - http://github.com/5v3n/tweetlr}
9
9
 
10
10
  def initialize(email, password, cookie=nil, since_id=nil, term=nil, config_file) #TODO use a hash or sth more elegant here...
11
- @log = Logger.new('tweetlr.log')
11
+ @log = Logger.new(File.join( Dir.pwd, 'tweetlr.log'))
12
12
  config = YAML.load_file(config_file)
13
13
  @results_per_page = config['results_per_page']
14
14
  @result_type = config['result_type']
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: tweetlr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sven Kraeuter
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-23 00:00:00 Z
13
+ date: 2011-04-25 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: daemons