bade 0.3.7 → 0.3.9

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: a481b2a1a19745d8660df10476ca85cfa6687a47115cf7f964d40c63dd36327e
4
- data.tar.gz: 5996a6dd699189cc5059619558524a65c892a751ffbedeb3fd09cdf41e7d8b18
3
+ metadata.gz: 73d88fecdae76de6653aa57c44576f3ce21bee35ac62eb242a8b57780e5a68af
4
+ data.tar.gz: 25d7ff84bb953fbd393c0fa2831f768a27e6d6487547c7551e750758170aefee
5
5
  SHA512:
6
- metadata.gz: 0675d10d28933ee600d2530a3ae863cdfe53bae8632c6eb92e59e49a37fddc7eb3a6b62b6f492d88734597e988c0361d5f0b1f4b68d069e7e55789d061d55ed2
7
- data.tar.gz: 149cb3709994965d70e3552b7f548b0c04d39610176379ed09b8ff21d6c2444d26546fceca0976c813cb86f997c174343cb418a480697551058b20dd7c1b2ede
6
+ metadata.gz: 7d03cef22b6ed6fcb6beeb8fbb19c5e0b0ff164f063083e78c7d5e92da5c7777c98b94e32fab62fc12a0bf3326c607e3d127901b18ec3ae502546d39052a5076
7
+ data.tar.gz: aa449b5351d9adb774b9ed101e1063cbe76bacf4ea82f2718a78547cbc69945ab640bc9c5d6c7044c9bb741eb519075416710aabfab6f197826ca2c28fc01f1d
data/Bade.gemspec CHANGED
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_dependency 'psych', '>= 2.2', '< 5.0'
25
+ spec.add_dependency 'psych', '>= 2.2', '< 6.0'
26
26
 
27
- spec.add_development_dependency 'fakefs', '~> 1.3'
27
+ spec.add_development_dependency 'fakefs', '>= 1.4', '< 3.0'
28
28
  spec.add_development_dependency 'rspec', '~> 3.2'
29
29
  spec.add_development_dependency 'rubocop', '~> 1.14'
30
30
  end
@@ -14,7 +14,7 @@ module Bade
14
14
 
15
15
  DEFAULT_BLOCK_NAME = 'default_block'.freeze
16
16
 
17
- REQUIRE_RELATIVE_REGEX = /require_relative\s+['"](.+)['"]/
17
+ REQUIRE_RELATIVE_REGEX = /require_relative\s+(['"])(.+)['"]/
18
18
 
19
19
  # @param [Document] document
20
20
  #
@@ -435,12 +435,19 @@ module Bade
435
435
  #
436
436
  def _fix_required_relative(text)
437
437
  text.gsub(REQUIRE_RELATIVE_REGEX) do
438
- relative_path = Regexp.last_match[1]
439
- abs_path = File.expand_path(relative_path, File.dirname(@documents.last.file_path))
440
- document_abs_path = Pathname.new(File.expand_path(File.dirname(@documents.first.file_path)))
441
- new_relative_path = Pathname.new(abs_path).relative_path_from(document_abs_path).to_s
438
+ quote = Regexp.last_match[1]
439
+ relative_path = Regexp.last_match[2]
442
440
 
443
- "require_relative '#{new_relative_path}'"
441
+ should_not_process = quote === '"' && relative_path.include?('#{')
442
+
443
+ new_relative_path = relative_path
444
+ unless should_not_process
445
+ abs_path = File.expand_path(relative_path, File.dirname(@documents.last.file_path))
446
+ document_abs_path = Pathname.new(File.expand_path(File.dirname(@documents.first.file_path)))
447
+ new_relative_path = Pathname.new(abs_path).relative_path_from(document_abs_path).to_s
448
+ end
449
+
450
+ "require_relative #{quote}#{new_relative_path}#{quote}"
444
451
  end
445
452
  end
446
453
  end
data/lib/bade/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bade
4
- VERSION = '0.3.7'.freeze
4
+ VERSION = '0.3.9'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Kříž
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-15 00:00:00.000000000 Z
11
+ date: 2023-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: psych
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '2.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.0'
22
+ version: '6.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,21 +29,27 @@ dependencies:
29
29
  version: '2.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.0'
32
+ version: '6.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: fakefs
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '1.4'
40
+ - - "<"
38
41
  - !ruby/object:Gem::Version
39
- version: '1.3'
42
+ version: '3.0'
40
43
  type: :development
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
- - - "~>"
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '1.4'
50
+ - - "<"
45
51
  - !ruby/object:Gem::Version
46
- version: '1.3'
52
+ version: '3.0'
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: rspec
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -134,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
140
  - !ruby/object:Gem::Version
135
141
  version: '0'
136
142
  requirements: []
137
- rubygems_version: 3.4.20
143
+ rubygems_version: 3.4.21
138
144
  signing_key:
139
145
  specification_version: 4
140
146
  summary: Minimalistic template engine for Ruby.