Comments (16)
Good suggestion. I will look into it.
from rnr.
A PR has been made: Homebrew/homebrew-core#115749
Please keep an eye.
from rnr.
You are welcome. Thank you for this helpful tool.
from rnr.
The PR has been accepted! This issue can be closed.
from rnr.
Thanks @Miserlou! I have no experience with Homebrew nor access to a MacOS system.
Any contribution will be more than welcome.
from rnr.
Hi, @ismaelgv, I'm trying to create a Homebrew script, but failed
The file is
class Rnr < Formula
desc "Command-line tool to batch rename files and directories"
homepage "https://github.com/ismaelgv/rnr"
url "https://github.com/ismaelgv/rnr/archive/refs/tags/v0.4.1.tar.gz"
sha256 "85013be46725acc1cd6f2d2089c42f426c052efab26d22db8a9f28051eebbb6a"
license "MIT"
depends_on "rust" => :build
def install
system "cargo", "install", "--locked", *std_cargo_args
generate_completions_from_executable(bin/"rnr", "gen_completions", base_name: "rnr")
end
test do
# Check that a typical Conventional Commit is considered correct.
system "git", "init"
(testpath/"some-file").write("")
system "git", "add", "some-file"
system "git", "config", "user.name", "'Ismael González Valverde'"
system "git", "config", "user.email", "[email protected]"
system "git", "commit", "-m", "chore: initial commit"
assert_equal "No errored commits", shell_output("#{bin}/rnr check 2>&1").strip
end
end
The error message is
Failure while executing; `\{\"SHELL\"=\>\"bash\"\} /opt/homebrew/Cellar/rnr/0.4.1/bin/rnr gen_completions bash` exited with 1. Here's the output:
This is the result of wrong command of generate_completions
functionality, then what is the exact command ?
I am sure it is not hard for you to understand the message as well as the manuscript above.
from rnr.
Thanks for trying to pack RnR for Homebrew. I got no experience with that package manager, but I will take a look at the problem of the completion generation as soon as possible.
from rnr.
@ivaquero I think that you do not need to generate anything manually. The completion files are generated when you build the project, not with any additional command. You would need to package the completions.
You can take a look to bat
formulae to use it as reference.
You can also check the current CI/CD configuration that generates the release:
https://github.com/ismaelgv/rnr/blob/master/.github/workflows/release.yml#L67-L105
from rnr.
For now, the script can successfully be built
class Rnr < Formula
desc "Command-line tool to batch rename files and directories"
homepage "https://github.com/ismaelgv/rnr"
url "https://github.com/ismaelgv/rnr/archive/refs/tags/v0.4.1.tar.gz"
sha256 "85013be46725acc1cd6f2d2089c42f426c052efab26d22db8a9f28051eebbb6a"
license "MIT"
depends_on "rust" => :build
def install
ENV["SHELL_COMPLETIONS_DIR"] = buildpath
system "cargo", "install", *std_cargo_args
deploy_dir = Dir["target/release/build/rnr-*/out"].first
bash_completion.install "#{deploy_dir}/rnr.bash" => "rnr"
fish_completion.install "#{deploy_dir}/rnr.fish"
# zsh_completion.install "#{deploy_dir}/rnr.zsh" => "rnr"
end
test do
end
end
❯ rnr -h
rnr 0.4.1
Ismael González Valverde <[email protected]>
RnR is a command-line tool to rename multiple files and directories that
supports regular expressions
USAGE:
rnr [FLAGS] [OPTIONS] <EXPRESSION> <REPLACEMENT> <PATH(S)>...
rnr [FLAGS] [OPTIONS] <SUBCOMMAND>
....
However, there are several missing parts
- zsh_completion, the CI doesn't include zsh
- test function, I am not sure the best way to test
rnr
, I wonder whether to use the previous one
from rnr.
zsh_completion, the CI doesn't include zsh
The CI is generating the ZSH completion, but the file is called _rnr
. You need to correct that in the script.
test function, I am not sure the best way to test rnr, I wonder whether to use the previous one
All the testing is running in the CI system of the project (Github Actions). I am not sure why it is needed to be run in the Homebrew again.
from rnr.
Okay, it build past, but it seems the competion doesn't work correctly
class Rnr < Formula
desc "Command-line tool to batch rename files and directories"
homepage "https://github.com/ismaelgv/rnr"
url "https://github.com/ismaelgv/rnr/archive/refs/tags/v0.4.1.tar.gz"
sha256 "85013be46725acc1cd6f2d2089c42f426c052efab26d22db8a9f28051eebbb6a"
license "MIT"
depends_on "rust" => :build
def install
ENV["SHELL_COMPLETIONS_DIR"] = buildpath
system "cargo", "install", *std_cargo_args
deploy_dir = Dir["target/release/build/rnr-*/out"].first
zsh_completion.install "#{deploy_dir}/_rnr" => "rnr"
bash_completion.install "#{deploy_dir}/rnr.bash" => "rnr"
fish_completion.install "#{deploy_dir}/rnr.fish"
end
test do
end
end
I will check what to put in the test sectioin.
from rnr.
@ivaquero I think you need to copy ZSH completion file as it is _rnr
, you are renaming it to rnr
.
If you want to test something you may want to rename a dummy file. For example, the bat
example is just checking that the CLI tool is functional printing the content of a file.
from rnr.
No problem, I will try.
I suggest that you create a new repo to host this Homebrew script and mention it in the README, because Homebrew official has a relatively strict standard, we need more time and users to test to avoid the PR to be closed accidentally.
from rnr.
Feel free to host it yourself until it is merged to Homebrew official repository. I cannot provide proper support to that script since I cannot test it. However, you can maintain it if it is fine for you.
I will add the information to the README.md once it is ready.
Thanks for your contribution to the project!
from rnr.
@ivaquero I see that they approved the PR, thanks for the contribution! I will add the information to the README.md
.
from rnr.
I will update the readme before closing this issue. I am a bit busy these days so it may take me some time. Thanks!
from rnr.
Related Issues (20)
- Windows support? HOT 4
- How to do `git mv` for renaming? HOT 2
- Regex replacement doesn't work in cmd.exe, only in sh.exe HOT 10
- Logo proposal HOT 2
- Add option to write to/read from file HOT 1
- Create examples
- [Feature request] Highlight replacements in dry-run mode. HOT 3
- Add option to select number of replacements
- regexp in windows HOT 2
- Support change of case on case-insensitive file systems HOT 4
- Add new workflow to generate releases
- ascii restriction mode HOT 8
- [Feature request] Add file names enumeration (counter) option HOT 7
- Confirming cli app only HOT 2
- Ignore version control directories HOT 1
- Support for non-valid UTF-8 strings HOT 2
- Ignore hidden directories
- Detect non-compatible with color=auto HOT 1
- Allow renaming of folders HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rnr.