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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17c1b340350863507e6a37b71a4dd2977d1326dd
4
- data.tar.gz: e07fb668ce3e2c98b685a3daa9e9ef1e17a29b74
3
+ metadata.gz: 0b43240079e6305af5cf47b1b329d8b0b304f12f
4
+ data.tar.gz: 42a81e32f4d165ef72cf581afc0c7211cfe623f5
5
5
  SHA512:
6
- metadata.gz: 19a1e8b30d5f7b735dc6e2cfe0e2e9337e88fd5774bb452bd6983f95576456df89cb6a7d663ad9aeae9edb32360d6064623dd603fc0939d32e80cfa5a5e9ab5c
7
- data.tar.gz: 8e20e55d7b2b955154dc4a8fcf74d261f35da161e015c790368b9c3505b41401e3d35bb0b65dcf7478312caa023093cdee89ebc6b5c4fbcd9d163a78ef3e43c2
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
@@ -1,3 +1,3 @@
1
1
  module MarkdownDatafier
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -50,9 +50,13 @@ module MarkdownDatafier
50
50
  end
51
51
 
52
52
  def find_by_path(shortname)
53
- path = determine_file_path(content_directory + strip_leading_slashes(shortname))
54
- content = "Shortname: #{shortname}\nCreate Datetime: #{File.ctime(path)}\n" + File.open(path).read
55
- parse_file_content(content)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_datafier
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
  - J. Ryan Williams