low_voltage 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -3
- data/lib/low_voltage/post_finder.rb +22 -1
- data/lib/low_voltage/version.rb +1 -1
- data/low_voltage.gemspec +0 -1
- metadata +10 -26
data/README.md
CHANGED
@@ -14,9 +14,20 @@ Add the following line to your Gemfile:
|
|
14
14
|
|
15
15
|
## Basic Usage
|
16
16
|
|
17
|
-
1. Add a directory called `posts`
|
18
|
-
2.
|
19
|
-
|
17
|
+
1. Add a directory called `posts` to your views folder, all your blog posts will go here.
|
18
|
+
2. Publish a new blog post by creating a new markdown file similar to the example below:
|
19
|
+
```
|
20
|
+
---
|
21
|
+
title: Secondary Title
|
22
|
+
date: June 28 2012
|
23
|
+
author: Adam Michel
|
24
|
+
---
|
25
|
+
|
26
|
+
Hello World
|
27
|
+
===========
|
28
|
+
Here is my first post!
|
29
|
+
```
|
30
|
+
3. Run `rails server` and browse to [localhost:3000/blog](http://localhost:3000/blog) to see your new Markdown powered blog.
|
20
31
|
|
21
32
|
## TODO
|
22
33
|
|
@@ -1,5 +1,10 @@
|
|
1
1
|
module LowVoltage
|
2
|
-
class PostFinder
|
2
|
+
class PostFinder
|
3
|
+
VALID_CHARACTERS = "a-zA-Z0-9~!@$%^&*()#`_+-=<>\"{}|[];',?".freeze
|
4
|
+
|
5
|
+
def initialize(post_id)
|
6
|
+
@post_id = post_id
|
7
|
+
end
|
3
8
|
|
4
9
|
def find
|
5
10
|
Rails.root.join("app/views/#{content_path}/#{clean_path}.md")
|
@@ -9,5 +14,21 @@ module LowVoltage
|
|
9
14
|
LowVoltage.configuration.content_path
|
10
15
|
end
|
11
16
|
|
17
|
+
protected
|
18
|
+
|
19
|
+
# The raw page id passed in by the user
|
20
|
+
attr_reader :post_id
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def clean_path
|
25
|
+
path = Pathname.new("/#{clean_id}")
|
26
|
+
path.cleanpath.to_s[1..-1]
|
27
|
+
end
|
28
|
+
|
29
|
+
def clean_id
|
30
|
+
@post_id.tr("^#{VALID_CHARACTERS}", '')
|
31
|
+
end
|
32
|
+
|
12
33
|
end
|
13
34
|
end
|
data/lib/low_voltage/version.rb
CHANGED
data/low_voltage.gemspec
CHANGED
@@ -17,7 +17,6 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
|
-
s.add_dependency("high_voltage", ">= 1.2.0")
|
21
20
|
s.add_dependency("metadown", ">= 1.0.1")
|
22
21
|
s.add_development_dependency("rake")
|
23
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: low_voltage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,56 +9,40 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: high_voltage
|
16
|
-
prerelease: false
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 1.2.0
|
22
|
-
none: false
|
23
|
-
type: :runtime
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
requirements:
|
26
|
-
- - ! '>='
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: 1.2.0
|
29
|
-
none: false
|
30
14
|
- !ruby/object:Gem::Dependency
|
31
15
|
name: metadown
|
32
|
-
prerelease: false
|
33
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
34
18
|
requirements:
|
35
19
|
- - ! '>='
|
36
20
|
- !ruby/object:Gem::Version
|
37
21
|
version: 1.0.1
|
38
|
-
none: false
|
39
22
|
type: :runtime
|
23
|
+
prerelease: false
|
40
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
41
26
|
requirements:
|
42
27
|
- - ! '>='
|
43
28
|
- !ruby/object:Gem::Version
|
44
29
|
version: 1.0.1
|
45
|
-
none: false
|
46
30
|
- !ruby/object:Gem::Dependency
|
47
31
|
name: rake
|
48
|
-
prerelease: false
|
49
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
50
34
|
requirements:
|
51
35
|
- - ! '>='
|
52
36
|
- !ruby/object:Gem::Version
|
53
37
|
version: '0'
|
54
|
-
none: false
|
55
38
|
type: :development
|
39
|
+
prerelease: false
|
56
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
57
42
|
requirements:
|
58
43
|
- - ! '>='
|
59
44
|
- !ruby/object:Gem::Version
|
60
45
|
version: '0'
|
61
|
-
none: false
|
62
46
|
description: Building off High Voltage, Low Voltage allows you to have a file based
|
63
47
|
blog in your Rails app.
|
64
48
|
email:
|
@@ -90,17 +74,17 @@ rdoc_options: []
|
|
90
74
|
require_paths:
|
91
75
|
- lib
|
92
76
|
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
93
78
|
requirements:
|
94
79
|
- - ! '>='
|
95
80
|
- !ruby/object:Gem::Version
|
96
81
|
version: '0'
|
97
|
-
none: false
|
98
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
99
84
|
requirements:
|
100
85
|
- - ! '>='
|
101
86
|
- !ruby/object:Gem::Version
|
102
87
|
version: '0'
|
103
|
-
none: false
|
104
88
|
requirements: []
|
105
89
|
rubyforge_project: low_voltage
|
106
90
|
rubygems_version: 1.8.24
|