flue 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +9 -0
- data/TODO.txt +7 -0
- data/bin/flue +5 -0
- data/flue.gemspec +30 -0
- data/lib/flue.rb +10 -0
- data/lib/flue/basefile.rb +54 -0
- data/lib/flue/benchmark.rb +16 -0
- data/lib/flue/content_filter.rb +87 -0
- data/lib/flue/filter_register.rb +28 -0
- data/lib/flue/init.rb +11 -0
- data/lib/flue/logger.rb +26 -0
- data/lib/flue/partial_file.rb +21 -0
- data/lib/flue/runner.rb +30 -0
- data/lib/flue/version.rb +3 -0
- data/spec/basefile_spec.rb +59 -0
- data/spec/content_filter_spec.rb +101 -0
- data/spec/filter_register_spec.rb +18 -0
- data/spec/logger_spec.rb +17 -0
- data/spec/partial_file_spec.rb +12 -0
- data/spec/test_helper.rb +14 -0
- metadata +258 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Scott Windsor
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Flue
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'flue'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install flue
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/TODO.txt
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
* Add logging object so we don't have to rely on puts [done]
|
2
|
+
* Set up data loader for .yml files / bind to erb [done]
|
3
|
+
* Rename the bastard [done]
|
4
|
+
* Set up other bound variables for .yml files (sass/coffescript?)
|
5
|
+
* Set up default filters via final ext
|
6
|
+
* Add publishers for s3/ftp/rsync
|
7
|
+
* Add config for site/public
|
data/bin/flue
ADDED
data/flue.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'flue/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "flue"
|
8
|
+
gem.version = Flue::VERSION
|
9
|
+
gem.authors = ["Scott Windsor"]
|
10
|
+
gem.email = ["swindsor@gmail.com"]
|
11
|
+
gem.description = %q{A static site generator}
|
12
|
+
gem.summary = %q{An AMAZING static site generator}
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/).reject{|f| f =~ /example/ }
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
gem.add_dependency 'rake'
|
20
|
+
gem.add_dependency 'maruku'
|
21
|
+
gem.add_dependency 'RedCloth'
|
22
|
+
gem.add_dependency 'gemoji'
|
23
|
+
gem.add_dependency 'sass'
|
24
|
+
gem.add_dependency 'coffee-script'
|
25
|
+
gem.add_dependency 'nokogiri'
|
26
|
+
gem.add_dependency 'coderay'
|
27
|
+
gem.add_dependency 'rack'
|
28
|
+
gem.add_development_dependency 'minitest'
|
29
|
+
gem.add_development_dependency 'simplecov'
|
30
|
+
end
|
data/lib/flue.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
|
3
|
+
module Flue
|
4
|
+
class Basefile
|
5
|
+
attr_reader :filename, :options
|
6
|
+
|
7
|
+
def initialize(filename, options={})
|
8
|
+
@filename = filename
|
9
|
+
@options = options
|
10
|
+
end
|
11
|
+
|
12
|
+
def parts
|
13
|
+
basename.split(".")
|
14
|
+
end
|
15
|
+
|
16
|
+
def dirname
|
17
|
+
File.dirname filename
|
18
|
+
end
|
19
|
+
|
20
|
+
def basename
|
21
|
+
File.basename filename
|
22
|
+
end
|
23
|
+
|
24
|
+
def exts
|
25
|
+
parts[1..-2]
|
26
|
+
end
|
27
|
+
|
28
|
+
def outfile_basename
|
29
|
+
[parts[0], parts[-1]].join(".")
|
30
|
+
end
|
31
|
+
|
32
|
+
def outfile_name
|
33
|
+
["_site", outfile_basename].join("/")
|
34
|
+
end
|
35
|
+
|
36
|
+
def datafile_basename
|
37
|
+
[parts[0], "yml"].join(".")
|
38
|
+
end
|
39
|
+
|
40
|
+
def datafile_name
|
41
|
+
[dirname, datafile_basename].join("/")
|
42
|
+
end
|
43
|
+
|
44
|
+
def datafile
|
45
|
+
if File.exists? datafile_name
|
46
|
+
File.read(datafile_name)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def content
|
51
|
+
File.read(filename)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require "erb"
|
2
|
+
require "fileutils"
|
3
|
+
require "maruku"
|
4
|
+
require "redcloth"
|
5
|
+
require "gemoji"
|
6
|
+
require "sass"
|
7
|
+
require "coffee-script"
|
8
|
+
require "nokogiri"
|
9
|
+
require "coderay"
|
10
|
+
|
11
|
+
module Flue
|
12
|
+
class MarkdownFilter
|
13
|
+
def call(input, options={})
|
14
|
+
maruku = Maruku.new(input)
|
15
|
+
if options[:partial]
|
16
|
+
maruku.to_html
|
17
|
+
else
|
18
|
+
maruku.to_html_document
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class TextileFilter
|
24
|
+
def call(input, options={})
|
25
|
+
RedCloth.new(input).to_html
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class ERBFilter
|
30
|
+
include Flue::Logger
|
31
|
+
include Flue::Benchmark
|
32
|
+
|
33
|
+
def call(input, options={})
|
34
|
+
if options[:variables]
|
35
|
+
options[:variables].each do |name,value|
|
36
|
+
instance_variable_set("@#{name.to_s}", value)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
ERB.new(input).result(binding)
|
40
|
+
end
|
41
|
+
|
42
|
+
def partial(name)
|
43
|
+
partialfile = PartialFile.new(name)
|
44
|
+
benchmark "#{partialfile.basename} => partial" do
|
45
|
+
call( FilterRegister.run(partialfile.exts, partialfile.content, :partial => true) )
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class EmojiFilter
|
51
|
+
def call(input, options={})
|
52
|
+
input.gsub(/:([a-z0-9\+\-_]+):/) do |match|
|
53
|
+
if Emoji.names.include?($1)
|
54
|
+
FileUtils.mkdir_p "_site/images/emoji"
|
55
|
+
FileUtils.cp "#{Emoji.images_path}/emoji/#{$1}.png", "_site/images/emoji/#{$1}.png"
|
56
|
+
'<img alt="' + $1 + '" height="20" src="images/' + "emoji/#{$1}.png" + '" style="vertical-align:middle" width="20" />'
|
57
|
+
else
|
58
|
+
match
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class CodeFilter
|
65
|
+
def call(input, options={})
|
66
|
+
doc = Nokogiri::HTML::DocumentFragment.parse(input)
|
67
|
+
doc.css('code').each do |code|
|
68
|
+
language = code["data-language"] || "ruby"
|
69
|
+
code.replace(CodeRay.scan(code.content, language.to_sym).div)
|
70
|
+
end
|
71
|
+
doc.to_html
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class SassFilter
|
76
|
+
def call(input, options={})
|
77
|
+
engine = Sass::Engine.new(input, :syntax => :scss)
|
78
|
+
engine.render
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class CoffeeScriptFilter
|
83
|
+
def call(input, options={})
|
84
|
+
CoffeeScript.compile(input)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Flue
|
2
|
+
class FilterRegister
|
3
|
+
@@filters = {}
|
4
|
+
|
5
|
+
def self.filters
|
6
|
+
@@filters
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.register(ext, filter)
|
10
|
+
filters[ext.to_s] = filter
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.run(exts, content, options={})
|
14
|
+
f = exts.pop
|
15
|
+
return content unless f
|
16
|
+
result = run_ext(f, content, options)
|
17
|
+
run(exts,result, options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.run_ext(ext,content, options)
|
21
|
+
if filters[ext]
|
22
|
+
filters[ext].new.call(content, options)
|
23
|
+
else
|
24
|
+
content
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/flue/init.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
module Flue
|
2
|
+
|
3
|
+
FilterRegister.register :erb, ERBFilter
|
4
|
+
FilterRegister.register :md, MarkdownFilter
|
5
|
+
FilterRegister.register :textile, TextileFilter
|
6
|
+
FilterRegister.register :emoji, EmojiFilter
|
7
|
+
FilterRegister.register :code, CodeFilter
|
8
|
+
FilterRegister.register :scss, SassFilter
|
9
|
+
FilterRegister.register :coffee, CoffeeScriptFilter
|
10
|
+
|
11
|
+
end
|
data/lib/flue/logger.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module Flue
|
4
|
+
module Logger
|
5
|
+
DEFAULT_LOGGER = ::Logger.new($stdout)
|
6
|
+
|
7
|
+
def self.included(base)
|
8
|
+
base.extend ClassMethods
|
9
|
+
end
|
10
|
+
|
11
|
+
def logger
|
12
|
+
self.class.logger || DEFAULT_LOGGER
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
def logger
|
17
|
+
@logger
|
18
|
+
end
|
19
|
+
|
20
|
+
def logger=(new_logger)
|
21
|
+
@logger = new_logger
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
|
3
|
+
module Flue
|
4
|
+
class PartialFile
|
5
|
+
extend Forwardable
|
6
|
+
attr_reader :name
|
7
|
+
def_delegators :basefile, :basename, :exts, :content
|
8
|
+
|
9
|
+
def initialize(name)
|
10
|
+
@name = name
|
11
|
+
end
|
12
|
+
|
13
|
+
def partial_filename
|
14
|
+
Dir[File.join(["site", "_#{name.to_s}"]) + "*"].first
|
15
|
+
end
|
16
|
+
|
17
|
+
def basefile
|
18
|
+
Basefile.new(partial_filename, :partial => true)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/flue/runner.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require "yaml"
|
3
|
+
|
4
|
+
module Flue
|
5
|
+
class Runner
|
6
|
+
include Flue::Benchmark
|
7
|
+
include Flue::Logger
|
8
|
+
|
9
|
+
def files
|
10
|
+
Dir["site/[^_]*"] - Dir["site/*.yml"]
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
logger.info "beginning run..."
|
15
|
+
files.each do |file|
|
16
|
+
basefile = Basefile.new(file)
|
17
|
+
File.open(basefile.outfile_name, "w") do |f|
|
18
|
+
benchmark "#{basefile.basename} => #{basefile.outfile_name}" do
|
19
|
+
options = {}
|
20
|
+
data = basefile.datafile
|
21
|
+
if data
|
22
|
+
options[:variables] = YAML.load(data)
|
23
|
+
end
|
24
|
+
f.write FilterRegister.run(basefile.exts, basefile.content, options)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/flue/version.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require "./spec/test_helper.rb"
|
2
|
+
|
3
|
+
describe Basefile do
|
4
|
+
let(:md_erb) do
|
5
|
+
Basefile.new("site/test.md.erb.html")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should have basename" do
|
9
|
+
md_erb.basename.must_equal "test.md.erb.html"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have parts" do
|
13
|
+
md_erb.parts.must_equal ["test","md","erb", "html"]
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have exts" do
|
17
|
+
md_erb.exts.must_equal ["md","erb"]
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have dirname" do
|
21
|
+
md_erb.dirname.must_equal "site"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have outfile_basename" do
|
25
|
+
md_erb.outfile_basename.must_equal "test.html"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should have outfile_name" do
|
29
|
+
md_erb.outfile_name.must_equal "_site/test.html"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should read basefile" do
|
33
|
+
test_content = "test content"
|
34
|
+
File.stub :read, test_content do
|
35
|
+
md_erb.content.must_equal test_content
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should have a datafile_name" do
|
40
|
+
md_erb.datafile_name.must_equal "site/test.yml"
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should have a datafile_name" do
|
44
|
+
test_data = "test data"
|
45
|
+
File.stub :exists?, true do
|
46
|
+
File.stub :read, test_data do
|
47
|
+
md_erb.datafile.must_equal test_data
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should not have test data when file does not exist" do
|
53
|
+
File.stub :exists?, false do
|
54
|
+
md_erb.datafile.must_equal nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require "./spec/test_helper.rb"
|
2
|
+
|
3
|
+
describe MarkdownFilter do
|
4
|
+
it "should filter markdown" do
|
5
|
+
MarkdownFilter.new.call("# Foo").must_equal (<<-eos
|
6
|
+
<?xml version=\"1.0\" encoding=\"utf-8\"?>
|
7
|
+
<!DOCTYPE html PUBLIC
|
8
|
+
\"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN\"
|
9
|
+
\"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd\">
|
10
|
+
<html xml:lang='en' xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/1999/xhtml'>
|
11
|
+
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>Foo</title></head>
|
12
|
+
<body>
|
13
|
+
<h1 id='foo'>Foo</h1>
|
14
|
+
</body></html>
|
15
|
+
eos
|
16
|
+
).chomp
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should filter markdown partial" do
|
20
|
+
MarkdownFilter.new.call("# Foo", :partial => true).must_equal "<h1 id='foo'>Foo</h1>"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe TextileFilter do
|
25
|
+
it "should filter textile" do
|
26
|
+
TextileFilter.new.call("h1. Just a test").must_equal "<h1>Just a test</h1>"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe ERBFilter do
|
31
|
+
it "should filter erb" do
|
32
|
+
ERBFilter.new.call("<p><%= 1 + 2 %></p>").must_equal "<p>3</p>"
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should filter erb with variables" do
|
36
|
+
ERBFilter.new.call("<p><%= @a + @b %></p>", :variables => {:a => 1, :b => 2}).must_equal "<p>3</p>"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should filter erb with partial" do
|
40
|
+
basefile = MiniTest::Mock.new
|
41
|
+
basefile.expect :exts, []
|
42
|
+
basefile.expect :content, "test"
|
43
|
+
basefile.expect :basename, "_test.html"
|
44
|
+
logger = MiniTest::Mock.new
|
45
|
+
logger.expect :info, true, [/_test\.html => partial/]
|
46
|
+
Dir.stub :[], ["test"] do
|
47
|
+
Basefile.stub :new, basefile do
|
48
|
+
FilterRegister.stub :run, "<p>This is a test</p>" do
|
49
|
+
erb_filter = ERBFilter.new
|
50
|
+
erb_filter.stub :logger, logger do
|
51
|
+
erb_filter.call("<%= partial :test %>").must_equal "<p>This is a test</p>"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe EmojiFilter do
|
60
|
+
it "should filter emoji" do
|
61
|
+
FileUtils.stub :mkdir_p, true do
|
62
|
+
FileUtils.stub :cp, true do
|
63
|
+
EmojiFilter.new.call(":poop:").must_equal '<img alt="poop" height="20" src="images/emoji/poop.png" style="vertical-align:middle" width="20" />'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should not filter invalid emoji names" do
|
69
|
+
EmojiFilter.new.call(":unicornsprinkles:").must_equal ":unicornsprinkles:"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe CodeFilter do
|
74
|
+
it "should filter code" do
|
75
|
+
CodeFilter.new.call("<code>puts 'hi'</code>").must_equal <<-eos
|
76
|
+
<div class="CodeRay">
|
77
|
+
<div class="code"><pre>puts <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">'</span><span style="color:#D20">hi</span><span style="color:#710">'</span></span></pre></div>
|
78
|
+
</div>
|
79
|
+
eos
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe SassFilter do
|
84
|
+
it "should filter sass" do
|
85
|
+
SassFilter.new.call("table.h1{ td.ln { font: { color: red; } } }").must_equal "table.h1 td.ln {\n font-color: red; }\n"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe CoffeeScriptFilter do
|
90
|
+
it "should filter coffeescript" do
|
91
|
+
CoffeeScriptFilter.new.call("number = 42").must_equal (<<-eos
|
92
|
+
(function() {
|
93
|
+
var number;
|
94
|
+
|
95
|
+
number = 42;
|
96
|
+
|
97
|
+
}).call(this);
|
98
|
+
eos
|
99
|
+
)
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "./spec/test_helper.rb"
|
2
|
+
|
3
|
+
describe FilterRegister do
|
4
|
+
class MockFilter
|
5
|
+
def call(input,options={})
|
6
|
+
"mock"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should run registered filters" do
|
11
|
+
FilterRegister.register :mock, MockFilter
|
12
|
+
FilterRegister.run(["mock"], "test").must_equal "mock"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should echo unregistered filters" do
|
16
|
+
FilterRegister.run(["notavailable"], "test").must_equal "test"
|
17
|
+
end
|
18
|
+
end
|
data/spec/logger_spec.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require "./spec/test_helper.rb"
|
2
|
+
|
3
|
+
describe Logger do
|
4
|
+
class Foo
|
5
|
+
include Flue::Logger
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:custom_logger) do
|
9
|
+
MiniTest::Mock.new
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should be able to set a custom logger" do
|
13
|
+
custom_logger.expect :info, true, ["test"]
|
14
|
+
Foo.logger = custom_logger
|
15
|
+
Foo.new.logger.info "test"
|
16
|
+
end
|
17
|
+
end
|
data/spec/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,258 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flue
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Scott Windsor
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: maruku
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: RedCloth
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: gemoji
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: sass
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: coffee-script
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: nokogiri
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: coderay
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :runtime
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: rack
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :runtime
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: minitest
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: simplecov
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
description: A static site generator
|
191
|
+
email:
|
192
|
+
- swindsor@gmail.com
|
193
|
+
executables:
|
194
|
+
- flue
|
195
|
+
extensions: []
|
196
|
+
extra_rdoc_files: []
|
197
|
+
files:
|
198
|
+
- .gitignore
|
199
|
+
- Gemfile
|
200
|
+
- LICENSE.txt
|
201
|
+
- README.md
|
202
|
+
- Rakefile
|
203
|
+
- TODO.txt
|
204
|
+
- bin/flue
|
205
|
+
- flue.gemspec
|
206
|
+
- lib/flue.rb
|
207
|
+
- lib/flue/basefile.rb
|
208
|
+
- lib/flue/benchmark.rb
|
209
|
+
- lib/flue/content_filter.rb
|
210
|
+
- lib/flue/filter_register.rb
|
211
|
+
- lib/flue/init.rb
|
212
|
+
- lib/flue/logger.rb
|
213
|
+
- lib/flue/partial_file.rb
|
214
|
+
- lib/flue/runner.rb
|
215
|
+
- lib/flue/version.rb
|
216
|
+
- spec/basefile_spec.rb
|
217
|
+
- spec/content_filter_spec.rb
|
218
|
+
- spec/filter_register_spec.rb
|
219
|
+
- spec/logger_spec.rb
|
220
|
+
- spec/partial_file_spec.rb
|
221
|
+
- spec/test_helper.rb
|
222
|
+
homepage: ''
|
223
|
+
licenses: []
|
224
|
+
post_install_message:
|
225
|
+
rdoc_options: []
|
226
|
+
require_paths:
|
227
|
+
- lib
|
228
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
229
|
+
none: false
|
230
|
+
requirements:
|
231
|
+
- - ! '>='
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: '0'
|
234
|
+
segments:
|
235
|
+
- 0
|
236
|
+
hash: 291351673547993666
|
237
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
238
|
+
none: false
|
239
|
+
requirements:
|
240
|
+
- - ! '>='
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '0'
|
243
|
+
segments:
|
244
|
+
- 0
|
245
|
+
hash: 291351673547993666
|
246
|
+
requirements: []
|
247
|
+
rubyforge_project:
|
248
|
+
rubygems_version: 1.8.24
|
249
|
+
signing_key:
|
250
|
+
specification_version: 3
|
251
|
+
summary: An AMAZING static site generator
|
252
|
+
test_files:
|
253
|
+
- spec/basefile_spec.rb
|
254
|
+
- spec/content_filter_spec.rb
|
255
|
+
- spec/filter_register_spec.rb
|
256
|
+
- spec/logger_spec.rb
|
257
|
+
- spec/partial_file_spec.rb
|
258
|
+
- spec/test_helper.rb
|