extract-repo 0.0.7 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/extract_repo.rb +22 -34
- metadata +4 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 557339120e6b4827fe0283731b74abf3466ca706a376496aacab6bfdfd004b52
|
4
|
+
data.tar.gz: e29e7133f566f40cf7637f0017ad68fd091079dd0f8635832f20beacfb3a5c58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37fedadcff384c41c447b2cd2a28cd7ca4da621978899d01c8859b9db4ce758ed600b410bd0609c9b626551367143d0d913e28bf789174d93e2195174d97e6a7
|
7
|
+
data.tar.gz: 702b4446a2b45d8ec36c903669131192fab9c7358c3af66388c302c223acaf8b32ca50c6e1c1c17fede64db726767a64245cd71f881861f3b4026c2ad96c97a5
|
data/CHANGELOG.md
CHANGED
data/lib/extract_repo.rb
CHANGED
@@ -43,26 +43,16 @@ class ExtractRepo < Foobara::Command
|
|
43
43
|
Dir.chdir(File.expand_path(dir), &)
|
44
44
|
end
|
45
45
|
|
46
|
-
def repo_dir
|
47
|
-
File.join(output_path, repo_name)
|
48
|
-
end
|
49
|
-
|
50
|
-
def repo_name
|
51
|
-
File.basename(repo_url, ".git")
|
52
|
-
end
|
53
|
-
|
54
46
|
def mk_extract_dir
|
55
47
|
sh "mkdir -p #{output_path}"
|
56
48
|
end
|
57
49
|
|
58
50
|
def rm_old_repo
|
59
|
-
sh "rm -rf #{
|
51
|
+
sh "rm -rf #{output_path}"
|
60
52
|
end
|
61
53
|
|
62
54
|
def clone_repo
|
63
|
-
|
64
|
-
sh "git clone #{absolute_repo_path}"
|
65
|
-
end
|
55
|
+
sh "git clone #{absolute_repo_path} #{output_path}"
|
66
56
|
end
|
67
57
|
|
68
58
|
def local_repository?
|
@@ -70,19 +60,19 @@ class ExtractRepo < Foobara::Command
|
|
70
60
|
end
|
71
61
|
|
72
62
|
def remove_origin
|
73
|
-
chdir
|
63
|
+
chdir output_path do
|
74
64
|
sh "git remote rm origin"
|
75
65
|
end
|
76
66
|
end
|
77
67
|
|
78
68
|
def remove_tags
|
79
|
-
chdir
|
69
|
+
chdir output_path do
|
80
70
|
sh "for i in `git tag`; do git tag -d $i; done"
|
81
71
|
end
|
82
72
|
end
|
83
73
|
|
84
74
|
def remove_replaces
|
85
|
-
chdir
|
75
|
+
chdir output_path do
|
86
76
|
replace_sha1s = sh "git replace -l", silent: true
|
87
77
|
replace_sha1s = replace_sha1s.chomp.split("\n")
|
88
78
|
replace_sha1s.each do |replace_sha1|
|
@@ -95,27 +85,25 @@ class ExtractRepo < Foobara::Command
|
|
95
85
|
end
|
96
86
|
|
97
87
|
def determine_paths
|
98
|
-
chdir
|
88
|
+
chdir output_path do
|
99
89
|
self.file_paths = []
|
100
90
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|
91
|
+
paths.each do |path|
|
92
|
+
unless File.exist?(path)
|
93
|
+
# :nocov:
|
94
|
+
raise "Path #{path} does not exist in repo #{output_path}"
|
95
|
+
# :nocov:
|
96
|
+
end
|
108
97
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
end
|
113
|
-
else
|
114
|
-
# TODO: test this path
|
115
|
-
# :nocov:
|
116
|
-
file_paths << path
|
117
|
-
# :nocov:
|
98
|
+
if File.directory?(path)
|
99
|
+
Dir.glob("#{path}/**/*").each do |file|
|
100
|
+
file_paths << file if File.file?(file)
|
118
101
|
end
|
102
|
+
else
|
103
|
+
# TODO: test this path
|
104
|
+
# :nocov:
|
105
|
+
file_paths << path
|
106
|
+
# :nocov:
|
119
107
|
end
|
120
108
|
end
|
121
109
|
end
|
@@ -124,7 +112,7 @@ class ExtractRepo < Foobara::Command
|
|
124
112
|
end
|
125
113
|
|
126
114
|
def determine_historic_paths
|
127
|
-
chdir
|
115
|
+
chdir output_path do
|
128
116
|
file_paths.dup.each do |file_path|
|
129
117
|
historic_paths = sh "git log --follow --name-only --pretty=format: -- \"#{file_path}\""
|
130
118
|
|
@@ -144,7 +132,7 @@ class ExtractRepo < Foobara::Command
|
|
144
132
|
end
|
145
133
|
|
146
134
|
def filter_repo
|
147
|
-
chdir
|
135
|
+
chdir output_path do
|
148
136
|
path_args = file_paths.map { |path| "--path #{path}" }.join(" ")
|
149
137
|
sh "git-filter-repo #{path_args} --force --prune-degenerate always"
|
150
138
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extract-repo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-07 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: foobara
|
@@ -38,7 +37,6 @@ dependencies:
|
|
38
37
|
- - ">="
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: '0'
|
41
|
-
description:
|
42
40
|
email:
|
43
41
|
- azimux@gmail.com
|
44
42
|
executables:
|
@@ -65,7 +63,6 @@ metadata:
|
|
65
63
|
source_code_uri: https://github.com/foobara/extract-repo
|
66
64
|
changelog_uri: https://github.com/foobara/extract-repo/blob/main/CHANGELOG.md
|
67
65
|
rubygems_mfa_required: 'true'
|
68
|
-
post_install_message:
|
69
66
|
rdoc_options: []
|
70
67
|
require_paths:
|
71
68
|
- lib
|
@@ -73,15 +70,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
70
|
requirements:
|
74
71
|
- - ">="
|
75
72
|
- !ruby/object:Gem::Version
|
76
|
-
version: 3.
|
73
|
+
version: 3.4.0
|
77
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
75
|
requirements:
|
79
76
|
- - ">="
|
80
77
|
- !ruby/object:Gem::Version
|
81
78
|
version: '0'
|
82
79
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
84
|
-
signing_key:
|
80
|
+
rubygems_version: 3.6.2
|
85
81
|
specification_version: 4
|
86
82
|
summary: Extract code from one repository into a new repository, preserving history
|
87
83
|
of the extracted files.
|