extract-repo 0.0.7 → 0.0.8

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/extract_repo.rb +22 -34
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb1f35a8e4326be22434c39f93d42c2cdeb7f14803c4305a960ef61aab327186
4
- data.tar.gz: 5596a40671de2dd1b58a4d06613e89ad9ea3cdaa7701ca932c9dd51306ddee0c
3
+ metadata.gz: ff0ac721f57a6835cec23e2212bbda0c7e77e84159170ae987267045d4a771e9
4
+ data.tar.gz: e43e0030a41ff37fea7bb88375bc772a32bb50f6e661c1713c4c6da49bc6920c
5
5
  SHA512:
6
- metadata.gz: e66d8b47f630703007ae7bce86d0ca08128abae65a71ad8041d149ee52b37687c49ec07872868c97faf6d658ab312afe73f9951e22f173e30d94e8e6b35712e5
7
- data.tar.gz: ce9d147031b7cff5a07e0d9c2defd13e4cf819135f614c51c392093014cb6a819ea5927b89954365529fc8aac4677886140bf425ff8774ce0d49b26e943fffed
6
+ metadata.gz: 4e578231b0f5dab20d385c385aefebc3c32037735766851f757be1587544ebbca5f1410499b5fa195755a139658e005f7ce9039f7f4a8efff7352aeaeaac688f
7
+ data.tar.gz: 612f90e4ebf638024437ec283b5a8bf1dab9f8f839b7983deec21e9a4700142f1b33b9b7f90fd44545c6876ddcbb16044d97e284ef0cc4813cc4fff3afb5591c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.8] - 2024-11-07
2
+
3
+ - Don't give the new repository the name of the source repository
4
+
1
5
  ## [0.0.7] - 2024-10-18
2
6
 
3
7
  - Fix URI bug
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 #{repo_dir}"
51
+ sh "rm -rf #{output_path}"
60
52
  end
61
53
 
62
54
  def clone_repo
63
- chdir output_path do
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 repo_dir do
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 repo_dir do
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 repo_dir do
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 repo_dir do
88
+ chdir output_path do
99
89
  self.file_paths = []
100
90
 
101
- chdir repo_dir do
102
- paths.each do |path|
103
- unless File.exist?(path)
104
- # :nocov:
105
- raise "Path #{path} does not exist in repo #{repo_dir}"
106
- # :nocov:
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
- if File.directory?(path)
110
- Dir.glob("#{path}/**/*").each do |file|
111
- file_paths << file if File.file?(file)
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 repo_dir do
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 repo_dir do
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,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extract-repo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-19 00:00:00.000000000 Z
11
+ date: 2024-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foobara
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubygems_version: 3.5.22
83
+ rubygems_version: 3.5.23
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Extract code from one repository into a new repository, preserving history