flutterby 0.0.3 → 0.0.4

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: 3142b3b6f9d6284c439ab4f0a05ccba91287c683
4
- data.tar.gz: f70c919e11f47de289c4a44cbfd7ed12a05eea4f
3
+ metadata.gz: 64a9b696e8df3a189602d85625d18e8443c9fc34
4
+ data.tar.gz: bdd0f27e2369cfa721796730a0731c8907729924
5
5
  SHA512:
6
- metadata.gz: 2d053f494c3d78fe79c1dbebf868f8b4a7e06fa9f2ac49b9f4e0ba14f36df9f24799292de616cd7ce588c4e00c1044431a5840830fe6cf5a7c089f784745bd99
7
- data.tar.gz: 7a39b259afd9e2857e60574c34b121baa010dafa1164824f35fe853ee9ddb01cd6818887ee619403c63d950aca2b4c078bab2eaa670d6ddb6eebd1a618329731
6
+ metadata.gz: 8a59e096e19e78c88150a77e69bd3a79e06c1ffaa0a51d99efab9fe623d3e7d0e928814377a25ede59105ab095e29a77b1e0baeb67cb37f9da13cdca14db2506
7
+ data.tar.gz: a0667f74b94ab8a4e71c6d1c197706111a02118277f333e21d49d1203a6486abe6fe688a617062a9ad968899b4af457c2472039a3aee5d45b8841ac99372bbb1
data/README.md CHANGED
@@ -1,37 +1,23 @@
1
1
  # Flutterby
2
2
 
3
- w00h00!
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
- ## Installation
8
+ ## Actual Features
7
9
 
8
- Add this line to your application's Gemfile:
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
- And then execute:
15
+ ## Missing (but Planned) Features
15
16
 
16
- $ bundle
17
-
18
- Or install it yourself as:
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
@@ -38,10 +38,6 @@ module Flutterby
38
38
  end
39
39
  end
40
40
 
41
- def process_filters(input)
42
- input
43
- end
44
-
45
41
  def url
46
42
  @url ||= ::File.join(parent ? parent.url : "/", full_name)
47
43
  end
@@ -37,18 +37,20 @@ module Flutterby
37
37
  data
38
38
  end
39
39
 
40
- def process_filters(input)
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
- input = send(meth, input)
47
+ result = send(meth, result)
46
48
  else
47
49
  puts "Woops, no #{meth} available :("
48
50
  end
49
51
  end
50
52
 
51
- input
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 write_static(path)
107
- rendered = process_filters(@contents)
108
- output = apply_layout? ? apply_layout(rendered) : rendered
108
+ def render(layout: true)
109
+ rendered = filter_contents
110
+ (layout && apply_layout?) ? apply_layout(rendered) : rendered
111
+ end
109
112
 
110
- ::File.write(path, output)
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 = [output]
123
+ res.body = [render]
124
124
  end
125
125
  end
126
126
  end
@@ -21,9 +21,12 @@ module Flutterby
21
21
  end
22
22
  end
23
23
 
24
- def find(name)
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.
@@ -1,3 +1,3 @@
1
1
  module Flutterby
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flutterby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Mans