wordpress-xmlrpc 0.0.5 → 0.0.6

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
data/lib/blog.rb CHANGED
@@ -60,14 +60,11 @@ module Wordpress
60
60
 
61
61
  raise ArgumentError, "Image not found (path: #{image[:file_path]})" unless File.exist?(image[:file_path])
62
62
 
63
- image_file = File.open(image[:file_path], "rb")
64
- file_name = File.basename(image_file.path)
65
-
63
+ basename = File.basename(image[:file_path])
66
64
  uploaded_image = upload_file(File.open(image[:file_path], "rb"))
67
65
  raise "Image upload failed" if uploaded_image.nil?
68
-
69
- doc.xpath("img[contains(@src, '#{file_name}')]").each do |img|
70
- img['src'] = uploaded_image['url']
66
+ doc.css("img").each do |img|
67
+ img['src'] = uploaded_image['url'] if img['src'].include?(basename)
71
68
  end
72
69
  end
73
70
  post.content = doc.to_html
data/spec/blog_spec.rb CHANGED
@@ -61,7 +61,7 @@ describe Wordpress::Blog do
61
61
  images = [{:file_path => File.expand_path("./spec/support/files/post_picture.jpg")}]
62
62
  post = Wordpress::Post.new(
63
63
  :title => "Hey ho",
64
- :content => "Content <img src=\"http://otherhost/post_picture.jpg\">",
64
+ :content => "Content <img src=\"http://otherhost/post_picture.jpg?1231231123\">",
65
65
  :excerpt => "Excerpt",
66
66
  :images => images,
67
67
  :publish_date => Date.parse("01.08.2010"))
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wordpress-xmlrpc}
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alexander Naumenko"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordpress-xmlrpc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alexander Naumenko