Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fuminori-ido
Copy link
Contributor

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:

$ itamae list
itamae-plugin-recipe-god gem:
  god
  god::install
  god::start
  god::stop
  god::version
itamae-plugin-recipe-hadoop gem:
  hadoop
  hadoop::install
  hadoop::version
itamae-plugin-recipe-passenger gem:
  passenger
  passenger::install
  passenger::version
itamae-plugin-recipe-postgresql gem:
  postgresql
  postgresql::version

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.

@unasuke unasuke self-requested a review August 17, 2020 05:06
Copy link
Member

@unasuke unasuke left a 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... 🤔

end

# from rubygems Gem::Commands::QueryCommand#output_versions
versions.each do |gem_name, matching_tuples|
Copy link
Member

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.

Copy link
Contributor Author

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.
@fuminori-ido
Copy link
Contributor Author

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??

@unasuke unasuke self-requested a review August 19, 2020 08:27
Comment on lines +19 to +23
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
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants