compostr 0.1.4 → 0.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e0e60c497f1a77185d48809e600c2b4f9436dd5d28304e210826aea0125bd0f
4
- data.tar.gz: 7546b3c8d3b73c5857b4308e40e3105c514fc4e0492dfc3ef21137e3ddecd360
3
+ metadata.gz: 8ebe394c131ac5e4b1a446fd0413783254ab7d907d978afcb32a012b072baaf3
4
+ data.tar.gz: d24824f7b8df8aeb9dbdfab420ad6d496779f8327978791d8726ac0cdbd46fa2
5
5
  SHA512:
6
- metadata.gz: d0e1a47ce967801d01d15a286734bab7fcea7ebb9426eefd9726f969eed7739f048ce6db55c2b0370188c45ad2582a1a22d59f781133aa472fb13d04e7b3d9ca
7
- data.tar.gz: ee7beeb503d4d47d0fd3054ee67ba36be30ff6283e4f31a1e90f09856d62890d38024e16e91f3099f4a5c61f98a8e91f98412fe070ad7d5e2c8a743cf40eb9d2
6
+ metadata.gz: c3134bd3be696c8662f6d69894cd3bdd68da46dda152cc35bc13e10cf0893a7054ddf9b20d63f2fbd20fec60976a85077b5250f25dd9ed99c72616e27d8be9e8
7
+ data.tar.gz: d1b7435b2e816dc05814a3f75a2bc4649c1772be1281e61415d6fba30fad2f9bf62227129f206c6ebcdba3faf12f27aab5eb154d22a38b563e2ad93af518d99f
data/README.md CHANGED
@@ -71,7 +71,10 @@ Global configuration is given in `compostr.conf`, where connection information t
71
71
  password: "buzzword"
72
72
  language_term: "Deutsch"
73
73
  author_id: 1
74
- use_ssl: true
74
+ use_ssl: true
75
+ path: "/blog/xmlrpc.php"
76
+
77
+ Most of the values directly relate to the [RubyPress configuration](https://github.com/zachfeldman/rubypress).
75
78
 
76
79
  ### Logging/Logger
77
80
 
@@ -310,6 +310,7 @@ module Compostr
310
310
  supported_single_fields.include? field_name
311
311
  end
312
312
 
313
+ # Fetched from wordpress/ Post-ID known?
313
314
  def in_wordpress?
314
315
  post_id.to_s != '' && !!post_id
315
316
  end
@@ -88,6 +88,12 @@ module Compostr
88
88
  end
89
89
  end
90
90
 
91
+ def flush
92
+ @name_id_map = nil
93
+ @uuid_id_map = nil
94
+ @full_data = nil
95
+ end
96
+
91
97
  private
92
98
 
93
99
  def get_all_posts
@@ -16,17 +16,20 @@ module Compostr
16
16
  @force = force
17
17
  end
18
18
 
19
- # Updates or creates Custom Post Types Posts.
19
+ # Updates or creates a Custom Post Types Post.
20
20
  #
21
21
  # The post will be identified by uuid (or not).
22
22
  #
23
23
  # new_post_content (a CustomPostType)
24
24
  # The data that **should** be in wordpress (without knowing
25
- # of wordpress post or custom field ids). Usually descendant of CustomPostType.
25
+ # of wordpress post or custom field ids).
26
+ # Usually descendant of Compostr::CustomPostType.
26
27
  #
27
28
  # old_post (a hash)
28
29
  # The data currently available in wordpress (including
29
30
  # wordpress post id, custom field ids).
31
+ #
32
+ # Returns post_id (of WordPress) or nil (if failure).
30
33
  def merge_push new_post, old_post
31
34
  if old_post && old_post.in_wordpress?
32
35
  info "#{new_post.class.name} with UUID #{new_post.uuid} found, updating"
@@ -50,13 +53,14 @@ module Compostr
50
53
  debug "Upload Post ##{new_post.post_id} with wp-content: #{content}"
51
54
 
52
55
  post_id = Compostr::wp.editPost(blog_id: 0,
53
- post_id: new_post.post_id,
54
- content: content)
56
+ post_id: new_post.post_id,
57
+ content: content)
55
58
  if post_id
56
59
  info "#{new_post.class} ##{new_post.post_id} updated"
57
60
  else
58
61
  info "#{new_post.class} ##{new_post.post_id} not updated!"
59
62
  end
63
+ return post_id
60
64
  else
61
65
  # Easy, create new one
62
66
  info "#{new_post.class.name} with UUID #{new_post.uuid} not found, creating"
@@ -77,6 +81,7 @@ module Compostr
77
81
  info "#{new_post.class} not created!"
78
82
  end
79
83
  new_post.post_id = new_post_id
84
+ return new_post_id
80
85
  end
81
86
  end
82
87
 
@@ -1,3 +1,3 @@
1
1
  module Compostr
2
- VERSION = "0.1.4".freeze
2
+ VERSION = "0.1.5".freeze
3
3
  end
data/lib/compostr.rb CHANGED
@@ -37,7 +37,8 @@ module Compostr
37
37
  @wp ||= Rubypress::Client.new(host: config.host,
38
38
  username: config.username,
39
39
  password: config.password,
40
- use_ssl: config.use_ssl)
40
+ use_ssl: config.use_ssl,
41
+ path: config.path || "/xmlrpc.php")
41
42
  end
42
43
 
43
44
  # Access the logger, initialize and memoize it on demand.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compostr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Wolfsteller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-22 00:00:00.000000000 Z
11
+ date: 2018-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubypress