ruzip 0.1.0 → 0.2.0

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: 005b429739ebd855ccaf9d9f26860daf965afad15b204f421b8783feca5214ee
4
- data.tar.gz: 7a5599f4510de29b3f177a08318fb7c0371f5a568ffc7312ba0f052d6157e577
3
+ metadata.gz: 1a3933d33701a2ef5266034395c9d150def3302051cc5e58cfec95e0c8781f26
4
+ data.tar.gz: 483047dd80f31be198c1123ee28f93c316d7041ea48c640936fe584d9573b9c8
5
5
  SHA512:
6
- metadata.gz: d7dd75900ab1db49783d0560f8a711f31df8a6366e62a7d4fa8cbbe5f3d79655f36ff0516c8cde456c972683053220b412dc3f49ab18bbdb8fee7696d314fe51
7
- data.tar.gz: 8d8a1d3ba72c469168424fb1072a4c4f8ecfcf151932bf9668ecf860908d2b4bb26e7e4177cd2029e17857a03b62869917a0005a0af8ab2714053f2007ee31fb
6
+ metadata.gz: de64677667aabcf0f6d6246af4bb7ff0653f8c49b26f2b0b412ba68590c211865e64af5bf64ff2ebd18030c8d93aeb575e2963e3c3df5943a4bb295cb66f5090
7
+ data.tar.gz: 8fca9556da607ca7661457baf087c5f9063855538051142aad32452f770074d9879389ff8a1479a8d2ebb0fe8c16809ee12f30a6febee2d447b1e5d6ba190ec6
data/.gitignore CHANGED
@@ -14,3 +14,4 @@ mkmf.log
14
14
  target/
15
15
  Gemfile.lock
16
16
  /test/fixtures/accessible_epub_3.epub
17
+ html/
data/.gitlab-ci.yml CHANGED
@@ -1,12 +1,11 @@
1
1
  default:
2
- image: ruby:3.4.7
2
+ image: ruby:4.0.0
3
3
 
4
4
  before_script:
5
5
  - apt-get update && apt-get install -y clang
6
6
  - curl https://sh.rustup.rs -sSf | sh -s -- -y
7
7
  - . "$HOME/.cargo/env"
8
8
  - gem update --system
9
- - gem install bundler
10
9
  - bundle install
11
10
 
12
11
  test:
data/.rdoc_options ADDED
@@ -0,0 +1,9 @@
1
+ main_page: README.md
2
+
3
+ include:
4
+ - CHANGELOG.md
5
+ - sig
6
+
7
+ exclude:
8
+ - ext/target
9
+ - vendor
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2026-01-04
4
+
5
+ * Return binary from {File#read}
6
+ * Raise exception safely
7
+ * Update zip crate to v7.0.0
8
+
3
9
  ## [0.1.0] - 2023-12-08
4
10
 
5
11
  - Initial release
data/README.md CHANGED
@@ -1,35 +1,41 @@
1
1
  # RuZip
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ruzip`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Library to support the reading and writing of zip files. A wrapper of Rust's [zip](https://github.com/zip-rs/zip2?tab=readme-ov-file) crate.
6
4
 
7
5
  ## Installation
8
6
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
7
  Install the gem and add to the application's Gemfile by executing:
12
8
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
9
+ $ bundle add ruzip
14
10
 
15
11
  If bundler is not being used to manage dependencies, install the gem by executing:
16
12
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
13
+ $ gem install ruzip
18
14
 
19
15
  ## Usage
20
16
 
21
- TODO: Write usage instructions here
17
+ require "ruzip"
18
+
19
+ archive = RuZip::Archive.new("path/to/archive.zip")
20
+ archive.length #=> Integer, the number of files the archive holds
21
+
22
+ archive.length.times do |i|
23
+ file = archive.by_index(i) #=> RuZip::File
24
+ file.name # => String
25
+ file.size # => Integer, the size of decompressed file
26
+ file.last_modified # => Time
27
+ content = file.read # => ASCII-8BIT String (BINARY)
28
+ content.force_encoding("UTF-8") # If it's text, it is in UTF-8.
29
+ end
30
+
31
+ archive.by_name("path/in/zip/archive") # => RuZip::File
22
32
 
23
33
  ## Development
24
34
 
25
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test-unit` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
+ After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rake test` to run the tests. You can also run `bundle exec rake console` for an interactive prompt that will allow you to experiment.
26
36
 
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `ext/Cargo.toml`, run `cargo update --manifest-path=ext/Cargo.toml`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
38
 
29
39
  ## Contributing
30
40
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ruzip. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/ruzip/blob/main/CODE_OF_CONDUCT.md).
32
-
33
- ## Code of Conduct
34
-
35
- Everyone interacting in the RuZip project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ruzip/blob/main/CODE_OF_CONDUCT.md).
41
+ Bug reports and pull requests are welcome on GitLab at https://gitlab.com/KitaitiMakoto/ruzip. This project is intended to be a safe, welcoming space for collaboration.
data/Rakefile CHANGED
@@ -3,19 +3,18 @@ require "rake/testtask"
3
3
  require "rubygems/ext"
4
4
  require "rubygems/tasks"
5
5
  require "kar/dsl"
6
+ require "rdoc/task"
6
7
 
7
8
  cargo "ruzip"
8
9
 
9
10
  Gem::Tasks.new
10
11
  task build: "cargo:check"
11
12
 
12
- Rake::TestTask.new
13
-
14
- directory "test/fixtures"
15
13
  TEST_FIXTURE = "test/fixtures/accessible_epub_3.epub"
16
- file TEST_FIXTURE => "test/fixtures"
17
14
  download TEST_FIXTURE => "https://github.com/IDPF/epub3-samples/releases/download/20230704/accessible_epub_3.epub"
18
15
 
19
- task test: [:cargo, TEST_FIXTURE]
16
+ Rake::TestTask.new test: [:cargo, TEST_FIXTURE]
17
+
18
+ RDoc::Task.new
20
19
 
21
20
  task default: :test