Drop Ruby 1.8 support and clean up#66
Conversation
| storage_repository_class.require_before_save.must_equal([ :name, :type ]) | ||
| end | ||
| end No newline at end of file | ||
|
|
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| :type => :type, | ||
| :uuid => :uuid, | ||
| :virtual_allocation => :virtual_allocation, | ||
| :pbds => :PBDs, |
| :tags => :tags, | ||
| :type => :type, | ||
| :uuid => :uuid, | ||
| :virtual_allocation => :virtual_allocation, |
There was a problem hiding this comment.
Use the new Ruby 1.9 hash syntax.
Line is too long. [89/80]
| :sm_config => :sm_config, | ||
| :tags => :tags, | ||
| :type => :type, | ||
| :uuid => :uuid, |
| :shared => :shared, | ||
| :sm_config => :sm_config, | ||
| :tags => :tags, | ||
| :type => :type, |
| :description => :description, | ||
| :introduced_by => :introduced_by, | ||
| :local_cache_enabled => :local_cache_enabled, | ||
| :name => :name, |
| :current_operations => :current_operations, | ||
| :description => :description, | ||
| :introduced_by => :introduced_by, | ||
| :local_cache_enabled => :local_cache_enabled, |
There was a problem hiding this comment.
Use the new Ruby 1.9 hash syntax.
Line is too long. [91/80]
| :content_type => :content_type, | ||
| :current_operations => :current_operations, | ||
| :description => :description, | ||
| :introduced_by => :introduced_by, |
| :blobs => :blobs, | ||
| :content_type => :content_type, | ||
| :current_operations => :current_operations, | ||
| :description => :description, |
| :allowed_operations => :allowed_operations, | ||
| :blobs => :blobs, | ||
| :content_type => :content_type, | ||
| :current_operations => :current_operations, |
There was a problem hiding this comment.
Use the new Ruby 1.9 hash syntax.
Line is too long. [89/80]
| storage_repository_class.require_before_save.must_equal([ :name, :type ]) | ||
| end | ||
| end No newline at end of file | ||
|
|
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| :type => :type, | ||
| :uuid => :uuid, | ||
| :virtual_allocation => :virtual_allocation, | ||
| :pbds => :PBDs, |
| :tags => :tags, | ||
| :type => :type, | ||
| :uuid => :uuid, | ||
| :virtual_allocation => :virtual_allocation, |
There was a problem hiding this comment.
Use the new Ruby 1.9 hash syntax.
Line is too long. [89/80]
| :sm_config => :sm_config, | ||
| :tags => :tags, | ||
| :type => :type, | ||
| :uuid => :uuid, |
| :shared => :shared, | ||
| :sm_config => :sm_config, | ||
| :tags => :tags, | ||
| :type => :type, |
| :description => :description, | ||
| :introduced_by => :introduced_by, | ||
| :local_cache_enabled => :local_cache_enabled, | ||
| :name => :name, |
| :current_operations => :current_operations, | ||
| :description => :description, | ||
| :introduced_by => :introduced_by, | ||
| :local_cache_enabled => :local_cache_enabled, |
There was a problem hiding this comment.
Use the new Ruby 1.9 hash syntax.
Line is too long. [91/80]
| :content_type => :content_type, | ||
| :current_operations => :current_operations, | ||
| :description => :description, | ||
| :introduced_by => :introduced_by, |
| :blobs => :blobs, | ||
| :content_type => :content_type, | ||
| :current_operations => :current_operations, | ||
| :description => :description, |
| :allowed_operations => :allowed_operations, | ||
| :blobs => :blobs, | ||
| :content_type => :content_type, | ||
| :current_operations => :current_operations, |
There was a problem hiding this comment.
Use the new Ruby 1.9 hash syntax.
Line is too long. [89/80]
|
|
||
| private | ||
|
|
||
| def load_data(keep_type = nil, delete_templates = false) |
There was a problem hiding this comment.
Since this method is for servers collection only maybe you want to rename it to load_servers?
There was a problem hiding this comment.
Fair call; I'll trust you.
To be really honest, I only have a simple understanding of what this whole gem does — saw some warnings and thought I could apply some standard code practices 😆
I'll do a little more (hopefully over the next day) and will review this again.
| @collection_name = collection_name | ||
| end | ||
|
|
||
| def define_methods(methods) |
| end | ||
|
|
||
| super | ||
| end |
| HOST_METHODS = [ | ||
| :emergency_ha_disable, :list_methods, :local_management_reconfigure, | ||
| :management_disable, :management_reconfigure, :shutdown_agent | ||
| ].freeze |
| raise RequestFailed.new( | ||
| %(#{method}: #{response["ErrorDescription"]}) | ||
| ) | ||
| end |
There was a problem hiding this comment.
Great Great Great Great Great Great Great Great refactoring. =)
| pif_class::PIF_METHODS.each do |method| | ||
| methods.include?(method).must_equal(true) | ||
| end | ||
| end |
There was a problem hiding this comment.
You know when the code is good when the test can be as simple as that. Great refactoring including tests. =)
|
@HashNotAdam Thats a great PR. I'm really excited to merge it in. Could you just fix @houndci-bot comments and the one i made regarding the name of the method before i push this forward please? |
|
In reviewing your comments, I've found a bug in |
|
@plribeiro3000, when attempting to add a test for the above-mentioned bug, I encountered a few issues. Firstly, The second issue is related to the first in that I found there is a huge amount of duplication in this class, however, given the lack of tests, I can't safely refactor. As an example, the method I created from existing code ( If you can provide assistance regarding how I could get a suitable test environment or equivalent, I'd be happy to continue refactoring. If not, I'll just clean up what I've already submitted and leave it there. |
|
@HashNotAdam Sadly there isn't a documentation regarding testing because even the tests were never finished. Those Feel free to let this change off for now so we can merge what you already have and later (another PR) we can tackle this. What do you think? |
|
Thanks @plribeiro3000, that sounds good; I'm far too nervous about playing with code I have no way of testing. |
|
@HashNotAdam Can you confirm nothing broke with those changes? |
|
@plribeiro3000 no, as mentioned above, I know of at least one bug so I need to do a clean up and then I'll let you know when I believe it is good. TBH, even then, if there are no tests, there is no way to be 100% certain. |
|
@HashNotAdam Thats ok to not work. hehehhe Let me know when we can move forward with this. |
TODO
Fog::Compute::XenServer::Models::ClassMethods.define_methodshas a note about how it could be better designed if not for Ruby 1.8.7 but I couldn't see a test that could explain the use case. Hopefully someone else can help with this.