rundoc 3.1.1 → 3.1.2

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: d21f4ac48ad2eab762969c03ce386aeb097f99162d38716e4736de44c9bbac83
4
- data.tar.gz: 79f9be265a84d8474e3ed7d55d90781e9999790b6cf5e578943db89e0fec7ee9
3
+ metadata.gz: 2c2298eda9572df3a7acbb3d9a81ba5bdc2b5c80ba5ebc913d22308780aeff47
4
+ data.tar.gz: d9b2f86f1cfe167657f4d0d76c23f44340b6f992b959864401c1496241fbcbea
5
5
  SHA512:
6
- metadata.gz: fcf456c89f09000ddeeaf7aa22654acf419f36294b9e88dec9735f9ec3fcab315085dd6ee97cbd63eb580078e009968219b5240a6fe7a6db4c022d1b878d97cb
7
- data.tar.gz: 8e2ee0bd6fa26b8b8906ec9b2267a9e98feedc40b54dc53ca457937a7199865c2c6b7663837a067802426321fc93740da3038289ea516139a573a1e5679c8724
6
+ metadata.gz: 0db0233ad2b0773f453f2eb487bebc2d3cd3fb114f44aaf2295206250722ca3c4a29ceb558d1546de88865cdb120bc113ac828397b9a50c04c06b50e9aa0a0d2
7
+ data.tar.gz: d89e65b47bca1d1bd76f5894621c2ea53a957215008b043e3be6e672e87093e3a6af3a8696c9ab03e1dcf2ebb39b8362b882bc38235a0e4c1718744f30d2592c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## HEAD
2
2
 
3
+ ## 3.1.2
4
+
5
+ - Fix: Using `rundoc.require` inside of a document that was `rundoc.require`-d now sources files from the correct relative document path (https://github.com/zombocom/rundoc/pull/84)
6
+ - Fix: `rundoc <file> --with-contents <dir>` now expands the path passed in to the `--with-contents` so relative paths can safely be used (https://github.com/zombocom/rundoc/pull/83)
7
+
3
8
  ## 3.1.1
4
9
 
5
10
  - Fix: Include all code sections in the event of a failure, not just the last one (https://github.com/zombocom/rundoc/pull/71)
@@ -111,7 +111,7 @@ module Rundoc
111
111
  end
112
112
 
113
113
  opts.on("--with-contents <dir>", "Copies contents of directory into the tmp working dir") do |v|
114
- options[:with_contents_dir] = v
114
+ options[:with_contents_dir] = File.expand_path(v)
115
115
  end
116
116
 
117
117
  opts.on("--on-success-dir <dir>", "Success dir, relative to CWD. i.e. `<rundoc.md/dir>/#{CLI::DEFAULTS::ON_SUCCESS_DIR}/`.") do |v|
@@ -14,12 +14,17 @@ class ::Rundoc::CodeCommand
14
14
  end
15
15
 
16
16
  def call(env = {})
17
- document_path = @path.expand_path(env[:context].source_dir)
17
+ execution_context = env[:context]
18
+ document_path = @path.expand_path(execution_context.source_dir)
18
19
 
19
- puts "rundoc.require: Start executing #{@path.to_s.inspect}"
20
20
  output = Rundoc::Parser.new(
21
21
  document_path.read,
22
- context: env[:context]
22
+ context: Rundoc::Context::Execution.new(
23
+ source_path: document_path,
24
+ output_dir: execution_context.output_dir,
25
+ screenshots_dirname: execution_context.screenshots_dir,
26
+ with_contents_dir: execution_context.with_contents_dir
27
+ )
23
28
  ).to_md
24
29
 
25
30
  if render_result?
@@ -1,3 +1,3 @@
1
1
  module Rundoc
2
- VERSION = "3.1.1"
2
+ VERSION = "3.1.2"
3
3
  end
@@ -60,4 +60,38 @@ class IntegrationRequireTest < Minitest::Test
60
60
  end
61
61
  end
62
62
  end
63
+
64
+ def test_require_is_relative_to_current_file_not_source_file
65
+ Dir.mktmpdir do |dir|
66
+ Dir.chdir(dir) do
67
+ dir = Pathname(dir)
68
+
69
+ source_path = dir.join("RUNDOC.md")
70
+ source_path.write <<~EOF
71
+ ```
72
+ :::>> rundoc.require "./src/a.md"
73
+ ```
74
+ EOF
75
+
76
+ dir.join("src").tap(&:mkpath).join("a.md").write <<~EOF
77
+ ```
78
+ :::-> rundoc.require "./b.md"
79
+ ```
80
+ EOF
81
+
82
+ dir.join("src").join("b.md").write <<~EOF
83
+ ```
84
+ :::-> print.text Hello World!
85
+ ```
86
+ EOF
87
+
88
+ parsed = parse_contents(
89
+ source_path.read,
90
+ source_path: source_path
91
+ )
92
+ actual = parsed.to_md.gsub(Rundoc::CodeSection::AUTOGEN_WARNING, "")
93
+ assert_equal "Hello World!", actual.strip
94
+ end
95
+ end
96
+ end
63
97
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rundoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-22 00:00:00.000000000 Z
11
+ date: 2024-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor