excavate 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/metanorma.yml +49 -8
- data/.github/workflows/test-and-release.yml +69 -0
- data/Gemfile +1 -1
- data/excavate.gemspec +1 -2
- data/lib/excavate/archive.rb +15 -5
- data/lib/excavate/version.rb +1 -1
- metadata +7 -8
- data/.github/workflows/release.yml +0 -36
- data/.github/workflows/rspec.yml +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b66a3e8ff5083bd78711cff8289e18f958578d84fea44be53dcd4f5349508755
|
4
|
+
data.tar.gz: 1c65ff305ed20893b27470063280f60698d9920db597d42af8e75127c947784a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feac4007753c19cb52d9f32432f96ab2a2cf6553556cb950ad15f210a0e8f3d0209622b81702e17d4a9fef3e975b42f7f97178d7d55dfc914731245093a159f0
|
7
|
+
data.tar.gz: 93bed15a89d5f620e45232f9de42afde7efaabc7e79734617c8443f2324858a6a97e6b9e40995ee18ad5bce4d36ea1ac584b238d257accf567e88472ea0fd991
|
@@ -2,32 +2,73 @@ name: metanorma
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches: [
|
5
|
+
branches: [ main ]
|
6
6
|
pull_request:
|
7
7
|
|
8
|
+
concurrency:
|
9
|
+
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
|
10
|
+
cancel-in-progress: true
|
11
|
+
|
8
12
|
jobs:
|
13
|
+
prepare:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
outputs:
|
16
|
+
head_tag: ${{ steps.check.outputs.head_tag }}
|
17
|
+
foreign_pr: ${{ steps.check.outputs.foreign_pr }}
|
18
|
+
steps:
|
19
|
+
- name: Checkout
|
20
|
+
uses: actions/checkout@v2.3.4
|
21
|
+
|
22
|
+
- name: Retrieve tags
|
23
|
+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
|
24
|
+
- name: Set output variables
|
25
|
+
id: check
|
26
|
+
run: |
|
27
|
+
fpr="no"
|
28
|
+
tag=""
|
29
|
+
if [[ "${{ github.ref }}" == refs/heads/* ]]; then
|
30
|
+
tag="$(git tag --points-at HEAD)"
|
31
|
+
elif [[ "${{ github.ref }}" == refs/pull/* ]] && [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.event.pull_request.base.repo.full_name }}" ]; then
|
32
|
+
fpr="yes"
|
33
|
+
fi
|
34
|
+
echo "::set-output name=foreign_pr::${fpr}"
|
35
|
+
echo "::set-output name=head_tag::${tag}"
|
36
|
+
|
9
37
|
test:
|
10
|
-
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
38
|
+
name: Test with Metanorma on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
39
|
+
needs: prepare
|
11
40
|
runs-on: ${{ matrix.os }}
|
12
|
-
continue-on-error:
|
41
|
+
continue-on-error: false
|
13
42
|
strategy:
|
14
43
|
fail-fast: false
|
15
44
|
matrix:
|
16
|
-
ruby: [ '2.
|
45
|
+
ruby: [ '2.7', '3.0', '3.1' ]
|
17
46
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
18
|
-
experimental: [ true ]
|
19
47
|
steps:
|
20
|
-
- uses: actions/checkout@
|
48
|
+
- uses: actions/checkout@v3
|
21
49
|
with:
|
22
50
|
repository: metanorma/metanorma
|
23
51
|
|
24
|
-
- uses:
|
52
|
+
- uses: metanorma/metanorma-build-scripts/inkscape-setup-action@main
|
53
|
+
|
54
|
+
- uses: actions/checkout@v3
|
25
55
|
with:
|
26
56
|
path: "excavate"
|
27
57
|
|
28
58
|
- run: 'echo ''gem "excavate", path: "./excavate"'' > Gemfile.devel'
|
29
59
|
|
30
|
-
-
|
60
|
+
- if: matrix.ruby == '3.0'
|
61
|
+
uses: ruby/setup-ruby@v1
|
62
|
+
with:
|
63
|
+
ruby-version: ${{ matrix.ruby }}
|
64
|
+
bundler-cache: false
|
65
|
+
rubygems: latest
|
66
|
+
|
67
|
+
- if: matrix.ruby == '3.0'
|
68
|
+
run: bundle
|
69
|
+
|
70
|
+
- if: matrix.ruby != '3.0'
|
71
|
+
uses: ruby/setup-ruby@v1
|
31
72
|
with:
|
32
73
|
ruby-version: ${{ matrix.ruby }}
|
33
74
|
bundler-cache: true
|
@@ -0,0 +1,69 @@
|
|
1
|
+
name: test-and-release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
tags: [ 'v*' ]
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
concurrency:
|
10
|
+
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
|
11
|
+
cancel-in-progress: true
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
prepare:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
outputs:
|
17
|
+
head_tag: ${{ steps.check.outputs.head_tag }}
|
18
|
+
foreign_pr: ${{ steps.check.outputs.foreign_pr }}
|
19
|
+
steps:
|
20
|
+
- name: Checkout
|
21
|
+
uses: actions/checkout@v2.3.4
|
22
|
+
|
23
|
+
- name: Retrieve tags
|
24
|
+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
|
25
|
+
- name: Set output variables
|
26
|
+
id: check
|
27
|
+
run: |
|
28
|
+
fpr="no"
|
29
|
+
tag=""
|
30
|
+
if [[ "${{ github.ref }}" == refs/heads/* ]]; then
|
31
|
+
tag="$(git tag --points-at HEAD)"
|
32
|
+
elif [[ "${{ github.ref }}" == refs/pull/* ]] && [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.event.pull_request.base.repo.full_name }}" ]; then
|
33
|
+
fpr="yes"
|
34
|
+
fi
|
35
|
+
echo "::set-output name=foreign_pr::${fpr}"
|
36
|
+
echo "::set-output name=head_tag::${tag}"
|
37
|
+
|
38
|
+
test:
|
39
|
+
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
40
|
+
needs: prepare
|
41
|
+
runs-on: ${{ matrix.os }}
|
42
|
+
continue-on-error: false
|
43
|
+
strategy:
|
44
|
+
fail-fast: false
|
45
|
+
matrix:
|
46
|
+
ruby: [ '2.6', '2.7', '3.0', '3.1' ]
|
47
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
48
|
+
|
49
|
+
steps:
|
50
|
+
- uses: actions/checkout@v3
|
51
|
+
|
52
|
+
- uses: ruby/setup-ruby@v1
|
53
|
+
with:
|
54
|
+
ruby-version: ${{ matrix.ruby }}
|
55
|
+
bundler-cache: true
|
56
|
+
|
57
|
+
- run: bundle exec rspec
|
58
|
+
|
59
|
+
release:
|
60
|
+
name: Release gem
|
61
|
+
needs: test
|
62
|
+
runs-on: ubuntu-latest
|
63
|
+
if: contains(github.ref, 'refs/tags/v')
|
64
|
+
steps:
|
65
|
+
- uses: actions/checkout@v3
|
66
|
+
|
67
|
+
- uses: cadwallion/publish-rubygems-action@master
|
68
|
+
env:
|
69
|
+
RUBYGEMS_API_KEY: ${{secrets.FONTIST_CI_RUBYGEMS_API_KEY}}
|
data/Gemfile
CHANGED
data/excavate.gemspec
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
2
|
require_relative "lib/excavate/version"
|
4
3
|
|
5
4
|
Gem::Specification.new do |spec|
|
@@ -31,6 +30,6 @@ Gem::Specification.new do |spec|
|
|
31
30
|
spec.add_runtime_dependency "libmspack", "~> 0.1"
|
32
31
|
spec.add_runtime_dependency "ruby-ole", "~> 1.0"
|
33
32
|
spec.add_runtime_dependency "rubyzip", "~> 2.3"
|
34
|
-
spec.add_runtime_dependency "
|
33
|
+
spec.add_runtime_dependency "seven-zip", "~> 1.4"
|
35
34
|
spec.add_runtime_dependency "thor", "~> 1.0"
|
36
35
|
end
|
data/lib/excavate/archive.rb
CHANGED
@@ -155,11 +155,7 @@ module Excavate
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def extract_recursively(archive, target)
|
158
|
-
|
159
|
-
duplicate_dir(archive, target)
|
160
|
-
else
|
161
|
-
extract_once(archive, target)
|
162
|
-
end
|
158
|
+
extract_to_directory(archive, target)
|
163
159
|
|
164
160
|
all_files_in(target).each do |file|
|
165
161
|
next unless archive?(file)
|
@@ -168,6 +164,16 @@ module Excavate
|
|
168
164
|
end
|
169
165
|
end
|
170
166
|
|
167
|
+
def extract_to_directory(archive, target)
|
168
|
+
if File.directory?(archive)
|
169
|
+
duplicate_dir(archive, target)
|
170
|
+
elsif !archive?(archive)
|
171
|
+
copy_file(archive, target)
|
172
|
+
else
|
173
|
+
extract_once(archive, target)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
171
177
|
def duplicate_dir(source, target)
|
172
178
|
Dir.chdir(source) do
|
173
179
|
(Dir.entries(".") - [".", ".."]).each do |entry|
|
@@ -176,6 +182,10 @@ module Excavate
|
|
176
182
|
end
|
177
183
|
end
|
178
184
|
|
185
|
+
def copy_file(archive, target)
|
186
|
+
FileUtils.cp(archive, target)
|
187
|
+
end
|
188
|
+
|
179
189
|
def extract_once(archive, target)
|
180
190
|
extension = normalized_extension(archive)
|
181
191
|
extractor_class = TYPES[extension]
|
data/lib/excavate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excavate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arr-pm
|
@@ -81,19 +81,19 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: seven-zip
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
89
|
+
version: '1.4'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.4'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: thor
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,8 +117,7 @@ extensions: []
|
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
119
|
- ".github/workflows/metanorma.yml"
|
120
|
-
- ".github/workflows/release.yml"
|
121
|
-
- ".github/workflows/rspec.yml"
|
120
|
+
- ".github/workflows/test-and-release.yml"
|
122
121
|
- ".gitignore"
|
123
122
|
- ".rspec"
|
124
123
|
- ".rubocop.yml"
|
@@ -169,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
168
|
- !ruby/object:Gem::Version
|
170
169
|
version: '0'
|
171
170
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
171
|
+
rubygems_version: 3.3.7
|
173
172
|
signing_key:
|
174
173
|
specification_version: 4
|
175
174
|
summary: Extract nested archives with a single command.
|
@@ -1,36 +0,0 @@
|
|
1
|
-
name: release
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
tags:
|
6
|
-
- 'v*'
|
7
|
-
|
8
|
-
jobs:
|
9
|
-
release:
|
10
|
-
runs-on: ubuntu-18.04
|
11
|
-
steps:
|
12
|
-
- uses: actions/checkout@v1
|
13
|
-
|
14
|
-
- uses: ruby/setup-ruby@v1
|
15
|
-
with:
|
16
|
-
ruby-version: '2.6'
|
17
|
-
|
18
|
-
- run: bundle config set path 'vendor/bundle'
|
19
|
-
|
20
|
-
- run: bundle install --jobs 4 --retry 3
|
21
|
-
|
22
|
-
- run: bundle exec rspec
|
23
|
-
|
24
|
-
- name: Publish to rubygems.org
|
25
|
-
env:
|
26
|
-
RUBYGEMS_API_KEY: ${{secrets.FONTIST_CI_RUBYGEMS_API_KEY}}
|
27
|
-
run: |
|
28
|
-
gem install gem-release
|
29
|
-
touch ~/.gem/credentials
|
30
|
-
cat > ~/.gem/credentials << EOF
|
31
|
-
---
|
32
|
-
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
33
|
-
EOF
|
34
|
-
chmod 0600 ~/.gem/credentials
|
35
|
-
git status
|
36
|
-
gem release
|
data/.github/workflows/rspec.yml
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
name: rspec
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ master, main ]
|
6
|
-
pull_request:
|
7
|
-
|
8
|
-
jobs:
|
9
|
-
build:
|
10
|
-
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
11
|
-
runs-on: ${{ matrix.os }}
|
12
|
-
continue-on-error: ${{ matrix.experimental }}
|
13
|
-
strategy:
|
14
|
-
fail-fast: false
|
15
|
-
matrix:
|
16
|
-
ruby: [ '2.4', '2.5', '2.6', '2.7' ]
|
17
|
-
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
18
|
-
experimental: [ false ]
|
19
|
-
include:
|
20
|
-
- ruby: '3.0'
|
21
|
-
os: 'ubuntu-latest'
|
22
|
-
experimental: true
|
23
|
-
- ruby: '3.0'
|
24
|
-
os: 'windows-latest'
|
25
|
-
experimental: true
|
26
|
-
- ruby: '3.0'
|
27
|
-
os: 'macos-latest'
|
28
|
-
experimental: true
|
29
|
-
|
30
|
-
steps:
|
31
|
-
- uses: actions/checkout@master
|
32
|
-
|
33
|
-
- uses: ruby/setup-ruby@v1
|
34
|
-
with:
|
35
|
-
ruby-version: ${{ matrix.ruby }}
|
36
|
-
|
37
|
-
- uses: actions/cache@v1
|
38
|
-
with:
|
39
|
-
path: vendor/bundle
|
40
|
-
key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
|
41
|
-
restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
|
42
|
-
|
43
|
-
- run: bundle config set path 'vendor/bundle'
|
44
|
-
|
45
|
-
- run: bundle install --jobs 4 --retry 3
|
46
|
-
|
47
|
-
- run: bundle exec rspec
|