bundler-gem_bytes 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/.commitlintrc.yml +16 -0
- data/.husky/commit-msg +1 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/CHANGELOG.md +20 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE.txt +21 -0
- data/README.md +160 -0
- data/Rakefile +87 -0
- data/lib/bundler/gem_bytes/bundler_command.rb +53 -0
- data/lib/bundler/gem_bytes/script_executor.rb +41 -0
- data/lib/bundler/gem_bytes/version.rb +8 -0
- data/lib/bundler/gem_bytes.rb +18 -0
- data/package.json +11 -0
- data/plugins.rb +8 -0
- metadata +223 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cd1c19bddd6ef1887fcae3ed68a346395ba811b781e2c1321140015a1403e5d1
|
4
|
+
data.tar.gz: d48849f9cf568c0dc3bd2f8b29cd8122b15993650d9bde3fbc41703931970fb7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a42c3cee7bd326a9564144e2d6029a273be1676eece61bcb9fce50fac5b33e2939e328bef28a5121acdef69352f351c0c251ff16e36b918804b5c1d4935cdf4
|
7
|
+
data.tar.gz: 95be78f3a9535dd2385425e231dae7de2e3bd4c186a9db24db53506eaae3843f293e89b6cf8c9642e14562f849060a1223f005e66286eeeabedc856df83afa83
|
data/.commitlintrc.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
extends: '@commitlint/config-conventional'
|
3
|
+
|
4
|
+
rules:
|
5
|
+
# See: https://commitlint.js.org/reference/rules.html
|
6
|
+
#
|
7
|
+
# Rules are made up by a name and a configuration array. The configuration array contains:
|
8
|
+
#
|
9
|
+
# * Severity [0..2]: 0 disable rule, 1 warning if violated, or 2 error if violated
|
10
|
+
# * Applicability [always|never]: never inverts the rule
|
11
|
+
# * Value: value to use for this rule
|
12
|
+
#
|
13
|
+
# Run `npx commitlint --print-config` to see the current setting for all rules.
|
14
|
+
#
|
15
|
+
body-leading-blank: [2, 'always']
|
16
|
+
footer-leading-blank: [2, 'always']
|
data/.husky/commit-msg
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
npx --no-install commitlint --edit "$1"
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to the process_executer gem will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## v0.1.0 (2024-10-17)
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/main-branch/bundler-gem_bytes/compare/ce13f25..v0.1.0)
|
11
|
+
|
12
|
+
Changes:
|
13
|
+
|
14
|
+
* b678393 feat: download and execute GemBytes script
|
15
|
+
* 88c3ee9 chore: add script loading to the bundler plugin
|
16
|
+
* afda321 chore: add bug tracker uri to gemspec
|
17
|
+
* fe40e6c feat: add the script loader class
|
18
|
+
* 83c8841 fix: correct the require for bindler/gem_bytes in bin/console
|
19
|
+
* 74a638a chore: implement bundler plugin
|
20
|
+
* ce13f25 chore: initial version
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
* Public or private harassment
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at
|
63
|
+
[INSERT CONTACT METHOD].
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
65
|
+
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
reporter of any incident.
|
68
|
+
|
69
|
+
## Enforcement Guidelines
|
70
|
+
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73
|
+
|
74
|
+
### 1. Correction
|
75
|
+
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
unprofessional or unwelcome in the community.
|
78
|
+
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
82
|
+
|
83
|
+
### 2. Warning
|
84
|
+
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
86
|
+
actions.
|
87
|
+
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
93
|
+
ban.
|
94
|
+
|
95
|
+
### 3. Temporary Ban
|
96
|
+
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
98
|
+
sustained inappropriate behavior.
|
99
|
+
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
communication with the community for a specified period of time. No public or
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104
|
+
Violating these terms may lead to a permanent ban.
|
105
|
+
|
106
|
+
### 4. Permanent Ban
|
107
|
+
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
111
|
+
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
113
|
+
community.
|
114
|
+
|
115
|
+
## Attribution
|
116
|
+
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118
|
+
version 2.1, available at
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
120
|
+
|
121
|
+
Community Impact Guidelines were inspired by
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
123
|
+
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
127
|
+
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 James Couball
|
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,160 @@
|
|
1
|
+
# bundler-gem_bytes gem
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/bundler-gem_bytes)
|
5
|
+
[](https://rubydoc.info/gems/bundler-gem_bytes/)
|
6
|
+
[](https://rubydoc.info/gems/bundler-gem_bytes/file/CHANGELOG.md)
|
8
|
+
[](https://github.com/main-branch/bundler-gem_bytes/actions/workflows/continuous-integration.yml)
|
10
|
+
[](https://codeclimate.com/github/main-branch/bundler-gem_bytes/maintainability)
|
11
|
+
[](https://codeclimate.com/github/main-branch/bundler-gem_bytes/test_coverage)
|
13
|
+
[](https://conventionalcommits.org)
|
15
|
+
[](https://main-branch.slack.com/archives/C07RKRKTLDT)
|
16
|
+
|
17
|
+
This gem is a bundler plugin that can add testing, linting, and security frameworks
|
18
|
+
to a Ruby gem project.
|
19
|
+
|
20
|
+
This project is similar to [the RailsBytes project](https://railsbytes.com) which
|
21
|
+
helps add configuration to a Rails project.
|
22
|
+
|
23
|
+
GemBytes scripts are run via the `bundler gem-bytes` command:
|
24
|
+
|
25
|
+
```shell
|
26
|
+
bundler gem-bytes PATH_OR_URI
|
27
|
+
```
|
28
|
+
|
29
|
+
where `PATH_OR_URI` identifies a gem-bytes script.
|
30
|
+
|
31
|
+
See [the repository of GemBytes scripts](http://gembytes.com/scripts) for publicly
|
32
|
+
available GemBytes scripts.
|
33
|
+
|
34
|
+
**NOTE: [the GemBytes repository](https://gembytes.com) is not yet active. For now, you will have to bring your
|
35
|
+
own script**
|
36
|
+
|
37
|
+
* [Installation](#installation)
|
38
|
+
* [Usage](#usage)
|
39
|
+
* [Example](#example)
|
40
|
+
* [Handling Errors](#handling-errors)
|
41
|
+
* [Development](#development)
|
42
|
+
* [Contributing](#contributing)
|
43
|
+
* [Commit message guidelines](#commit-message-guidelines)
|
44
|
+
* [Pull request guidelines](#pull-request-guidelines)
|
45
|
+
* [License](#license)
|
46
|
+
* [Code of Conduct](#code-of-conduct)
|
47
|
+
|
48
|
+
## Installation
|
49
|
+
|
50
|
+
Install this bundler plugin as follows:
|
51
|
+
|
52
|
+
```shell
|
53
|
+
bundle plugin install bunder-gem_bytes
|
54
|
+
```
|
55
|
+
|
56
|
+
## Usage
|
57
|
+
|
58
|
+
The `bundler gem-bytes` command requires exactly one argument, which can either be a
|
59
|
+
file path or a URI to a script. The script will be loaded and executed within the
|
60
|
+
context of your project.
|
61
|
+
|
62
|
+
### Example
|
63
|
+
|
64
|
+
1. Find a template script for a feature you'd like to add to your gem and make a note
|
65
|
+
of its URI.
|
66
|
+
2. Run `bundler gem-bytes PATH_OR_URI` where `PATH_OR_URI` is either a local file
|
67
|
+
path or a remote URI.
|
68
|
+
3. The script will be executed to add the relevant feature to your project.
|
69
|
+
|
70
|
+
### Handling Errors
|
71
|
+
|
72
|
+
If the file or URI cannot be loaded, an error message will be printed to `stderr`,
|
73
|
+
and the command will exit with a status code of `1`.
|
74
|
+
|
75
|
+
## Development
|
76
|
+
|
77
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
78
|
+
`rake` to run all the tests that will be run in the `continuous-integration`
|
79
|
+
workflow. You can also run `bin/console` for an interactive prompt that will allow
|
80
|
+
you to experiment.
|
81
|
+
|
82
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
83
|
+
release a new version, update the version number in `version.rb`, and then run
|
84
|
+
`bundle exec rake release`, which will create a git tag for the version, push git
|
85
|
+
commits and the created tag, and push the `.gem` file to
|
86
|
+
[rubygems.org](https://rubygems.org).
|
87
|
+
|
88
|
+
To install this bundler plugin from the source code, run the following command from
|
89
|
+
the project's root directory:
|
90
|
+
|
91
|
+
```shell
|
92
|
+
bundler plugin install --path . bundler-gem_bytes
|
93
|
+
```
|
94
|
+
|
95
|
+
and then run `bundler plugin list` to make sure it was installed correctly:
|
96
|
+
|
97
|
+
```shell
|
98
|
+
$ bundler plugin list
|
99
|
+
bundler-gem_bytes
|
100
|
+
-----
|
101
|
+
gem-bytes
|
102
|
+
|
103
|
+
$
|
104
|
+
```
|
105
|
+
|
106
|
+
Once installed, the bundler plugin can be run with the following command:
|
107
|
+
|
108
|
+
```shell
|
109
|
+
bundler gem-bytes
|
110
|
+
```
|
111
|
+
|
112
|
+
To uninstall the plugin, run:
|
113
|
+
|
114
|
+
```shell
|
115
|
+
bundler uninstall bundler-gem_bytes
|
116
|
+
```
|
117
|
+
|
118
|
+
## Contributing
|
119
|
+
|
120
|
+
Bug reports and pull requests are welcome on GitHub at
|
121
|
+
https://github.com/main-branch/bundler-gem_bytes. This project is intended to be a
|
122
|
+
safe, welcoming space for collaboration, and contributors are expected to adhere to
|
123
|
+
the [code of
|
124
|
+
conduct](https://github.com/main-branch/bundler-gem_bytes/blob/main/CODE_OF_CONDUCT.md).
|
125
|
+
|
126
|
+
### Commit message guidelines
|
127
|
+
|
128
|
+
All commit messages must follow the [Conventional Commits
|
129
|
+
standard](https://www.conventionalcommits.org/en/v1.0.0/). This helps us maintain a
|
130
|
+
clear and structured commit history, automate versioning, and generate changelogs
|
131
|
+
effectively.
|
132
|
+
|
133
|
+
To ensure compliance, this project includes:
|
134
|
+
|
135
|
+
* A git commit-msg hook that validates your commit messages before they are accepted.
|
136
|
+
|
137
|
+
To activate the hook, you must have node installed and run `npm install`.
|
138
|
+
|
139
|
+
* A GitHub Actions workflow that will enforce the Conventional Commit standard as
|
140
|
+
part of the continuous integration pipeline.
|
141
|
+
|
142
|
+
Any commit message that does not conform to the Conventional Commits standard will
|
143
|
+
cause the workflow to fail and not allow the PR to be merged.
|
144
|
+
|
145
|
+
### Pull request guidelines
|
146
|
+
|
147
|
+
All pull requests must be merged using rebase merges. This ensures that commit
|
148
|
+
messages from the feature branch are preserved in the release branch, keeping the
|
149
|
+
history clean and meaningful.
|
150
|
+
|
151
|
+
## License
|
152
|
+
|
153
|
+
The gem is available as open source under the terms of the [MIT
|
154
|
+
License](https://opensource.org/licenses/MIT).
|
155
|
+
|
156
|
+
## Code of Conduct
|
157
|
+
|
158
|
+
Everyone interacting in the Bundler::GemBytes project's codebases, issue trackers,
|
159
|
+
chat rooms and mailing lists is expected to follow the [code of
|
160
|
+
conduct](https://github.com/main-branch/bundler-gem_bytes/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
desc 'Run the same tasks that the CI build will run'
|
4
|
+
if RUBY_PLATFORM == 'java'
|
5
|
+
task default: %w[spec rubocop bundle:audit build]
|
6
|
+
else
|
7
|
+
task default: %w[spec rubocop yard bundle:audit build]
|
8
|
+
end
|
9
|
+
|
10
|
+
# Bundler Audit
|
11
|
+
|
12
|
+
require 'bundler/audit/task'
|
13
|
+
Bundler::Audit::Task.new
|
14
|
+
|
15
|
+
# Bundler Gem Build
|
16
|
+
|
17
|
+
require 'bundler'
|
18
|
+
require 'bundler/gem_tasks'
|
19
|
+
|
20
|
+
begin
|
21
|
+
Bundler.setup(:default, :development)
|
22
|
+
rescue Bundler::BundlerError => e
|
23
|
+
warn e.message
|
24
|
+
warn 'Run `bundle install` to install missing gems'
|
25
|
+
exit e.status_code
|
26
|
+
end
|
27
|
+
|
28
|
+
CLEAN << 'pkg'
|
29
|
+
CLOBBER << 'Gemfile.lock'
|
30
|
+
|
31
|
+
# RSpec
|
32
|
+
|
33
|
+
require 'rspec/core/rake_task'
|
34
|
+
|
35
|
+
RSpec::Core::RakeTask.new
|
36
|
+
|
37
|
+
CLEAN << 'coverage'
|
38
|
+
CLEAN << '.rspec_status'
|
39
|
+
CLEAN << 'rspec-report.xml'
|
40
|
+
|
41
|
+
# Rubocop
|
42
|
+
|
43
|
+
require 'rubocop/rake_task'
|
44
|
+
|
45
|
+
RuboCop::RakeTask.new
|
46
|
+
|
47
|
+
CLEAN << 'rubocop-report.json'
|
48
|
+
|
49
|
+
# YARD
|
50
|
+
|
51
|
+
unless RUBY_PLATFORM == 'java'
|
52
|
+
require 'yard'
|
53
|
+
|
54
|
+
namespace :yard do
|
55
|
+
# yard:build
|
56
|
+
|
57
|
+
YARD::Rake::YardocTask.new(:build) do |t|
|
58
|
+
t.files = %w[lib/**/*.rb examples/**/*]
|
59
|
+
t.stats_options = ['--list-undoc']
|
60
|
+
end
|
61
|
+
|
62
|
+
CLEAN << '.yardoc'
|
63
|
+
CLEAN << 'doc'
|
64
|
+
|
65
|
+
# yard:audit
|
66
|
+
|
67
|
+
desc 'Run yardstick to show missing YARD doc elements'
|
68
|
+
task :audit do
|
69
|
+
sh "yardstick 'lib/**/*.rb'"
|
70
|
+
end
|
71
|
+
|
72
|
+
# yard:coverage
|
73
|
+
|
74
|
+
require 'yardstick/rake/verify'
|
75
|
+
|
76
|
+
Yardstick::Rake::Verify.new(:coverage) do |verify|
|
77
|
+
verify.threshold = 100
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# yard
|
82
|
+
|
83
|
+
task yard: %i[yard:build yard:audit yard:coverage]
|
84
|
+
end
|
85
|
+
|
86
|
+
CLOBBER << 'package-lock.json'
|
87
|
+
CLOBBER << 'node_modules'
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
module GemBytes
|
5
|
+
# A bundler command that adds features to your existing Ruby Gems project
|
6
|
+
#
|
7
|
+
# @api public
|
8
|
+
#
|
9
|
+
class BundlerCommand < Bundler::Plugin::API
|
10
|
+
# Called when the `gem-bytes` command is invoked
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# BundlerCommand.new.exec('gem-bytes', ['path_or_uri_to_script'])
|
14
|
+
# @param _command [String] the command that was invoked (in this case, 'gem-bytes')
|
15
|
+
# @param args [Array<String>] any additional arguments passed to the command
|
16
|
+
# @raise [SystemExit] if there was an error executing the command
|
17
|
+
# @return [void]
|
18
|
+
def exec(_command, args)
|
19
|
+
uri_or_path = validate_args(args)
|
20
|
+
execute_script(uri_or_path)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
# Validates that exactly one argument is provided
|
26
|
+
#
|
27
|
+
# @param args [Array<String>] the arguments passed to the command
|
28
|
+
# @raise [SystemExit] if the argument count is not correct
|
29
|
+
# @return [String] the validated URI or file path
|
30
|
+
# @api private
|
31
|
+
def validate_args(args)
|
32
|
+
if args.size != 1
|
33
|
+
warn 'Error: You must provide exactly one argument, either a file path or URI.'
|
34
|
+
exit 1
|
35
|
+
end
|
36
|
+
args.first
|
37
|
+
end
|
38
|
+
|
39
|
+
# Executes the script using ScriptExecutor
|
40
|
+
#
|
41
|
+
# @param uri_or_path [String] the URI or file path to the script
|
42
|
+
# @return [void]
|
43
|
+
# @api private
|
44
|
+
def execute_script(uri_or_path)
|
45
|
+
executor = ScriptExecutor.new
|
46
|
+
executor.execute(uri_or_path)
|
47
|
+
rescue RuntimeError => e
|
48
|
+
warn "Error applying script: #{e.message}"
|
49
|
+
exit 1
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# require 'pp'
|
4
|
+
require 'thor'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
module Bundler
|
8
|
+
module GemBytes
|
9
|
+
# ScriptExecutor is responsible for executing scripts using Thor actions
|
10
|
+
#
|
11
|
+
# @api public
|
12
|
+
#
|
13
|
+
# @example Executing a script from a file or URI
|
14
|
+
# executor = Bundler::GemBytes::ScriptExecutor.new
|
15
|
+
# executor.execute('path_or_uri_to_script')
|
16
|
+
class ScriptExecutor < Thor::Group
|
17
|
+
include Thor::Actions
|
18
|
+
|
19
|
+
# Set the source paths for Thor to use
|
20
|
+
# @return [Array<String>] the source paths
|
21
|
+
# @api private
|
22
|
+
def self.source_paths
|
23
|
+
# Add the current working directory or the directory of the script
|
24
|
+
[Dir.pwd]
|
25
|
+
end
|
26
|
+
|
27
|
+
# Executes the script from a URI or file path
|
28
|
+
#
|
29
|
+
# @param path_or_uri [String] the URI or file path to the script
|
30
|
+
# @return [void]
|
31
|
+
# @raise [RuntimeError] if the script cannot be loaded
|
32
|
+
# @example Execute a script from a path
|
33
|
+
# execute('path/to/script.rb')
|
34
|
+
def execute(path_or_uri)
|
35
|
+
apply(path_or_uri)
|
36
|
+
rescue StandardError => e
|
37
|
+
raise "Failed to execute script from #{path_or_uri}: #{e.message}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The bundler namespace within which the GemBytes plugin will be defined
|
4
|
+
module Bundler
|
5
|
+
# A bundler plugin that adds features to your existing Ruby Gems project
|
6
|
+
#
|
7
|
+
# See [our repository of templates](http://gembytes.com/templates) for adding
|
8
|
+
# testing, linting, and security frameworks to your project.
|
9
|
+
#
|
10
|
+
# @api public
|
11
|
+
#
|
12
|
+
module GemBytes
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
require_relative 'gem_bytes/bundler_command'
|
17
|
+
require_relative 'gem_bytes/script_executor'
|
18
|
+
require_relative 'gem_bytes/version'
|
data/package.json
ADDED
data/plugins.rb
ADDED
metadata
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bundler-gem_bytes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Couball
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-10-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler-audit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.9'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: main_branch_shared_rubocop_config
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '13.2'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '13.2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.13'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.13'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.66'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.66'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.22'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.22'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.4'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.4'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: redcarpet
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.5'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.5'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.9'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.9'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: yardstick
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.9'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.9'
|
167
|
+
description: |
|
168
|
+
A bundler plugin that adds features to your existing Ruby Gems project.
|
169
|
+
|
170
|
+
See [our repository of templates](http://gembytes.com/templates) for adding
|
171
|
+
testing, linting, and security frameworks to your project.
|
172
|
+
email:
|
173
|
+
- jcouball@yahoo.com
|
174
|
+
executables: []
|
175
|
+
extensions: []
|
176
|
+
extra_rdoc_files: []
|
177
|
+
files:
|
178
|
+
- ".commitlintrc.yml"
|
179
|
+
- ".husky/commit-msg"
|
180
|
+
- ".rspec"
|
181
|
+
- ".rubocop.yml"
|
182
|
+
- CHANGELOG.md
|
183
|
+
- CODE_OF_CONDUCT.md
|
184
|
+
- LICENSE.txt
|
185
|
+
- README.md
|
186
|
+
- Rakefile
|
187
|
+
- lib/bundler/gem_bytes.rb
|
188
|
+
- lib/bundler/gem_bytes/bundler_command.rb
|
189
|
+
- lib/bundler/gem_bytes/script_executor.rb
|
190
|
+
- lib/bundler/gem_bytes/version.rb
|
191
|
+
- package.json
|
192
|
+
- plugins.rb
|
193
|
+
homepage: https://github.com/main-branch/bundler-gem_bytes
|
194
|
+
licenses:
|
195
|
+
- MIT
|
196
|
+
metadata:
|
197
|
+
allowed_push_host: https://rubygems.org
|
198
|
+
homepage_uri: https://github.com/main-branch/bundler-gem_bytes
|
199
|
+
source_code_uri: https://github.com/main-branch/bundler-gem_bytes
|
200
|
+
documentation_uri: https://rubydoc.info/gems/bundler-gem_bytes/0.1.0
|
201
|
+
changelog_uri: https://rubydoc.info/gems/bundler-gem_bytes/0.1.0/file/CHANGELOG.md
|
202
|
+
bug_tracker_uri: https://github.com/main-branch/bundler-gem_bytes/issues
|
203
|
+
rubygems_mfa_required: 'true'
|
204
|
+
post_install_message:
|
205
|
+
rdoc_options: []
|
206
|
+
require_paths:
|
207
|
+
- lib
|
208
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
209
|
+
requirements:
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: 3.1.0
|
213
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
|
+
requirements:
|
215
|
+
- - ">="
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
version: '0'
|
218
|
+
requirements: []
|
219
|
+
rubygems_version: 3.5.16
|
220
|
+
signing_key:
|
221
|
+
specification_version: 4
|
222
|
+
summary: A bundler plugin that adds features to your existing Ruby Gems project
|
223
|
+
test_files: []
|