epub-rb 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 849b081d7cddbdb2eb58d244c3e63a592e77eb17a954260aa963afb387580869
4
+ data.tar.gz: cbe1f6e8f759c167b06dfe9198ed0284af344ede80f720a9b7f56a90be3f78cf
5
+ SHA512:
6
+ metadata.gz: 96cb09f533b6ed5a07c309ee8c0a354d226478cd087303cbc83b912df4d70e06d96bd938f2db59d6f0894d5528af64dc06c90f18ce697f22fcaef28b65923981
7
+ data.tar.gz: 61f5f252c171559dd0183236c80d50064c7f03b2ab48977131f99634eb201c2735add1c22ce96ec665a4c33c2ff1c56efdeac69236f9511ef24e38ce92930924
@@ -0,0 +1,4 @@
1
+ # You can read more about CODEOWNERS at
2
+ # https://help.github.com/github/creating-cloning-and-archiving-repositories/about-code-owners
3
+
4
+ * @fnando
@@ -0,0 +1,4 @@
1
+ # These are supported funding model platforms
2
+ ---
3
+ github: [fnando]
4
+ custom: ["https://paypal.me/nandovieira/๐Ÿ•"]
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: "๐Ÿ› Bug Report"
3
+ about: Report a reproducible bug or regression.
4
+ title: 'Bug: '
5
+ labels: 'Status: Unconfirmed'
6
+
7
+ ---
8
+
9
+ <!--
10
+ - Please provide a clear and concise description of what the bug is.
11
+ - If possible, add an example reproducing your issue.
12
+ - Please test using the latest version of epub-rb
13
+ to make sure your issue has not already been fixed.
14
+ -->
15
+
16
+ ## Description
17
+
18
+ [Add bug description here]
19
+
20
+ ## How to reproduce
21
+
22
+ [Add steps on how to reproduce this issue]
23
+
24
+ ## What do you expect
25
+
26
+ [Describe what do you expect to happen]
27
+
28
+ ## What happened instead
29
+
30
+ [Describe the actual results]
31
+
32
+ ## Software:
33
+
34
+ - Gem version: [Add gem version here]
35
+ - Ruby version: [Add version here]
36
+
37
+ ## Full backtrace
38
+
39
+ ```text
40
+ [Paste full backtrace here]
41
+ ```
@@ -0,0 +1,5 @@
1
+ ---
2
+ contact_links:
3
+ - name: "๐Ÿคจ Q&A"
4
+ url: https://github.com/fnando/epub/discussions/new?category=q-a
5
+ about: Have a question? Ask it away here!
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: "๐Ÿ’ก Feature request"
3
+ about: Have an idea that may be useful? Make a suggestion!
4
+ title: 'Feature Request: '
5
+ labels: 'Feature request'
6
+
7
+ ---
8
+
9
+ ## Description
10
+
11
+ _A clear and concise description of what the problem is._
12
+
13
+ ## Describe the solution
14
+
15
+ _A clear and concise description of what you want to happen._
16
+
17
+ ## Alternatives you considered
18
+
19
+ _A clear and concise description of any alternative solutions or features you've considered._
20
+
21
+ ## Additional context
22
+
23
+ _Add any other context, screenshots, links, etc about the feature request here._
@@ -0,0 +1,38 @@
1
+ <!--
2
+ If you're making a doc PR or something tiny where the below is irrelevant,
3
+ delete this template and use a short description, but in your description aim to
4
+ include both what the change is, and why it is being made, with enough context
5
+ for anyone to understand.
6
+ -->
7
+
8
+ <details>
9
+ <summary>PR Checklist</summary>
10
+
11
+ ### PR Structure
12
+
13
+ - [ ] This PR has reasonably narrow scope (if not, break it down into smaller
14
+ PRs).
15
+ - [ ] This PR avoids mixing refactoring changes with feature changes (split into
16
+ two PRs otherwise).
17
+ - [ ] This PR's title starts is concise and descriptive.
18
+
19
+ ### Thoroughness
20
+
21
+ - [ ] This PR adds tests for the most critical parts of the new functionality or
22
+ fixes.
23
+ - [ ] I've updated any docs, `.md` files, etcโ€ฆ affected by this change.
24
+
25
+ </details>
26
+
27
+ ### What
28
+
29
+ [TODO: Short statement about what is changing.]
30
+
31
+ ### Why
32
+
33
+ [TODO: Why this change is being made. Include any context required to understand
34
+ the why.]
35
+
36
+ ### Known limitations
37
+
38
+ [TODO or N/A]
@@ -0,0 +1,15 @@
1
+ ---
2
+ # Documentation:
3
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
4
+
5
+ version: 2
6
+ updates:
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "daily"
11
+
12
+ - package-ecosystem: bundler
13
+ directory: "/"
14
+ schedule:
15
+ interval: "daily"
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: ruby-tests
3
+
4
+ on:
5
+ pull_request_target:
6
+ push:
7
+ branches:
8
+ - main
9
+ workflow_dispatch:
10
+ inputs: {}
11
+
12
+ jobs:
13
+ build:
14
+ name: Tests with Ruby ${{ matrix.ruby }} and ${{ matrix.gemfile }}
15
+ runs-on: "ubuntu-latest"
16
+ if: |
17
+ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target' ||
18
+ github.actor != 'dependabot[bot]'
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ ruby: ["3.2", "3.3"]
23
+ gemfile:
24
+ - Gemfile
25
+
26
+ steps:
27
+ - uses: fnando/epubcheck-action@main
28
+
29
+ - uses: actions/checkout@v4
30
+
31
+ - uses: actions/cache@v4
32
+ with:
33
+ path: vendor/bundle
34
+ key: >
35
+ ${{ runner.os }}-${{ matrix.ruby }}-gems-${{
36
+ hashFiles(matrix.gemfile) }}
37
+
38
+ - name: Set up Ruby
39
+ uses: ruby/setup-ruby@v1
40
+ with:
41
+ ruby-version: ${{ matrix.ruby }}
42
+
43
+ - name: Install gem dependencies
44
+ env:
45
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
46
+ run: |
47
+ gem install bundler
48
+ bundle config path vendor/bundle
49
+ bundle update --jobs 4 --retry 3
50
+
51
+ - name: Run Tests
52
+ env:
53
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
54
+ run: |
55
+ bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /vendor/
10
+ *.log
11
+ *.lock
12
+ /test/support/toc.html
13
+ *.epub
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ ---
2
+ inherit_gem:
3
+ rubocop-fnando: .rubocop.yml
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 3.2
7
+ NewCops: enable
8
+ Exclude:
9
+ - vendor/**/*
10
+ - gemfiles/**/*
11
+ Naming/FileName:
12
+ Exclude:
13
+ - lib/epub-rb.rb
data/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ <!--
4
+ Prefix your message with one of the following:
5
+
6
+ - [Added] for new features.
7
+ - [Changed] for changes in existing functionality.
8
+ - [Deprecated] for soon-to-be removed features.
9
+ - [Removed] for now removed features.
10
+ - [Fixed] for any bug fixes.
11
+ - [Security] in case of vulnerabilities.
12
+ -->
13
+
14
+ ## Unreleased
15
+
16
+ - Initial release.
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at me@fnando.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,81 @@
1
+ # Contributing to epub-rb
2
+
3
+ ๐Ÿ‘๐ŸŽ‰ First off, thanks for taking the time to contribute! ๐ŸŽ‰๐Ÿ‘
4
+
5
+ The following is a set of guidelines for contributing to this project. These are
6
+ mostly guidelines, not rules. Use your best judgment, and feel free to propose
7
+ changes to this document in a pull request.
8
+
9
+ ## Code of Conduct
10
+
11
+ Everyone interacting in this project's codebases, issue trackers, chat rooms and
12
+ mailing lists is expected to follow the
13
+ [code of conduct](https://github.com/fnando/epub/blob/main/CODE_OF_CONDUCT.md).
14
+
15
+ ## Reporting bugs
16
+
17
+ This section guides you through submitting a bug report. Following these
18
+ guidelines helps maintainers and the community understand your report, reproduce
19
+ the behavior, and find related reports.
20
+
21
+ - Before creating bug reports, please check the open issues; somebody may
22
+ already have submitted something similar, and you may not need to create a new
23
+ one.
24
+ - When you are creating a bug report, please include as many details as
25
+ possible, with an example reproducing the issue.
26
+
27
+ ## Contributing with code
28
+
29
+ Before making any radicals changes, please make sure you discuss your intention
30
+ by [opening an issue on Github](https://github.com/fnando/epub/issues).
31
+
32
+ When you're ready to make your pull request, follow checklist below to make sure
33
+ your contribution is according to how this project works.
34
+
35
+ 1. [Fork](https://help.github.com/forking/) epub-rb
36
+ 2. Create a topic branch - `git checkout -b my_branch`
37
+ 3. Make your changes using [descriptive commit messages](#commit-messages)
38
+ 4. Update CHANGELOG.md describing your changes by adding an entry to the
39
+ "Unreleased" section. If this section is not available, create one right
40
+ before the last version.
41
+ 5. Push to your branch - `git push origin my_branch`
42
+ 6. [Create a pull request](https://help.github.com/articles/creating-a-pull-request)
43
+ 7. That's it!
44
+
45
+ ## Styleguides
46
+
47
+ ### Commit messages
48
+
49
+ - Use the present tense ("Add feature" not "Added feature")
50
+ - Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
51
+ - Limit the first line to 72 characters or less
52
+ - Reference issues and pull requests liberally after the first line
53
+
54
+ ### Changelog
55
+
56
+ - Add a message describing your changes to the "Unreleased" section. The
57
+ changelog message should follow the same style as the commit message.
58
+ - Prefix your message with one of the following:
59
+ - `[Added]` for new features.
60
+ - `[Changed]` for changes in existing functionality.
61
+ - `[Deprecated]` for soon-to-be removed features.
62
+ - `[Removed]` for now removed features.
63
+ - `[Fixed]` for any bug fixes.
64
+ - `[Security]` in case of vulnerabilities.
65
+
66
+ ### Ruby code
67
+
68
+ - This project uses [Rubocop](https://rubocop.org) to enforce code style. Before
69
+ submitting your changes, make sure your tests are passing and code conforms to
70
+ the expected style by running `rake`.
71
+ - Do not change the library version. This will be done by the maintainer
72
+ whenever a new version is about to be released.
73
+
74
+ ## Setting up the environment
75
+
76
+ - Use the latest ruby version (although any of the two ruby releases are
77
+ officially supported).
78
+ - Make sure you have [epubchecker](https://www.w3.org/publishing/epubcheck/)
79
+ available on your path, as it's used to test that generated files are valid.
80
+ - Install dependencies with `bundle install`.
81
+ - Run tests with `bundle exec rake`.
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ # The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Nando Vieira
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,116 @@
1
+ # epub-rb
2
+
3
+ [![Tests](https://github.com/fnando/epub/workflows/ruby-tests/badge.svg)](https://github.com/fnando/epub)
4
+ [![Gem](https://img.shields.io/gem/v/epub-rb.svg)](https://rubygems.org/gems/epub-rb)
5
+ [![Gem](https://img.shields.io/gem/dt/epub-rb.svg)](https://rubygems.org/gems/epub-rb)
6
+ [![MIT License](https://img.shields.io/:License-MIT-blue.svg)](https://tldrlegal.com/license/mit-license)
7
+
8
+ Create epub files using Ruby.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ gem install epub-rb
14
+ ```
15
+
16
+ Or add the following line to your project's Gemfile:
17
+
18
+ ```ruby
19
+ gem "epub-rb"
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```ruby
25
+ require "epub"
26
+
27
+ epub = Epub.new(
28
+ root_dir: "./book",
29
+ title: "Hello World",
30
+ subtitle: "A Complete Beginnerโ€™s Guide to Ruby Programming",
31
+ creators: ["John Doe"],
32
+ publisher: "epub-rb",
33
+ date: "2024-01-24",
34
+ id: "d05f92ea-62f7-44d6-bb48-d94c11e660db",
35
+ copyright: "Copyright 2024 by John Doe",
36
+ identifiers: ["915869090000000000DD", "urn:isbn:9780000000001"],
37
+ contributors: ["Jane Doe"],
38
+ files: [
39
+ "./book/book.css",
40
+ "./book/cover.png",
41
+ "./book/cover.html",
42
+ "./book/toc.html",
43
+ "./book/ch01.html",
44
+ "./book/ch02.html",
45
+ "./book/images/terminal.svg"
46
+ ]
47
+ )
48
+
49
+ epub.save("hello-word.epub")
50
+ ```
51
+
52
+ The epub file is compliant with the EPUB 3.3 specification. You can check it by
53
+ using [epubcheck](https://www.w3.org/publishing/epubcheck/).
54
+
55
+ > [!NOTE]
56
+ >
57
+ > epub-rb makes a few assumptions that you need to follow.
58
+ >
59
+ > 1. You need to have a file name `toc.{xhtml,html}`. This file must be
60
+ > compliant with the EPUB 3 spec.
61
+ > 2. You'll also need a cover image named as `cover.{png,jpg,gif}`.
62
+ > 3. You'll also need a companion file called `cover.{xhtml,html}`.
63
+
64
+ ### Generating the Table of Contents (navigation file)
65
+
66
+ You can use the methods `Epub::Navigation.extract(files, root_dir:)` and
67
+ `Epub::Navigation.extract_html(files, root_dir:)` to generate the `toc.html`
68
+ file. A simple way would be using something like this:
69
+
70
+ ```ruby
71
+ navigation = Epub::Navigation.extract_html(
72
+ Dir["./book/**/*.html"],
73
+ root_dir: "./book"
74
+ )
75
+
76
+ File.open("toc.html", "w") do |file|
77
+ file << <<~HTML
78
+ <?xml version='1.0' encoding='utf-8'?>
79
+ <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en">
80
+ <head>
81
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
82
+ <title>Table of Contents</title>
83
+ </head>
84
+ <body>
85
+ #{navigation}
86
+ </body>
87
+ </html>
88
+
89
+ HTML
90
+ end
91
+ ```
92
+
93
+ ## Maintainer
94
+
95
+ - [Nando Vieira](https://github.com/fnando)
96
+
97
+ ## Contributors
98
+
99
+ - https://github.com/fnando/epub/contributors
100
+
101
+ ## Contributing
102
+
103
+ For more details about how to contribute, please read
104
+ https://github.com/fnando/epub/blob/main/CONTRIBUTING.md.
105
+
106
+ ## License
107
+
108
+ The gem is available as open source under the terms of the
109
+ [MIT License](https://opensource.org/licenses/MIT). A copy of the license can be
110
+ found at https://github.com/fnando/epub/blob/main/LICENSE.md.
111
+
112
+ ## Code of Conduct
113
+
114
+ Everyone interacting in the epub-rb project's codebases, issue trackers, chat
115
+ rooms and mailing lists is expected to follow the
116
+ [code of conduct](https://github.com/fnando/epub/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+ require "rubocop/rake_task"
6
+
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs << "test"
9
+ t.libs << "lib"
10
+ t.test_files = FileList["test/**/*_test.rb"]
11
+ end
12
+
13
+ RuboCop::RakeTask.new
14
+
15
+ task default: %i[test rubocop]
data/bin/console ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "epub-rb"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ begin
11
+ require "pry"
12
+ Pry.start
13
+ rescue LoadError
14
+ require "irb"
15
+ IRB.start(__FILE__)
16
+ end
data/bin/setup ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ IFS=$'\n\t'
6
+ set -vx
7
+
8
+ bundle install
9
+
10
+ # Do any other automated setup that you need to do here
data/epub-rb.gemspec ADDED
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/epub/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "epub-rb"
7
+ spec.version = Epub::VERSION
8
+ spec.authors = ["Nando Vieira"]
9
+ spec.email = ["me@fnando.com"]
10
+ spec.metadata = {"rubygems_mfa_required" => "true"}
11
+
12
+ spec.summary = "Create epub files using Ruby."
13
+ spec.description = spec.summary
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
16
+
17
+ github_url = "https://github.com/fnando/epub"
18
+ github_tree_url = "#{github_url}/tree/v#{spec.version}"
19
+
20
+ spec.homepage = github_url
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ spec.metadata["bug_tracker_uri"] = "#{github_url}/issues"
23
+ spec.metadata["source_code_uri"] = github_tree_url
24
+ spec.metadata["changelog_uri"] = "#{github_tree_url}/CHANGELOG.md"
25
+ spec.metadata["documentation_uri"] = "#{github_tree_url}/README.md"
26
+ spec.metadata["license_uri"] = "#{github_tree_url}/LICENSE.md"
27
+
28
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
29
+ `git ls-files -z`
30
+ .split("\x0")
31
+ .reject {|f| f.match(%r{^(test|spec|features)/}) }
32
+ end
33
+
34
+ spec.bindir = "exe"
35
+ spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
36
+ spec.require_paths = ["lib"]
37
+
38
+ spec.add_dependency "builder"
39
+ spec.add_dependency "nokogiri"
40
+ spec.add_dependency "rubyzip"
41
+ spec.add_dependency "thor"
42
+ spec.add_development_dependency "minitest"
43
+ spec.add_development_dependency "minitest-utils"
44
+ spec.add_development_dependency "pry-meta"
45
+ spec.add_development_dependency "rake"
46
+ spec.add_development_dependency "rubocop"
47
+ spec.add_development_dependency "rubocop-fnando"
48
+ spec.add_development_dependency "simplecov"
49
+ end
data/exe/epub ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../lib/epub-rb"
5
+ Epub::CLI.start
data/lib/epub/cli.rb ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Epub
4
+ class CLI < Thor
5
+ check_unknown_options!
6
+
7
+ def self.exit_on_failure?
8
+ true
9
+ end
10
+
11
+ desc "new PATH", "Create a new gem"
12
+ def new(path)
13
+ generator = Generator.new
14
+ generator.destination_root = File.expand_path(path)
15
+ generator.options = options
16
+ generator.invoke_all
17
+ end
18
+
19
+ no_commands do
20
+ # Add helper methods here
21
+ end
22
+ end
23
+ end