wp_wrapper 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wp_wrapper/client.rb +10 -7
- data/lib/wp_wrapper/modules/authorization.rb +3 -2
- data/lib/wp_wrapper.rb +4 -2
- data/wp_wrapper.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b9e21959217ff182e62ebba47888d528feea4af
|
4
|
+
data.tar.gz: f397526568234c292637a38f62d0df031f19db34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23de8f530654fa563368dbdc12765c1fdab9bd62b44f206aeada12ecc483db98932a771a4714402ccef732d6a858189f76ddea0933edcab8b9d18b539c6f9c3f
|
7
|
+
data.tar.gz: a6ac0a6480b5f272b8162a527a43e6c638048f42649605d35b2a4de4cee4730eb61bc7961e4f19b952d98c3459061ea03c02bae5b79b1c1cdd92f584c3d96075
|
data/lib/wp_wrapper/client.rb
CHANGED
@@ -3,19 +3,22 @@ module WpWrapper
|
|
3
3
|
attr_accessor :url, :username, :password
|
4
4
|
attr_accessor :environment, :logged_in
|
5
5
|
attr_accessor :http_client, :mechanize_client
|
6
|
+
attr_accessor :reraise_exceptions
|
6
7
|
|
7
8
|
def initialize(options = {})
|
8
9
|
options.symbolize_keys! if options.respond_to?(:symbolize_keys!)
|
9
10
|
|
10
|
-
self.url
|
11
|
-
self.url
|
11
|
+
self.url = options.fetch(:url, nil)
|
12
|
+
self.url = "#{self.url}/" unless self.url.nil? || self.url =~ /\/$/i
|
12
13
|
|
13
|
-
self.username
|
14
|
-
self.password
|
15
|
-
self.logged_in
|
14
|
+
self.username = options.fetch(:username, nil)
|
15
|
+
self.password = options.fetch(:password, nil)
|
16
|
+
self.logged_in = false
|
16
17
|
|
17
|
-
self.http_client
|
18
|
-
self.mechanize_client
|
18
|
+
self.http_client = HttpUtilities::Http::Client.new
|
19
|
+
self.mechanize_client = HttpUtilities::Http::Mechanize::Client.new
|
20
|
+
|
21
|
+
self.reraise_exceptions = options.fetch(:reraise_exceptions, false)
|
19
22
|
end
|
20
23
|
|
21
24
|
include WpWrapper::Modules::Authorization
|
@@ -27,12 +27,13 @@ module WpWrapper
|
|
27
27
|
|
28
28
|
rescue Exception => e
|
29
29
|
puts "#{Time.now}: Url: #{self.url}. Failed to login. Error Class: #{e.class.name}. Error Message: #{e.message}"
|
30
|
-
login(retries - 1) if
|
30
|
+
login(retries - 1) if retries > 0
|
31
|
+
raise WpWrapper::FailedLoginException, "Failed to login" if retries <= 0 && self.reraise_exceptions
|
31
32
|
end
|
32
33
|
|
33
34
|
else
|
34
35
|
puts "\n\n#{Time.now}: Url: #{self.url}. Something's broken! Can't find wp-admin login form! Retrying...\n\n"
|
35
|
-
login(retries - 1) if
|
36
|
+
login(retries - 1) if retries > 0
|
36
37
|
end
|
37
38
|
end
|
38
39
|
end
|
data/lib/wp_wrapper.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
module WpWrapper
|
2
|
-
VERSION = "0.0.
|
2
|
+
VERSION = "0.0.4"
|
3
3
|
|
4
4
|
require File.join(File.dirname(__FILE__), 'wp_wrapper/railtie') if defined?(Rails)
|
5
|
-
|
5
|
+
|
6
|
+
require File.join(File.dirname(__FILE__), 'wp_wrapper/exceptions')
|
7
|
+
|
6
8
|
require File.join(File.dirname(__FILE__), 'wp_wrapper/modules/authorization')
|
7
9
|
require File.join(File.dirname(__FILE__), 'wp_wrapper/modules/setup')
|
8
10
|
require File.join(File.dirname(__FILE__), 'wp_wrapper/modules/upgrade')
|
data/wp_wrapper.gemspec
CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
|
4
4
|
|
5
5
|
s.name = 'wp_wrapper'
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.4'
|
7
7
|
|
8
8
|
s.homepage = "http://github.com/Agiley/wp_wrapper"
|
9
9
|
s.email = "sebastian@agiley.se"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wp_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Johnsson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|