extract-repo 1.0.0 → 1.0.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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/extract_repo.rb +25 -9
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5a9293c9fcfc7ca1fa0e6c1b6ea98fc2f8a49b759cc10e6fdf51c88c50810a05
|
|
4
|
+
data.tar.gz: ce6a41d8871ae90bd0b11e2e9bb5db5d42cc4a5f1637269d90cf9b47484c318b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ebbb6934f7ba07f305efc9b5f619ba8e9693aec319e4a0575decd010b4122433e4151ec50c64004b38f344ddff4dbe1cbfb8ed9dbd44c8e2a6d833d47691603c
|
|
7
|
+
data.tar.gz: 72cdc37b3597fc725e6590a1e753e4db709f4e7453b740e204bb2a2eeaca9978fb839e74e5b08e9c797d471fd1e36d9a4f0b7e97b831f6715ac69db2a353bf7f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [1.0.2] - 2026-11-06
|
|
2
|
+
|
|
3
|
+
- Create new repo on main branch even if source repo is on a feature branch
|
|
4
|
+
|
|
5
|
+
## [1.0.1] - 2026-11-04
|
|
6
|
+
|
|
7
|
+
- Handle FileUtils not being loaded in Ruby 4
|
|
8
|
+
- Support appending file paths with "/" without breaking things
|
|
9
|
+
|
|
1
10
|
## [0.0.14] - 2025-07-31
|
|
2
11
|
|
|
3
12
|
- Bump deps and use 1.x.x versions of foobara gems
|
data/lib/extract_repo.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require "uri"
|
|
2
2
|
require "English"
|
|
3
|
+
require "fileutils"
|
|
3
4
|
|
|
4
5
|
require "foobara/all"
|
|
5
6
|
|
|
@@ -29,6 +30,7 @@ class ExtractRepo < Foobara::Command
|
|
|
29
30
|
determine_historic_paths
|
|
30
31
|
filter_repo
|
|
31
32
|
remove_replaces
|
|
33
|
+
change_to_main_if_needed
|
|
32
34
|
|
|
33
35
|
delete_extracted_paths if delete_extracted?
|
|
34
36
|
end
|
|
@@ -79,33 +81,47 @@ class ExtractRepo < Foobara::Command
|
|
|
79
81
|
replace_sha1s = replace_sha1s.chomp.split("\n")
|
|
80
82
|
replace_sha1s.each do |replace_sha1|
|
|
81
83
|
# It seems like some versions of git do not create replace markers when doing this
|
|
82
|
-
# :
|
|
84
|
+
# simplecov:disable
|
|
83
85
|
sh "git replace -d #{replace_sha1}"
|
|
84
|
-
# :
|
|
86
|
+
# simplecov:enable
|
|
85
87
|
end
|
|
86
88
|
end
|
|
87
89
|
end
|
|
88
90
|
|
|
91
|
+
def change_to_main_if_needed
|
|
92
|
+
unless current_branch == "main"
|
|
93
|
+
chdir output_path do
|
|
94
|
+
sh "git branch -m main"
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def current_branch
|
|
100
|
+
chdir output_path do
|
|
101
|
+
sh "git branch --show-current"
|
|
102
|
+
end.strip
|
|
103
|
+
end
|
|
104
|
+
|
|
89
105
|
def determine_paths
|
|
90
106
|
chdir output_path do
|
|
91
107
|
self.file_paths = []
|
|
92
108
|
|
|
93
109
|
paths.each do |path|
|
|
94
110
|
unless File.exist?(path)
|
|
95
|
-
# :
|
|
111
|
+
# simplecov:disable
|
|
96
112
|
raise "Path #{path} does not exist in repo #{output_path}"
|
|
97
|
-
# :
|
|
113
|
+
# simplecov:enable
|
|
98
114
|
end
|
|
99
115
|
|
|
100
116
|
if File.directory?(path)
|
|
101
|
-
Dir.glob("
|
|
117
|
+
Dir.glob(File.join(path, "/**/*")).each do |file|
|
|
102
118
|
file_paths << file if File.file?(file)
|
|
103
119
|
end
|
|
104
120
|
else
|
|
105
121
|
# TODO: test this path
|
|
106
|
-
# :
|
|
122
|
+
# simplecov:disable
|
|
107
123
|
file_paths << path
|
|
108
|
-
# :
|
|
124
|
+
# simplecov:enable
|
|
109
125
|
end
|
|
110
126
|
end
|
|
111
127
|
end
|
|
@@ -199,9 +215,9 @@ class ExtractRepo < Foobara::Command
|
|
|
199
215
|
result = `#{cmd}`
|
|
200
216
|
|
|
201
217
|
unless $CHILD_STATUS.success?
|
|
202
|
-
# :
|
|
218
|
+
# simplecov:disable
|
|
203
219
|
raise "Command #{cmd} failed with status #{$CHILD_STATUS.exitstatus}: #{result}"
|
|
204
|
-
# :
|
|
220
|
+
# simplecov:enable
|
|
205
221
|
end
|
|
206
222
|
|
|
207
223
|
result
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: extract-repo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miles Georgi
|
|
@@ -71,13 +71,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
71
71
|
- - ">="
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
73
|
version: 3.4.0
|
|
74
|
+
- - "<"
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '4.1'
|
|
74
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
78
|
requirements:
|
|
76
79
|
- - ">="
|
|
77
80
|
- !ruby/object:Gem::Version
|
|
78
81
|
version: '0'
|
|
79
82
|
requirements: []
|
|
80
|
-
rubygems_version:
|
|
83
|
+
rubygems_version: 4.0.24
|
|
81
84
|
specification_version: 4
|
|
82
85
|
summary: Extract code from one repository into a new repository, preserving history
|
|
83
86
|
of the extracted files.
|