-
Notifications
You must be signed in to change notification settings - Fork 898
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
generator for providers #12209
generator for providers #12209
Conversation
Oh poor @miq-bot. Is this the first template we've created? Can't see any cops we can add to Rubocop to validate |
We can add this whole directory to the excludes list, probably. |
Also 😮 😮 😮 😮 Very excited!! |
@@ -0,0 +1,59 @@ | |||
require "rails/generators/rails/app/app_generator" | |||
class ProviderGenerator < Rails::Generators::NamedBase | |||
source_root File.expand_path('../templates', __FILE__) |
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.
Prefer File.expand_path("templates", __dir__)
@@ -0,0 +1,2 @@ | |||
class ManageIQ::Providers::<% class_name %>::CloudManager < ManageIQ::Providers::CloudManager |
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.
Should this be <%=
vs <%
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) | ||
|
||
Dir.chdir APP_ROOT do | ||
if File.exists?("spec/manageiq") |
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.
Rubocop: File.exists?
is deprecated in favor of File.exist?
.
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.
Pasting CodeClimate? 😛 But thanks.
export BUNDLE_WITHOUT=development | ||
export BUNDLE_GEMFILE=${PWD}/Gemfile | ||
|
||
set +v |
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.
It would be nice if we could keep super-common stuff like this in the ManageIQ repo, and then refer to it somehow. Like, perhaps keep the git clone and then have the rest of the file live in ManageIQ/tools/ci somewhere?
The more that's duplicated across provider repos, the more it has to be fixed across the board.
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.
agreed. I'll see what I can do.
OTOH, whats nice about the generator: you can run it again and have it patch the files in the repos
[![Code Climate](https://codeclimate.com/github/ManageIQ/manageiq-providers-<%= provider_name %>.svg)](https://codeclimate.com/github/ManageIQ/manageiq-providers-<%= provider_name %>) | ||
[![Test Coverage](https://codeclimate.com/github/ManageIQ/manageiq-providers-<%= provider_name %>/badges/coverage.svg)](https://codeclimate.com/github/ManageIQ/manageiq-providers-<%= provider_name %>/coverage) | ||
[![Dependency Status](https://gemnasium.com/ManageIQ/manageiq-providers-<%= provider_name %>.svg)](https://gemnasium.com/ManageIQ/manageiq-providers-<%= provider_name %>) | ||
[![Security](https://hakiri.io/github/ManageIQ/manageiq-providers-<%= provider_name %>/master.svg)](https://hakiri.io/github/ManageIQ/manageiq-providers-<%= provider_name %>/master) |
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.
Where's the zanata badge.
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.
there it is now. 👇
Wonder if it should create it at |
This is really great stuff @durandom !! |
786aebe
to
96fc0ee
Compare
notifications: | ||
webhooks: | ||
urls: | ||
- https://webhooks.gitter.im/e/7af45001fe6b7a4039f2 |
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.
This is a webhook for a specific gitter channel, so this should not be in the template.
@durandom Wouldn't it be easier to develop and maintain this as a rails plugin in its own repo rather than baked into ManageIQ directly? |
I'm ok with it starting here and extracting afterwards. |
@djberg96 I totally agree with you, but in order to get this jumpstarted I implemented it here first. This gives us CI and other stuff. I also need it quite soon to extract the other providers. If you want to help out on doing this you are more than welcome 😄 |
9e2e920
to
5d59d3e
Compare
@jrafanie can you have a look at the split of If ok, I can extract them to their own PR. |
ManageIQ/manageiq-providers-amazon#71 applies the output to the manageiq repo and CI is still working there |
cp config/database.pg.yml config/database.yml | ||
cp config/cable.yml.sample config/cable.yml | ||
psql -c "CREATE USER root SUPERUSER PASSWORD 'smartvm';" -U postgres | ||
|
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.
Looks good @durandom 👍
If these changes work, it's good to bucket these various setups into categories.
👍 I like it. My only concern that seems to keep creeping in is ways to keep your copied templates in sync with any changes we make in MIQ. We probably need some ways to keep repos in sync since we'll be routinely copying content to new repos from old locations. |
@durandom this PR is solid "Like a rock, like a planet" |
like a f*** 💣 |
8c9cdf5
to
a78859c
Compare
@Fryguy its green, merge? |
d2de7e0
to
8f3c7d8
Compare
8f3c7d8
to
255bfa7
Compare
d17de54
to
55c6209
Compare
creates an empty provider at providers/<provider_name> use as rails generate provider
55c6209
to
141d49b
Compare
<github_pr_commenter_batch />Some comments on commits durandom/manageiq@4a72236~...141d49b lib/generators/provider/templates/Rakefile
lib/generators/provider/templates/bin/setup
|
Checked commits durandom/manageiq@4a72236~...141d49b with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 lib/generators/provider/provider_generator.rb
|
@jrafanie do you dare to merge this? 😈 |
While I like the templates, I wonder if the generator could fetch the latest versions of the templates from the main repo, where the templates in this PR are identical with the main repos... Either way, we can do that later. I've seen it all along, LGTM. |
@jrafanie thanks for merging 🎉 Will try to address your concerns / ideas in follow ups |
creates an empty provider at
providers/<provider_name>
use as
rails generate provider UberCloud
@miq-bot add_labels pluggable providers
@miq-bot assign Fryguy
cc @juliancheal @blomquisg @Ladas