nanoc 4.8.10 → 4.8.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +6 -0
  3. data/NEWS.md +7 -0
  4. data/lib/nanoc.rb +11 -6
  5. data/lib/nanoc/base.rb +1 -0
  6. data/lib/nanoc/base/changes_stream.rb +53 -0
  7. data/lib/nanoc/base/contracts_support.rb +0 -2
  8. data/lib/nanoc/base/feature.rb +3 -0
  9. data/lib/nanoc/base/memoization.rb +0 -2
  10. data/lib/nanoc/base/repos/aggregate_data_source.rb +8 -0
  11. data/lib/nanoc/base/repos/data_source.rb +12 -0
  12. data/lib/nanoc/base/repos/in_mem_data_source.rb +10 -1
  13. data/lib/nanoc/base/repos/prefixed_data_source.rb +8 -0
  14. data/lib/nanoc/base/repos/site_loader.rb +11 -7
  15. data/lib/nanoc/base/services/compiler.rb +2 -3
  16. data/lib/nanoc/base/services/compiler/stages/postprocess.rb +2 -3
  17. data/lib/nanoc/base/services/compiler/stages/preprocess.rb +1 -1
  18. data/lib/nanoc/base/services/pruner.rb +0 -2
  19. data/lib/nanoc/base/services/temp_filename_factory.rb +0 -2
  20. data/lib/nanoc/checking/checks/external_links.rb +0 -5
  21. data/lib/nanoc/checking/checks/internal_links.rb +0 -2
  22. data/lib/nanoc/checking/checks/stale.rb +0 -2
  23. data/lib/nanoc/cli.rb +7 -1
  24. data/lib/nanoc/cli/commands/compile_listeners/diff_generator.rb +0 -3
  25. data/lib/nanoc/cli/commands/live.rb +30 -0
  26. data/lib/nanoc/cli/commands/view.rb +4 -5
  27. data/lib/nanoc/cli/error_handler.rb +52 -36
  28. data/lib/nanoc/cli/logger.rb +0 -2
  29. data/lib/nanoc/cli/stack_trace_writer.rb +50 -0
  30. data/lib/nanoc/data_sources/filesystem.rb +25 -0
  31. data/lib/nanoc/extra.rb +1 -0
  32. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +0 -2
  33. data/lib/nanoc/extra/link_collector.rb +0 -2
  34. data/lib/nanoc/extra/live_recompiler.rb +131 -0
  35. data/lib/nanoc/extra/parallel_collection.rb +0 -2
  36. data/lib/nanoc/extra/piper.rb +0 -2
  37. data/lib/nanoc/filters/relativize_paths.rb +8 -7
  38. data/lib/nanoc/helpers/link_to.rb +0 -2
  39. data/lib/nanoc/rule_dsl/action_provider.rb +2 -2
  40. data/lib/nanoc/version.rb +1 -1
  41. data/nanoc.gemspec +15 -4
  42. data/nanoc.manifest +545 -0
  43. data/spec/manifest_spec.rb +22 -0
  44. data/spec/nanoc/base/changes_stream_spec.rb +45 -0
  45. data/spec/nanoc/base/checksummer_spec.rb +0 -2
  46. data/spec/nanoc/base/directed_graph_spec.rb +66 -0
  47. data/spec/nanoc/base/entities/code_snippet_spec.rb +9 -0
  48. data/spec/nanoc/base/entities/context_spec.rb +26 -0
  49. data/spec/nanoc/base/entities/identifiable_collection_spec.rb +53 -0
  50. data/spec/nanoc/base/repos/aggregate_data_source_spec.rb +87 -0
  51. data/spec/nanoc/base/repos/data_source_spec.rb +95 -0
  52. data/spec/nanoc/base/repos/in_mem_data_source_spec.rb +39 -0
  53. data/spec/nanoc/base/repos/prefixed_data_source_spec.rb +39 -0
  54. data/spec/nanoc/cli/error_handler_spec.rb +43 -0
  55. data/spec/nanoc/cli/stack_trace_writer_spec.rb +156 -0
  56. data/spec/nanoc/data_sources/filesystem_spec.rb +46 -0
  57. data/spec/nanoc/extra/live_recompiler_spec.rb +129 -0
  58. data/spec/nanoc/helpers/blogging_spec.rb +1 -1
  59. data/spec/spec_helper.rb +60 -0
  60. data/test/base/test_compiler.rb +11 -11
  61. data/test/cli/test_cli.rb +0 -1
  62. data/test/cli/test_error_handler.rb +4 -5
  63. data/test/filters/test_relativize_paths.rb +30 -0
  64. data/test/filters/test_sass.rb +3 -3
  65. data/test/rule_dsl/test_compiler_dsl.rb +2 -2
  66. metadata +39 -43
  67. data/.github/CONTRIBUTING.md +0 -17
  68. data/.github/ISSUE_TEMPLATE.md +0 -23
  69. data/.github/PULL_REQUEST_TEMPLATE.md +0 -18
  70. data/.gitignore +0 -10
  71. data/.travis.yml +0 -27
  72. data/Gemfile +0 -73
  73. data/Guardfile +0 -5
  74. data/scripts/release +0 -95
  75. data/test/base/test_code_snippet.rb +0 -17
  76. data/test/base/test_context.rb +0 -35
  77. data/test/base/test_data_source.rb +0 -60
  78. data/test/base/test_directed_graph.rb +0 -56
  79. data/test/base/test_item_array.rb +0 -37
@@ -1,17 +0,0 @@
1
- Contributing
2
- ============
3
-
4
- Reporting bugs
5
- --------------
6
-
7
- If you find a bug in Nanoc, you should report it! Some information that you should include in your bug report is the Nanoc version (`nanoc --version`) and, if relevant, the crash log (`crash.log`). For details, check the [*bug reporting* section of the development guide](http://nanoc.ws/development/#reporting-bugs).
8
-
9
- Contributing code
10
- -----------------
11
-
12
- Pull requests are appreciated! When submitting a PR, make sure that your changes have covering tests, that the documentation remains up-to-date and that you retain backwards compatibility. For details, check the [*contributing code* section of the development guide](http://nanoc.ws/development/#contributing-code).
13
-
14
- Contributor code of conduct
15
- ---------------------------
16
-
17
- In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone. For details, see the contributor code of conduct at http://nanoc.ws/contributing/#contributor-code-of-conduct.
@@ -1,23 +0,0 @@
1
- (Summarise the bug in a single line.)
2
-
3
- ### Steps to reproduce
4
-
5
- 1. [First step]
6
- 2. [Second step]
7
- 3. …
8
-
9
- ### Expected behavior
10
-
11
- (Describe what you expected to happen.)
12
-
13
- ### Actual behavior
14
-
15
- (Describe what actually happened instead.)
16
-
17
- ### Details
18
-
19
- (Describe other details, if any, that you believe might be relevant.)
20
-
21
- ### Crash log
22
-
23
- (When reporting a crash, create a [Gist](https://gist.github.com/) with the contents of the `crash.log` file, and link the Gist here.)
@@ -1,18 +0,0 @@
1
- (Summarise the change in a single line.)
2
-
3
- ### Detailed description
4
-
5
- (Describe the change in detail.)
6
-
7
- ### To do
8
-
9
- (Include the to-do list for this PR to be finished here.)
10
-
11
- * [ ] Tests
12
- * [ ] Documentation
13
- * [ ] Feature flags
14
- * [ ] …
15
-
16
- ### Related issues
17
-
18
- (Add issue IDs for related issues here.)
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- .DS_Store
2
- *.gem
3
- *.gemfile.lock
4
- *~
5
-
6
- /.yardoc/
7
- /coverage/
8
- /Gemfile.lock
9
- /doc/yardoc/
10
- /.vscode/
data/.travis.yml DELETED
@@ -1,27 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - "2.3"
4
- - "2.4"
5
- branches:
6
- only:
7
- - "master"
8
- env:
9
- global:
10
- -
11
- LC_ALL=en_US.UTF_8
12
- LANG=en_US.UTF_8
13
- matrix:
14
- fast_finish: true
15
- include:
16
- - rvm: jruby-9.1.9.0
17
- env: DISABLE_NOKOGIRI=1
18
- allow_failures:
19
- - rvm: jruby-9.1.9.0
20
- env: DISABLE_NOKOGIRI=1
21
- script:
22
- - bundle exec rake test_ci
23
- - bundle exec appraisal install && FOCUS=rouge bundle exec appraisal rake spec
24
- cache: bundler
25
- sudo: false
26
- git:
27
- depth: 10
data/Gemfile DELETED
@@ -1,73 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
6
-
7
- group :devel do
8
- gem 'codecov', require: false
9
- gem 'contracts', '~> 0.14'
10
- gem 'coveralls', require: false
11
- gem 'fuubar'
12
- gem 'guard-rake'
13
- gem 'json', '~> 2.0'
14
- gem 'm', '~> 1.5'
15
- gem 'minitest', '~> 5.0'
16
- gem 'mocha'
17
- gem 'pry'
18
- gem 'rainbow', '~> 2.1'
19
- gem 'rake'
20
- gem 'rdoc', '~> 5.0'
21
- gem 'rspec'
22
- gem 'rspec-its', '~> 1.2'
23
- gem 'rspec-mocks'
24
- gem 'rubocop', '~> 0.49'
25
- gem 'simplecov', require: false
26
- gem 'timecop'
27
- gem 'vcr'
28
- gem 'webmock'
29
- gem 'yard'
30
- gem 'yard-contracts'
31
- end
32
-
33
- group :plugins do
34
- gem 'adsf'
35
- gem 'asciidoctor'
36
- gem 'bluecloth', platforms: :ruby
37
- gem 'builder'
38
- gem 'coderay'
39
- gem 'coffee-script'
40
- gem 'compass'
41
- gem 'erubi'
42
- gem 'erubis'
43
- gem 'fog-aws'
44
- gem 'fog-local'
45
- gem 'haml'
46
- gem 'handlebars', platforms: :ruby
47
- gem 'kramdown'
48
- gem 'less', '~> 2.0', platforms: :ruby
49
- gem 'libv8', platforms: :ruby
50
- gem 'listen'
51
- gem 'markaby'
52
- gem 'maruku'
53
- gem 'mime-types'
54
- gem 'mustache', '~> 1.0'
55
- gem 'nokogiri', '~> 1.6'
56
- gem 'nokogumbo', '~> 1.4', platforms: :ruby
57
- gem 'pandoc-ruby'
58
- gem 'pygments.rb', '~> 1.1', '>= 1.1.1', platforms: %i[ruby mswin]
59
- gem 'rack'
60
- gem 'rainpress'
61
- gem 'rdiscount', '~> 2.2', platforms: %i[ruby mswin]
62
- gem 'redcarpet', platforms: %i[ruby mswin]
63
- gem 'RedCloth', platforms: :ruby
64
- gem 'rouge'
65
- gem 'rubypants'
66
- gem 'sass'
67
- gem 'slim', '~> 3.0'
68
- gem 'therubyracer', '~> 0.12', platforms: :ruby
69
- gem 'typogruby'
70
- gem 'uglifier'
71
- gem 'w3c_validators'
72
- gem 'yuicompressor'
73
- end
data/Guardfile DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- guard 'rake', task: 'default' do
4
- watch(%r{^(lib|test|spec)/})
5
- end
data/scripts/release DELETED
@@ -1,95 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'fileutils'
5
- require 'octokit'
6
-
7
- def run(*args)
8
- puts 'I will execute the following:'
9
- puts ' ' + args.map { |a| a =~ /\s/ ? a.inspect : a }.join(' ')
10
- print 'Is this correct? [y/N] '
11
- res = gets
12
- unless res.strip.casecmp('y').zero?
13
- $stderr.puts 'Answer was not Y; release aborted.'
14
- exit 1
15
- end
16
-
17
- system('echo', *args)
18
- system(*args)
19
-
20
- print 'Continue? [y/N] '
21
- res = gets
22
- unless res.strip.casecmp('y').zero?
23
- $stderr.puts 'Answer was not Y; release aborted.'
24
- exit 1
25
- end
26
- end
27
-
28
- puts '=== Logging in to GitHub’s API…'
29
- client = Octokit::Client.new(netrc: true)
30
- puts
31
-
32
- puts '=== Deleting old *.gem files…'
33
- Dir['*.gem'].each do |fn|
34
- puts " #{fn}…"
35
- FileUtils.rm_f(fn)
36
- end
37
- puts
38
-
39
- puts '=== Verifying presence of release date…'
40
- unless File.readlines('NEWS.md').drop(2).first =~ / \(\d{4}-\d{2}-\d{2}\)$/
41
- $stderr.puts 'No proper release date found!'
42
- exit 1
43
- end
44
- puts
45
-
46
- puts '=== Building new gem…'
47
- run('gem', 'build', 'nanoc.gemspec')
48
- puts
49
-
50
- puts '=== Reading version…'
51
- require './lib/nanoc/version'
52
- puts "Version = #{Nanoc::VERSION}"
53
- puts
54
-
55
- puts '=== Verifying that release does not yet exist…'
56
- releases = client.releases('nanoc/nanoc')
57
- release = releases.find { |r| r.tag_name == Nanoc::VERSION }
58
- if release
59
- $stderr.puts 'Release already exists!'
60
- $stderr.puts 'ABORTED!'
61
- exit 1
62
- end
63
- puts
64
-
65
- puts '=== Creating Git tag…'
66
- run('git', 'tag', '--sign', '--annotate', Nanoc::VERSION, '--message', "Version #{Nanoc::VERSION}")
67
- puts
68
-
69
- puts '=== Pushing Git data…'
70
- run('git', 'push', 'origin', '--tags')
71
- puts
72
-
73
- puts '=== Pushing gem…'
74
- run('gem', 'push', "nanoc-#{Nanoc::VERSION}.gem")
75
- puts
76
-
77
- puts '=== Reading release notes…'
78
- release_notes =
79
- File.readlines('NEWS.md')
80
- .drop(4)
81
- .take_while { |l| l !~ /^## / }
82
- .join
83
- puts
84
-
85
- puts '=== Creating release on GitHub…'
86
- sleep 3 # Give GitHub some time to detect the new tag
87
- is_prerelease = Nanoc::VERSION =~ /a|b|rc/ || Nanoc::VERSION =~ /^0/
88
- client.create_release(
89
- 'nanoc/nanoc', Nanoc::VERSION,
90
- prerelease: !is_prerelease.nil?,
91
- body: release_notes
92
- )
93
- puts
94
-
95
- puts 'DONE!'
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'helper'
4
-
5
- class Nanoc::Int::CodeSnippetTest < Nanoc::TestCase
6
- def test_load_with_toplevel_binding
7
- # Initialize
8
- @foo = 'meow'
9
-
10
- # Create code and load it
11
- code_snippet = Nanoc::Int::CodeSnippet.new("@foo = 'woof'", 'dog.rb')
12
- code_snippet.load
13
-
14
- # Ensure binding is correct
15
- assert_equal('meow', @foo)
16
- end
17
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'helper'
4
-
5
- class Nanoc::Int::ContextTest < Nanoc::TestCase
6
- def test_context_with_instance_variable
7
- # Create context
8
- context = Nanoc::Int::Context.new(foo: 'bar', baz: 'quux')
9
-
10
- # Ensure correct evaluation
11
- assert_equal('bar', eval('@foo', context.get_binding))
12
- end
13
-
14
- def test_context_with_instance_method
15
- # Create context
16
- context = Nanoc::Int::Context.new(foo: 'bar', baz: 'quux')
17
-
18
- # Ensure correct evaluation
19
- assert_equal('bar', eval('foo', context.get_binding))
20
- end
21
-
22
- def test_example
23
- # Parse
24
- YARD.parse(LIB_DIR + '/nanoc/base/entities/context.rb')
25
-
26
- # Run
27
- assert_examples_correct 'Nanoc::Int::Context#initialize'
28
- end
29
-
30
- def test_include
31
- context = Nanoc::Int::Context.new({})
32
- eval('include Nanoc::Helpers::HTMLEscape', context.get_binding)
33
- assert_equal('&lt;&gt;', eval('h("<>")', context.get_binding))
34
- end
35
- end
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'helper'
4
-
5
- class Nanoc::DataSourceTest < Nanoc::TestCase
6
- def test_not_implemented
7
- # Create data source
8
- data_source = Nanoc::DataSource.new(nil, nil, nil, nil)
9
-
10
- # Test optional methods
11
- data_source.up
12
- data_source.down
13
-
14
- # Test methods - loading data
15
- assert_equal [], data_source.items
16
- assert_equal [], data_source.layouts
17
- end
18
-
19
- def test_new_item
20
- data_source = Nanoc::DataSource.new(nil, nil, nil, nil)
21
-
22
- item = data_source.new_item('stuff', { title: 'Stuff!' }, '/asdf', checksum_data: 'abcdef')
23
- assert_equal 'stuff', item.content.string
24
- assert_equal 'Stuff!', item.attributes[:title]
25
- assert_equal Nanoc::Identifier.new('/asdf'), item.identifier
26
- assert_equal 'abcdef', item.checksum_data
27
- end
28
-
29
- def test_new_item_with_checksums
30
- data_source = Nanoc::DataSource.new(nil, nil, nil, nil)
31
-
32
- item = data_source.new_item('stuff', { title: 'Stuff!' }, '/asdf', content_checksum_data: 'con-cs', attributes_checksum_data: 'attr-cs')
33
- assert_equal 'stuff', item.content.string
34
- assert_equal 'Stuff!', item.attributes[:title]
35
- assert_equal Nanoc::Identifier.new('/asdf'), item.identifier
36
- assert_equal 'con-cs', item.content_checksum_data
37
- assert_equal 'attr-cs', item.attributes_checksum_data
38
- end
39
-
40
- def test_new_layout
41
- data_source = Nanoc::DataSource.new(nil, nil, nil, nil)
42
-
43
- layout = data_source.new_layout('stuff', { title: 'Stuff!' }, '/asdf', checksum_data: 'abcdef')
44
- assert_equal 'stuff', layout.content.string
45
- assert_equal 'Stuff!', layout.attributes[:title]
46
- assert_equal Nanoc::Identifier.new('/asdf'), layout.identifier
47
- assert_equal 'abcdef', layout.checksum_data
48
- end
49
-
50
- def test_new_layout_with_checksums
51
- data_source = Nanoc::DataSource.new(nil, nil, nil, nil)
52
-
53
- layout = data_source.new_layout('stuff', { title: 'Stuff!' }, '/asdf', content_checksum_data: 'con-cs', attributes_checksum_data: 'attr-cs')
54
- assert_equal 'stuff', layout.content.string
55
- assert_equal 'Stuff!', layout.attributes[:title]
56
- assert_equal Nanoc::Identifier.new('/asdf'), layout.identifier
57
- assert_equal 'con-cs', layout.content_checksum_data
58
- assert_equal 'attr-cs', layout.attributes_checksum_data
59
- end
60
- end
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'helper'
4
-
5
- class Nanoc::Int::DirectedGraphTest < Nanoc::TestCase
6
- def test_add_edge
7
- graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
8
-
9
- assert_equal [], graph.predecessors_of(2).to_a
10
-
11
- graph.add_edge(1, 2)
12
-
13
- assert_equal [1], graph.predecessors_of(2).to_a
14
- end
15
-
16
- def test_add_edge_with_new_vertices
17
- graph = Nanoc::Int::DirectedGraph.new([1])
18
- graph.add_edge(1, 2)
19
- graph.add_edge(3, 2)
20
-
21
- assert graph.vertices.include?(2)
22
- assert graph.vertices.include?(3)
23
- end
24
-
25
- def test_delete_edges_to
26
- graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
27
-
28
- graph.add_edge(1, 2)
29
- graph.add_edge(2, 1)
30
- graph.add_edge(2, 3)
31
- graph.add_edge(3, 2)
32
- graph.add_edge(1, 3)
33
- graph.add_edge(3, 1)
34
-
35
- assert_equal [2, 3], graph.direct_predecessors_of(1).sort
36
- assert_equal [1, 3], graph.direct_predecessors_of(2).sort
37
- assert_equal [1, 2], graph.direct_predecessors_of(3).sort
38
-
39
- graph.delete_edges_to(1)
40
-
41
- assert_equal [], graph.direct_predecessors_of(1).sort
42
- assert_equal [1, 3], graph.direct_predecessors_of(2).sort
43
- assert_equal [1, 2], graph.direct_predecessors_of(3).sort
44
-
45
- graph.delete_edges_to(2)
46
-
47
- assert_equal [], graph.direct_predecessors_of(1).sort
48
- assert_equal [], graph.direct_predecessors_of(2).sort
49
- assert_equal [1, 2], graph.direct_predecessors_of(3).sort
50
- end
51
-
52
- def test_example
53
- YARD.parse(LIB_DIR + '/nanoc/base/entities/directed_graph.rb')
54
- assert_examples_correct 'Nanoc::Int::DirectedGraph'
55
- end
56
- end