nanoc-tidy.rb 0.7.0 → 0.8.0

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: baa9bd78c6f407c7050903ec46fe89c19a702dc788eb556438078d43f10c2adf
4
- data.tar.gz: 5bd8b9fd26eb7eb0a6831eaee86d0da38e02ceee4589cfbdef4881f29f52b6a7
3
+ metadata.gz: 133f30c53d54b2f5cea16c3877fa597d86b5db84bb240214459eee5e6a8c4f07
4
+ data.tar.gz: 8d054b51e4f6fbd7351fac5eb78ddcae57bcf175ebfea062c588daf9d5358c56
5
5
  SHA512:
6
- metadata.gz: 3acb6eb29a332c6013cdaa878f54327abfc96ec87fbd36c8a439afe153469b724713cea1a77572ab02b069c24e6f3dac25c1b05e00aeac146e304f9637c6766e
7
- data.tar.gz: 83f346f2273873f02015065cc8701d8693e6cfd8a26686a767789a9dcd2f4cd46b084b452b928807758141ac4e3f312afb0f80d63bc6f355cdbd1663db9ab03d
6
+ metadata.gz: 95b712fefeaf461ec57efe23fbcfada16a9be99498ee923affd4db983ffa522157f95b2659a4fd726d626296a515a6cb1631ca1ae890af7caa5e8ef82949716a
7
+ data.tar.gz: d83de9881073f9a53818fec78482c7a98023acc1bc798137b78a766b96f343cec659b54e06425cda3cd78c611d32a2b606c9f15cca466859ca3b95257e9cb4ef
data/README.md CHANGED
@@ -14,8 +14,9 @@ build process.
14
14
 
15
15
  __Defaults__
16
16
 
17
- The following example uses the
18
- [default command line arguments](https://0x1eef.github.io/x/nanoc-tidy.rb/Nanoc/Tidy/Filter#default_argv-class_method):
17
+ The following example executes tidy with the default settings. <br>
18
+ See [Nanoc::Tidy.default_argv](https://0x1eef.github.io/x/nanoc-tidy.rb/Nanoc/Tidy/Filter#default_argv-class_method)
19
+ for more details:
19
20
 
20
21
  ``` ruby
21
22
  # Rules
@@ -28,9 +29,10 @@ compile "/index.html.erb" do
28
29
  end
29
30
  ```
30
31
 
31
- __Options__
32
+ __Option: argv__
32
33
 
33
- The following example forwards a command line argument:
34
+ The following example sets the "argv" filter option. <br>
35
+ The filter option is combined with [Nanoc::Tidy.default_argv](https://0x1eef.github.io/x/nanoc-tidy.rb/Nanoc/Tidy/Filter#default_argv-class_method):
34
36
 
35
37
  ```ruby
36
38
  # Rules
@@ -43,7 +45,7 @@ compile "/index.html.erb" do
43
45
  end
44
46
  ```
45
47
 
46
- ## <a id='install'>Install</a>
48
+ ## Install
47
49
 
48
50
  **Rubygems.org**
49
51
 
@@ -58,6 +60,6 @@ nanoc-tidy.rb can be installed via rubygems.org:
58
60
 
59
61
  ## License
60
62
 
61
- [BSD Zero Clause](https://choosealicense.com/licenses/0bsd/).
63
+ [BSD Zero Clause](https://choosealicense.com/licenses/0bsd/)
62
64
  <br>
63
- See [LICENSE](./LICENSE).
65
+ See [LICENSE](./LICENSE)
@@ -3,6 +3,7 @@
3
3
  module Nanoc::Tidy
4
4
  module Spawn
5
5
  require "fileutils"
6
+ require "test-cmd"
6
7
 
7
8
  ##
8
9
  # Spawns a process
@@ -14,28 +15,24 @@ module Nanoc::Tidy
14
15
  # An array of command line arguments
15
16
  #
16
17
  # @return [void]
17
- def spawn(exe, argv, workdir: File.join(Dir.getwd, "tmp"))
18
- logfile = File.join(workdir, ".#{Process.pid}.tidy")
19
- Kernel.spawn(exe, *argv, {STDERR => logfile, STDOUT => logfile})
20
- Process.wait
21
- status = $?
18
+ def spawn(exe, argv)
19
+ r = cmd(exe, *argv)
22
20
  ##
23
21
  # exit codes
24
22
  # * 0: no warnings, no errors
25
23
  # * 1: has warnings
26
24
  # * 2: has errors
27
- if [0, 1].include?(status.exitstatus)
28
- status.exitstatus
25
+ if [0, 1].include?(r.exit_status)
26
+ r.exit_status
29
27
  else
30
28
  raise Nanoc::Tidy::Error,
31
29
  "#{File.basename(exe)} exited unsuccessfully\n" \
32
30
  "(item: #{item.identifier})\n" \
33
- "(exit code: #{status.exitstatus})\n" \
34
- "output:\n#{File.binread(logfile)}\n",
31
+ "(exit code: #{r.exit_status})\n" \
32
+ "(stdout:\n#{r.stdout})\n" \
33
+ "(stderr:\n#{r.stderr})\n",
35
34
  []
36
35
  end
37
- ensure
38
- File.exist?(logfile) ? FileUtils.rm(logfile) : nil
39
36
  end
40
37
  end
41
38
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Tidy
5
- VERSION = "0.7.0"
5
+ VERSION = "0.8.0"
6
6
  end
7
7
  end
@@ -12,6 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.require_paths = ["lib"]
13
13
  gem.summary = "nanoc + tidy-html5"
14
14
  gem.description = gem.summary
15
+ gem.add_runtime_dependency "test-cmd.rb", "~> 0.12.2"
15
16
  gem.add_development_dependency "yard", "~> 0.9"
16
17
  gem.add_development_dependency "redcarpet", "~> 3.5"
17
18
  gem.add_development_dependency "test-unit", "~> 3.6"
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-tidy.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - '0x1eef'
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-24 00:00:00.000000000 Z
11
+ date: 2024-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: test-cmd.rb
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.12.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.12.2
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: yard
15
29
  requirement: !ruby/object:Gem::Requirement