csexton-twitter_archive 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.
data/Manifest CHANGED
@@ -2,7 +2,6 @@ bin/twitter_archive
2
2
  config/example.yml
3
3
  config/test.yml
4
4
  History
5
- joe
6
5
  lib/twitter_archive/backends/blogger/base.rb
7
6
  lib/twitter_archive/backends/blogger/blogger.rb
8
7
  lib/twitter_archive/backends/blogger/post_body.html.erb
@@ -24,6 +23,7 @@ script/generate
24
23
  spec/backends/blogger_archive_spec.rb
25
24
  spec/backends/yaml_archive_spec.rb
26
25
  spec/fixtures/blogger_authenticate_response.yml
26
+ spec/fixtures/blogger_post_response.yml
27
27
  spec/fixtures/twitter_response.yml
28
28
  spec/spec.opts
29
29
  spec/spec_helper.rb
data/config/test.yml CHANGED
@@ -3,4 +3,8 @@ accounts:
3
3
  - name: fuzzymonk
4
4
  - name: jnunemaker
5
5
  backend: yaml
6
+ blogger_pass: secret
7
+ blogger_title: Twitter
8
+ blogger_user: blogger@example.user
9
+ blogger_id: 1234567890123456789
6
10
 
@@ -56,7 +56,7 @@ module GData
56
56
  end
57
57
 
58
58
  def post(path, entry)
59
- http.post(path, entry, @headers)
59
+ ret = http.post(path, entry, @headers)
60
60
  end
61
61
 
62
62
  def put(path, entry)
@@ -10,13 +10,20 @@ end
10
10
  module TwitterArchive
11
11
  class Runner
12
12
  def self.runner
13
- ta = TwitterArchive::Base.new
14
- ta.load_config
13
+ @ta = TwitterArchive::Base.new
15
14
 
16
15
  parse_options
17
16
 
18
- puts ta.get_latest
19
- ta.save_config
17
+ unless File.exists? @ta.config_file
18
+ puts "Not config file found at '#{@ta.config_file}'"
19
+ puts "See 'twitter_archive --help' for more details"
20
+ exit
21
+ end
22
+
23
+ @ta.load_config
24
+
25
+ puts @ta.get_latest
26
+ @ta.save_config
20
27
  end
21
28
 
22
29
  def self.parse_options
@@ -45,6 +52,11 @@ module TwitterArchive
45
52
  end
46
53
  exit
47
54
  end
55
+ opts.on('-cFILE', '--config FILE') do |file|
56
+ @ta.config_file = file
57
+ puts "Config file: #{file}"
58
+ exit
59
+ end
48
60
 
49
61
  end.parse!
50
62
  end
@@ -1,3 +1,3 @@
1
1
  module TwitterArchive
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -8,13 +8,14 @@ describe TwitterArchive::Backends::BloggerArchive do
8
8
 
9
9
  before(:each) do
10
10
  @ba = TwitterArchive::Backends::BloggerArchive.new
11
- @config = YAML::load_file(ENV['HOME'] + '/.twitter_archive.yml')
12
11
  @twitter_response = YAML::load_file File.dirname(__FILE__) +'/../fixtures/twitter_response.yml'
13
12
 
14
13
  if(ENV['TEST_BLOGGER'])
15
- Net::HTTPS.stub!(:post_form).and_return(YAML::load_file(
16
- File.dirname(__FILE__) + '/../../fixtures/blogger_authenticate_response.yml'))
17
- GData
14
+ @config = YAML::load_file(ENV['HOME'] + '/.twitter_archive.yml')
15
+ GData::Base.stub!(:authenticate).and_return(YAML::load_file(
16
+ File.dirname(__FILE__) + '/../fixtures/blogger_authenticate_response.yml'))
17
+ else
18
+ @config = YAML::load_file(File.dirname(__FILE__) + '/../../config/test.yml')
18
19
  end
19
20
 
20
21
  end
@@ -24,6 +25,9 @@ describe TwitterArchive::Backends::BloggerArchive do
24
25
  end
25
26
 
26
27
  it "should test post to blogger" do
28
+ GData::Base.stub!(:post).and_return(YAML::load_file(
29
+ File.dirname(__FILE__) + '/../fixtures/blogger_authenticate_response.yml'))
30
+
27
31
  @config['blogger_title'] = "Testing twitter_archive"
28
32
  @ba.archive(@twitter_response['results'], @config)
29
33
  end