nanoc3 3.2.0a3 → 3.2.0a4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/LICENSE +1 -1
- data/NEWS.md +23 -4
- data/README.md +7 -0
- data/lib/nanoc3/base/compilation/checksum_store.rb +17 -90
- data/lib/nanoc3/base/compilation/compiled_content_cache.rb +5 -0
- data/lib/nanoc3/base/compilation/compiler.rb +112 -175
- data/lib/nanoc3/base/compilation/compiler_dsl.rb +54 -11
- data/lib/nanoc3/base/compilation/dependency_tracker.rb +32 -65
- data/lib/nanoc3/base/compilation/filter.rb +4 -3
- data/lib/nanoc3/base/compilation/item_rep_proxy.rb +19 -4
- data/lib/nanoc3/base/compilation/item_rep_recorder_proxy.rb +90 -0
- data/lib/nanoc3/base/compilation/outdatedness_checker.rb +152 -15
- data/lib/nanoc3/base/compilation/outdatedness_reasons.rb +12 -9
- data/lib/nanoc3/base/compilation/rule.rb +3 -1
- data/lib/nanoc3/base/compilation/rule_memory_calculator.rb +42 -0
- data/lib/nanoc3/base/compilation/rule_memory_store.rb +53 -0
- data/lib/nanoc3/base/compilation/rules_collection.rb +205 -0
- data/lib/nanoc3/base/core_ext/array.rb +20 -0
- data/lib/nanoc3/base/core_ext/hash.rb +30 -0
- data/lib/nanoc3/base/core_ext/pathname.rb +26 -0
- data/lib/nanoc3/base/core_ext/string.rb +12 -0
- data/lib/nanoc3/base/core_ext.rb +1 -0
- data/lib/nanoc3/base/directed_graph.rb +11 -3
- data/lib/nanoc3/base/errors.rb +0 -4
- data/lib/nanoc3/base/memoization.rb +72 -0
- data/lib/nanoc3/base/result_data/item_rep.rb +64 -25
- data/lib/nanoc3/base/source_data/code_snippet.rb +9 -0
- data/lib/nanoc3/base/source_data/configuration.rb +20 -0
- data/lib/nanoc3/base/source_data/item.rb +29 -4
- data/lib/nanoc3/base/source_data/layout.rb +20 -1
- data/lib/nanoc3/base/source_data/site.rb +49 -26
- data/lib/nanoc3/base/store.rb +10 -1
- data/lib/nanoc3/base.rb +6 -1
- data/lib/nanoc3/cli/base.rb +20 -7
- data/lib/nanoc3/cli/commands/compile.rb +0 -2
- data/lib/nanoc3/cli/commands/create_site.rb +16 -7
- data/lib/nanoc3/cli/commands/debug.rb +3 -3
- data/lib/nanoc3/cli/commands/view.rb +1 -0
- data/lib/nanoc3/cli/commands/watch.rb +2 -1
- data/lib/nanoc3/data_sources/deprecated/delicious.rb +0 -2
- data/lib/nanoc3/data_sources/deprecated/last_fm.rb +0 -2
- data/lib/nanoc3/data_sources/deprecated/twitter.rb +0 -2
- data/lib/nanoc3/data_sources/filesystem.rb +17 -3
- data/lib/nanoc3/data_sources/filesystem_unified.rb +17 -17
- data/lib/nanoc3/extra/auto_compiler.rb +5 -1
- data/lib/nanoc3/extra/core_ext/time.rb +1 -1
- data/lib/nanoc3/extra/file_proxy.rb +11 -1
- data/lib/nanoc3/extra/validators/links.rb +1 -1
- data/lib/nanoc3/filters/asciidoc.rb +3 -3
- data/lib/nanoc3/filters/colorize_syntax.rb +106 -27
- data/lib/nanoc3/filters/erb.rb +16 -6
- data/lib/nanoc3/filters/erubis.rb +5 -1
- data/lib/nanoc3/filters/haml.rb +2 -1
- data/lib/nanoc3/filters/less.rb +3 -6
- data/lib/nanoc3/filters/mustache.rb +3 -0
- data/lib/nanoc3/filters/redcarpet.rb +27 -0
- data/lib/nanoc3/filters/sass.rb +1 -5
- data/lib/nanoc3/filters/slim.rb +25 -0
- data/lib/nanoc3/filters/typogruby.rb +23 -0
- data/lib/nanoc3/filters.rb +6 -0
- data/lib/nanoc3/helpers/blogging.rb +22 -26
- data/lib/nanoc3/helpers/rendering.rb +1 -1
- data/lib/nanoc3/helpers/xml_sitemap.rb +11 -2
- data/lib/nanoc3.rb +24 -3
- data/nanoc3.gemspec +4 -3
- data/tasks/clean.rake +11 -0
- data/tasks/doc.rake +14 -0
- data/tasks/test.rake +38 -0
- data/test/base/core_ext/array_spec.rb +55 -0
- data/test/base/core_ext/hash_spec.rb +82 -0
- data/test/base/core_ext/pathname_spec.rb +29 -0
- data/test/base/core_ext/string_spec.rb +39 -0
- data/test/base/test_checksum_store.rb +37 -0
- data/test/base/test_code_snippet.rb +33 -0
- data/test/base/test_compiler.rb +303 -0
- data/test/base/test_compiler_dsl.rb +156 -0
- data/test/base/test_context.rb +33 -0
- data/test/base/test_data_source.rb +48 -0
- data/test/base/test_dependency_tracker.rb +264 -0
- data/test/base/test_directed_graph.rb +285 -0
- data/test/base/test_filter.rb +85 -0
- data/test/base/test_item.rb +164 -0
- data/test/base/test_item_rep.rb +555 -0
- data/test/base/test_layout.rb +44 -0
- data/test/base/test_memoization.rb +53 -0
- data/test/base/test_notification_center.rb +36 -0
- data/test/base/test_outdatedness_checker.rb +365 -0
- data/test/base/test_plugin.rb +32 -0
- data/test/base/test_rule.rb +21 -0
- data/test/base/test_rule_context.rb +67 -0
- data/test/base/test_site.rb +144 -0
- data/test/cli/commands/test_compile.rb +12 -0
- data/test/cli/commands/test_create_item.rb +12 -0
- data/test/cli/commands/test_create_layout.rb +28 -0
- data/test/cli/commands/test_create_site.rb +24 -0
- data/test/cli/commands/test_help.rb +12 -0
- data/test/cli/commands/test_info.rb +12 -0
- data/test/cli/commands/test_update.rb +12 -0
- data/test/cli/test_logger.rb +12 -0
- data/test/data_sources/test_filesystem.rb +420 -0
- data/test/data_sources/test_filesystem_unified.rb +562 -0
- data/test/data_sources/test_filesystem_verbose.rb +359 -0
- data/test/extra/core_ext/test_enumerable.rb +32 -0
- data/test/extra/core_ext/test_time.rb +17 -0
- data/test/extra/deployers/test_rsync.rb +234 -0
- data/test/extra/test_auto_compiler.rb +417 -0
- data/test/extra/test_file_proxy.rb +21 -0
- data/test/extra/test_vcs.rb +24 -0
- data/test/extra/validators/test_links.rb +53 -0
- data/test/extra/validators/test_w3c.rb +49 -0
- data/test/filters/test_asciidoc.rb +22 -0
- data/test/filters/test_bluecloth.rb +20 -0
- data/test/filters/test_coderay.rb +46 -0
- data/test/filters/test_colorize_syntax.rb +149 -0
- data/test/filters/test_erb.rb +101 -0
- data/test/filters/test_erubis.rb +72 -0
- data/test/filters/test_haml.rb +98 -0
- data/test/filters/test_kramdown.rb +20 -0
- data/test/filters/test_less.rb +59 -0
- data/test/filters/test_markaby.rb +26 -0
- data/test/filters/test_maruku.rb +20 -0
- data/test/filters/test_mustache.rb +27 -0
- data/test/filters/test_rainpress.rb +31 -0
- data/test/filters/test_rdiscount.rb +33 -0
- data/test/filters/test_rdoc.rb +18 -0
- data/test/filters/test_redcarpet.rb +63 -0
- data/test/filters/test_redcloth.rb +35 -0
- data/test/filters/test_relativize_paths.rb +231 -0
- data/test/filters/test_rubypants.rb +20 -0
- data/test/filters/test_sass.rb +103 -0
- data/test/filters/test_slim.rb +37 -0
- data/test/filters/test_typogruby.rb +23 -0
- data/test/helper.rb +161 -0
- data/test/helpers/test_blogging.rb +756 -0
- data/test/helpers/test_breadcrumbs.rb +83 -0
- data/test/helpers/test_capturing.rb +43 -0
- data/test/helpers/test_filtering.rb +108 -0
- data/test/helpers/test_html_escape.rb +34 -0
- data/test/helpers/test_link_to.rb +251 -0
- data/test/helpers/test_rendering.rb +90 -0
- data/test/helpers/test_tagging.rb +89 -0
- data/test/helpers/test_text.rb +26 -0
- data/test/helpers/test_xml_sitemap.rb +105 -0
- data/test/tasks/test_clean.rb +69 -0
- metadata +96 -27
- data/lib/nanoc3/base/compilation/checksummer.rb +0 -68
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/helper'
|
4
|
+
|
5
|
+
class Nanoc3::Helpers::TextTest < MiniTest::Unit::TestCase
|
6
|
+
|
7
|
+
include Nanoc3::TestHelpers
|
8
|
+
|
9
|
+
include Nanoc3::Helpers::Text
|
10
|
+
|
11
|
+
def test_excerpt_length
|
12
|
+
assert_equal('...', excerptize('Foo bar baz quux meow woof', :length => 3))
|
13
|
+
assert_equal('Foo ...', excerptize('Foo bar baz quux meow woof', :length => 7))
|
14
|
+
assert_equal('Foo bar baz quux meow woof', excerptize('Foo bar baz quux meow woof', :length => 26))
|
15
|
+
assert_equal('Foo bar baz quux meow woof', excerptize('Foo bar baz quux meow woof', :length => 8623785))
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_excerpt_omission
|
19
|
+
assert_equal('Foo [continued]', excerptize('Foo bar baz quux meow woof', :length => 15, :omission => '[continued]'))
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_strip_html
|
23
|
+
# TODO implement
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/helper'
|
4
|
+
|
5
|
+
class Nanoc3::Helpers::XMLSitemapTest < MiniTest::Unit::TestCase
|
6
|
+
|
7
|
+
include Nanoc3::TestHelpers
|
8
|
+
|
9
|
+
include Nanoc3::Helpers::XMLSitemap
|
10
|
+
|
11
|
+
def test_xml_sitemap
|
12
|
+
if_have 'builder' do
|
13
|
+
# Create items
|
14
|
+
@items = [ mock, mock, mock, mock ]
|
15
|
+
|
16
|
+
# Create item 0
|
17
|
+
@items[0].expects(:[]).with(:is_hidden).returns(false)
|
18
|
+
@items[0].expects(:mtime).times(2).returns(nil)
|
19
|
+
@items[0].expects(:[]).times(2).with(:changefreq).returns(nil)
|
20
|
+
@items[0].expects(:[]).times(2).with(:priority).returns(nil)
|
21
|
+
item_reps = [ mock, mock ]
|
22
|
+
item_reps[0].expects(:path).returns('/kkk/')
|
23
|
+
item_reps[0].expects(:raw_path).returns('output/kkk/index.html')
|
24
|
+
item_reps[1].expects(:path).returns('/lll/')
|
25
|
+
item_reps[1].expects(:raw_path).returns('output/lll/index.html')
|
26
|
+
@items[0].expects(:reps).returns(item_reps)
|
27
|
+
|
28
|
+
# Create item 1
|
29
|
+
@items[1].expects(:[]).with(:is_hidden).returns(true)
|
30
|
+
|
31
|
+
# Create item 2
|
32
|
+
@items[2].expects(:[]).with(:is_hidden).returns(false)
|
33
|
+
@items[2].expects(:mtime).times(4).returns(Time.parse('12/07/2004'))
|
34
|
+
@items[2].expects(:[]).with(:changefreq).times(4).returns('daily')
|
35
|
+
@items[2].expects(:[]).with(:priority).times(4).returns(0.5)
|
36
|
+
item_reps = [ mock, mock ]
|
37
|
+
item_reps[0].expects(:path).returns('/aaa/')
|
38
|
+
item_reps[0].expects(:raw_path).returns('output/aaa/index.html')
|
39
|
+
item_reps[1].expects(:path).returns('/bbb/')
|
40
|
+
item_reps[1].expects(:raw_path).returns('output/bbb/index.html')
|
41
|
+
@items[2].expects(:reps).returns(item_reps)
|
42
|
+
|
43
|
+
# Create item 3
|
44
|
+
@items[3].expects(:[]).with(:is_hidden).returns(false)
|
45
|
+
item_rep = mock
|
46
|
+
item_rep.expects(:raw_path).returns(nil)
|
47
|
+
@items[3].expects(:reps).returns([ item_rep ])
|
48
|
+
|
49
|
+
# Create sitemap item
|
50
|
+
@item = mock
|
51
|
+
|
52
|
+
# Create site
|
53
|
+
config = mock
|
54
|
+
config.expects(:[]).with(:base_url).at_least_once.returns('http://example.com')
|
55
|
+
@site = mock
|
56
|
+
@site.expects(:config).at_least_once.returns(config)
|
57
|
+
|
58
|
+
# Check
|
59
|
+
xml_sitemap
|
60
|
+
end
|
61
|
+
ensure
|
62
|
+
@items = nil
|
63
|
+
@item = nil
|
64
|
+
@site = nil
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_sitemap_with_items_as_param
|
68
|
+
if_have 'builder' do
|
69
|
+
# Create items
|
70
|
+
@items = [ mock, mock, mock ]
|
71
|
+
|
72
|
+
# Create item 0
|
73
|
+
@items[0].expects(:[]).never
|
74
|
+
|
75
|
+
# Create item 1
|
76
|
+
@items[1].expects(:[]).never
|
77
|
+
|
78
|
+
# Create item 2
|
79
|
+
@items[2].expects(:mtime).times(2).returns(nil)
|
80
|
+
@items[2].expects(:[]).times(2).with(:changefreq).returns(nil)
|
81
|
+
@items[2].expects(:[]).times(2).with(:priority).returns(nil)
|
82
|
+
item_reps = [ mock, mock ]
|
83
|
+
item_reps[0].expects(:path).returns('/kkk/')
|
84
|
+
item_reps[0].expects(:raw_path).returns('output/kkk/index.html')
|
85
|
+
item_reps[1].expects(:path).returns('/lll/')
|
86
|
+
item_reps[1].expects(:raw_path).returns('output/lll/index.html')
|
87
|
+
@items[2].expects(:reps).returns(item_reps)
|
88
|
+
|
89
|
+
# Create sitemap item
|
90
|
+
@item = mock
|
91
|
+
|
92
|
+
# Create site
|
93
|
+
config = mock
|
94
|
+
config.expects(:[]).with(:base_url).at_least_once.returns('http://example.com')
|
95
|
+
@site = mock
|
96
|
+
@site.expects(:config).at_least_once.returns(config)
|
97
|
+
|
98
|
+
# Check
|
99
|
+
xml_sitemap(
|
100
|
+
:items => [@items[2]]
|
101
|
+
)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/helper'
|
4
|
+
|
5
|
+
class Nanoc3::Tasks::CleanTest < MiniTest::Unit::TestCase
|
6
|
+
|
7
|
+
include Nanoc3::TestHelpers
|
8
|
+
|
9
|
+
def test_simple
|
10
|
+
if_have 'w3c_validators' do
|
11
|
+
# Stub items
|
12
|
+
items = [ mock, mock ]
|
13
|
+
reps = [ [ mock, mock ], [ mock, mock ] ]
|
14
|
+
items[0].expects(:reps).returns(reps[0])
|
15
|
+
items[1].expects(:reps).returns(reps[1])
|
16
|
+
|
17
|
+
# Create sample files
|
18
|
+
[ 0, 1 ].each do |item_id|
|
19
|
+
[ 0, 1 ].each do |rep_id|
|
20
|
+
filename = "item-#{item_id}-rep-#{rep_id}.txt"
|
21
|
+
reps[item_id][rep_id].expects(:raw_path).returns(filename)
|
22
|
+
File.open(filename, 'w') { |io| io.write('hello') }
|
23
|
+
assert File.file?(filename)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Stub site
|
28
|
+
site = mock
|
29
|
+
site.expects(:items).returns(items)
|
30
|
+
|
31
|
+
# Create clean task
|
32
|
+
clean = ::Nanoc3::Tasks::Clean.new(site)
|
33
|
+
|
34
|
+
# Run
|
35
|
+
clean.run
|
36
|
+
|
37
|
+
# Check
|
38
|
+
[ 0, 1 ].each do |item_id|
|
39
|
+
[ 0, 1 ].each do |rep_id|
|
40
|
+
filename = "item-#{item_id}-rep-#{rep_id}.txt"
|
41
|
+
assert !File.file?(filename)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_with_nil_raw_path
|
48
|
+
if_have 'w3c_validators' do
|
49
|
+
# Stub items
|
50
|
+
item = mock
|
51
|
+
rep = mock
|
52
|
+
item.expects(:reps).returns([ rep ])
|
53
|
+
|
54
|
+
# Create sample file
|
55
|
+
rep.expects(:raw_path).returns(nil)
|
56
|
+
|
57
|
+
# Stub site
|
58
|
+
site = mock
|
59
|
+
site.expects(:items).returns([ item ])
|
60
|
+
|
61
|
+
# Create clean task
|
62
|
+
clean = ::Nanoc3::Tasks::Clean.new(site)
|
63
|
+
|
64
|
+
# Run
|
65
|
+
clean.run
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 3
|
8
|
-
- 2
|
9
|
-
- 0a3
|
10
|
-
version: 3.2.0a3
|
4
|
+
prerelease: 5
|
5
|
+
version: 3.2.0a4
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Denis Defreyne
|
@@ -15,8 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
19
|
-
default_executable: nanoc3
|
13
|
+
date: 2011-06-05 00:00:00 Z
|
20
14
|
dependencies:
|
21
15
|
- !ruby/object:Gem::Dependency
|
22
16
|
name: cri
|
@@ -26,11 +20,6 @@ dependencies:
|
|
26
20
|
requirements:
|
27
21
|
- - ">="
|
28
22
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 23
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 0
|
33
|
-
- 0
|
34
23
|
version: 1.0.0
|
35
24
|
type: :runtime
|
36
25
|
version_requirements: *id001
|
@@ -51,30 +40,38 @@ files:
|
|
51
40
|
- NEWS.md
|
52
41
|
- Rakefile
|
53
42
|
- README.md
|
43
|
+
- doc/yardoc_templates/default/layout/html/footer.erb
|
44
|
+
- bin/nanoc3
|
54
45
|
- lib/nanoc3/base/compilation/checksum_store.rb
|
55
|
-
- lib/nanoc3/base/compilation/checksummer.rb
|
56
46
|
- lib/nanoc3/base/compilation/compiled_content_cache.rb
|
57
47
|
- lib/nanoc3/base/compilation/compiler.rb
|
58
48
|
- lib/nanoc3/base/compilation/compiler_dsl.rb
|
59
49
|
- lib/nanoc3/base/compilation/dependency_tracker.rb
|
60
50
|
- lib/nanoc3/base/compilation/filter.rb
|
61
51
|
- lib/nanoc3/base/compilation/item_rep_proxy.rb
|
52
|
+
- lib/nanoc3/base/compilation/item_rep_recorder_proxy.rb
|
62
53
|
- lib/nanoc3/base/compilation/outdatedness_checker.rb
|
63
54
|
- lib/nanoc3/base/compilation/outdatedness_reasons.rb
|
64
55
|
- lib/nanoc3/base/compilation/rule.rb
|
65
56
|
- lib/nanoc3/base/compilation/rule_context.rb
|
57
|
+
- lib/nanoc3/base/compilation/rule_memory_calculator.rb
|
58
|
+
- lib/nanoc3/base/compilation/rule_memory_store.rb
|
59
|
+
- lib/nanoc3/base/compilation/rules_collection.rb
|
66
60
|
- lib/nanoc3/base/context.rb
|
67
61
|
- lib/nanoc3/base/core_ext/array.rb
|
68
62
|
- lib/nanoc3/base/core_ext/hash.rb
|
63
|
+
- lib/nanoc3/base/core_ext/pathname.rb
|
69
64
|
- lib/nanoc3/base/core_ext/string.rb
|
70
65
|
- lib/nanoc3/base/core_ext.rb
|
71
66
|
- lib/nanoc3/base/directed_graph.rb
|
72
67
|
- lib/nanoc3/base/errors.rb
|
68
|
+
- lib/nanoc3/base/memoization.rb
|
73
69
|
- lib/nanoc3/base/notification_center.rb
|
74
70
|
- lib/nanoc3/base/ordered_hash.rb
|
75
71
|
- lib/nanoc3/base/plugin_registry.rb
|
76
72
|
- lib/nanoc3/base/result_data/item_rep.rb
|
77
73
|
- lib/nanoc3/base/source_data/code_snippet.rb
|
74
|
+
- lib/nanoc3/base/source_data/configuration.rb
|
78
75
|
- lib/nanoc3/base/source_data/data_source.rb
|
79
76
|
- lib/nanoc3/base/source_data/item.rb
|
80
77
|
- lib/nanoc3/base/source_data/layout.rb
|
@@ -137,10 +134,13 @@ files:
|
|
137
134
|
- lib/nanoc3/filters/rainpress.rb
|
138
135
|
- lib/nanoc3/filters/rdiscount.rb
|
139
136
|
- lib/nanoc3/filters/rdoc.rb
|
137
|
+
- lib/nanoc3/filters/redcarpet.rb
|
140
138
|
- lib/nanoc3/filters/redcloth.rb
|
141
139
|
- lib/nanoc3/filters/relativize_paths.rb
|
142
140
|
- lib/nanoc3/filters/rubypants.rb
|
143
141
|
- lib/nanoc3/filters/sass.rb
|
142
|
+
- lib/nanoc3/filters/slim.rb
|
143
|
+
- lib/nanoc3/filters/typogruby.rb
|
144
144
|
- lib/nanoc3/filters.rb
|
145
145
|
- lib/nanoc3/helpers/blogging.rb
|
146
146
|
- lib/nanoc3/helpers/breadcrumbs.rb
|
@@ -159,10 +159,87 @@ files:
|
|
159
159
|
- lib/nanoc3/tasks/validate.rake
|
160
160
|
- lib/nanoc3/tasks.rb
|
161
161
|
- lib/nanoc3.rb
|
162
|
-
-
|
162
|
+
- tasks/clean.rake
|
163
|
+
- tasks/doc.rake
|
164
|
+
- tasks/test.rake
|
165
|
+
- test/base/core_ext/array_spec.rb
|
166
|
+
- test/base/core_ext/hash_spec.rb
|
167
|
+
- test/base/core_ext/pathname_spec.rb
|
168
|
+
- test/base/core_ext/string_spec.rb
|
169
|
+
- test/base/test_checksum_store.rb
|
170
|
+
- test/base/test_code_snippet.rb
|
171
|
+
- test/base/test_compiler.rb
|
172
|
+
- test/base/test_compiler_dsl.rb
|
173
|
+
- test/base/test_context.rb
|
174
|
+
- test/base/test_data_source.rb
|
175
|
+
- test/base/test_dependency_tracker.rb
|
176
|
+
- test/base/test_directed_graph.rb
|
177
|
+
- test/base/test_filter.rb
|
178
|
+
- test/base/test_item.rb
|
179
|
+
- test/base/test_item_rep.rb
|
180
|
+
- test/base/test_layout.rb
|
181
|
+
- test/base/test_memoization.rb
|
182
|
+
- test/base/test_notification_center.rb
|
183
|
+
- test/base/test_outdatedness_checker.rb
|
184
|
+
- test/base/test_plugin.rb
|
185
|
+
- test/base/test_rule.rb
|
186
|
+
- test/base/test_rule_context.rb
|
187
|
+
- test/base/test_site.rb
|
188
|
+
- test/cli/commands/test_compile.rb
|
189
|
+
- test/cli/commands/test_create_item.rb
|
190
|
+
- test/cli/commands/test_create_layout.rb
|
191
|
+
- test/cli/commands/test_create_site.rb
|
192
|
+
- test/cli/commands/test_help.rb
|
193
|
+
- test/cli/commands/test_info.rb
|
194
|
+
- test/cli/commands/test_update.rb
|
195
|
+
- test/cli/test_logger.rb
|
196
|
+
- test/data_sources/test_filesystem.rb
|
197
|
+
- test/data_sources/test_filesystem_unified.rb
|
198
|
+
- test/data_sources/test_filesystem_verbose.rb
|
199
|
+
- test/extra/core_ext/test_enumerable.rb
|
200
|
+
- test/extra/core_ext/test_time.rb
|
201
|
+
- test/extra/deployers/test_rsync.rb
|
202
|
+
- test/extra/test_auto_compiler.rb
|
203
|
+
- test/extra/test_file_proxy.rb
|
204
|
+
- test/extra/test_vcs.rb
|
205
|
+
- test/extra/validators/test_links.rb
|
206
|
+
- test/extra/validators/test_w3c.rb
|
207
|
+
- test/filters/test_asciidoc.rb
|
208
|
+
- test/filters/test_bluecloth.rb
|
209
|
+
- test/filters/test_coderay.rb
|
210
|
+
- test/filters/test_colorize_syntax.rb
|
211
|
+
- test/filters/test_erb.rb
|
212
|
+
- test/filters/test_erubis.rb
|
213
|
+
- test/filters/test_haml.rb
|
214
|
+
- test/filters/test_kramdown.rb
|
215
|
+
- test/filters/test_less.rb
|
216
|
+
- test/filters/test_markaby.rb
|
217
|
+
- test/filters/test_maruku.rb
|
218
|
+
- test/filters/test_mustache.rb
|
219
|
+
- test/filters/test_rainpress.rb
|
220
|
+
- test/filters/test_rdiscount.rb
|
221
|
+
- test/filters/test_rdoc.rb
|
222
|
+
- test/filters/test_redcarpet.rb
|
223
|
+
- test/filters/test_redcloth.rb
|
224
|
+
- test/filters/test_relativize_paths.rb
|
225
|
+
- test/filters/test_rubypants.rb
|
226
|
+
- test/filters/test_sass.rb
|
227
|
+
- test/filters/test_slim.rb
|
228
|
+
- test/filters/test_typogruby.rb
|
229
|
+
- test/helper.rb
|
230
|
+
- test/helpers/test_blogging.rb
|
231
|
+
- test/helpers/test_breadcrumbs.rb
|
232
|
+
- test/helpers/test_capturing.rb
|
233
|
+
- test/helpers/test_filtering.rb
|
234
|
+
- test/helpers/test_html_escape.rb
|
235
|
+
- test/helpers/test_link_to.rb
|
236
|
+
- test/helpers/test_rendering.rb
|
237
|
+
- test/helpers/test_tagging.rb
|
238
|
+
- test/helpers/test_text.rb
|
239
|
+
- test/helpers/test_xml_sitemap.rb
|
240
|
+
- test/tasks/test_clean.rb
|
163
241
|
- nanoc3.gemspec
|
164
|
-
-
|
165
|
-
has_rdoc: yard
|
242
|
+
- .gemtest
|
166
243
|
homepage: http://nanoc.stoneship.org/
|
167
244
|
licenses: []
|
168
245
|
|
@@ -192,25 +269,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
269
|
requirements:
|
193
270
|
- - ">="
|
194
271
|
- !ruby/object:Gem::Version
|
195
|
-
hash: 3
|
196
|
-
segments:
|
197
|
-
- 0
|
198
272
|
version: "0"
|
199
273
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
274
|
none: false
|
201
275
|
requirements:
|
202
276
|
- - ">"
|
203
277
|
- !ruby/object:Gem::Version
|
204
|
-
hash: 25
|
205
|
-
segments:
|
206
|
-
- 1
|
207
|
-
- 3
|
208
|
-
- 1
|
209
278
|
version: 1.3.1
|
210
279
|
requirements: []
|
211
280
|
|
212
281
|
rubyforge_project:
|
213
|
-
rubygems_version: 1.
|
282
|
+
rubygems_version: 1.8.2
|
214
283
|
signing_key:
|
215
284
|
specification_version: 3
|
216
285
|
summary: a web publishing system written in Ruby for building small to medium-sized websites.
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Nanoc3
|
4
|
-
|
5
|
-
# Responsible for creating checksums of files. Such checksums are used to
|
6
|
-
# determine whether files have changed between compilations.
|
7
|
-
#
|
8
|
-
# Identical content will always result in the same checksum. Multiple
|
9
|
-
# invocations of the checksum creation methods with the same content or
|
10
|
-
# filename will yield the same result.
|
11
|
-
#
|
12
|
-
# The returned checksum has the property that for two given files with
|
13
|
-
# different content, the returned checksum will be different with a very
|
14
|
-
# high probability. In practice, this boils down to using a secure
|
15
|
-
# cryptographic hash function, such as SHA-1.
|
16
|
-
#
|
17
|
-
# The format of the resulting checksum should not be relied upon. In future
|
18
|
-
# versions of nanoc, this function may use a different method for generating
|
19
|
-
# checksums.
|
20
|
-
#
|
21
|
-
# @api private
|
22
|
-
class Checksummer
|
23
|
-
|
24
|
-
# Returns a checksum for the specified file.
|
25
|
-
#
|
26
|
-
# @param [String] filename The name of the file for which the checksum
|
27
|
-
# should be calculated
|
28
|
-
#
|
29
|
-
# @return [String] The checksum for the given file
|
30
|
-
def self.checksum_for_file(filename)
|
31
|
-
require 'digest'
|
32
|
-
|
33
|
-
digest = Digest::SHA1.new
|
34
|
-
File.open(filename, 'r') do |io|
|
35
|
-
until io.eof
|
36
|
-
data = io.readpartial(2**10)
|
37
|
-
digest.update(data)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
digest.hexdigest
|
41
|
-
end
|
42
|
-
|
43
|
-
# Returns a checksum for the specified string.
|
44
|
-
#
|
45
|
-
# @param [String] string The string for which the checksum should be
|
46
|
-
# calculated
|
47
|
-
#
|
48
|
-
# @return [String] The checksum for the given string
|
49
|
-
def self.checksum_for_string(string)
|
50
|
-
require 'digest'
|
51
|
-
|
52
|
-
digest = Digest::SHA1.new
|
53
|
-
digest.update(string)
|
54
|
-
digest.hexdigest
|
55
|
-
end
|
56
|
-
|
57
|
-
# Returns a checksum for the specified hash.
|
58
|
-
#
|
59
|
-
# @param [Hash] hash The hash for which the checksum should be calculated.
|
60
|
-
#
|
61
|
-
# @return [String] The checksum for the given hash
|
62
|
-
def self.checksum_for_hash(hash)
|
63
|
-
self.checksum_for_string(YAML.dump(hash))
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|