kompo 0.3.2 → 0.4.0

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.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'English'
3
+ require "English"
4
4
  module Kompo
5
5
  # Section to handle platform-specific dependencies.
6
6
  # Switches implementation based on the current platform.
@@ -23,9 +23,9 @@ module Kompo
23
23
  InstallLibyaml.lib_path,
24
24
  InstallZlib.lib_path,
25
25
  InstallLibffi.lib_path
26
- ].compact.join(' ')
26
+ ].compact.join(" ")
27
27
 
28
- puts 'All Homebrew dependencies installed'
28
+ puts "All Homebrew dependencies installed"
29
29
  end
30
30
 
31
31
  # GMP library installation Section
@@ -37,8 +37,8 @@ module Kompo
37
37
  system("#{brew} list #{BREW_NAME} > /dev/null 2>&1") ? Installed : Install
38
38
  end
39
39
 
40
- BREW_NAME = 'gmp'
41
- MARKER_FILE = File.expand_path('~/.kompo_installed_gmp')
40
+ BREW_NAME = "gmp"
41
+ MARKER_FILE = File.expand_path("~/.kompo_installed_gmp")
42
42
 
43
43
  class Installed < Taski::Task
44
44
  def run
@@ -54,7 +54,7 @@ module Kompo
54
54
  brew = HomebrewPath.path
55
55
  puts "Installing #{BREW_NAME}..."
56
56
  system("#{brew} install #{BREW_NAME}") or raise "Failed to install #{BREW_NAME}"
57
- File.write(MARKER_FILE, 'installed')
57
+ File.write(MARKER_FILE, "installed")
58
58
 
59
59
  prefix = `#{brew} --prefix #{BREW_NAME} 2>/dev/null`.chomp
60
60
  @lib_path = "-L#{prefix}/lib" if $CHILD_STATUS.success? && !prefix.empty?
@@ -80,8 +80,8 @@ module Kompo
80
80
  system("#{brew} list #{BREW_NAME} > /dev/null 2>&1") ? Installed : Install
81
81
  end
82
82
 
83
- BREW_NAME = 'openssl@3'
84
- MARKER_FILE = File.expand_path('~/.kompo_installed_openssl')
83
+ BREW_NAME = "openssl@3"
84
+ MARKER_FILE = File.expand_path("~/.kompo_installed_openssl")
85
85
 
86
86
  class Installed < Taski::Task
87
87
  def run
@@ -97,7 +97,7 @@ module Kompo
97
97
  brew = HomebrewPath.path
98
98
  puts "Installing #{BREW_NAME}..."
99
99
  system("#{brew} install #{BREW_NAME}") or raise "Failed to install #{BREW_NAME}"
100
- File.write(MARKER_FILE, 'installed')
100
+ File.write(MARKER_FILE, "installed")
101
101
 
102
102
  prefix = `#{brew} --prefix #{BREW_NAME} 2>/dev/null`.chomp
103
103
  @lib_path = "-L#{prefix}/lib" if $CHILD_STATUS.success? && !prefix.empty?
@@ -123,8 +123,8 @@ module Kompo
123
123
  system("#{brew} list #{BREW_NAME} > /dev/null 2>&1") ? Installed : Install
124
124
  end
125
125
 
126
- BREW_NAME = 'readline'
127
- MARKER_FILE = File.expand_path('~/.kompo_installed_readline')
126
+ BREW_NAME = "readline"
127
+ MARKER_FILE = File.expand_path("~/.kompo_installed_readline")
128
128
 
129
129
  class Installed < Taski::Task
130
130
  def run
@@ -140,7 +140,7 @@ module Kompo
140
140
  brew = HomebrewPath.path
141
141
  puts "Installing #{BREW_NAME}..."
142
142
  system("#{brew} install #{BREW_NAME}") or raise "Failed to install #{BREW_NAME}"
143
- File.write(MARKER_FILE, 'installed')
143
+ File.write(MARKER_FILE, "installed")
144
144
 
145
145
  prefix = `#{brew} --prefix #{BREW_NAME} 2>/dev/null`.chomp
146
146
  @lib_path = "-L#{prefix}/lib" if $CHILD_STATUS.success? && !prefix.empty?
@@ -166,8 +166,8 @@ module Kompo
166
166
  system("#{brew} list #{BREW_NAME} > /dev/null 2>&1") ? Installed : Install
167
167
  end
168
168
 
169
- BREW_NAME = 'libyaml'
170
- MARKER_FILE = File.expand_path('~/.kompo_installed_libyaml')
169
+ BREW_NAME = "libyaml"
170
+ MARKER_FILE = File.expand_path("~/.kompo_installed_libyaml")
171
171
 
172
172
  class Installed < Taski::Task
173
173
  def run
@@ -183,7 +183,7 @@ module Kompo
183
183
  brew = HomebrewPath.path
184
184
  puts "Installing #{BREW_NAME}..."
185
185
  system("#{brew} install #{BREW_NAME}") or raise "Failed to install #{BREW_NAME}"
186
- File.write(MARKER_FILE, 'installed')
186
+ File.write(MARKER_FILE, "installed")
187
187
 
188
188
  prefix = `#{brew} --prefix #{BREW_NAME} 2>/dev/null`.chomp
189
189
  @lib_path = "-L#{prefix}/lib" if $CHILD_STATUS.success? && !prefix.empty?
@@ -209,8 +209,8 @@ module Kompo
209
209
  system("#{brew} list #{BREW_NAME} > /dev/null 2>&1") ? Installed : Install
210
210
  end
211
211
 
212
- BREW_NAME = 'zlib'
213
- MARKER_FILE = File.expand_path('~/.kompo_installed_zlib')
212
+ BREW_NAME = "zlib"
213
+ MARKER_FILE = File.expand_path("~/.kompo_installed_zlib")
214
214
 
215
215
  class Installed < Taski::Task
216
216
  def run
@@ -226,7 +226,7 @@ module Kompo
226
226
  brew = HomebrewPath.path
227
227
  puts "Installing #{BREW_NAME}..."
228
228
  system("#{brew} install #{BREW_NAME}") or raise "Failed to install #{BREW_NAME}"
229
- File.write(MARKER_FILE, 'installed')
229
+ File.write(MARKER_FILE, "installed")
230
230
 
231
231
  prefix = `#{brew} --prefix #{BREW_NAME} 2>/dev/null`.chomp
232
232
  @lib_path = "-L#{prefix}/lib" if $CHILD_STATUS.success? && !prefix.empty?
@@ -252,8 +252,8 @@ module Kompo
252
252
  system("#{brew} list #{BREW_NAME} > /dev/null 2>&1") ? Installed : Install
253
253
  end
254
254
 
255
- BREW_NAME = 'libffi'
256
- MARKER_FILE = File.expand_path('~/.kompo_installed_libffi')
255
+ BREW_NAME = "libffi"
256
+ MARKER_FILE = File.expand_path("~/.kompo_installed_libffi")
257
257
 
258
258
  class Installed < Taski::Task
259
259
  def run
@@ -269,7 +269,7 @@ module Kompo
269
269
  brew = HomebrewPath.path
270
270
  puts "Installing #{BREW_NAME}..."
271
271
  system("#{brew} install #{BREW_NAME}") or raise "Failed to install #{BREW_NAME}"
272
- File.write(MARKER_FILE, 'installed')
272
+ File.write(MARKER_FILE, "installed")
273
273
 
274
274
  prefix = `#{brew} --prefix #{BREW_NAME} 2>/dev/null`.chomp
275
275
  @lib_path = "-L#{prefix}/lib" if $CHILD_STATUS.success? && !prefix.empty?
@@ -291,30 +291,30 @@ module Kompo
291
291
  class ForLinux < Taski::Task
292
292
  def run
293
293
  unless pkg_config_available?
294
- puts '[WARNING] pkg-config not found. Skipping dependency check.'
295
- puts 'Install pkg-config to enable automatic dependency verification.'
296
- @lib_paths = ''
294
+ puts "[WARNING] pkg-config not found. Skipping dependency check."
295
+ puts "Install pkg-config to enable automatic dependency verification."
296
+ @lib_paths = ""
297
297
  return
298
298
  end
299
299
 
300
300
  check_dependencies
301
301
  @lib_paths = collect_lib_paths
302
302
 
303
- puts 'All required development libraries are installed.'
303
+ puts "All required development libraries are installed."
304
304
  end
305
305
 
306
306
  REQUIRED_LIBS = {
307
- 'openssl' => { pkg_config: 'openssl', apt: 'libssl-dev', yum: 'openssl-devel' },
308
- 'readline' => { pkg_config: 'readline', apt: 'libreadline-dev', yum: 'readline-devel' },
309
- 'zlib' => { pkg_config: 'zlib', apt: 'zlib1g-dev', yum: 'zlib-devel' },
310
- 'libyaml' => { pkg_config: 'yaml-0.1', apt: 'libyaml-dev', yum: 'libyaml-devel' },
311
- 'libffi' => { pkg_config: 'libffi', apt: 'libffi-dev', yum: 'libffi-devel' }
307
+ "openssl" => {pkg_config: "openssl", apt: "libssl-dev", yum: "openssl-devel"},
308
+ "readline" => {pkg_config: "readline", apt: "libreadline-dev", yum: "readline-devel"},
309
+ "zlib" => {pkg_config: "zlib", apt: "zlib1g-dev", yum: "zlib-devel"},
310
+ "libyaml" => {pkg_config: "yaml-0.1", apt: "libyaml-dev", yum: "libyaml-devel"},
311
+ "libffi" => {pkg_config: "libffi", apt: "libffi-dev", yum: "libffi-devel"}
312
312
  }.freeze
313
313
 
314
314
  private
315
315
 
316
316
  def pkg_config_available?
317
- system('which pkg-config > /dev/null 2>&1')
317
+ system("which pkg-config > /dev/null 2>&1")
318
318
  end
319
319
 
320
320
  def check_dependencies
@@ -330,13 +330,13 @@ module Kompo
330
330
  paths = pkg_names.flat_map do |pkg|
331
331
  `pkg-config --libs-only-L #{pkg} 2>/dev/null`.chomp.split
332
332
  end
333
- paths.uniq.join(' ')
333
+ paths.uniq.join(" ")
334
334
  end
335
335
 
336
336
  def build_error_message(missing)
337
- lib_names = missing.keys.join(', ')
338
- apt_packages = missing.values.map { |info| info[:apt] }.join(' ')
339
- yum_packages = missing.values.map { |info| info[:yum] }.join(' ')
337
+ lib_names = missing.keys.join(", ")
338
+ apt_packages = missing.values.map { |info| info[:apt] }.join(" ")
339
+ yum_packages = missing.values.map { |info| info[:yum] }.join(" ")
340
340
 
341
341
  <<~MSG
342
342
  Missing required development libraries: #{lib_names}
@@ -359,7 +359,7 @@ module Kompo
359
359
  private
360
360
 
361
361
  def macos?
362
- RUBY_PLATFORM.include?('darwin')
362
+ RUBY_PLATFORM.include?("darwin")
363
363
  end
364
364
  end
365
365
  end
@@ -1,14 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'fileutils'
4
- require_relative 'kompo_vfs_version_check'
3
+ require "fileutils"
4
+ require "open3"
5
+ require_relative "kompo_vfs_version_check"
5
6
 
6
7
  module Kompo
7
8
  # Section to get the kompo-vfs library path.
8
9
  # Priority:
9
10
  # 1. Local directory (if specified via context[:local_kompo_vfs_path])
10
- # 2. Homebrew (install if needed)
11
- # 3. Source build (fallback if Homebrew doesn't support arch/os)
11
+ # 2. macOS: Homebrew (required)
12
+ # 3. Linux: Build from source
12
13
  class KompoVfsPath < Taski::Section
13
14
  interfaces :path
14
15
 
@@ -16,10 +17,13 @@ module Kompo
16
17
  # Priority 1: Local directory if specified
17
18
  return FromLocal if Taski.args[:local_kompo_vfs_path]
18
19
 
19
- # # Priority 2: Homebrew if supported
20
- return FromHomebrew if homebrew_supported?
20
+ # macOS: Homebrew is required
21
+ if darwin?
22
+ check_homebrew_available!
23
+ return FromHomebrew
24
+ end
21
25
 
22
- # # Priority 3: Build from source
26
+ # Linux: Build from source
23
27
  FromSource
24
28
  end
25
29
 
@@ -27,15 +31,15 @@ module Kompo
27
31
  class FromLocal < Taski::Task
28
32
  def run
29
33
  local_path = Taski.args[:local_kompo_vfs_path]
30
- raise 'Local kompo-vfs path not specified' unless local_path
34
+ raise "Local kompo-vfs path not specified" unless local_path
31
35
  raise "Local kompo-vfs path does not exist: #{local_path}" unless Dir.exist?(local_path)
32
36
 
33
37
  puts "Building kompo-vfs from local directory: #{local_path}"
34
38
  cargo = CargoPath.path
35
39
 
36
- raise 'Failed to build kompo-vfs' unless system(cargo, 'build', '--release', chdir: local_path)
40
+ raise "Failed to build kompo-vfs" unless system(cargo, "build", "--release", chdir: local_path)
37
41
 
38
- @path = File.join(local_path, 'target', 'release')
42
+ @path = File.join(local_path, "target", "release")
39
43
  puts "kompo-vfs library path: #{@path}"
40
44
 
41
45
  KompoVfsVersionCheck.verify!(@path)
@@ -63,7 +67,7 @@ module Kompo
63
67
  unless missing_libs.empty?
64
68
  installed_version = `#{brew} list --versions kompo-vfs`.chomp.split.last
65
69
  raise "kompo-vfs #{installed_version} is outdated. Please run: brew upgrade kompo-vfs\n" \
66
- "Missing libraries: #{missing_libs.join(', ')}"
70
+ "Missing libraries: #{missing_libs.join(", ")}"
67
71
  end
68
72
 
69
73
  puts "kompo-vfs library path: #{@path}"
@@ -76,9 +80,9 @@ module Kompo
76
80
  class Install < Taski::Task
77
81
  def run
78
82
  brew = HomebrewPath.path
79
- puts 'Installing kompo-vfs via Homebrew...'
80
- system(brew, 'tap', 'ahogappa/kompo') or raise 'Failed to tap ahogappa/kompo'
81
- system(brew, 'install', 'kompo-vfs') or raise 'Failed to install kompo-vfs'
83
+ puts "Installing kompo-vfs via Homebrew..."
84
+ system(brew, "tap", "ahogappa/kompo-vfs", "https://github.com/ahogappa/kompo-vfs.git") or raise "Failed to tap ahogappa/kompo-vfs"
85
+ system(brew, "install", "ahogappa/kompo-vfs/kompo-vfs") or raise "Failed to install kompo-vfs"
82
86
 
83
87
  @path = "#{`#{brew} --prefix kompo-vfs`.chomp}/lib"
84
88
  puts "kompo-vfs library path: #{@path}"
@@ -100,24 +104,24 @@ module Kompo
100
104
 
101
105
  # Build from source (requires Cargo)
102
106
  class FromSource < Taski::Task
103
- REPO_URL = 'https://github.com/ahogappa/kompo-vfs'
107
+ REPO_URL = "https://github.com/ahogappa/kompo-vfs"
104
108
 
105
109
  def run
106
- puts 'Building kompo-vfs from source...'
110
+ puts "Building kompo-vfs from source..."
107
111
  cargo = CargoPath.path
108
112
 
109
- build_dir = File.expand_path('~/.kompo/kompo-vfs')
113
+ build_dir = File.expand_path("~/.kompo/kompo-vfs")
110
114
  FileUtils.mkdir_p(File.dirname(build_dir))
111
115
 
112
116
  if Dir.exist?(build_dir)
113
- system('git', '-C', build_dir, 'pull', '--quiet')
117
+ system("git", "-C", build_dir, "pull", "--quiet")
114
118
  else
115
- system('git', 'clone', REPO_URL, build_dir) or raise 'Failed to clone kompo-vfs repository'
119
+ system("git", "clone", REPO_URL, build_dir) or raise "Failed to clone kompo-vfs repository"
116
120
  end
117
121
 
118
- system(cargo, 'build', '--release', chdir: build_dir) or raise 'Failed to build kompo-vfs'
122
+ system(cargo, "build", "--release", chdir: build_dir) or raise "Failed to build kompo-vfs"
119
123
 
120
- @path = File.join(build_dir, 'target', 'release')
124
+ @path = File.join(build_dir, "target", "release")
121
125
  puts "kompo-vfs library path: #{@path}"
122
126
 
123
127
  KompoVfsVersionCheck.verify!(@path)
@@ -126,19 +130,24 @@ module Kompo
126
130
 
127
131
  private
128
132
 
129
- def homebrew_supported?
130
- # Check if current arch/os combination is supported by Homebrew formula
131
- arch = `uname -m`.chomp
132
- os = `uname -s`.chomp
133
+ def darwin?
134
+ RUBY_PLATFORM.include?("darwin") || `uname -s`.chomp == "Darwin"
135
+ end
136
+
137
+ def check_homebrew_available!
138
+ # Check if brew is in PATH
139
+ brew_in_path, = Open3.capture2("which", "brew", err: File::NULL)
140
+ return unless brew_in_path.chomp.empty?
141
+
142
+ # Check common Homebrew installation paths (including ARM64 at /opt/homebrew)
143
+ return if HomebrewPath::COMMON_BREW_PATHS.any? { |p| File.executable?(p) }
133
144
 
134
- # Supported combinations (adjust based on actual formula support)
135
- supported = [
136
- %w[arm64 Darwin],
137
- %w[x86_64 Darwin],
138
- %w[x86_64 Linux]
139
- ]
145
+ raise <<~ERROR
146
+ Homebrew is required on macOS but not installed.
147
+ Please install Homebrew first: https://brew.sh
140
148
 
141
- supported.include?([arch, os])
149
+ For local development, you can use --local-vfs-path option instead.
150
+ ERROR
142
151
  end
143
152
  end
144
153
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../version'
3
+ require_relative "../version"
4
4
 
5
5
  module Kompo
6
6
  # Verifies that the installed kompo-vfs version meets minimum requirements.
@@ -8,7 +8,7 @@ module Kompo
8
8
  module KompoVfsVersionCheck
9
9
  class IncompatibleVersionError < StandardError; end
10
10
 
11
- VERSION_FILE = 'KOMPO_VFS_VERSION'
11
+ VERSION_FILE = "KOMPO_VFS_VERSION"
12
12
 
13
13
  def self.verify!(lib_path)
14
14
  actual_version = get_version(lib_path)
@@ -37,7 +37,8 @@ module Kompo
37
37
  Required: >= #{required_version}
38
38
 
39
39
  Please upgrade:
40
- Homebrew: brew upgrade kompo-vfs
40
+ Homebrew: brew update && brew upgrade kompo-vfs
41
+ (If upgrade fails, try: brew tap --force-auto-update ahogappa/kompo)
41
42
  Source: cd ~/.kompo/kompo-vfs && git pull && cargo build --release
42
43
  MSG
43
44
  end
@@ -48,7 +49,8 @@ module Kompo
48
49
  Your kompo-vfs installation may be outdated (< 0.5.0).
49
50
 
50
51
  Please upgrade:
51
- Homebrew: brew upgrade kompo-vfs
52
+ Homebrew: brew update && brew upgrade kompo-vfs
53
+ (If upgrade fails, try: brew tap --force-auto-update ahogappa/kompo)
52
54
  Source: cd ~/.kompo/kompo-vfs && git pull && cargo build --release
53
55
  MSG
54
56
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'erb'
4
- require 'fileutils'
5
- require 'find'
3
+ require "erb"
4
+ require "fileutils"
5
+ require "find"
6
6
 
7
7
  module Kompo
8
8
  # Struct to hold file data for embedding
@@ -30,7 +30,7 @@ module Kompo
30
30
 
31
31
  def run
32
32
  @work_dir = WorkDir.path
33
- @path = File.join(@work_dir, 'fs.c')
33
+ @path = File.join(@work_dir, "fs.c")
34
34
 
35
35
  # Get original paths for Ruby standard library cache support
36
36
  # When Ruby is restored from cache, standard library paths are from the original build
@@ -47,8 +47,11 @@ module Kompo
47
47
  @file_bytes = []
48
48
  @paths = []
49
49
  @file_sizes = [0]
50
+ @added_paths = Set.new
51
+ @duplicate_count = 0
52
+ @verbose = Taski.args.fetch(:verbose, false)
50
53
 
51
- group('Collecting files') do
54
+ group("Collecting files") do
52
55
  embed_paths = collect_embed_paths
53
56
 
54
57
  embed_paths.each do |embed_path|
@@ -64,13 +67,14 @@ module Kompo
64
67
  add_file(expand_path)
65
68
  end
66
69
  end
67
- puts "Collected #{@file_sizes.size - 1} files"
70
+ duplicate_info = @duplicate_count.positive? ? " (#{@duplicate_count} duplicates skipped)" : ""
71
+ puts "Collected #{@file_sizes.size - 1} files#{duplicate_info}"
68
72
  end
69
73
 
70
- group('Generating fs.c') do
74
+ group("Generating fs.c") do
71
75
  context = build_template_context
72
76
 
73
- template_path = File.join(__dir__, '..', '..', 'fs.c.erb')
77
+ template_path = File.join(__dir__, "..", "..", "fs.c.erb")
74
78
  template = ERB.new(File.read(template_path))
75
79
  File.write(@path, template.result(binding))
76
80
  puts "Generated: fs.c (#{@file_bytes.size} bytes)"
@@ -81,7 +85,7 @@ module Kompo
81
85
  return unless @path && File.exist?(@path)
82
86
 
83
87
  FileUtils.rm_f(@path)
84
- puts 'Cleaned up fs.c'
88
+ puts "Cleaned up fs.c"
85
89
  end
86
90
 
87
91
  private
@@ -90,27 +94,21 @@ module Kompo
90
94
  paths = []
91
95
 
92
96
  # 1. Project files (entrypoint + additional files/directories specified by user)
93
- # Created by: CopyProjectFiles
94
97
  paths << CopyProjectFiles.entrypoint_path
95
98
  paths += CopyProjectFiles.additional_paths
96
99
 
97
100
  # 2. Gemfile, Gemfile.lock, and gemspec files (if exists)
98
- # Created by: CopyGemfile
99
101
  if CopyGemfile.gemfile_exists
100
- paths << File.join(@work_dir, 'Gemfile')
101
- paths << File.join(@work_dir, 'Gemfile.lock')
102
-
103
- # Include gemspec files for Bundler's gemspec directive
102
+ paths << File.join(@work_dir, "Gemfile")
103
+ paths << File.join(@work_dir, "Gemfile.lock")
104
104
  paths += CopyGemfile.gemspec_paths
105
105
 
106
106
  # 3. Bundle directory (.bundle/config and bundle/ruby/X.Y.Z/gems/...)
107
- # Created by: BundleInstall
108
107
  paths << BundleInstall.bundler_config_path
109
108
  paths << BundleInstall.bundle_ruby_dir
110
109
  end
111
110
 
112
111
  # 4. Ruby standard library
113
- # Retrieved by: CheckStdlibs
114
112
  paths += CheckStdlibs.paths
115
113
 
116
114
  paths.compact
@@ -139,7 +137,7 @@ module Kompo
139
137
 
140
138
  # Skip certain file extensions
141
139
  next if SKIP_EXTENSIONS.any? { |ext| path.end_with?(ext) }
142
- next if path.end_with?('selenium-manager')
140
+ next if path.end_with?("selenium-manager")
143
141
 
144
142
  # Skip files matching .kompoignore patterns
145
143
  next if should_ignore?(path)
@@ -157,7 +155,7 @@ module Kompo
157
155
  # Ruby standard library paths are outside work_dir and should not be filtered
158
156
  return false unless absolute_path.start_with?(@work_dir)
159
157
 
160
- relative_path = absolute_path.sub("#{@work_dir}/", '')
158
+ relative_path = absolute_path.sub("#{@work_dir}/", "")
161
159
  if @kompo_ignore.ignore?(relative_path)
162
160
  puts "Ignoring (via .kompoignore): #{relative_path}"
163
161
  true
@@ -167,15 +165,23 @@ module Kompo
167
165
  end
168
166
 
169
167
  def add_file(path)
168
+ # Skip duplicate files (same absolute path)
169
+ if @added_paths.include?(path)
170
+ @duplicate_count += 1
171
+ puts "skip: duplicate path #{path}" if @verbose
172
+ return
173
+ end
174
+ @added_paths.add(path)
175
+
170
176
  # Keep original paths for VFS - the caching system already ensures
171
177
  # the same work_dir path is reused across builds via metadata.json
172
178
  # Ruby's $LOAD_PATH uses work_dir paths, so embedded files must match.
173
179
  embedded_path = if @current_ruby_install_dir != @original_ruby_install_dir && path.start_with?(@current_ruby_install_dir)
174
- # Ruby install dir path replacement for cache compatibility (when paths differ)
175
- path.sub(@current_ruby_install_dir, @original_ruby_install_dir)
176
- else
177
- path
178
- end
180
+ # Ruby install dir path replacement for cache compatibility (when paths differ)
181
+ path.sub(@current_ruby_install_dir, @original_ruby_install_dir)
182
+ else
183
+ path
184
+ end
179
185
 
180
186
  puts "#{path} -> #{embedded_path}" if path != embedded_path
181
187
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'erb'
4
- require 'fileutils'
3
+ require "erb"
4
+ require "fileutils"
5
5
 
6
6
  module Kompo
7
7
  # Generate main.c from ERB template
@@ -15,25 +15,25 @@ module Kompo
15
15
 
16
16
  def run
17
17
  work_dir = WorkDir.path
18
- @path = File.join(work_dir, 'main.c')
18
+ @path = File.join(work_dir, "main.c")
19
19
 
20
20
  return if File.exist?(@path)
21
21
 
22
- template_path = File.join(__dir__, '..', '..', 'main.c.erb')
22
+ template_path = File.join(__dir__, "..", "..", "main.c.erb")
23
23
  template = ERB.new(File.read(template_path))
24
24
 
25
25
  # Build context object for ERB template
26
26
  context = build_template_context
27
27
 
28
28
  File.write(@path, template.result(binding))
29
- puts 'Generated: main.c'
29
+ puts "Generated: main.c"
30
30
  end
31
31
 
32
32
  def clean
33
33
  return unless @path && File.exist?(@path)
34
34
 
35
35
  FileUtils.rm_f(@path)
36
- puts 'Cleaned up main.c'
36
+ puts "Cleaned up main.c"
37
37
  end
38
38
 
39
39
  private