markdown_datafier 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 +4 -4
- data/README.md +2 -0
- data/lib/markdown_datafier/version.rb +1 -1
- data/lib/markdown_datafier.rb +7 -3
- data/spec/markdown_datafier_spec.rb +19 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b43240079e6305af5cf47b1b329d8b0b304f12f
|
4
|
+
data.tar.gz: 42a81e32f4d165ef72cf581afc0c7211cfe623f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72a2b266c64e5c1855884fcb4c3ebafe349902e93dcf0221ecfd84fde591df8eaf40e243feb8a886c1a5e497c02b3405ef11213783576ffb7809723f1fe98326
|
7
|
+
data.tar.gz: 14cbd76373d4875c168564d08a7196db60420a2924d8c3d999350a7fce642eb723d6633a8fbb8a91b89675e56fcf49309c3529240c73ec48654b1460cc783c3b
|
data/README.md
CHANGED
@@ -41,6 +41,8 @@ Files are accessed individually by their "shortname" (the file name path inside
|
|
41
41
|
|
42
42
|
content = server.find_by_path(some-existing-file)
|
43
43
|
|
44
|
+
Nil is returned for non-matching requests.
|
45
|
+
|
44
46
|
You can also get the home page like so:
|
45
47
|
|
46
48
|
content = server.home_page
|
data/lib/markdown_datafier.rb
CHANGED
@@ -50,9 +50,13 @@ module MarkdownDatafier
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def find_by_path(shortname)
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
begin
|
54
|
+
path = determine_file_path(content_directory + strip_leading_slashes(shortname))
|
55
|
+
content = "Shortname: #{shortname}\nCreate Datetime: #{File.ctime(path)}\n" + File.open(path).read
|
56
|
+
parse_file_content(content)
|
57
|
+
rescue
|
58
|
+
nil
|
59
|
+
end
|
56
60
|
end
|
57
61
|
|
58
62
|
def strip_leading_slashes(shortname)
|
@@ -218,6 +218,25 @@ describe MarkdownDatafier do
|
|
218
218
|
|
219
219
|
end
|
220
220
|
end
|
221
|
+
describe "with no matching content" do
|
222
|
+
|
223
|
+
before(:each) do
|
224
|
+
server.config["content_directory"] = MarkdownDatafier.root + "/spec/fixtures/empty/"
|
225
|
+
end
|
226
|
+
|
227
|
+
it "should return nil for find_by_path" do
|
228
|
+
expect(server.find_by_path("ragamuffin")).to be_nil
|
229
|
+
end
|
230
|
+
|
231
|
+
it "should return nil for home page" do
|
232
|
+
expect(server.home_page).to be_nil
|
233
|
+
end
|
234
|
+
|
235
|
+
it "should return nil for splash page" do
|
236
|
+
expect(server.splash_page).to be_nil
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|
221
240
|
|
222
241
|
|
223
242
|
describe ".root" do
|