flutterby 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -26
- data/lib/flutterby/entity.rb +0 -4
- data/lib/flutterby/file.rb +12 -12
- data/lib/flutterby/folder.rb +5 -2
- data/lib/flutterby/version.rb +1 -1
- 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: 64a9b696e8df3a189602d85625d18e8443c9fc34
|
4
|
+
data.tar.gz: bdd0f27e2369cfa721796730a0731c8907729924
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a59e096e19e78c88150a77e69bd3a79e06c1ffaa0a51d99efab9fe623d3e7d0e928814377a25ede59105ab095e29a77b1e0baeb67cb37f9da13cdca14db2506
|
7
|
+
data.tar.gz: a0667f74b94ab8a4e71c6d1c197706111a02118277f333e21d49d1203a6486abe6fe688a617062a9ad968899b4af457c2472039a3aee5d45b8841ac99372bbb1
|
data/README.md
CHANGED
@@ -1,37 +1,23 @@
|
|
1
1
|
# Flutterby
|
2
2
|
|
3
|
-
|
3
|
+
A currently highly experimental static site generator. Yes, there are many like it;
|
4
|
+
but this one is mine. (Actually, there are none like it. Ha! I'm very serious about
|
5
|
+
the _experimental_ bit, though. Use with care, if at all!)
|
4
6
|
|
5
7
|
|
6
|
-
##
|
8
|
+
## Actual Features
|
7
9
|
|
8
|
-
|
10
|
+
- Build your site simply as a tree of files and folders. Each file will be converted according to its extension chain (eg. `styles.css.scss` will be rendered as `styles.css`, `about.html.md` as `about.html` and so on.)
|
11
|
+
- Built-in support for Markdown (by way of [Slodown](https://github.com/hmans/slodown)), [Sass](https://github.com/sass/sass), [ERB](http://ruby-doc.org/stdlib-2.4.0/libdoc/erb/rdoc/ERB.html) and [Slim](http://slim-lang.com/).
|
12
|
+
- A (slow) HTTP server to serve your site dynamically (for development.)
|
9
13
|
|
10
|
-
```ruby
|
11
|
-
gem 'flutterby'
|
12
|
-
```
|
13
14
|
|
14
|
-
|
15
|
+
## Missing (but Planned) Features
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
$ gem install flutterby
|
21
|
-
|
22
|
-
## Usage
|
23
|
-
|
24
|
-
TODO: Write usage instructions here
|
25
|
-
|
26
|
-
## Development
|
27
|
-
|
28
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
29
|
-
|
30
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
|
-
|
32
|
-
## Contributing
|
33
|
-
|
34
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/flutterby.
|
17
|
+
- Extract filters (like Slim, Sass etc.) to separate gems
|
18
|
+
- Customize folder behavior through Ruby
|
19
|
+
- Produce a fun screencast to explain what the heck is going on here!
|
20
|
+
- More tests, of course!
|
35
21
|
|
36
22
|
|
37
23
|
## License
|
data/lib/flutterby/entity.rb
CHANGED
data/lib/flutterby/file.rb
CHANGED
@@ -37,18 +37,20 @@ module Flutterby
|
|
37
37
|
data
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
40
|
+
def filter_contents
|
41
|
+
result = @contents
|
42
|
+
|
41
43
|
# Apply all filters
|
42
44
|
filters.each do |filter|
|
43
45
|
meth = "process_#{filter}"
|
44
46
|
if respond_to?(meth)
|
45
|
-
|
47
|
+
result = send(meth, result)
|
46
48
|
else
|
47
49
|
puts "Woops, no #{meth} available :("
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
51
|
-
|
53
|
+
result
|
52
54
|
end
|
53
55
|
|
54
56
|
def page?
|
@@ -103,24 +105,22 @@ module Flutterby
|
|
103
105
|
page?
|
104
106
|
end
|
105
107
|
|
106
|
-
def
|
107
|
-
rendered =
|
108
|
-
|
108
|
+
def render(layout: true)
|
109
|
+
rendered = filter_contents
|
110
|
+
(layout && apply_layout?) ? apply_layout(rendered) : rendered
|
111
|
+
end
|
109
112
|
|
110
|
-
|
113
|
+
def write_static(path)
|
114
|
+
::File.write(path, render)
|
111
115
|
end
|
112
116
|
|
113
117
|
def serve(parts, req, res)
|
114
|
-
# TODO: DRY this up
|
115
|
-
rendered = process_filters(@contents)
|
116
|
-
output = apply_layout? ? apply_layout(rendered) : rendered
|
117
|
-
|
118
118
|
# Determine MIME type
|
119
119
|
mime_type = MIME::Types.type_for(ext) || "text/plain"
|
120
120
|
|
121
121
|
# Build response
|
122
122
|
res.headers["Content-Type"] = mime_type
|
123
|
-
res.body = [
|
123
|
+
res.body = [render]
|
124
124
|
end
|
125
125
|
end
|
126
126
|
end
|
data/lib/flutterby/folder.rb
CHANGED
@@ -21,9 +21,12 @@ module Flutterby
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def find(
|
24
|
+
def find(path)
|
25
|
+
(name, slash, rest) = path.partition("/")
|
26
|
+
|
25
27
|
name = name.split('.').first
|
26
|
-
@children.find { |c| c.name == name }
|
28
|
+
child = @children.find { |c| c.name == name }
|
29
|
+
rest.empty? ? child : child.find(rest)
|
27
30
|
end
|
28
31
|
|
29
32
|
# Returns all children that will compile to a HTML page.
|
data/lib/flutterby/version.rb
CHANGED