nanoc-external 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d6b874e7f7ae3fb33148fb4496368a0ff3976f93
4
- data.tar.gz: 46edf73cacb6ad444d403bdc8e4ddcc0a5907464
2
+ SHA256:
3
+ metadata.gz: 0e06ea835b1ad1ab34524b31c62a74842038125a56d3f11c740044572b059f86
4
+ data.tar.gz: af95f7457c1a766f40522d9823e59bfb73b48cd2408da305ee50726366a645c9
5
5
  SHA512:
6
- metadata.gz: 10e5a9cf175954db4ced30bc5f0432eb2e412df5bf82598f01bb82e113e1d60a86eb9a2759e1baea7b056b048ee0efc781a7e8f8271e99215a9d18956cab6192
7
- data.tar.gz: 539aeb9bc39b75c79c59b5bbecaf655ecec289418b233b8b8d5b20ff40f5ba3657e1dea0169588e7a82ee60c402dcd1c0359a1a1b4f5e8b3d3245659f413bb5c
6
+ metadata.gz: 50de96d91e8ea672376e1df8b3631077aa526837e1615a9abdf2f430572ac0e26a6afcacbfabd37e22734f3228eb613a3fa3b9058b2ed1904d31998d01475005
7
+ data.tar.gz: 35fa93d19f6b80ce215a594231c8386ed9fcb088eb70a75ad6f8c820d698a4ef9e228685d7b1c6f03faa938d7ee2995d3f5da202e0dbcf34cf8b6185ad5c25ed
data/NEWS.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # nanoc-external news
2
2
 
3
+ ## 1.0.2 (2017-12-03)
4
+
5
+ * Dropped support for Ruby 2.2 and older
6
+
3
7
  ## 1.0.1
4
8
 
5
9
  * Added support for Nanoc 4
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](http://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,18 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Nanoc::External
4
-
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
4
  class Filter < Nanoc::Filter
10
-
11
5
  identifier :external
12
6
 
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
7
  def run(content, params = {})
30
- debug = params.fetch(:debug, false)
31
- cmd = params.fetch(:exec, nil)
8
+ cmd = params.fetch(:exec)
32
9
  opts = params.fetch(:options, [])
33
10
 
34
- if cmd.nil?
35
- raise Nanoc::Errors::GenericTrivial.new("nanoc-external: missing :exec argument")
36
- end
37
-
38
- cmd_with_opts = [ cmd ] + opts
39
- odebug(cmd_with_opts.join(' ')) if debug
11
+ cmd_with_opts = [cmd] + opts
40
12
  out = StringIO.new
41
- piper = Nanoc::Extra::Piper.new(:stdout => out, :stderr => $stderr)
13
+ piper = Nanoc::Extra::Piper.new(stdout: out, stderr: $stderr)
42
14
  piper.run(cmd_with_opts, content)
43
- odebug(out.string) if debug
44
15
  out.string
45
16
  end
46
-
47
- private
48
-
49
- def odebug(msg)
50
- msg.each_line { |l| puts "\033[1;31mDEBUG:\033[0m #{l}" }
51
- end
52
-
53
17
  end
54
-
55
18
  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.1'
7
-
5
+ VERSION = '1.0.2'
8
6
  end
9
7
  end
metadata CHANGED
@@ -1,87 +1,54 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-external
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
- - Lifepillar
7
+ - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-07 00:00:00.000000000 Z
11
+ date: 2017-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nanoc
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 3.6.7
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: 5.0.0
23
- type: :runtime
24
- prerelease: false
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: 5.0.0
33
- - !ruby/object:Gem::Dependency
34
- name: bundler
35
15
  requirement: !ruby/object:Gem::Requirement
36
16
  requirements:
37
17
  - - "~>"
38
18
  - !ruby/object:Gem::Version
39
- version: '1.5'
40
- type: :development
19
+ version: '4.8'
20
+ type: :runtime
41
21
  prerelease: false
42
22
  version_requirements: !ruby/object:Gem::Requirement
43
23
  requirements:
44
24
  - - "~>"
45
25
  - !ruby/object:Gem::Version
46
- version: '1.5'
26
+ version: '4.8'
47
27
  description: Provides an :external filter for nanoc
48
- email: github@lifepillar.org
28
+ email: denis+rubygems@denis.ws
49
29
  executables: []
50
30
  extensions: []
51
- extra_rdoc_files:
52
- - LICENSE
53
- - README.md
54
- - NEWS.md
31
+ extra_rdoc_files: []
55
32
  files:
56
- - Gemfile
57
- - Gemfile.lock
58
- - LICENSE
59
33
  - NEWS.md
60
34
  - README.md
61
- - Rakefile
62
35
  - lib/nanoc-external.rb
63
36
  - lib/nanoc/external.rb
64
37
  - lib/nanoc/external/filter.rb
65
38
  - lib/nanoc/external/version.rb
66
- - nanoc-external-1.0.0.gem
67
- - nanoc-external.gemspec
68
- - test/filters/test_external.rb
69
- - test/helper.rb
70
39
  homepage: http://nanoc.ws/
71
40
  licenses:
72
41
  - MIT
73
42
  metadata: {}
74
43
  post_install_message:
75
- rdoc_options:
76
- - "--main"
77
- - README.md
44
+ rdoc_options: []
78
45
  require_paths:
79
46
  - lib
80
47
  required_ruby_version: !ruby/object:Gem::Requirement
81
48
  requirements:
82
- - - ">="
49
+ - - "~>"
83
50
  - !ruby/object:Gem::Version
84
- version: 1.9.3
51
+ version: '2.3'
85
52
  required_rubygems_version: !ruby/object:Gem::Requirement
86
53
  requirements:
87
54
  - - ">="
@@ -89,9 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
56
  version: '0'
90
57
  requirements: []
91
58
  rubyforge_project:
92
- rubygems_version: 2.4.7
59
+ rubygems_version: 2.7.3
93
60
  signing_key:
94
61
  specification_version: 4
95
62
  summary: External filter for nanoc
96
63
  test_files: []
97
- 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
data/Gemfile.lock DELETED
@@ -1,65 +0,0 @@
1
- GIT
2
- remote: git://github.com/nanoc/nanoc.git
3
- revision: bf13d9cc634faba39ceeaaa87b9ad6a9b2d45830
4
- specs:
5
- nanoc (4.0.0rc3)
6
- cri (~> 2.3)
7
-
8
- PATH
9
- remote: .
10
- specs:
11
- nanoc-external (1.0.1)
12
- nanoc (>= 3.6.7, < 4.0.0)
13
-
14
- GEM
15
- remote: https://rubygems.org/
16
- specs:
17
- colored (1.2)
18
- coveralls (0.8.3)
19
- json (~> 1.8)
20
- rest-client (>= 1.6.8, < 2)
21
- simplecov (~> 0.10.0)
22
- term-ansicolor (~> 1.3)
23
- thor (~> 0.19.1)
24
- cri (2.7.0)
25
- colored (~> 1.2)
26
- docile (1.1.5)
27
- domain_name (0.5.25)
28
- unf (>= 0.0.5, < 1.0.0)
29
- http-cookie (1.0.2)
30
- domain_name (~> 0.5)
31
- json (1.8.3)
32
- mime-types (2.6.2)
33
- minitest (5.8.2)
34
- netrc (0.11.0)
35
- rake (10.4.2)
36
- rest-client (1.8.0)
37
- http-cookie (>= 1.0.2, < 2.0)
38
- mime-types (>= 1.16, < 3.0)
39
- netrc (~> 0.7)
40
- simplecov (0.10.0)
41
- docile (~> 1.1.0)
42
- json (~> 1.8)
43
- simplecov-html (~> 0.10.0)
44
- simplecov-html (0.10.0)
45
- term-ansicolor (1.3.2)
46
- tins (~> 1.0)
47
- thor (0.19.1)
48
- tins (1.6.0)
49
- unf (0.1.4)
50
- unf_ext
51
- unf_ext (0.0.7.1)
52
-
53
- PLATFORMS
54
- ruby
55
-
56
- DEPENDENCIES
57
- bundler (~> 1.5)
58
- coveralls
59
- minitest
60
- nanoc!
61
- nanoc-external!
62
- rake
63
-
64
- BUNDLED WITH
65
- 1.10.6
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
Binary file
@@ -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', '< 5.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
data/test/helper.rb DELETED
@@ -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'