Skip to content
This repository was archived by the owner on Jul 1, 2021. It is now read-only.
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Gemfile.lock
/vendor/bundle/
/vmodl/
*.gem
.idea
272 changes: 272 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
AllCops:
UseCache: true
DisabledByDefault: false
Exclude:
- 'exe/*'

################## STYLE #################################

Style/NumericPredicate:
Enabled: false

Style/TernaryParentheses:
Enabled: false

Naming/AccessorMethodName:
Description: Check the naming of accessor methods for get_/set_.
Enabled: false

Layout/ArrayAlignment:
Description: >-
Align the elements of an array literal if they span more than
one line.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays'
Enabled: false

Layout/HashAlignment:
Description: >-
Align the elements of a hash literal if they span more than
one line.
Enabled: false

Layout/ParameterAlignment:
Description: >-
Align the parameters of a method call if they span more
than one line.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
Enabled: false

Style/CaseEquality:
Description: 'Avoid explicit use of the case equality operator(===).'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
Enabled: false

Style/Documentation:
Description: 'Document classes and non-namespace modules.'
Enabled: false

Layout/EmptyLines:
Description: "Don't use several empty lines in a row."
Enabled: false

Layout/ExtraSpacing:
Description: 'Do not use unnecessary spacing.'
Enabled: false

Naming/MethodName:
Enabled: false

Naming/VariableName:
Enabled: false

Naming/BlockParameterName:
Enabled: false

Style/MultilineTernaryOperator:
Description: >-
Avoid multi-line ?: (the ternary operator);
use if/unless instead.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary'
Enabled: false

Style/SingleLineBlockParams:
Description: 'Enforces the names of some block params.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
Enabled: false

Style/StringLiterals:
EnforcedStyle: double_quotes

Layout/EmptyLineAfterMagicComment:
Enabled: false

Style/PercentLiteralDelimiters:
PreferredDelimiters:
'default': '()'
'%i': '()'
'%w': '()'

Naming/MemoizedInstanceVariableName:
Enabled: false

Style/InverseMethods:
Enabled: false

Layout/MultilineMethodCallIndentation:
Enabled: false

Naming/MethodParameterName:
Enabled: false

Style/FormatStringToken:
Enabled: false

Style/SymbolArray:
Enabled: false

Style/FormatString:
Enabled: false

Style/DateTime:
Enabled: false

Style/AccessModifierDeclarations:
Enabled: false

Style/ExpandPathArguments:
Enabled: false

Naming/PredicateName:
Enabled: true

Style/MixinUsage:
Enabled: true
Exclude:
- 'bin/*'

Style/MultilineBlockChain:
Enabled: false

Style/MissingRespondToMissing:
Enabled: false

Style/ExponentialNotation:
Enabled: true

Style/HashEachMethods:
Enabled: true

Style/HashTransformKeys:
Enabled: true

Style/HashTransformValues:
Enabled: true

Style/IfUnlessModifier:
Enabled: true

Style/GuardClause:
Enabled: false

Style/SafeNavigation:
Enabled: false

Style/GlobalVars:
Enabled: false

Style/IfInsideElse:
Enabled: false

Style/MultipleComparison:
Enabled: false

################## METRICS #################################

Metrics/AbcSize:
Enabled: false

Metrics/BlockNesting:
Enabled: true
Max: 4

Metrics/ClassLength:
Enabled: false

Metrics/ModuleLength:
Enabled: true
Max: 150

Metrics/BlockLength:
Enabled: false

Metrics/ParameterLists:
Enabled: false

Metrics/MethodLength:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

################## LAYOUT #################################

Layout/LineLength:
Enabled: false

Layout/SpaceAroundMethodCallOperator:
Enabled: true

################## LINT #################################

Lint/AmbiguousBlockAssociation:
Enabled: false

Lint/Void:
Description: 'Possible use of operator/literal/variable in void context.'
Enabled: true

Lint/SendWithMixinArgument:
Enabled: true

Lint/Debugger:
Enabled: true

Lint/RaiseException:
Enabled: true

Lint/StructNewOverride:
Enabled: true

Lint/ShadowingOuterLocalVariable:
Enabled: false

Lint/LiteralAsCondition:
Enabled: false

Lint/UriEscapeUnescape:
Enabled: false

Lint/RescueException:
Enabled: false

Lint/DuplicateMethods:
Enabled: false

Lint/Void:
Enabled: false

Lint/UselessAssignment:
Enabled: false

Lint/AssignmentInCondition:
Enabled: false

Lint/NestedMethodDefinition:
Enabled: false

Naming/HeredocDelimiterNaming:
Enabled: false

Lint/NonLocalExitFromIterator:
Enabled: false

Naming/VariableNumber:
Enabled: false

Naming/FileName:
Enabled: false

Naming/BinaryOperatorParameterName:
Enabled: false

Security/Open:
Enabled: false

Security/MarshalLoad:
Enabled: false

Security/JSONLoad:
Enabled: false
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true
# Copyright (c) 2016-2017 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT

source 'https://rubygems.org'
source "https://rubygems.org"

gemspec
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ A simple example of turning on a VM:
require 'rbvmomi'

vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
dc = vim.serviceInstance.find_datacenter('my_datacenter') || fail('datacenter not found')
dc = vim.service_instance.find_datacenter('my_datacenter') || fail('datacenter not found')
vm = dc.find_vm('my_vm') || fail('VM not found')
vm.PowerOnVM_Task.wait_for_completion
```
Expand All @@ -40,7 +40,7 @@ to users of the Java SDK:
require 'rbvmomi'

vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
root_folder = vim.serviceInstance.content.rootFolder
root_folder = vim.service_instance.content.rootFolder
dc = root_folder.childEntity.grep(RbVmomi::VIM::Datacenter).find { |x| x.name == 'mydatacenter' } || fail('datacenter not found')
vm = dc.vmFolder.childEntity.grep(RbVmomi::VIM::VirtualMachine).find { |x| x.name == 'my_vm' } || fail('VM not found')
task = vm.PowerOnVM_Task
Expand Down
11 changes: 6 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# frozen_string_literal: true
# Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT

require 'bundler/gem_tasks'
require 'rake/testtask'
require 'yard'
require "bundler/gem_tasks"
require "rake/testtask"
require "yard"

task(:default => :test)
task(default: :test)

Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/test_*.rb']
t.test_files = FileList["test/test_*.rb"]
t.verbose = true
t.warning = true
end
Expand Down
7 changes: 4 additions & 3 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'rbvmomi'
require "bundler/setup"
require "rbvmomi"

require 'pry'
require "pry"
Pry.start
Loading