nanoc-webpack.rb 0.10.2 → 0.10.3

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
2
  SHA256:
3
- metadata.gz: 50fc64dec9fe69f4f196e037ad4e29e9a18d9e29956779a0e875ebabbc2ac92e
4
- data.tar.gz: df3d60655db70549e3063fc134e47c2627055ed2e2bbfdf64c7e5c3f6fab7a21
3
+ metadata.gz: c939a1fe4e2fb2f767e80b0fdac38ff132c5beff92aeb46d3019d2b4e5ec12da
4
+ data.tar.gz: 20b1ef0e1a025de9088dd99bc8047346b51d2f4fcf09fa203b5379c858ca28d4
5
5
  SHA512:
6
- metadata.gz: ebe00cd6038a0afd6ef57dcb9bdaeae7f28b82ff5ea29e3b68a9d7d65bda3099c9af9f63211c5545011e5ad6cebbec7147a05c604ef6dac673776effdc58e7b6
7
- data.tar.gz: ca7b8ea7060494597f1005724df564bcf955cd27ad7aef313053bb0e7f01469d7f2b2836a6eacf4f947d3146cb076001c9bd71219787b08ca609f2016867ca07
6
+ metadata.gz: d3a31c40abbe1052cd4bdc36ecc11cbefc784b7f97c9733e959837dbe6f88d435b106efccd7337c31ebfa6db06c49e97e23ffc2b6129440081f1ae15f9e581bb
7
+ data.tar.gz: ce8807fca6f33918d61af7a5df0c1dc0065b51121bf1913d7b60a9be7811b46e4cbf4c6c8267be0ae1d638ec164340c906b22c8303d8d8ecfeaf3247e0ae7e86
@@ -35,7 +35,7 @@ module Nanoc::Webpack
35
35
  # @return [void]
36
36
  def run(content, options = {})
37
37
  options = Ryo.from(options)
38
- path = temporary_file(content).path
38
+ file = temporary_file(content)
39
39
  depend_on dependable(paths: options.depend_on, reject: options.reject)
40
40
  .map { items[_1] }
41
41
  argv = [*(options.argv || []), *default_argv]
@@ -44,11 +44,11 @@ module Nanoc::Webpack
44
44
  ["./node_modules/webpack/bin/webpack.js",
45
45
  *argv,
46
46
  "--entry", File.join(Dir.getwd, item.attributes[:content_filename]),
47
- "--output-path", File.dirname(path),
48
- "--output-filename", File.basename(path)]
49
- File.read(path)
47
+ "--output-path", File.dirname(file.path),
48
+ "--output-filename", File.basename(file.path)]
49
+ File.read(file.path)
50
50
  ensure
51
- rm(path)
51
+ file ? file.tap(&:unlink).close : nil
52
52
  end
53
53
 
54
54
  private
@@ -58,20 +58,16 @@ module Nanoc::Webpack
58
58
  end
59
59
 
60
60
  def temporary_file(content)
61
- mkdir_p(tmpdir)
61
+ tmpdir = File.join(Dir.getwd, "tmp", "webpack")
62
62
  name = item.identifier.to_s
63
63
  file = Tempfile.new(
64
64
  [ File.basename(name), File.extname(name).sub(/\A\.(ts|tsx|jsx)\z/, '.js') ],
65
- tmpdir
65
+ mkdir_p(tmpdir).last
66
66
  )
67
67
  file.write(content)
68
68
  file.tap(&:flush)
69
69
  end
70
70
 
71
- def tmpdir
72
- File.join(Dir.getwd, "tmp", "webpack")
73
- end
74
-
75
71
  def scan(argv)
76
72
  options = argv.filter_map { _1.start_with?("-") ? _1 : nil }
77
73
  builtins = %w[--entry --output-path --output-filename]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Webpack
5
- VERSION = "0.10.2"
5
+ VERSION = "0.10.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-webpack.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - '0x1eef'