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

Plugin Generator Updates #628

Merged
merged 1 commit into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 26 additions & 33 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,37 @@
---
exclude_paths:
- ".git/"
- "**.xml"
- "**.yaml"
- "**.yml"
- locale/
- spec/
- tools/
engines:
brakeman:
version: '2'
prepare:
fetch:
- url: https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_base.yml
path: ".rubocop_base.yml"
- url: https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_cc_base.yml
path: ".rubocop_cc_base.yml"
checks:
argument-count:
enabled: false
bundler-audit:
complex-logic:
enabled: false
csslint:
file-lines:
enabled: false
duplication:
enabled: true
method-complexity:
config:
languages:
- ruby
- javascript
eslint:
threshold: 11
method-count:
enabled: false
channel: eslint-3
fixme:
method-lines:
enabled: false
markdownlint:
nested-control-flow:
enabled: false
return-statements:
enabled: false
plugins:
rubocop:
enabled: true
config: ".rubocop_cc.yml"
channel: rubocop-0-69
prepare:
fetch:
- url: https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_base.yml
path: ".rubocop_base.yml"
- url: https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_cc_base.yml
path: ".rubocop_cc_base.yml"
ratings:
paths:
- Gemfile.lock
- "**.rake"
- "**.rb"
channel: 'rubocop-0-69'
exclude_patterns:
- node_modules/
- spec/
- test/
- tmp/
- vendor/
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.rubocop-*
/.bundle/
/.yardoc
/Gemfile.lock
Expand All @@ -9,8 +8,10 @@
/spec/reports/
/tmp/

.rubocop-*
/bundler.d/*
!/bundler.d/.keep
/config/settings.local.yml
/config/settings/*.local.yml
/config/environments/*.local.yml

/spec/manageiq
1 change: 0 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
inherit_from:
- https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_base.yml
# put all local rubocop config into .rubocop_local.yml as it will be loaded by .rubocop_cc.yml as well
- .rubocop_local.yml
1 change: 0 additions & 1 deletion .rubocop_cc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
inherit_from:
# this is downloaded by .codeclimate.yml
- .rubocop_base.yml
- .rubocop_cc_base.yml
- .rubocop_local.yml
12 changes: 2 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
---
dist: xenial
language: ruby
cache: bundler
rvm:
- 2.5.7
- 2.6.5
sudo: false
cache: bundler
env:
global:
- RUBY_GC_HEAP_GROWTH_MAX_SLOTS=300000
- RUBY_GC_HEAP_INIT_SLOTS=600000
- RUBY_GC_HEAP_GROWTH_FACTOR=1.25
addons:
postgresql: '10'
install: bin/setup
after_script: bundle exec codeclimate-test-reporter
after_script: bin/ci/after_script
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# manageiq-providers-vmware
# ManageIQ::Providers::Vmware

[![Gem Version](https://badge.fury.io/rb/manageiq-providers-vmware.svg)](http://badge.fury.io/rb/manageiq-providers-vmware)
[![Build Status](https://travis-ci.com/ManageIQ/manageiq-providers-vmware.svg?branch=master)](https://travis-ci.com/ManageIQ/manageiq-providers-vmware)
[![Code Climate](https://codeclimate.com/github/ManageIQ/manageiq-providers-vmware.svg)](https://codeclimate.com/github/ManageIQ/manageiq-providers-vmware)
[![Test Coverage](https://codeclimate.com/github/ManageIQ/manageiq-providers-vmware/badges/coverage.svg)](https://codeclimate.com/github/ManageIQ/manageiq-providers-vmware/coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/73bf62adcd9632fd9c7d/maintainability)](https://codeclimate.com/github/ManageIQ/manageiq-providers-vmware/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/73bf62adcd9632fd9c7d/test_coverage)](https://codeclimate.com/github/ManageIQ/manageiq-providers-vmware/test_coverage)
[![Security](https://hakiri.io/github/ManageIQ/manageiq-providers-vmware/master.svg)](https://hakiri.io/github/ManageIQ/manageiq-providers-vmware/master)

[![Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ManageIQ/manageiq-providers-vmware?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

ManageIQ plugin for the Vmware provider.
ManageIQ plugin for the VMware provider.

## Development

See the section on pluggable providers in the [ManageIQ Developer Setup](http://manageiq.org/docs/guides/developer_setup)
See the section on plugins in the [ManageIQ Developer Setup](http://manageiq.org/docs/guides/developer_setup/plugins)

For quick local setup run `bin/setup`, which will clone the core ManageIQ repository under the *spec* directory and setup necessary config files. If you have already cloned it, you can run `bin/update` to bring the core ManageIQ code up to date.

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require 'bundler/setup'
begin
require 'rspec/core/rake_task'

APP_RAKEFILE = File.expand_path("../spec/manageiq/Rakefile", __FILE__)
APP_RAKEFILE = File.expand_path("spec/manageiq/Rakefile", __dir__)
load 'rails/tasks/engine.rake'
load 'rails/tasks/statistics.rake'
rescue LoadError
Expand Down
3 changes: 3 additions & 0 deletions bin/ci/after_script
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
Empty file added bundler.d/.keep
Empty file.
3 changes: 3 additions & 0 deletions lib/manageiq-providers-vmware.rb
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
require "manageiq/providers/vmware/engine"
require "manageiq/providers/vmware/version"

require "manageiq/providers/vmware"
3 changes: 0 additions & 3 deletions lib/manageiq/providers/vmware.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
require "manageiq/providers/vmware/engine"
require "manageiq/providers/vmware/version"

module ManageIQ
module Providers
module Vmware
Expand Down
2 changes: 2 additions & 0 deletions lib/manageiq/providers/vmware/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ module Vmware
class Engine < ::Rails::Engine
isolate_namespace ManageIQ::Providers::Vmware

config.autoload_paths << root.join('lib').to_s

def self.vmdb_plugin?
true
end
Expand Down
20 changes: 17 additions & 3 deletions lib/tasks/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Tasks (.rake files) in this directory will be available in the main ManageIQ app.
They can be executed in the provider gem via the app: namespace
Tasks (.rake files) in this directory will be available as public tasks in the main
ManageIQ app. They can be executed in the plugin gem via the app: namespace

```shell
bin/rails app:<task>
```

Task private to the provider should go into lib/tasks/tasks_private.
Since these tasks are public, please namespace them, as in the following example:

```ruby
namespace "manageiq:providers:vmware" do
desc "Explaining what the task does"
task :your_task do
# Task goes here
end
end
```

Tasks places in the lib/tasks_private directory will be private to the plugin
and not available in the ManageIQ app.
5 changes: 2 additions & 3 deletions lib/tasks_private/spec.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace :spec do
end

desc "Run all specs"
RSpec::Core::RakeTask.new(:spec => ["app:test:initialize", "app:evm:compile_sti_loader", "app:test:providers_common"]) do |t|
spec_dir = File.expand_path("../../spec", __dir__)
EvmTestHelper.init_rspec_task(t, ['--require', File.join(spec_dir, 'spec_helper')])
RSpec::Core::RakeTask.new(:spec => ['app:test:spec_deps', 'app:test:providers_common']) do |t|
EvmTestHelper.init_rspec_task(t)
end
40 changes: 22 additions & 18 deletions manageiq-providers-vmware.gemspec
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
$:.push File.expand_path("../lib", __FILE__)
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'manageiq/providers/vmware/version'

require "manageiq/providers/vmware/version"
Gem::Specification.new do |spec|
spec.name = "manageiq-providers-vmware"
spec.version = ManageIQ::Providers::Vmware::VERSION
spec.authors = ["ManageIQ Authors"]

Gem::Specification.new do |s|
s.name = "manageiq-providers-vmware"
s.version = ManageIQ::Providers::Vmware::VERSION
s.authors = ["ManageIQ Developers"]
s.homepage = "https://github.com/ManageIQ/manageiq-providers-vmware"
s.summary = "Vmware Provider for ManageIQ"
s.description = "Vmware Provider for ManageIQ"
s.licenses = ["Apache-2.0"]
spec.summary = "ManageIQ plugin for the VMware provider."
spec.description = "ManageIQ plugin for the VMware provider."
spec.homepage = "https://github.com/ManageIQ/manageiq-providers-vmware"
spec.license = "Apache-2.0"

s.files = Dir["{app,config,lib}/**/*"]
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

s.add_dependency("fog-vcloud-director", ["~> 0.3.0"])
s.add_dependency "ffi-vix_disk_lib", "~>1.1"
s.add_dependency "rbvmomi", "~>3.0"
s.add_dependency "vmware_web_service", "~>2.0"
s.add_dependency "vsphere-automation-sdk", "~>0.4.7"
spec.add_dependency "fog-vcloud-director", "~> 0.3.0"
spec.add_dependency "ffi-vix_disk_lib", "~>1.1"
spec.add_dependency "rbvmomi", "~>3.0"
spec.add_dependency "vmware_web_service", "~>2.0"
spec.add_dependency "vsphere-automation-sdk", "~>0.4.7"

s.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
s.add_development_dependency "simplecov"
spec.add_development_dependency "simplecov"
end
8 changes: 5 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
SimpleCov.start
end

Dir[Rails.root.join("spec/shared/**/*.rb")].each { |f| require f }
Dir[File.join(__dir__, "support/**/*.rb")].each { |f| require f }

require "manageiq-providers-vmware"

VCR.configure do |config|
config.ignore_hosts 'codeclimate.com' if ENV['CI']
config.cassette_library_dir = File.join(ManageIQ::Providers::Vmware::Engine.root, 'spec/vcr_cassettes')
end

Dir[Rails.root.join("spec/shared/**/*.rb")].each { |f| require f }
Dir[ManageIQ::Providers::Vmware::Engine.root.join("spec/support/**/*.rb")].each { |f| require f }