wp2middleman 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: 6bf5c2076748c910b3515e473912c17758f0be58
4
- data.tar.gz: 45ca770a54f40a300656253b68c0db60ad48e880
3
+ metadata.gz: 8cc3acbccf8275ebe620d3c81d01704a2319c2b5
4
+ data.tar.gz: 0f7a930c5cd6e05dc15d2e2a83f933358d27bc13
5
5
  SHA512:
6
- metadata.gz: 1c4f3e75ba32a0912cbc858b426d87fe580c2a83cf6721acb64913b0aba589819e2fe9d3267f958930794ff8b9325fe68883e087681a564fb0b0a8a97f2cbb14
7
- data.tar.gz: 34571e5da1978978e4e8d04b8aec6f262744d06f7b145b271e89232c987ee7ab2b90f93acab6e2af7e42a27a8c712254b22e910ae73770f028265b54a215be05
6
+ metadata.gz: c97f2977e5a071dfa85994b02a170ae5933957a42a067e419c1536e0b09527207324d71753323573de1b940077e8acf4e548840bf7a8af81f33cb4be5945051c
7
+ data.tar.gz: 340e18061a29b1ec432fe362bc4cecc3cefbbf0f851de6036b7e774d30dbc8c27972ee5a263de884e9f480c9421c9d6429d5f058a486a1f30eb86ac0cfbbc445
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  Gemfile.lock
2
2
  coverage/
3
3
  export/
4
+ pkg
@@ -10,7 +10,7 @@ module WP2Middleman
10
10
  def post_data
11
11
  data = {
12
12
  'title' => post.title,
13
- 'date' => post.date_published,
13
+ 'date' => post.date_time_published,
14
14
  'tags' => post.tags
15
15
  }
16
16
 
@@ -31,4 +31,4 @@ module WP2Middleman
31
31
 
32
32
  attr_reader :post, :include_fields
33
33
  end
34
- end
34
+ end
@@ -13,7 +13,7 @@ module WP2Middleman
13
13
  end
14
14
 
15
15
  def valid?
16
- !(post_date.nil? || title.nil? || date_published.nil? || content.nil?)
16
+ !(post_date.nil? || title.nil? || date_time_published.nil? || content.nil?)
17
17
  end
18
18
 
19
19
  def attachment?
@@ -32,6 +32,10 @@ module WP2Middleman
32
32
  Date.parse(post_date).to_s
33
33
  end
34
34
 
35
+ def date_time_published
36
+ Time.parse(post_date).strftime("%F %T")
37
+ end
38
+
35
39
  def status
36
40
  post.xpath("wp:status").first.inner_text
37
41
  end
@@ -1,3 +1,3 @@
1
1
  module WP2Middleman
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -68,7 +68,7 @@ describe WP2Middleman::CLI do
68
68
  subject(:usage) { cli.usage }
69
69
 
70
70
  it "displays version info, GitHub info, and help" do
71
- expect(cli).to receive(:say).with('wp2middleman 0.0.1')
71
+ expect(cli).to receive(:say).with('wp2middleman 0.0.3')
72
72
  expect(cli).to receive(:say).with('https://github.com/mdb/wp2middleman')
73
73
  expect(cli).to receive(:say).with("\n")
74
74
  expect(cli).to receive(:help)
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe WP2Middleman::Migrator do
4
4
  def post(attributes = {})
5
- defaults = {title: "mytitle", date_published: "mydate", tags: "mytags", published?: false}
5
+ defaults = {title: "mytitle", date_time_published: "mydate", tags: "mytags", published?: false}
6
6
  @post ||= double(defaults.merge attributes)
7
7
  end
8
8
 
@@ -4,6 +4,7 @@ describe WP2Middleman::MiddlemanPost do
4
4
  let(:post_one) { double :post,
5
5
  title: "A Title",
6
6
  date_published: Date.new(2012,6,8).to_s,
7
+ date_time_published: Time.new(2012,6,8,10,11,12).strftime("%F %T"),
7
8
  content: "Paragraph one.\n\n Paragraph two.\n ",
8
9
  tags: [],
9
10
  published?: true
@@ -12,6 +13,7 @@ describe WP2Middleman::MiddlemanPost do
12
13
  let(:post_two) { double :post,
13
14
  title: "A second title",
14
15
  date_published: Date.new(2011,7,25).to_s,
16
+ date_time_published: Time.new(2011,7,25,1,2,3).strftime("%F %T"),
15
17
  content: " <strong>Foo</strong>",
16
18
  tags: ["some_tag", "another tag", "tag"],
17
19
  published?: true
@@ -20,6 +22,7 @@ describe WP2Middleman::MiddlemanPost do
20
22
  let(:post_three) { double :post,
21
23
  title: "A third title: With colon",
22
24
  date_published: Date.new(2011,7,26).to_s,
25
+ date_time_published: Time.new(2011,7,26,4,5,6).strftime("%F %T"),
23
26
  content: "Foo",
24
27
  tags: ["some_tag", "another tag", "tag"],
25
28
  published?: false
@@ -28,6 +31,7 @@ describe WP2Middleman::MiddlemanPost do
28
31
  let(:post_with_iframe) { double :post,
29
32
  title: "A fourth item with iframe and comment",
30
33
  date_published: Date.new(2011,7,26).to_s,
34
+ date_time_published: Time.new(2011,7,26,7,8,9).strftime("%F %T"),
31
35
  content: "Here's a post with an iframe and a comment.\n\n<!--more-->\n\n<iframe width=\"400\" height=\"100\" style=\"position: relative; display: block; width: 400px; height: 100px;\" src=\"http://bandcamp.com/EmbeddedPlayer/v=2/track=833121761/size=venti/bgcol=FFFFFF/linkcol=4285BB/\" allowtransparency=\"true\" frameborder=\"0\"><a href=\"http://dihannmoore.bandcamp.com/track/you-do-it-for-me\">&quot;YOU DO IT FOR ME&quot; by DIHANN MOORE</a></iframe>",
32
36
  tags: ["some_tag", "another tag", "tag"],
33
37
  published?: false
@@ -72,7 +76,7 @@ describe WP2Middleman::MiddlemanPost do
72
76
  post = WP2Middleman::MiddlemanPost.new post_one
73
77
 
74
78
  expect(post.file_content).to eq(
75
- "---\ntitle: A Title\ndate: '2012-06-08'\ntags: []\n---\n\nParagraph one.\n\n Paragraph two.\n \n"
79
+ "---\ntitle: A Title\ndate: '2012-06-08 10:11:12'\ntags: []\n---\n\nParagraph one.\n\n Paragraph two.\n \n"
76
80
  )
77
81
  end
78
82
 
@@ -80,14 +84,14 @@ describe WP2Middleman::MiddlemanPost do
80
84
  post = WP2Middleman::MiddlemanPost.new post_two, body_to_markdown: true
81
85
 
82
86
  expect( post.file_content ).to eq(
83
- "---\ntitle: A second title\ndate: '2011-07-25'\ntags:\n- some_tag\n- another tag\n- tag\n---\n\n**Foo**\n"
87
+ "---\ntitle: A second title\ndate: '2011-07-25 01:02:03'\ntags:\n- some_tag\n- another tag\n- tag\n---\n\n**Foo**\n"
84
88
  )
85
89
  end
86
90
 
87
91
  it "ignores iframe and comment tags when converting to markdown" do
88
92
  post = WP2Middleman::MiddlemanPost.new post_with_iframe, body_to_markdown: true
89
93
 
90
- expect(post.file_content).to eq("---\ntitle: A fourth item with iframe and comment\ndate: '2011-07-26'\ntags:\n- some_tag\n- another tag\n- tag\npublished: false\n---\n\nHere's a post with an iframe and a comment.\n\n\n<!--more-->\n\n\n<iframe width=\"400\" height=\"100\" style=\"position: relative; display: block; width: 400px; height: 100px;\" src=\"http://bandcamp.com/EmbeddedPlayer/v=2/track=833121761/size=venti/bgcol=FFFFFF/linkcol=4285BB/\" allowtransparency=\"true\" frameborder=\"0\"><a href=\"http://dihannmoore.bandcamp.com/track/you-do-it-for-me\">\"YOU DO IT FOR ME\" by DIHANN MOORE</a></iframe>\n")
94
+ expect(post.file_content).to eq("---\ntitle: A fourth item with iframe and comment\ndate: '2011-07-26 07:08:09'\ntags:\n- some_tag\n- another tag\n- tag\npublished: false\n---\n\nHere's a post with an iframe and a comment.\n\n\n<!--more-->\n\n\n<iframe width=\"400\" height=\"100\" style=\"position: relative; display: block; width: 400px; height: 100px;\" src=\"http://bandcamp.com/EmbeddedPlayer/v=2/track=833121761/size=venti/bgcol=FFFFFF/linkcol=4285BB/\" allowtransparency=\"true\" frameborder=\"0\"><a href=\"http://dihannmoore.bandcamp.com/track/you-do-it-for-me\">\"YOU DO IT FOR ME\" by DIHANN MOORE</a></iframe>\n")
91
95
  end
92
96
 
93
97
  it "appends included fields in with frontmatter" do
@@ -95,7 +99,7 @@ describe WP2Middleman::MiddlemanPost do
95
99
  post = WP2Middleman::MiddlemanPost.new post_two, include_fields: ['wp:post_id']
96
100
 
97
101
  expect( post.file_content ).to eq(
98
- "---\ntitle: A second title\ndate: '2011-07-25'\ntags:\n- some_tag\n- another tag\n- tag\nwp:post_id: '209'\n---\n\n <strong>Foo</strong>\n"
102
+ "---\ntitle: A second title\ndate: '2011-07-25 01:02:03'\ntags:\n- some_tag\n- another tag\n- tag\nwp:post_id: '209'\n---\n\n <strong>Foo</strong>\n"
99
103
  )
100
104
  end
101
105
 
@@ -103,7 +107,7 @@ describe WP2Middleman::MiddlemanPost do
103
107
  post = WP2Middleman::MiddlemanPost.new post_three
104
108
 
105
109
  expect( post.file_content ).to eq(
106
- "---\ntitle: 'A third title: With colon'\ndate: '2011-07-26'\ntags:\n- some_tag\n- another tag\n- tag\npublished: false\n---\n\nFoo\n"
110
+ "---\ntitle: 'A third title: With colon'\ndate: '2011-07-26 04:05:06'\ntags:\n- some_tag\n- another tag\n- tag\npublished: false\n---\n\nFoo\n"
107
111
  )
108
112
  end
109
113
 
@@ -28,6 +28,12 @@ describe WP2Middleman::Post do
28
28
  it { is_expected.to eq "2012-06-08" }
29
29
  end
30
30
 
31
+ describe "#date_time_published" do
32
+ subject { post_one.date_time_published }
33
+
34
+ it { is_expected.to eq "2012-06-08 03:21:41" }
35
+ end
36
+
31
37
  describe "#status" do
32
38
  subject { post_three.status }
33
39
 
@@ -72,12 +78,12 @@ describe WP2Middleman::Post do
72
78
  end
73
79
 
74
80
  describe "#valid?" do
75
- def post(post_date: Date.new(2014,2,19), title: "Title", date_published: Date.new(2014,2,19), content: "content")
81
+ def post(post_date: Date.new(2014,2,19), title: "Title", date_time_published: Time.new(2014,2,19,1,2,3), content: "content")
76
82
  post = WP2Middleman::Post.new(double)
77
83
 
78
84
  allow(post).to receive(:post_date) { post_date }
79
85
  allow(post).to receive(:title) { title }
80
- allow(post).to receive(:date_published) { date_published }
86
+ allow(post).to receive(:date_time_published) { date_time_published }
81
87
  allow(post).to receive(:content) { content }
82
88
 
83
89
  post
@@ -96,7 +102,7 @@ describe WP2Middleman::Post do
96
102
  end
97
103
 
98
104
  it "is not valid without a date_published" do
99
- expect(post(date_published: nil)).to_not be_valid
105
+ expect(post(date_time_published: nil)).to_not be_valid
100
106
  end
101
107
 
102
108
  it "is not valid without content" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wp2middleman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Ball
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-10 00:00:00.000000000 Z
11
+ date: 2015-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  version: '0'
166
166
  requirements: []
167
167
  rubyforge_project:
168
- rubygems_version: 2.2.2
168
+ rubygems_version: 2.4.6
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: Migrate Wordpress blog posts to Middleman-style markdown files