markdown_datafier 1.0.1 → 1.0.2

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: cde3f4e2699fa8a1e0bb15dd12d6012b1cc83891
4
- data.tar.gz: 63a7eadf7972a49192beef734692711b03339081
3
+ metadata.gz: 987596b618b015006f29436d463283d11a3f9397
4
+ data.tar.gz: 5c36e8e66fcadf5734258e98fd351c14fe450744
5
5
  SHA512:
6
- metadata.gz: 686ef848dd143ba3a2311f4c069997164ac9d0dfc87641afdbc192a71cf34039da69d08b81212efb7e03887ec57695c8b8319f8d62ed9a569661a151f2ec7b2b
7
- data.tar.gz: 3eafeab8de7ccce91f5de2537c0b1382ca29d6403150f8a961ce155bc43de4698b5b5f8a124c7e90edd696e3feb7f310e27e97fd756c87a1cd8107527fd1f617
6
+ metadata.gz: ad7dfefc8bdfe769c038568d321a4dd00038c5a0fd75a54b9e21eb662b172f6b3022652a0734409c80d4a31e8fe577fc89dda23083e195f6cfe50ad5179247d7
7
+ data.tar.gz: a944a3af3307174cc90eab2608b1126ff3f382d70cd327c215fa77bcfc689f2ef5821632422145af9548d8bc309a5ce306032ddee9c0f3e71d21d8ce32557929
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MarkdownDatafier
2
2
 
3
- MarkdownDatafier is a ruby gem which reads a structure of Markdown files, parses their metadata and outputs to a simple hash. It is framework agnostic, configurable to any content and configuration location and easy to plug into your own API endpoints or controller actions.
3
+ MarkdownDatafier is a ruby gem which reads a structure of Markdown files, parses their metadata and outputs to a simple hash or array of hashes. It's framework agnostic, configurable to any content location, and is easy to plug into your own API endpoints or controller actions.
4
4
 
5
5
  MarkdownDatafier was inspired by the NestaCMS framework. But instead of a self-contained CMS, I simply wanted to get data out of a Markdown file structure to be used however I like (direct into Mustache templates via server-side Sinarta or Rails; or via an API endpoint to a javascript framework, iOS/Android app, and so on).
6
6
 
@@ -14,15 +14,20 @@ Add this line to your application's Gemfile:
14
14
 
15
15
  And then execute:
16
16
 
17
- $ bundle
17
+ bundle install
18
18
 
19
19
  Or install it yourself as:
20
20
 
21
- $ gem install markdown_datafier
21
+ gem install markdown_datafier
22
+
23
+
24
+ ## Purpose
25
+
26
+ I've attempted to design this gem to be useful in a few different ways, depending on your needs. In each case, you create a server instance targeted at the content directory of your choosing. However, how you represent your content in Markdown and what you do with the resulting structured data is up to you. For instance, you can set it up so that each page of a website is represented by the structure of your Markdown files and subdirectories (look in /spec/fixtures/server_content/ for an example of this). Or, you could alternatively use each Markdown file to represent persistence of object data (look in /spec/fixtures/instances/ for an example of this), which could then be used to create objects on another class.
22
27
 
23
28
  ## Setup
24
29
 
25
- Create an object, include MarkdownDatafier and set the absolute path to your Markdown files to the @@content_path global variable:
30
+ Create one (or many) Datafier objects by requiring and including MarkdownDatafier for your class:
26
31
 
27
32
  require 'markdown_datafier'
28
33
  class MyDatafier
@@ -30,10 +35,8 @@ Create an object, include MarkdownDatafier and set the absolute path to your Mar
30
35
  end
31
36
 
32
37
  ## Usage
33
-
34
- I've attempting to design this module to be useful in a few different ways, depending on your needs. In each case, you create a server instance targeted at the content directory of your choosing. However, how you design your application to both represent your content in Markdown and what you do with the resulting structured data is up to you. For instance, you can set it up so that each page of a website is represented by the structure of your Markdown files and subdirectories (look in /spec/fixtures/server_content/ for an example of this). Or, you could alternatively use each Markdown file to represent persistence of object data (look in /spec/fixtures/instances/ for an example of this), which could then be used to create objects on another class.
35
38
 
36
- Set up an instance of your server, passing the relative path to your content directory as shown:
39
+ Set up an instance of your server, passing the path to your content directory as shown:
37
40
 
38
41
  server = MyDatafier.new(content_path: "/path/to/content/directory")
39
42
 
@@ -59,7 +62,7 @@ Or a splash page like so:
59
62
 
60
63
  content = server.splash_page
61
64
 
62
- Both the home_page and splash pages work by the naming convention on the root :content_path.
65
+ Both the home_page and splash_page methods work by the file naming convention on the root :content_path.
63
66
 
64
67
  You can also grab a collection of indexes for the top level sections of your content
65
68
 
@@ -69,11 +72,11 @@ Or specify a sub level (for instance by using the "shortname" of previously retr
69
72
 
70
73
  collection = server.indexes_for_sections("/section-two")
71
74
 
72
- Take a look at the file structure in spec/fixtures/content to see how the directory structure and meta data works.
75
+ Take a look at the file structure examples in spec/fixtures/ to see how the directory structure and meta data works. You can pass any fields in the meta data that you like. Many basic ones are assumed and set for you as well.
73
76
 
74
77
  ## Recommendation
75
78
 
76
- This will all work just dandy running as it is in ObjectSpace. However, the intention is that you would use Markdown files to manage your content and its structure, and either use Rake to generate actual HTML files or set up some sort of caching system (clearing and rewriting your cache when content is changed). There's no need to be doing all this parsing overhead with each request to your application.
79
+ This will work just dandy running as it does in Ruby's ObjectSpace. However, the intention is that you would use Markdown files to manage your content and its structure, and either use Rake to generate actual HTML files or set up some sort of caching system (clearing and rewriting your cache when content is changed). There's no need to be doing all this parsing overhead with each request to your application.
77
80
 
78
81
  ## Contributing
79
82
 
@@ -1,3 +1,3 @@
1
1
  module MarkdownDatafier
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
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: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - J. Ryan Williams