fb_video_url_converter 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG.rdoc +2 -0
- data/Rakefile +1 -1
- data/fb_video_url_converter.gemspec +1 -1
- data/lib/facebook_bot.rb +6 -2
- data/spec/facebook_bot_spec.rb +11 -1
- data/spec/spec_helper.rb +1 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('fb_video_url_converter', '0.1.
|
5
|
+
Echoe.new('fb_video_url_converter', '0.1.8') do |p|
|
6
6
|
p.description = "Facebook Video URL Converter is intended as an easy alternative to changing video hosting from Facebook to a different one."
|
7
7
|
p.url = "https://github.com/mensfeld/FB-Video-URL-Converter"
|
8
8
|
p.author = "Maciej Mensfeld"
|
data/lib/facebook_bot.rb
CHANGED
@@ -15,11 +15,13 @@ end
|
|
15
15
|
class FacebookBot
|
16
16
|
|
17
17
|
# Probably wrong login || password
|
18
|
-
class LoginFailed
|
18
|
+
class LoginFailed < StandardError; end
|
19
|
+
class CookiePathNotInitialized < StandardError; end
|
19
20
|
|
20
21
|
class << self
|
21
22
|
attr_accessor :email
|
22
23
|
attr_accessor :password
|
24
|
+
attr_accessor :cookie_path
|
23
25
|
end
|
24
26
|
|
25
27
|
FB_URL = "http://www.facebook.com/"
|
@@ -35,7 +37,9 @@ class FacebookBot
|
|
35
37
|
begin
|
36
38
|
@@root = File.join(Rails.root, 'tmp')
|
37
39
|
rescue
|
38
|
-
|
40
|
+
raise CookiePathNotInitialized, 'Specify cookie_path' if self.class.cookie_path.nil?
|
41
|
+
# @@root = File.expand_path(File.dirname(__FILE__))
|
42
|
+
@@root = self.class.cookie_path
|
39
43
|
end
|
40
44
|
|
41
45
|
@cookies = File.join(@@root, "cookie_#{self.class.email}.yml")
|
data/spec/facebook_bot_spec.rb
CHANGED
@@ -5,7 +5,7 @@ ROOT = File.expand_path(File.dirname(__FILE__))
|
|
5
5
|
|
6
6
|
def remove_cookie
|
7
7
|
c_p = File.join(ROOT, '..', 'lib', "cookie_#{FacebookBot.email}.yml")
|
8
|
-
FileUtils.rm( c_p ) if File.file?( c_p )
|
8
|
+
#FileUtils.rm( c_p ) if File.file?( c_p )
|
9
9
|
end
|
10
10
|
|
11
11
|
describe FacebookBot do
|
@@ -29,6 +29,16 @@ describe FacebookBot do
|
|
29
29
|
subject.email = l
|
30
30
|
end
|
31
31
|
end
|
32
|
+
|
33
|
+
|
34
|
+
context "and we don't specify cookie path" do
|
35
|
+
it "should throw failed exception" do
|
36
|
+
l = subject.cookie_path
|
37
|
+
subject.cookie_path = nil
|
38
|
+
lambda { subject.new }.should raise_error(subject::CookiePathNotInitialized, 'Specify cookie_path')
|
39
|
+
subject.cookie_path = l
|
40
|
+
end
|
41
|
+
end
|
32
42
|
end
|
33
43
|
|
34
44
|
context "when we are logged in" do
|
data/spec/spec_helper.rb
CHANGED
@@ -25,6 +25,7 @@ require 'fileutils'
|
|
25
25
|
|
26
26
|
FacebookBot.email = 'email'
|
27
27
|
FacebookBot.password = 'password'
|
28
|
+
FacebookBot.cookie_path = File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib')
|
28
29
|
FacebookVideo.cache = 60*10
|
29
30
|
|
30
31
|
ActiveRecord::Base.establish_connection(
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|