-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"itamae list" command to list itamae plugin recipes #321
base: master
Are you sure you want to change the base?
"itamae list" command to list itamae plugin recipes #321
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding spec is better, but Itamae has no official plugin, so if add spec, it depends on 3rd-party's gem. That looks not good way to me... 🤔
lib/itamae/list.rb
Outdated
end | ||
|
||
# from rubygems Gem::Commands::QueryCommand#output_versions | ||
versions.each do |gem_name, matching_tuples| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is gem_name
unused? I think you should add a prefix _
if that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your pointing out! I did so at 80fadc1
inspired by 'rubygems' test to test around gem so that before/after, and instance variables are used.
I tried to add spec at f234f5b . It's a little bit too long because of testing in temporary created gem space as 'rubygems' tests itself. I'm not sure if it is acceptable?? |
req = Gem::Requirement.default | ||
dep = Gem::Deprecate.skip_during { Gem::Dependency.new pattern, req } | ||
specs.select! do |s| | ||
dep.match?(s.name, s.version, false) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fuminori-ido I can't understand these lines. What purpose of this?
NAME
"itamae list" command lists recipes in installed itamae-plugin-recipe-X gems
SYNOPSIS
itamae list
DESCRIPTION
"itamae list" command lists recipes in installed itamae-plugin-recipe-X gems; for example:
Implementation Note
The basic idea is "gem list ^itamae-plugin-recipe", scan '*.rb' , then print the path with conversion of directory separator from '/' to '::'. "X/default.rb" will be converted to "X" as well.