From ecec12d4014e806b16fec123f21f4b23d90335da Mon Sep 17 00:00:00 2001 From: Marcel Hild Date: Fri, 6 Jan 2017 14:50:02 +0100 Subject: [PATCH 1/2] applying changes from provider generator * leverage ManageIQ::Environment for setup * dev dependencies in gemspec * rubocop definition from managiq/guides --- .codeclimate.yml | 6 +++--- .rubocop.yml | 2 +- .rubocop_cc.yml | 3 ++- .travis.yml | 3 +-- Gemfile | 5 ----- README.md | 5 +++-- bin/setup | 31 +++++++------------------------ bin/update | 14 ++++++++++++++ manageiq-providers-amazon.gemspec | 3 +++ 9 files changed, 34 insertions(+), 38 deletions(-) create mode 100644 bin/update diff --git a/.codeclimate.yml b/.codeclimate.yml index 14559aca1..0de35ec21 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -36,10 +36,10 @@ engines: config: '.rubocop_cc.yml' prepare: fetch: - - url: "https://raw.githubusercontent.com/ManageIQ/manageiq/master/.rubocop_base.yml" + - url: "https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_base.yml" path: ".rubocop_base.yml" - - url: "https://raw.githubusercontent.com/ManageIQ/manageiq/master/.rubocop_cc.yml" - path: ".rubocop_manageiq_cc.yml" + - url: "https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_cc_base.yml" + path: ".rubocop_cc_base.yml" ratings: paths: - Gemfile.lock diff --git a/.rubocop.yml b/.rubocop.yml index 5d8bf5240..4c9381b2e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,4 @@ inherit_from: -- https://raw.githubusercontent.com/ManageIQ/manageiq/master/.rubocop_base.yml +- 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 diff --git a/.rubocop_cc.yml b/.rubocop_cc.yml index 9020fc29b..ff96a0cba 100644 --- a/.rubocop_cc.yml +++ b/.rubocop_cc.yml @@ -1,4 +1,5 @@ inherit_from: # this is downloaded by .codeclimate.yml -- .rubocop_cc_mangeiq.yml +- .rubocop_base.yml +- .rubocop_cc_base.yml - .rubocop_local.yml diff --git a/.travis.yml b/.travis.yml index 72835585f..102e55a46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,7 @@ env: - RUBY_GC_HEAP_GROWTH_FACTOR=1.25 addons: postgresql: '9.4' -before_install: -- source ${TRAVIS_BUILD_DIR}/tools/ci/before_install.sh +before_install: bin/setup script: - bundle exec bin/rails app:test:providers:amazon:setup app:test:providers:amazon after_script: bundle exec codeclimate-test-reporter diff --git a/Gemfile b/Gemfile index cd9d4d4a6..259edabbe 100644 --- a/Gemfile +++ b/Gemfile @@ -3,11 +3,6 @@ # development dependencies will be added by default to the :development group. gemspec -group :test do - gem "simplecov", :require => false - gem "codeclimate-test-reporter", "~> 1.0.0", :require => false -end - # 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 diff --git a/README.md b/README.md index bdeb1aca6..d09d8d8a7 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ # manageiq-providers-amazon -[![Join the chat at https://gitter.im/ManageIQ/manageiq-providers-amazon](https://badges.gitter.im/ManageIQ/manageiq-providers-amazon.svg)](https://gitter.im/ManageIQ/manageiq-providers-amazon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - [![Gem Version](https://badge.fury.io/rb/manageiq-providers-amazon.svg)](http://badge.fury.io/rb/manageiq-providers-amazon) [![Build Status](https://travis-ci.org/ManageIQ/manageiq-providers-amazon.svg)](https://travis-ci.org/ManageIQ/manageiq-providers-amazon) [![Code Climate](https://codeclimate.com/github/ManageIQ/manageiq-providers-amazon.svg)](https://codeclimate.com/github/ManageIQ/manageiq-providers-amazon) [![Test Coverage](https://codeclimate.com/github/ManageIQ/manageiq-providers-amazon/badges/coverage.svg)](https://codeclimate.com/github/ManageIQ/manageiq-providers-amazon/coverage) [![Dependency Status](https://gemnasium.com/ManageIQ/manageiq-providers-amazon.svg)](https://gemnasium.com/ManageIQ/manageiq-providers-amazon) [![Security](https://hakiri.io/github/ManageIQ/manageiq-providers-amazon/master.svg)](https://hakiri.io/github/ManageIQ/manageiq-providers-amazon/master) + +[![Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ManageIQ/manageiq-providers-amazon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Translate](https://img.shields.io/badge/translate-zanata-blue.svg)](https://translate.zanata.org/zanata/project/view/manageiq-providers-amazon) +[![License](http://img.shields.io/badge/license-APACHE2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) ManageIQ plugin for the Amazon provider. diff --git a/bin/setup b/bin/setup index f608ab3f7..e01a8505c 100755 --- a/bin/setup +++ b/bin/setup @@ -1,29 +1,12 @@ #!/usr/bin/env ruby require 'pathname' -# path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +gem_root = Pathname.new(__dir__).join("..") -Dir.chdir APP_ROOT do - if File.exist?("spec/manageiq") - puts "== Updating manageiq sample app ==" - system "cd spec/manageiq && git pull" - else - puts "== Cloning manageiq sample app ==" - system "git clone git@github.com:ManageIQ/manageiq.git --depth 1 spec/manageiq" - end - - puts "== Installing dependencies ==" - system "gem install bundler --conservative" - system "bundle check || bundle install" - - unless File.exist?("spec/manageiq/config/database.yml") - puts "\n== Copying sample config/database.yml ==" - system "cp spec/manageiq/config/database.pg.yml spec/manageiq/config/database.yml" - end - - unless File.exist?("spec/manageiq/certs/v2_key") - puts "\n== Copying sample certs/v2_key ==" - system "cp spec/manageiq/certs/v2_key.dev spec/manageiq/certs/v2_key" - end +unless gem_root.join("spec/manageiq").exist? + puts "== Cloning manageiq sample app ==" + system "git clone https://github.com/ManageIQ/manageiq.git --branch master --depth 1 spec/manageiq" end + +require gem_root.join("spec/manageiq/lib/manageiq/environment").to_s +ManageIQ::Environment.manageiq_plugin_setup diff --git a/bin/update b/bin/update new file mode 100644 index 000000000..417a86127 --- /dev/null +++ b/bin/update @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +require 'pathname' + +gem_root = Pathname.new(__dir__).join("..") + +if gem_root.join("spec/manageiq").symlink? + puts "== SKIPPING update of spec/manageiq because its 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_setup diff --git a/manageiq-providers-amazon.gemspec b/manageiq-providers-amazon.gemspec index 97bb966ac..eb42e1186 100644 --- a/manageiq-providers-amazon.gemspec +++ b/manageiq-providers-amazon.gemspec @@ -13,5 +13,8 @@ Gem::Specification.new do |s| s.files = Dir["{app,config.lib}/**/*"] + s.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0" + s.add_development_dependency "simplecov" + s.add_dependency("aws-sdk", ["~>2.6.14"]) end From be4f55abdc337fb76ae9fb8451133c81d69d97b8 Mon Sep 17 00:00:00 2001 From: Marcel Hild Date: Fri, 6 Jan 2017 15:23:41 +0100 Subject: [PATCH 2/2] removed controller specs - they'll move to manageiq-ui-classic --- spec/controllers/cloud_network_controller_spec.rb | 5 ----- spec/controllers/cloud_subnet_controller_spec.rb | 5 ----- spec/controllers/ems_network_controller_spec.rb | 5 ----- spec/controllers/floating_ip_controller_spec.rb | 5 ----- spec/controllers/load_balancer_controller_spec.rb | 5 ----- spec/controllers/network_port_controller_spec.rb | 5 ----- spec/controllers/network_router_controller_spec.rb | 5 ----- spec/controllers/security_group_controller_spec.rb | 5 ----- 8 files changed, 40 deletions(-) delete mode 100644 spec/controllers/cloud_network_controller_spec.rb delete mode 100644 spec/controllers/cloud_subnet_controller_spec.rb delete mode 100644 spec/controllers/ems_network_controller_spec.rb delete mode 100644 spec/controllers/floating_ip_controller_spec.rb delete mode 100644 spec/controllers/load_balancer_controller_spec.rb delete mode 100644 spec/controllers/network_port_controller_spec.rb delete mode 100644 spec/controllers/network_router_controller_spec.rb delete mode 100644 spec/controllers/security_group_controller_spec.rb diff --git a/spec/controllers/cloud_network_controller_spec.rb b/spec/controllers/cloud_network_controller_spec.rb deleted file mode 100644 index 1dcfc3d6a..000000000 --- a/spec/controllers/cloud_network_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require Rails.root.join('spec/shared/controllers/shared_examples_for_cloud_network_controller') - -describe CloudNetworkController do - include_examples :shared_examples_for_cloud_network_controller, %w(amazon) -end diff --git a/spec/controllers/cloud_subnet_controller_spec.rb b/spec/controllers/cloud_subnet_controller_spec.rb deleted file mode 100644 index 746bc0951..000000000 --- a/spec/controllers/cloud_subnet_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require Rails.root.join('spec/shared/controllers/shared_examples_for_cloud_subnet_controller') - -describe CloudSubnetController do - include_examples :shared_examples_for_cloud_subnet_controller, %w(amazon) -end diff --git a/spec/controllers/ems_network_controller_spec.rb b/spec/controllers/ems_network_controller_spec.rb deleted file mode 100644 index 55468db10..000000000 --- a/spec/controllers/ems_network_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require Rails.root.join('spec/shared/controllers/shared_examples_for_ems_network_controller') - -describe EmsNetworkController do - include_examples :shared_examples_for_ems_network_controller, %w(amazon) -end diff --git a/spec/controllers/floating_ip_controller_spec.rb b/spec/controllers/floating_ip_controller_spec.rb deleted file mode 100644 index 4f65a3abb..000000000 --- a/spec/controllers/floating_ip_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require Rails.root.join('spec/shared/controllers/shared_examples_for_floating_ip_controller') - -describe FloatingIpController do - include_examples :shared_examples_for_floating_ip_controller, %w(amazon) -end diff --git a/spec/controllers/load_balancer_controller_spec.rb b/spec/controllers/load_balancer_controller_spec.rb deleted file mode 100644 index 9bb4f4b9f..000000000 --- a/spec/controllers/load_balancer_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require Rails.root.join('spec/shared/controllers/shared_examples_for_load_balancer_controller') - -describe LoadBalancerController do - include_examples :shared_examples_for_load_balancer_controller, %w(amazon) -end diff --git a/spec/controllers/network_port_controller_spec.rb b/spec/controllers/network_port_controller_spec.rb deleted file mode 100644 index af92746b4..000000000 --- a/spec/controllers/network_port_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require Rails.root.join('spec/shared/controllers/shared_examples_for_network_port_controller') - -describe NetworkPortController do - include_examples :shared_examples_for_network_port_controller, %w(amazon) -end diff --git a/spec/controllers/network_router_controller_spec.rb b/spec/controllers/network_router_controller_spec.rb deleted file mode 100644 index f5728f0fe..000000000 --- a/spec/controllers/network_router_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require Rails.root.join('spec/shared/controllers/shared_examples_for_network_router_controller') - -describe NetworkRouterController do - include_examples :shared_examples_for_network_router_controller, %w(amazon) -end diff --git a/spec/controllers/security_group_controller_spec.rb b/spec/controllers/security_group_controller_spec.rb deleted file mode 100644 index 58d9b8304..000000000 --- a/spec/controllers/security_group_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require Rails.root.join('spec/shared/controllers/shared_examples_for_security_group_controller') - -describe SecurityGroupController do - include_examples :shared_examples_for_security_group_controller, %w(amazon) -end