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 CHANGED
Binary file
@@ -1,3 +1,5 @@
1
+ = Version 0.1.8
2
+ * Allowing to specify different cookie_path store place
1
3
  = Version 0.1.7
2
4
  * Fix for not loggin attemp
3
5
  = Version 0.1.6
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.7') do |p|
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"
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{fb_video_url_converter}
5
- s.version = "0.1.7"
5
+ s.version = "0.1.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Maciej Mensfeld"]
@@ -15,11 +15,13 @@ end
15
15
  class FacebookBot
16
16
 
17
17
  # Probably wrong login || password
18
- class LoginFailed < StandardError; end
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
- @@root = File.expand_path(File.dirname(__FILE__))
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")
@@ -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
@@ -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
@@ -2,7 +2,7 @@
2
2
  name: fb_video_url_converter
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.7
5
+ version: 0.1.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Maciej Mensfeld
metadata.gz.sig CHANGED
Binary file