kompo 0.3.0 → 0.3.1

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: 9810a7219117daa1c6a82c2741df55d16acb20a7d59b6dec0609f2f6a68418dd
4
- data.tar.gz: 0b304b0510ec458f50c75e94528d604f71fa9cc7f5cdbb7386bcf1671495ca02
3
+ metadata.gz: 62d037ca6d6e6732787913525793259a1f7fc873ef236d878f311f7f7a006027
4
+ data.tar.gz: 85a8518c2f667948993610c8c371f5965f23a9c5e3966c56528effd1d83f83c1
5
5
  SHA512:
6
- metadata.gz: d678007c08242abee43dc8dd74a70a425701287336782b87f55e60624fa605ce1d844b345f14f70583e11dbccbcf507aec307b3cdcfc9a1472f5eab356d0c80c
7
- data.tar.gz: ef31ac68e4ef6e15d1b98b1e71d97faf8385b36c3f75d85c918e970a0f47331845f4b994c1a4a68144ed730ca18331b21794b8c9dd543c881639c71c8042df02
6
+ metadata.gz: 39f7e8db6050dc96a268717d9f8e95bd46a1e25a2d9f39062565fd4d61975440d5810eec072011361c4ba6d68189ce271326f9b43adbae5ea06ce9f022a85a0f
7
+ data.tar.gz: 4dde801ca0ca7df82a0221a2e79a3a9ce835a201108010355262d2c77aad55bff5b2d21f119746560cbb71275a8b07ca2db87f1c7da44200c022dbe911510124
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.1] - 2025-01-25
11
+
12
+ ### Fixed
13
+ - Copy gemspec files when Gemfile contains `gemspec` directive [#8](https://github.com/ahogappa/kompo/pull/8)
14
+ - Fix "." directory handling to copy contents directly instead of creating nested structure [#8](https://github.com/ahogappa/kompo/pull/8)
15
+
10
16
  ## [0.3.0] - 2026-01-24
11
17
 
12
18
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kompo (0.3.0)
4
+ kompo (0.3.1)
5
5
  async
6
6
  mini_portile2
7
7
  pathspec
@@ -3,7 +3,7 @@
3
3
  require 'fileutils'
4
4
 
5
5
  module Kompo
6
- # Copy Gemfile and Gemfile.lock to working directory if they exist
6
+ # Copy Gemfile, Gemfile.lock, and gemspec files to working directory if they exist
7
7
  class CopyGemfile < Taski::Task
8
8
  exports :gemfile_exists
9
9
 
@@ -15,6 +15,7 @@ module Kompo
15
15
  gemfile_lock_path = File.join(project_dir, 'Gemfile.lock')
16
16
 
17
17
  @gemfile_exists = File.exist?(gemfile_path)
18
+ @copied_gemspecs = []
18
19
 
19
20
  if @gemfile_exists
20
21
  FileUtils.cp(gemfile_path, work_dir)
@@ -24,6 +25,9 @@ module Kompo
24
25
  FileUtils.cp(gemfile_lock_path, work_dir)
25
26
  puts 'Copied: Gemfile.lock'
26
27
  end
28
+
29
+ # Copy gemspec files if Gemfile references gemspec
30
+ copy_gemspec_if_needed(gemfile_path, project_dir, work_dir)
27
31
  else
28
32
  puts 'No Gemfile found, skipping'
29
33
  end
@@ -40,7 +44,35 @@ module Kompo
40
44
 
41
45
  FileUtils.rm_f(gemfile)
42
46
  FileUtils.rm_f(gemfile_lock)
47
+
48
+ # Clean up copied gemspec files
49
+ (@copied_gemspecs || []).each do |gemspec|
50
+ FileUtils.rm_f(gemspec)
51
+ end
52
+
43
53
  puts 'Cleaned up Gemfile'
44
54
  end
55
+
56
+ private
57
+
58
+ def copy_gemspec_if_needed(gemfile_path, project_dir, work_dir)
59
+ gemfile_content = File.read(gemfile_path)
60
+
61
+ # Check if Gemfile contains a gemspec directive
62
+ return unless gemfile_content.match?(/^\s*gemspec\b/)
63
+
64
+ # Copy all .gemspec files from project directory
65
+ gemspec_files = Dir.glob(File.join(project_dir, '*.gemspec'))
66
+ gemspec_files.each do |gemspec_path|
67
+ dest_path = File.join(work_dir, File.basename(gemspec_path))
68
+ FileUtils.cp(gemspec_path, dest_path)
69
+ @copied_gemspecs << dest_path
70
+ puts "Copied: #{File.basename(gemspec_path)}"
71
+ end
72
+
73
+ if gemspec_files.empty?
74
+ warn 'Warning: Gemfile contains gemspec directive but no .gemspec files found'
75
+ end
76
+ end
45
77
  end
46
78
  end
@@ -53,13 +53,20 @@ module Kompo
53
53
  end
54
54
 
55
55
  if File.directory?(src)
56
- FileUtils.mkdir_p(dest)
57
- FileUtils.cp_r(src, File.dirname(dest))
56
+ # Special handling for "." - copy directory contents directly to work_dir
57
+ if file == '.' || real_src == real_project_dir
58
+ copy_directory_contents(src, work_dir)
59
+ @additional_paths << work_dir
60
+ else
61
+ FileUtils.mkdir_p(dest)
62
+ FileUtils.cp_r(src, File.dirname(dest))
63
+ @additional_paths << dest
64
+ end
58
65
  else
59
66
  FileUtils.mkdir_p(File.dirname(dest))
60
67
  FileUtils.cp(src, dest)
68
+ @additional_paths << dest
61
69
  end
62
- @additional_paths << dest
63
70
  puts "Copied: #{file}"
64
71
  end
65
72
  end
@@ -85,5 +92,21 @@ module Kompo
85
92
  end
86
93
  puts 'Cleaned up project files'
87
94
  end
95
+
96
+ private
97
+
98
+ def copy_directory_contents(src_dir, dest_dir)
99
+ # Copy all files and directories from src_dir directly into dest_dir
100
+ Dir.each_child(src_dir) do |child|
101
+ src_path = File.join(src_dir, child)
102
+ dest_path = File.join(dest_dir, child)
103
+
104
+ if File.directory?(src_path)
105
+ FileUtils.cp_r(src_path, dest_path)
106
+ else
107
+ FileUtils.cp(src_path, dest_path)
108
+ end
109
+ end
110
+ end
88
111
  end
89
112
  end
data/lib/kompo/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kompo
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  KOMPO_VFS_MIN_VERSION = '0.5.0'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kompo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hirano
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  - !ruby/object:Gem::Version
132
132
  version: 3.3.11
133
133
  requirements: []
134
- rubygems_version: 4.0.3
134
+ rubygems_version: 4.0.4
135
135
  specification_version: 4
136
136
  summary: A tool to pack Ruby and Ruby scripts in one binary.
137
137
  test_files: []