markdown_datafier 0.0.3 → 1.0.0
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 +4 -4
- data/lib/markdown_datafier.rb +1 -13
- data/lib/markdown_datafier/version.rb +1 -1
- data/spec/markdown_datafier_spec.rb +10 -6
- metadata +3 -5
- data/spec/fixtures/config/markdown_datafier.yml +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc8799940b1cfb8cdb3c5cd3b86b21afe60737c8
|
4
|
+
data.tar.gz: 23a3ec116b0913d432afbb650779f9f3fe539cbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e29a6e7391bcd2a5a092e06abbd74bdd9c7ea1fc37603f91d03f351987e18b2288e144a2e4ae30e6d0a3be1300cd743964881b6da3c66966d901b2fa87ac6942
|
7
|
+
data.tar.gz: c6ac3ad38dce7163a6abf2b687c6217fe6d8633f4d835ca9e787869422474c934a7f02998c706bcfd99ae41e0846ecad56839c6e480ede6d0f453d48af61a83b
|
data/lib/markdown_datafier.rb
CHANGED
@@ -3,25 +3,13 @@ require "time"
|
|
3
3
|
require "redcarpet"
|
4
4
|
|
5
5
|
module MarkdownDatafier
|
6
|
-
attr_accessor :
|
6
|
+
attr_accessor :content_directory
|
7
7
|
class MetadataParseError < RuntimeError; end
|
8
8
|
|
9
9
|
def self.root
|
10
10
|
File.expand_path '../..', __FILE__
|
11
11
|
end
|
12
12
|
|
13
|
-
def initialize(attributes)
|
14
|
-
set_config_directory(attributes[:config_directory])
|
15
|
-
end
|
16
|
-
|
17
|
-
def set_config_directory(path)
|
18
|
-
@config = YAML.load_file( path + "markdown_datafier.yml")
|
19
|
-
end
|
20
|
-
|
21
|
-
def content_directory
|
22
|
-
@config["content_directory"]
|
23
|
-
end
|
24
|
-
|
25
13
|
def home_page
|
26
14
|
find_by_path("index")
|
27
15
|
end
|
@@ -2,12 +2,16 @@ require_relative 'spec_helper'
|
|
2
2
|
|
3
3
|
describe MarkdownDatafier do
|
4
4
|
|
5
|
-
let(:server) { TestServer.new
|
5
|
+
let(:server) { TestServer.new }
|
6
6
|
|
7
7
|
describe "initialization" do
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
server.content_directory = MarkdownDatafier.root + "/spec/fixtures/content/"
|
11
|
+
end
|
8
12
|
|
9
|
-
it "should
|
10
|
-
expect(server.content_directory).to eq "/
|
13
|
+
it "should set the content_directory" do
|
14
|
+
expect(server.content_directory).to eq MarkdownDatafier.root + "/spec/fixtures/content/"
|
11
15
|
end
|
12
16
|
end
|
13
17
|
|
@@ -15,7 +19,7 @@ describe MarkdownDatafier do
|
|
15
19
|
let(:contents) { File.open(server.content_directory + "test-one.mdown").read }
|
16
20
|
|
17
21
|
before(:each) do
|
18
|
-
server.
|
22
|
+
server.content_directory = MarkdownDatafier.root + "/spec/fixtures/content/"
|
19
23
|
end
|
20
24
|
|
21
25
|
it "should strip leading slashes from shortname" do
|
@@ -96,7 +100,7 @@ describe MarkdownDatafier do
|
|
96
100
|
describe "with existing content" do
|
97
101
|
|
98
102
|
before(:each) do
|
99
|
-
server.
|
103
|
+
server.content_directory = MarkdownDatafier.root + "/spec/fixtures/content/"
|
100
104
|
end
|
101
105
|
|
102
106
|
it "should return the home page content" do
|
@@ -221,7 +225,7 @@ describe MarkdownDatafier do
|
|
221
225
|
describe "with no matching content" do
|
222
226
|
|
223
227
|
before(:each) do
|
224
|
-
server.
|
228
|
+
server.content_directory = MarkdownDatafier.root + "/spec/fixtures/empty/"
|
225
229
|
end
|
226
230
|
|
227
231
|
it "should return nil for find_by_path" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown_datafier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J. Ryan Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|
@@ -82,7 +82,6 @@ files:
|
|
82
82
|
- lib/markdown_datafier.rb
|
83
83
|
- lib/markdown_datafier/version.rb
|
84
84
|
- markdown_datafier.gemspec
|
85
|
-
- spec/fixtures/config/markdown_datafier.yml
|
86
85
|
- spec/fixtures/content/index.mdown
|
87
86
|
- spec/fixtures/content/section-one/index.mdown
|
88
87
|
- spec/fixtures/content/section-one/sub-one-test-one.mdown
|
@@ -115,13 +114,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
114
|
version: '0'
|
116
115
|
requirements: []
|
117
116
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.2.1
|
119
118
|
signing_key:
|
120
119
|
specification_version: 4
|
121
120
|
summary: Reads a structure of Markdown files parses their metadata and outputs to
|
122
121
|
a ruby hash or array of hashes. Easy to plug into your own API endpoints.
|
123
122
|
test_files:
|
124
|
-
- spec/fixtures/config/markdown_datafier.yml
|
125
123
|
- spec/fixtures/content/index.mdown
|
126
124
|
- spec/fixtures/content/section-one/index.mdown
|
127
125
|
- spec/fixtures/content/section-one/sub-one-test-one.mdown
|
@@ -1 +0,0 @@
|
|
1
|
-
content_directory: '/path/to/your/content/'
|