nanoc-tidy.rb 0.8.2 → 0.8.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
  SHA256:
3
- metadata.gz: 8d6e154d29de034dfe0b684d5e95473021844c209b99fcd5660e7bf9a9f68fd6
4
- data.tar.gz: e03bc5eaa2bc6ce7d3b24fd449bc72ad4dd0e31b0aec5af5f4419ae4c298fc1d
3
+ metadata.gz: 75a424457999e15e194c8f3554ee093a6c167b43b6e92e8d278761581b223a5c
4
+ data.tar.gz: 7df3dceb9b56809423b686cabed730e7364b9969a631d16f607360814393b34b
5
5
  SHA512:
6
- metadata.gz: 8a92d50b08bdd9bbd65ab664c55a867404a9755ddf3c2f0dd4f40c8fecf48c00e84bfd824e5281cda17083b2963b4b7ccfb8614d3b40c308815570b7b53b8e00
7
- data.tar.gz: 840a2eca0b0cbbeec99fa022d13f0674fb0eca061310b070e58d3d99c916cb14b43d249f6234b8c78217834f9ceadcac3dd1907a57692f4d3dfea2f73c505265
6
+ metadata.gz: 99d9987e8a238e0f4d296b63c279e407affd095554e4cd70298ebe4b0e1938654ba66647b5d23ab59d5bdb3f645349315f0d58172f6c563610949dab630b348e
7
+ data.tar.gz: c9af1e3c5fa769f91da03968b73ad28daba8d42af491ae1489d9693af3bfdeb8233a2d0a4e7d7adb54daf011fb11958c455db2d00dce34104b7abaf25797cd2a
@@ -56,7 +56,7 @@ module Nanoc::Tidy
56
56
  tmpdir = File.join(Dir.getwd, "tmp", "tidy")
57
57
  name = item.identifier.to_s
58
58
  file = Tempfile.new(
59
- [ File.basename(name), File.extname(name) ],
59
+ [File.basename(name), File.extname(name)],
60
60
  mkdir_p(tmpdir).last
61
61
  )
62
62
  file.write(content)
@@ -19,11 +19,13 @@ module Nanoc::Tidy
19
19
  def spawn(exe, argv)
20
20
  r = cmd(exe, *argv)
21
21
  ##
22
- # exit codes
22
+ # tidy-html5 exit codes
23
23
  # * 0: no warnings, no errors
24
24
  # * 1: has warnings
25
25
  # * 2: has errors
26
- if [0, 1].include?(r.exit_status)
26
+ if r.not_found?
27
+ raise Nanoc::Tidy::Error, "The #{exe} executable was not found"
28
+ elsif [0, 1].include?(r.exit_status)
27
29
  r.exit_status
28
30
  else
29
31
  raise Nanoc::Tidy::Error,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Tidy
5
- VERSION = "0.8.2"
5
+ VERSION = "0.8.4"
6
6
  end
7
7
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.summary = "nanoc-tidy.rb = nanoc + tidy-html5"
14
14
  gem.description = gem.summary
15
15
  gem.add_runtime_dependency "ryo.rb", "~> 0.5"
16
- gem.add_runtime_dependency "test-cmd.rb", "~> 0.12.3"
16
+ gem.add_runtime_dependency "test-cmd.rb", "~> 0.12.4"
17
17
  gem.add_development_dependency "yard", "~> 0.9"
18
18
  gem.add_development_dependency "redcarpet", "~> 3.5"
19
19
  gem.add_development_dependency "test-unit", "~> 3.6"
@@ -4,17 +4,25 @@ require_relative "setup"
4
4
 
5
5
  class FilterTest < Test::Unit::TestCase
6
6
  def test_default_options
7
- options = {argv: ["--tidy-mark", "false"]}
7
+ options = {exe:, argv: ["--tidy-mark", "false"]}
8
8
  assert_equal read_result("default_options.html"),
9
9
  filter_for("fixture.html").run(html, options)
10
10
  end
11
11
 
12
12
  def test_upper_option
13
- options = {argv: ["-upper", "--tidy-mark", "false"]}
13
+ options = {exe:, argv: ["-upper", "--tidy-mark", "false"]}
14
14
  assert_equal read_result("upper_option.html"),
15
15
  filter_for("fixture.html").run(html, options)
16
16
  end
17
17
 
18
+ def test_exe_not_found
19
+ options = {exe: "/path/not/found", argv: ["-upper", "--tidy-mark", "false"]}
20
+ assert_raises(
21
+ Nanoc::Tidy::Error,
22
+ "The /path/not/found executable was not found"
23
+ ) { filter_for("fixture.html").run(html, options) }
24
+ end
25
+
18
26
  private
19
27
 
20
28
  def filter_for(basename)
@@ -39,4 +47,8 @@ class FilterTest < Test::Unit::TestCase
39
47
  def html
40
48
  File.binread "./test/fixtures/fixture.html"
41
49
  end
50
+
51
+ def exe
52
+ `which tidy || which tidy5`.chomp
53
+ end
42
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-tidy.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - '0x1eef'
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-15 00:00:00.000000000 Z
11
+ date: 2024-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ryo.rb
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.12.3
33
+ version: 0.12.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.12.3
40
+ version: 0.12.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: yard
43
43
  requirement: !ruby/object:Gem::Requirement