Skip to content

Commit

Permalink
Plugin Generator Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryguy committed Sep 10, 2020
1 parent 4f0222b commit 78b0b8d
Show file tree
Hide file tree
Showing 23 changed files with 169 additions and 198 deletions.
57 changes: 26 additions & 31 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
---
exclude_paths:
- ".git/"
- "**.xml"
- "**.yaml"
- "**.yml"
- spec/
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/
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
/coverage/
/doc/
/pkg/
/spec/manageiq
/spec/reports/
/tmp/

.rubocop-*
/bundler.d/*
!/bundler.d/.keep
/config/settings.local.yml
/config/settings/*.local.yml
/config/environments/*.local.yml
/spec/manageiq
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--require manageiq/spec/spec_helper
--require spec_helper
--color
--order random
--exclude-pattern "spec/manageiq/**/*_spec.rb"
2 changes: 2 additions & 0 deletions .rspec_ci
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
--require manageiq/spec/spec_helper
--require spec_helper
--color
--order random
--profile 25
--exclude-pattern "spec/manageiq/**/*_spec.rb"
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
16 changes: 2 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
---
dist: xenial
language: ruby
cache: bundler
rvm:
- 2.5.7
- 2.6.5
sudo: false
cache: bundler
addons:
postgresql: '10'
bundler_args: "--no-deployment"
before_script: bundle exec rake spec:setup
install: bin/setup
after_script: bundle exec codeclimate-test-reporter
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/46abb9c5f1f009b6a699
on_success: change
on_failure: always
on_start: never
after_script: bin/ci/after_script
1 change: 1 addition & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
ignore: |
/vendor/**
/spec/manageiq/**

extends: relaxed

Expand Down
19 changes: 9 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
source 'https://rubygems.org'

# Declare your gem's dependencies in manageiq-content.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

# Load Gemfile with dependencies from manageiq
manageiq_gemfile = File.expand_path("spec/manageiq/Gemfile", __dir__)
if File.exist?(manageiq_gemfile)
eval_gemfile(manageiq_gemfile)
else
puts "ERROR: The ManageIQ application must be present in spec/manageiq."
puts " Clone it from GitHub or symlink it from local source."
exit 1
end
eval_gemfile(File.expand_path("spec/manageiq/Gemfile", __dir__))
43 changes: 18 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
# ManageIQ Content
# ManageIQ::Content

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

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

Default ManageIQ content.
Content plugin for ManageIQ.

## Notes on content

At present, this repo contains only the ManageIQ automate domain. In the future,
more content will be extracted from the ManageIQ/manageiq repo such as dialogs,
reports, and policies.

## Contributing
## Development

First, you will need to set up your repo for development.
See the section on plugins in the [ManageIQ Developer Setup](http://manageiq.org/docs/guides/developer_setup/plugins)

1. Clone the repo.
2. Set up the ManageIQ application in the spec/manageiq directory. This can be
done in one of two ways.
- Run `bin/setup`. This command will do a shallow clone of ManageIQ into spec/manageiq,
and also prepare any files for setup.
- Create a symlink from spec/manageiq to a local source checkout of ManageIQ.
This is especially useful if you will be modifying ManageIQ itself at the
same time.
3. `bundle`
4. `bundle exec rake spec:setup`
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.

Now you are ready to begin development. You can run the specs with
`bundle exec rake`.
## License

Please be sure to add specs for any new automate methods you create, and follow
the [ManageIQ development guidelines](https://github.com/ManageIQ/guides/blob/master/coding_style_and_standards.md).
Thanks for your contribution!
The gem is available as open source under the terms of the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).

## License
## Contributing

The gem is available as open source under the terms of the [Apache License 2.0](LICENSE.txt).
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
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
4 changes: 2 additions & 2 deletions bin/update
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ require 'pathname'
gem_root = Pathname.new(__dir__).join("..")

if gem_root.join("spec/manageiq").symlink?
puts "== SKIPPING update of spec/manageiq because its symlinked =="
puts "== SKIPPING update of spec/manageiq because it is symlinked =="
else
puts "== Updating manageiq sample app =="
system("git pull", :chdir => gem_root.join("spec/manageiq"))
end

require gem_root.join("spec/manageiq/lib/manageiq/environment").to_s
ManageIQ::Environment.manageiq_plugin_update
ManageIQ::Environment.manageiq_plugin_update(gem_root)
Empty file added bundler.d/.keep
Empty file.
Empty file added config/settings.yml
Empty file.
4 changes: 2 additions & 2 deletions lib/manageiq/content/engine.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require 'rails/engine'

module ManageIQ
module Content
class Engine < ::Rails::Engine
isolate_namespace ManageIQ::Content

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

def self.vmdb_plugin?
true
end
Expand Down
20 changes: 20 additions & 0 deletions lib/tasks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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>
```

Since these tasks are public, please namespace them, as in the following example:

```ruby
namespace "manageiq:content" 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.
11 changes: 5 additions & 6 deletions lib/tasks_private/spec.rake
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
namespace :spec do
desc "Setup environment for specs"
task :setup => ["app:test:initialize", "app:test:verify_no_db_access_loading_rails_environment", "app:test:setup_db"]
desc "Setup environment specs"
task :setup => ["app:test:vmdb:setup"]
end

RSpec::Core::RakeTask.new(:spec => ["app:test:initialize", "app:evm:compile_sti_loader"]) do |t|
spec_dir = File.expand_path("../../spec", __dir__)
EvmTestHelper.init_rspec_task(t, ['--require', File.join(spec_dir, 'spec_helper')])
t.pattern = FileList[spec_dir + '/**/*_spec.rb'].exclude(spec_dir + '/manageiq/**/*_spec.rb')
desc "Run all specs"
RSpec::Core::RakeTask.new(:spec => 'app:test:spec_deps') do |t|
EvmTestHelper.init_rspec_task(t)
end
Empty file added locale/.keep
Empty file.
34 changes: 18 additions & 16 deletions manageiq-content.gemspec
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
$:.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/content/version'

# Maintain your gem's version:
require "manageiq/content/version"
Gem::Specification.new do |spec|
spec.name = "manageiq-content"
spec.version = ManageIQ::Content::VERSION
spec.authors = ["ManageIQ Authors"]

# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "manageiq-content"
s.version = ManageIQ::Content::VERSION
s.authors = ["ManageIQ Developers"]
s.homepage = "https://github.com/ManageIQ/manageiq-content"
s.summary = "Default ManageIQ content"
s.description = "Default ManageIQ content"
s.licenses = ["Apache-2.0"]
spec.summary = "Content plugin for ManageIQ."
spec.description = "Content plugin for ManageIQ."
spec.homepage = "https://github.com/ManageIQ/manageiq-content"
spec.license = "Apache-2.0"

s.files = Dir["{content,lib}/**/*", "LICENSE.txt", "Rakefile", "README.md"]
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_runtime_dependency "savon", "~>2.11.1" # Because users expect it to be there for custom code
spec.add_runtime_dependency "savon", "~>2.11.1" # Because users expect it to be there for custom code

s.add_development_dependency "codeclimate-test-reporter"
s.add_development_dependency "simplecov"
spec.add_development_dependency "simplecov"
end
Loading

0 comments on commit 78b0b8d

Please sign in to comment.