nanoc-external 1.0.0 → 1.0.5

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
- SHA1:
3
- metadata.gz: e52bfe8f2eab2b27d2f4d3d5c2836dec17479c84
4
- data.tar.gz: 45dc63c7ef389f0eeade105d573956ff505e707b
2
+ SHA256:
3
+ metadata.gz: 14fc8e63139a81c757162280b1b3b8d02f5a288a5b155dcd46c6e797adcec8e1
4
+ data.tar.gz: e41ca0b6681e62e67ce43008686e02755c74aaf0fcbcd18d53fc692ea96d7522
5
5
  SHA512:
6
- metadata.gz: 45f0d2bfb03731996479768de25226c0c959608cc12bb3dcb5c604ed1e702bf1c06a508378cc21fded3e463fb88c8636f6aa7dae2c2cf4d620153b45282e9d3f
7
- data.tar.gz: 5077eb9cda044d6b98bc98726ad9550a3a554c3475515e375919ba34027499249109c9a46d668d5620ee0d53cbb742c09e6c45e845219d5a2b34a1b5fb0591f2
6
+ metadata.gz: af42121acb15406be39401a35c18233dd8a722a69d9ff102574ded2ab90dcff76dfbdc7d4fa86dd5335642d118dedb7264ce2cb726c6433e3329cb032c2c1e34
7
+ data.tar.gz: 43456697e102ff83c2c3ec3be9c7c3f1c87f8a1011ea27dadce548f23ee38dd50aa632fb6b2519944619006a387c126a0ba544708c8a10cfd68d8a8b29460c25
data/NEWS.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # nanoc-external news
2
2
 
3
+ ## 1.0.5 (2021-01-01)
4
+
5
+ Enhancements:
6
+
7
+ * Added support for Ruby 3.x
8
+
9
+ ## 1.0.4 (2020-03-07)
10
+
11
+ Fixes:
12
+
13
+ * Restored compatibility with Nanoc 4.11.14.
14
+
15
+ ## 1.0.3 (2019-04-28)
16
+
17
+ Fixes:
18
+
19
+ * Restored compatibility with latest version of Nanoc
20
+
21
+ ## 1.0.2 (2017-12-03)
22
+
23
+ * Dropped support for Ruby 2.2 and older
24
+
25
+ ## 1.0.1
26
+
27
+ * Added support for Nanoc 4
28
+
3
29
  ## 1.0.0 (2015-03-07)
4
30
 
5
31
  Initial release.
data/README.md CHANGED
@@ -1,35 +1,34 @@
1
- [![Build Status](https://travis-ci.org/nanoc/nanoc-external.png)](https://travis-ci.org/nanoc/nanoc-external)
2
- [![Code Climate](https://codeclimate.com/github/nanoc/nanoc-external.png)](https://codeclimate.com/github/nanoc/nanoc-external)
3
- [![Coverage Status](https://coveralls.io/repos/nanoc/nanoc-external/badge.png?branch=master)](https://coveralls.io/r/nanoc/nanoc-external)
4
-
5
1
  # nanoc-external
6
2
 
7
- This provides a filter that allows [nanoc](http://nanoc.ws) to process content by executing an external program.
8
-
9
- Maintained by [lifepillar](https://github.com/lifepillar).
3
+ This provides a filter that allows [Nanoc](https://nanoc.ws) to process content by executing an external program.
10
4
 
11
5
  ## Installation
12
6
 
13
- `gem install nanoc-external`
7
+ Add `nanoc-external` to the `nanoc` group of your Gemfile:
8
+
9
+ ```ruby
10
+ group :nanoc do
11
+ gem 'nanoc-external'
12
+ end
13
+ ```
14
14
 
15
15
  ## Usage
16
16
 
17
+ Call the `:external` filter and pass the command to execute as the `:exec` argument. For example:
18
+
17
19
  ```ruby
18
- filter :external, :exec => 'command-name'
20
+ filter :external, exec: 'wc'
19
21
  ```
20
22
 
21
- The only requirement is that the external command must be
22
- able to receive its input from STDIN and it must send its
23
- output to STDOUT.
23
+ The external command must receive input from standard input (“stdin”) and must send its output to standard out (“stdout”).
24
24
 
25
- Options passed to this filter will be passed on to the
26
- external command. For example:
25
+ Options passed to this filter will be passed on to the external command. For example:
27
26
 
28
27
  ```ruby
29
- filter :external, exec: 'multimarkdown', options: => %w(--accept --mask --labels --smart)
28
+ filter :external, exec: 'multimarkdown', options: %w(--accept --mask --labels --smart)
30
29
  ```
31
30
 
32
- If the executable is not in your PATH, use its full path:
31
+ You can also pass the full path of the executable:
33
32
 
34
33
  ```ruby
35
34
  filter :external, exec: '/opt/local/bin/htmlcompressor'
@@ -1,3 +1,3 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'nanoc/external'
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Nanoc
4
4
  module External
@@ -1,55 +1,17 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- module Nanoc::External
3
+ module Nanoc
4
+ module External
5
+ class Filter < Nanoc::Filter
6
+ identifier :external
4
7
 
5
- # Pipes content through an external process.
6
- #
7
- # For this filter to work, the external program must be able to receive input
8
- # from standard input and it must write its output to standard output.
9
- class Filter < Nanoc::Filter
8
+ def run(content, params = {})
9
+ cmd = params.fetch(:exec)
10
+ opts = params.fetch(:options, [])
10
11
 
11
- identifier :external
12
-
13
- # Executes this filter. Parameters passed to this filter
14
- # through `:options` will be passed to the specified command.
15
- #
16
- # @param [String] content The content to filter.
17
- #
18
- # @option params [Symbol] :options ([]) A list of options for the external command.
19
- #
20
- # @option params [Symbol] :exec ("") The name or the full path of the executable.
21
- #
22
- # @option params [Symbol] :debug (false) Set to true to enable debugging.
23
- #
24
- # @return [String] The filtered content
25
- #
26
- # @example
27
- # filter :external, exec: 'multimarkdown', options: %w( --smart )
28
- # filter :external, exec: '/usr/local/bin/htmlcompressor
29
- def run(content, params = {})
30
- debug = params.fetch(:debug, false)
31
- cmd = params.fetch(:exec, nil)
32
- opts = params.fetch(:options, [])
33
-
34
- if cmd.nil?
35
- raise Nanoc::Errors::GenericTrivial.new("nanoc-external: missing :exec argument")
12
+ command = TTY::Command.new(printer: :null)
13
+ command.run(cmd, *opts, input: content).out
36
14
  end
37
-
38
- cmd_with_opts = [ cmd ] + opts
39
- odebug(cmd_with_opts.join(' ')) if debug
40
- out = StringIO.new
41
- piper = Nanoc::Extra::Piper.new(:stdout => out, :stderr => $stderr)
42
- piper.run(cmd_with_opts, content)
43
- odebug(out.string) if debug
44
- out.string
45
- end
46
-
47
- private
48
-
49
- def odebug(msg)
50
- msg.each_line { |l| puts "\033[1;31mDEBUG:\033[0m #{l}" }
51
15
  end
52
-
53
16
  end
54
-
55
17
  end
@@ -1,9 +1,7 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Nanoc
4
4
  module External
5
-
6
- VERSION = '1.0.0'
7
-
5
+ VERSION = '1.0.5'
8
6
  end
9
7
  end
metadata CHANGED
@@ -1,96 +1,68 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-external
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
- - Lifepillar
8
- autorequire:
7
+ - Denis Defreyne
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-07 00:00:00.000000000 Z
11
+ date: 2021-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: nanoc
14
+ name: nanoc-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.6.7
20
- - - "<"
19
+ version: '4.11'
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 4.0.0
22
+ version: 4.11.14
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 3.6.7
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: 4.0.0
33
- - !ruby/object:Gem::Dependency
34
- name: bundler
35
- requirement: !ruby/object:Gem::Requirement
36
26
  requirements:
37
27
  - - "~>"
38
28
  - !ruby/object:Gem::Version
39
- version: '1.5'
40
- type: :development
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
29
+ version: '4.11'
30
+ - - ">="
45
31
  - !ruby/object:Gem::Version
46
- version: '1.5'
47
- description: Provides an :external filter for nanoc
48
- email: github@lifepillar.org
32
+ version: 4.11.14
33
+ description: Provides an :external filter for Nanoc
34
+ email: denis+rubygems@denis.ws
49
35
  executables: []
50
36
  extensions: []
51
- extra_rdoc_files:
52
- - LICENSE
53
- - README.md
54
- - NEWS.md
37
+ extra_rdoc_files: []
55
38
  files:
56
- - Gemfile
57
- - Gemfile.lock
58
- - LICENSE
59
39
  - NEWS.md
60
40
  - README.md
61
- - Rakefile
62
41
  - lib/nanoc-external.rb
63
42
  - lib/nanoc/external.rb
64
43
  - lib/nanoc/external/filter.rb
65
44
  - lib/nanoc/external/version.rb
66
- - nanoc-external.gemspec
67
- - test/filters/test_external.rb
68
- - test/helper.rb
69
- homepage: http://nanoc.ws/
45
+ homepage: https://nanoc.ws/
70
46
  licenses:
71
47
  - MIT
72
48
  metadata: {}
73
- post_install_message:
74
- rdoc_options:
75
- - "--main"
76
- - README.md
49
+ post_install_message:
50
+ rdoc_options: []
77
51
  require_paths:
78
52
  - lib
79
53
  required_ruby_version: !ruby/object:Gem::Requirement
80
54
  requirements:
81
55
  - - ">="
82
56
  - !ruby/object:Gem::Version
83
- version: 1.9.3
57
+ version: '2.5'
84
58
  required_rubygems_version: !ruby/object:Gem::Requirement
85
59
  requirements:
86
60
  - - ">="
87
61
  - !ruby/object:Gem::Version
88
62
  version: '0'
89
63
  requirements: []
90
- rubyforge_project:
91
- rubygems_version: 2.4.5
92
- signing_key:
64
+ rubygems_version: 3.2.4
65
+ signing_key:
93
66
  specification_version: 4
94
- summary: External filter for nanoc
67
+ summary: External filter for Nanoc
95
68
  test_files: []
96
- has_rdoc:
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- gem 'minitest'
6
- gem 'rake'
7
- gem 'coveralls', require: false
@@ -1,48 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- nanoc-external (1.0.0)
5
- nanoc (>= 3.6.7, < 4.0.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- colored (1.2)
11
- coveralls (0.7.11)
12
- multi_json (~> 1.10)
13
- rest-client (>= 1.6.8, < 2)
14
- simplecov (~> 0.9.1)
15
- term-ansicolor (~> 1.3)
16
- thor (~> 0.19.1)
17
- cri (2.6.1)
18
- colored (~> 1.2)
19
- docile (1.1.5)
20
- mime-types (2.4.3)
21
- minitest (5.5.1)
22
- multi_json (1.11.0)
23
- nanoc (3.7.5)
24
- cri (~> 2.3)
25
- netrc (0.10.3)
26
- rake (10.4.2)
27
- rest-client (1.7.3)
28
- mime-types (>= 1.16, < 3.0)
29
- netrc (~> 0.7)
30
- simplecov (0.9.2)
31
- docile (~> 1.1.0)
32
- multi_json (~> 1.0)
33
- simplecov-html (~> 0.9.0)
34
- simplecov-html (0.9.0)
35
- term-ansicolor (1.3.0)
36
- tins (~> 1.0)
37
- thor (0.19.1)
38
- tins (1.3.5)
39
-
40
- PLATFORMS
41
- ruby
42
-
43
- DEPENDENCIES
44
- bundler (~> 1.5)
45
- coveralls
46
- minitest
47
- nanoc-external!
48
- rake
data/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2014 Denis Defreyne and contributors
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- SOFTWARE.
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'rake/testtask'
4
-
5
- Rake::TestTask.new do |t|
6
- t.libs = %w( lib test )
7
- t.test_files = FileList['test/**/test_*.rb', 'test/**/*_spec.rb']
8
- end
9
-
10
- task :default => :test
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH.unshift(File.expand_path('../lib/', __FILE__))
4
- require 'nanoc/external/version'
5
-
6
- Gem::Specification.new do |s|
7
- s.name = 'nanoc-external'
8
- s.version = Nanoc::External::VERSION
9
- s.homepage = 'http://nanoc.ws/'
10
- s.summary = 'External filter for nanoc'
11
- s.description = 'Provides an :external filter for nanoc'
12
-
13
- s.author = 'Lifepillar'
14
- s.email = 'github@lifepillar.org'
15
- s.license = 'MIT'
16
-
17
- s.required_ruby_version = '>= 1.9.3'
18
-
19
- s.files = Dir['[A-Z]*'] +
20
- Dir['{lib,test}/**/*'] +
21
- [ 'nanoc-external.gemspec' ]
22
- s.require_paths = [ 'lib' ]
23
-
24
- s.rdoc_options = [ '--main', 'README.md' ]
25
- s.extra_rdoc_files = [ 'LICENSE', 'README.md', 'NEWS.md' ]
26
-
27
- s.add_runtime_dependency('nanoc', '>= 3.6.7', '< 4.0.0')
28
- s.add_development_dependency('bundler', '~> 1.5')
29
- end
@@ -1,16 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'helper'
4
-
5
- class Nanoc::External::FilterTest < Minitest::Test
6
-
7
- def test_filter
8
- filter = ::Nanoc::External::Filter.new({})
9
- src = <<-SHAKESPEARE
10
- Shall I compare thee to a Summer's day?
11
- Thou art more lovely and more temperate
12
- SHAKESPEARE
13
- assert_match(/^\s*2\s*$/, filter.run(src, :exec => 'wc', :options => %w( -l ) ))
14
- end
15
-
16
- end
@@ -1,9 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'coveralls'
4
- Coveralls.wear!
5
-
6
- require 'minitest'
7
- require 'minitest/autorun'
8
- require 'nanoc'
9
- require 'nanoc-external'