rbpacker 0.1.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 +7 -0
- data/.rubocop.yml +46 -0
- data/.yardopts +6 -0
- data/CHANGELOG.md +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +68 -0
- data/Rakefile +26 -0
- data/Steepfile +35 -0
- data/exe/rbpacker +51 -0
- data/lib/rbpacker/cli.rb +24 -0
- data/lib/rbpacker/source_bundler.rb +115 -0
- data/lib/rbpacker/version.rb +5 -0
- data/lib/rbpacker.rb +11 -0
- data/rbs_collection.lock.yaml +44 -0
- data/rbs_collection.yaml +22 -0
- data/sig/rbpacker/cli.rbs +5 -0
- data/sig/rbpacker/source_bundler.rbs +17 -0
- data/sig/rbpacker.rbs +8 -0
- metadata +203 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 410ba7f1086c8d7e44a58175948ac647d37c1216f9bf9ff487c2be39d8e15a8b
|
|
4
|
+
data.tar.gz: f4e544f0ba31bbc8a115b7d12709ddf2041316b330c81ecdff1011b2986d46c8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a1ca09bd6333ddb5a69bd91add85027b80e2768e5f1ed27cb24ba3f84b8256d86c880c5c32d2506e09be1ae9aaa08816c437efbbb4c10e66d162971f88cfedd6
|
|
7
|
+
data.tar.gz: 30bbf1ceb126d5204d941fd077d5aa9849a3b877e7f3332ff4418546b3fbb0d0f30e1eb4b00e15f1dd80d3f736fdcc57248718305a995299be92e528a17b8c69
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# The behavior of RuboCop can be controlled via the .rubocop.yml
|
|
2
|
+
# configuration file. It makes it possible to enable/disable
|
|
3
|
+
# certain cops (checks) and to alter their behavior if they accept
|
|
4
|
+
# any parameters. The file can be placed either in your home
|
|
5
|
+
# directory or in some project directory.
|
|
6
|
+
#
|
|
7
|
+
# RuboCop will start looking for the configuration file in the directory
|
|
8
|
+
# where the inspected file is and continue its way up to the root directory.
|
|
9
|
+
#
|
|
10
|
+
# See https://docs.rubocop.org/rubocop/configuration
|
|
11
|
+
|
|
12
|
+
AllCops:
|
|
13
|
+
NewCops: enable
|
|
14
|
+
TargetRubyVersion: 3.3
|
|
15
|
+
SuggestExtensions: false
|
|
16
|
+
Exclude:
|
|
17
|
+
- 'spec/fixtures/**/*'
|
|
18
|
+
|
|
19
|
+
# ref. https://github.com/rubocop/rubocop/blob/v1.90.0/config/default.yml#L56
|
|
20
|
+
- 'node_modules/**/*'
|
|
21
|
+
- 'tmp/**/*'
|
|
22
|
+
- 'vendor/**/*'
|
|
23
|
+
- '.git/**/*'
|
|
24
|
+
|
|
25
|
+
Gemspec/DevelopmentDependencies:
|
|
26
|
+
EnforcedStyle: gemspec
|
|
27
|
+
|
|
28
|
+
Layout/HashAlignment:
|
|
29
|
+
EnforcedColonStyle: table
|
|
30
|
+
|
|
31
|
+
Layout/LeadingCommentSpace:
|
|
32
|
+
AllowRBSInlineAnnotation: true
|
|
33
|
+
|
|
34
|
+
Metrics/BlockLength:
|
|
35
|
+
Exclude:
|
|
36
|
+
- "*.gemspec"
|
|
37
|
+
- 'spec/**/*'
|
|
38
|
+
|
|
39
|
+
Style/StringLiterals:
|
|
40
|
+
EnforcedStyle: double_quotes
|
|
41
|
+
|
|
42
|
+
Style/TrailingCommaInArguments:
|
|
43
|
+
EnforcedStyleForMultiline: comma
|
|
44
|
+
|
|
45
|
+
Style/TrailingCommaInHashLiteral:
|
|
46
|
+
EnforcedStyleForMultiline: comma
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sue445
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all 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,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Rbpacker
|
|
2
|
+
Bundles and minifies multiple Ruby scripts into a single file
|
|
3
|
+
|
|
4
|
+
[](https://github.com/sue445/rbpacker/actions/workflows/test.yml)
|
|
5
|
+
|
|
6
|
+
## Example
|
|
7
|
+
```bash
|
|
8
|
+
$ cat /path/to/test.rb
|
|
9
|
+
require_relative "a"
|
|
10
|
+
require_relative "dir/b"
|
|
11
|
+
|
|
12
|
+
$ cat /path/to/a.rb
|
|
13
|
+
class A
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
$ cat /path/to/dir/b.rb
|
|
17
|
+
class B
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
$ rbpacker --src-file /path/to/test.rb
|
|
21
|
+
class A
|
|
22
|
+
end
|
|
23
|
+
class B
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
$ rbpacker --src-file /path/to/test.rb --dst-file /tmp/output.rb
|
|
27
|
+
/tmp/output.rb is created
|
|
28
|
+
|
|
29
|
+
$ rbpacker --src-file /path/to/test.rb --minify
|
|
30
|
+
class A;end;class B;end
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
bundle add rbpacker
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
gem install rbpacker
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
```bash
|
|
49
|
+
$ rbpacker --help
|
|
50
|
+
Usage: rbpacker [options]
|
|
51
|
+
--src-file SRC_FILE source file path
|
|
52
|
+
--dst-file DST_FILE destination file path (default: stdout)
|
|
53
|
+
--minify whether to minify
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
59
|
+
|
|
60
|
+
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).
|
|
61
|
+
|
|
62
|
+
## Contributing
|
|
63
|
+
|
|
64
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sue445/rbpacker.
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rspec/core/rake_task"
|
|
5
|
+
require "rubocop/rake_task"
|
|
6
|
+
|
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
8
|
+
|
|
9
|
+
RuboCop::RakeTask.new
|
|
10
|
+
|
|
11
|
+
namespace :rbs do
|
|
12
|
+
desc "`rbs collection install` and `git commit`"
|
|
13
|
+
task :install do
|
|
14
|
+
sh "rbs collection install"
|
|
15
|
+
sh "git add rbs_collection.lock.yaml"
|
|
16
|
+
sh "git commit -m 'rbs collection install' || true"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
desc "Check rbs"
|
|
21
|
+
task :rbs do
|
|
22
|
+
sh "rbs validate"
|
|
23
|
+
sh "steep check"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
task default: %i[spec rbs]
|
data/Steepfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# D = Steep::Diagnostic
|
|
4
|
+
#
|
|
5
|
+
target :lib do
|
|
6
|
+
signature "sig"
|
|
7
|
+
ignore_signature "sig/test"
|
|
8
|
+
|
|
9
|
+
check "lib" # Directory name
|
|
10
|
+
# check "path/to/source.rb" # File name
|
|
11
|
+
# check "app/models/**/*.rb" # Glob
|
|
12
|
+
# ignore "lib/templates/*.rb"
|
|
13
|
+
|
|
14
|
+
# RBSs for the gems in Gemfile.lock are loaded via rbs collection automatically.
|
|
15
|
+
# Set it up with `rbs collection init` and `rbs collection install`.
|
|
16
|
+
# library "monitor" # Load an RBS that rbs collection doesn't manage
|
|
17
|
+
|
|
18
|
+
# configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default)
|
|
19
|
+
# configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
|
|
20
|
+
# configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
|
|
21
|
+
# configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting
|
|
22
|
+
# configure_code_diagnostics do |hash| # You can setup everything yourself
|
|
23
|
+
# hash[D::Ruby::NoMethod] = :information
|
|
24
|
+
# end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# target :test do
|
|
28
|
+
# unreferenced! # Skip type checking the `lib` code when types in `test` target is changed
|
|
29
|
+
# signature "sig/test" # Put RBS files for tests under `sig/test`
|
|
30
|
+
# check "test" # Type check Ruby scripts under `test`
|
|
31
|
+
#
|
|
32
|
+
# configure_code_diagnostics(D::Ruby.lenient) # Weak type checking for test code
|
|
33
|
+
#
|
|
34
|
+
# # library "monitor" # Load an RBS that rbs collection doesn't manage
|
|
35
|
+
# end
|
data/exe/rbpacker
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "rbpacker/cli"
|
|
5
|
+
require "rbpacker/version"
|
|
6
|
+
require "optparse"
|
|
7
|
+
|
|
8
|
+
opt = OptionParser.new
|
|
9
|
+
params = {
|
|
10
|
+
src_file: nil,
|
|
11
|
+
dst_file: nil,
|
|
12
|
+
minify: false,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
Version = Rbpacker::VERSION
|
|
16
|
+
|
|
17
|
+
opt.on("--src-file SRC_FILE", "source file path") do |v|
|
|
18
|
+
params[:src_file] = v
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
opt.on("--dst-file DST_FILE", "destination file path (default: stdout)") do |v|
|
|
22
|
+
params[:dst_file] = v
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
opt.on("--minify", "whether to minify") do |v|
|
|
26
|
+
params[:minify] = v
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
opt.parse!(ARGV)
|
|
30
|
+
|
|
31
|
+
unless params[:src_file]
|
|
32
|
+
warn "ERROR: --src-file is required"
|
|
33
|
+
warn opt
|
|
34
|
+
exit 1
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
unless File.exist?(params[:src_file])
|
|
38
|
+
warn "ERROR: #{params[:src_file]} is not found"
|
|
39
|
+
exit 1
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
unless File.file?(params[:src_file])
|
|
43
|
+
warn "ERROR: #{params[:src_file]} must be a file"
|
|
44
|
+
exit 1
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
Rbpacker::Cli.new.perform(
|
|
48
|
+
src_file: params[:src_file],
|
|
49
|
+
dst_file: params[:dst_file],
|
|
50
|
+
minify: params[:minify],
|
|
51
|
+
)
|
data/lib/rbpacker/cli.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rbpacker"
|
|
4
|
+
|
|
5
|
+
module Rbpacker
|
|
6
|
+
# Command-line interface for rbpacker
|
|
7
|
+
class Cli
|
|
8
|
+
# @param src_file: [String]
|
|
9
|
+
# @param dst_file: [String,nil] non-nil: output to filepath, nil: output to stdout
|
|
10
|
+
# @param minify: [Boolean]
|
|
11
|
+
def perform(src_file:, dst_file:, minify:)
|
|
12
|
+
content = SourceBundler.new.bundle(src_file).result
|
|
13
|
+
|
|
14
|
+
content = Minifyrb::Minifier.new(content).minify if minify
|
|
15
|
+
|
|
16
|
+
if dst_file
|
|
17
|
+
File.binwrite(dst_file, content)
|
|
18
|
+
warn "#{dst_file} is created"
|
|
19
|
+
else
|
|
20
|
+
$stdout.write(content)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rbpacker
|
|
4
|
+
# Bundles Ruby source files into a single script by resolving `require_relative`.
|
|
5
|
+
#
|
|
6
|
+
# @note Bundling evaluates the input files to capture nested `require_relative` calls,
|
|
7
|
+
# so running this on untrusted sources can execute arbitrary code.
|
|
8
|
+
class SourceBundler
|
|
9
|
+
REQUIRE_RELATIVE_PATTERN = /
|
|
10
|
+
(?<separator>\A|[;\n])
|
|
11
|
+
[ \t]*
|
|
12
|
+
require_relative
|
|
13
|
+
[ \t]*
|
|
14
|
+
\(?
|
|
15
|
+
[ \t]*
|
|
16
|
+
(?<quote>["'])
|
|
17
|
+
(?:\\.|(?!\k<quote>).)*
|
|
18
|
+
\k<quote>
|
|
19
|
+
[ \t]*
|
|
20
|
+
\)?
|
|
21
|
+
[ \t]*
|
|
22
|
+
(?=;|\n|\z)
|
|
23
|
+
/x
|
|
24
|
+
|
|
25
|
+
def initialize
|
|
26
|
+
@loaded_files = Set.new
|
|
27
|
+
@collected_sources = [] #: Array[String]
|
|
28
|
+
@depth = 0
|
|
29
|
+
@original_require_relative = Kernel.instance_method(:require_relative)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# @param filepath [String]
|
|
33
|
+
#
|
|
34
|
+
# @return [SourceBundler]
|
|
35
|
+
def bundle(filepath)
|
|
36
|
+
filepath += ".rb" unless filepath.end_with?(".rb")
|
|
37
|
+
abs_path = File.expand_path(filepath)
|
|
38
|
+
|
|
39
|
+
return self if @loaded_files.include?(abs_path)
|
|
40
|
+
|
|
41
|
+
@loaded_files.add(abs_path)
|
|
42
|
+
code = File.read(abs_path)
|
|
43
|
+
|
|
44
|
+
with_require_relative_hook do
|
|
45
|
+
eval_and_collect_source(code, abs_path)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
self
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# @return [String]
|
|
52
|
+
def result
|
|
53
|
+
@collected_sources.join
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
# @yield
|
|
59
|
+
# @private
|
|
60
|
+
def with_require_relative_hook
|
|
61
|
+
define_require_relative_hook if @depth.zero?
|
|
62
|
+
|
|
63
|
+
@depth += 1
|
|
64
|
+
yield
|
|
65
|
+
ensure
|
|
66
|
+
@depth -= 1
|
|
67
|
+
|
|
68
|
+
restore_require_relative if @depth.zero?
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# @private
|
|
72
|
+
def define_require_relative_hook
|
|
73
|
+
current_bundler = self
|
|
74
|
+
|
|
75
|
+
Kernel.send(:define_method, :require_relative) do |relative_path|
|
|
76
|
+
caller_location = caller_locations(1, 1)&.first
|
|
77
|
+
raise Error, "caller location is not found" unless caller_location
|
|
78
|
+
|
|
79
|
+
caller_path = caller_location.path
|
|
80
|
+
raise Error, "caller path is not found" unless caller_path
|
|
81
|
+
|
|
82
|
+
caller_dir = File.dirname(caller_path)
|
|
83
|
+
target_path = File.expand_path(relative_path, caller_dir)
|
|
84
|
+
|
|
85
|
+
current_bundler.bundle(target_path)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# @private
|
|
90
|
+
def restore_require_relative
|
|
91
|
+
Kernel.send(:define_method, :require_relative, @original_require_relative)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# @param code [String]
|
|
95
|
+
# @param abs_path [String]
|
|
96
|
+
# @private
|
|
97
|
+
def eval_and_collect_source(code, abs_path)
|
|
98
|
+
source = strip_require_relative(code)
|
|
99
|
+
|
|
100
|
+
TOPLEVEL_BINDING.eval(code, abs_path)
|
|
101
|
+
@collected_sources << source unless source.strip.empty?
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# @param code [String]
|
|
105
|
+
# @private
|
|
106
|
+
def strip_require_relative(code)
|
|
107
|
+
code.gsub(REQUIRE_RELATIVE_PATTERN) do
|
|
108
|
+
match = Regexp.last_match
|
|
109
|
+
raise Error, "regexp match is not found" unless match
|
|
110
|
+
|
|
111
|
+
match[:separator] == ";" ? ";" : ""
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
data/lib/rbpacker.rb
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
path: ".gem_rbs_collection"
|
|
3
|
+
gems:
|
|
4
|
+
- name: diff-lcs
|
|
5
|
+
version: '1.5'
|
|
6
|
+
source:
|
|
7
|
+
type: git
|
|
8
|
+
name: ruby/gem_rbs_collection
|
|
9
|
+
revision: 31250b67b9dadaeaccdb65c55d64a20dca7a812e
|
|
10
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
11
|
+
repo_dir: gems
|
|
12
|
+
- name: fileutils
|
|
13
|
+
version: '0'
|
|
14
|
+
source:
|
|
15
|
+
type: stdlib
|
|
16
|
+
- name: io-console
|
|
17
|
+
version: '0'
|
|
18
|
+
source:
|
|
19
|
+
type: stdlib
|
|
20
|
+
- name: pp
|
|
21
|
+
version: '0'
|
|
22
|
+
source:
|
|
23
|
+
type: stdlib
|
|
24
|
+
- name: prettyprint
|
|
25
|
+
version: '0'
|
|
26
|
+
source:
|
|
27
|
+
type: stdlib
|
|
28
|
+
- name: prism
|
|
29
|
+
version: 1.9.0
|
|
30
|
+
source:
|
|
31
|
+
type: rubygems
|
|
32
|
+
- name: rake
|
|
33
|
+
version: '13.0'
|
|
34
|
+
source:
|
|
35
|
+
type: git
|
|
36
|
+
name: ruby/gem_rbs_collection
|
|
37
|
+
revision: 31250b67b9dadaeaccdb65c55d64a20dca7a812e
|
|
38
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
39
|
+
repo_dir: gems
|
|
40
|
+
- name: rdoc
|
|
41
|
+
version: '0'
|
|
42
|
+
source:
|
|
43
|
+
type: stdlib
|
|
44
|
+
gemfile_lock_path: Gemfile.lock
|
data/rbs_collection.yaml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Download sources
|
|
2
|
+
sources:
|
|
3
|
+
- type: git
|
|
4
|
+
name: ruby/gem_rbs_collection
|
|
5
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
6
|
+
revision: main
|
|
7
|
+
repo_dir: gems
|
|
8
|
+
|
|
9
|
+
# You can specify local directories as sources also.
|
|
10
|
+
# - type: local
|
|
11
|
+
# path: path/to/your/local/repository
|
|
12
|
+
|
|
13
|
+
# A directory to install the downloaded RBSs
|
|
14
|
+
path: .gem_rbs_collection
|
|
15
|
+
|
|
16
|
+
gems:
|
|
17
|
+
- name: rbs
|
|
18
|
+
ignore: true
|
|
19
|
+
- name: steep
|
|
20
|
+
ignore: true
|
|
21
|
+
- name: yard
|
|
22
|
+
ignore: true
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Rbpacker
|
|
2
|
+
class SourceBundler
|
|
3
|
+
REQUIRE_RELATIVE_PATTERN: Regexp
|
|
4
|
+
|
|
5
|
+
def initialize: () -> void
|
|
6
|
+
def bundle: (String filepath) -> SourceBundler
|
|
7
|
+
def result: () -> String
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def with_require_relative_hook: () { () -> untyped } -> untyped
|
|
12
|
+
def define_require_relative_hook: () -> void
|
|
13
|
+
def restore_require_relative: () -> void
|
|
14
|
+
def eval_and_collect_source: (String code, String abs_path) -> void
|
|
15
|
+
def strip_require_relative: (String code) -> String
|
|
16
|
+
end
|
|
17
|
+
end
|
data/sig/rbpacker.rbs
ADDED
metadata
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rbpacker
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- sue445
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: minifyrb
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "<"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "<"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: irb
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rake
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: rbs
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: rspec
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: rspec-temp_dir
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
89
|
+
type: :development
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: rubocop
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
type: :development
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: rubocop_auto_corrector
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - ">="
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0'
|
|
117
|
+
type: :development
|
|
118
|
+
prerelease: false
|
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '0'
|
|
124
|
+
- !ruby/object:Gem::Dependency
|
|
125
|
+
name: steep
|
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - ">="
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '0'
|
|
131
|
+
type: :development
|
|
132
|
+
prerelease: false
|
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - ">="
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '0'
|
|
138
|
+
- !ruby/object:Gem::Dependency
|
|
139
|
+
name: yard
|
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - ">="
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '0'
|
|
145
|
+
type: :development
|
|
146
|
+
prerelease: false
|
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - ">="
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: '0'
|
|
152
|
+
description: Bundles and minifies multiple Ruby scripts into a single file
|
|
153
|
+
email:
|
|
154
|
+
- sue445@sue445.net
|
|
155
|
+
executables:
|
|
156
|
+
- rbpacker
|
|
157
|
+
extensions: []
|
|
158
|
+
extra_rdoc_files: []
|
|
159
|
+
files:
|
|
160
|
+
- ".rubocop.yml"
|
|
161
|
+
- ".yardopts"
|
|
162
|
+
- CHANGELOG.md
|
|
163
|
+
- LICENSE.txt
|
|
164
|
+
- README.md
|
|
165
|
+
- Rakefile
|
|
166
|
+
- Steepfile
|
|
167
|
+
- exe/rbpacker
|
|
168
|
+
- lib/rbpacker.rb
|
|
169
|
+
- lib/rbpacker/cli.rb
|
|
170
|
+
- lib/rbpacker/source_bundler.rb
|
|
171
|
+
- lib/rbpacker/version.rb
|
|
172
|
+
- rbs_collection.lock.yaml
|
|
173
|
+
- rbs_collection.yaml
|
|
174
|
+
- sig/rbpacker.rbs
|
|
175
|
+
- sig/rbpacker/cli.rbs
|
|
176
|
+
- sig/rbpacker/source_bundler.rbs
|
|
177
|
+
homepage: https://github.com/sue445/rbpacker
|
|
178
|
+
licenses:
|
|
179
|
+
- MIT
|
|
180
|
+
metadata:
|
|
181
|
+
homepage_uri: https://github.com/sue445/rbpacker
|
|
182
|
+
source_code_uri: https://github.com/sue445/rbpacker
|
|
183
|
+
changelog_uri: https://github.com/sue445/rbpacker/blob/main/CHANGELOG.md
|
|
184
|
+
documentation_uri: https://sue445.github.io/rbpacker/
|
|
185
|
+
rubygems_mfa_required: 'true'
|
|
186
|
+
rdoc_options: []
|
|
187
|
+
require_paths:
|
|
188
|
+
- lib
|
|
189
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
|
+
requirements:
|
|
191
|
+
- - ">="
|
|
192
|
+
- !ruby/object:Gem::Version
|
|
193
|
+
version: 3.3.0
|
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
|
+
requirements:
|
|
196
|
+
- - ">="
|
|
197
|
+
- !ruby/object:Gem::Version
|
|
198
|
+
version: '0'
|
|
199
|
+
requirements: []
|
|
200
|
+
rubygems_version: 4.0.17
|
|
201
|
+
specification_version: 4
|
|
202
|
+
summary: Bundles and minifies multiple Ruby scripts into a single file
|
|
203
|
+
test_files: []
|