csexton-twitter_archive 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +1 -1
- data/config/test.yml +4 -0
- data/lib/twitter_archive/backends/blogger/base.rb +1 -1
- data/lib/twitter_archive/runner.rb +16 -4
- data/lib/twitter_archive/version.rb +1 -1
- data/spec/backends/blogger_archive_spec.rb +8 -4
- data/tmp/test_yaml_archive.yml +1377 -0
- data/twitter_archive.gemspec +2 -2
- metadata +2 -2
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
@@ -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
|
-
|
19
|
-
|
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
|
@@ -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
|
-
|
16
|
-
|
17
|
-
|
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
|