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

Rename CDN::AWS to AWS::CDN #467

Merged
merged 3 commits into from
Sep 18, 2018
Merged

Rename CDN::AWS to AWS::CDN #467

merged 3 commits into from
Sep 18, 2018

Conversation

jaredbeck
Copy link
Contributor

Fixes fog-core deprecation warning

[fog][DEPRECATION] Unable to load Fog::AWS::CDN
[fog][DEPRECATION] The format Fog::CDN::AWS is deprecated

Part of #466

Fixes fog-core deprecation warning

```
[fog][DEPRECATION] Unable to load Fog::AWS::CDN
[fog][DEPRECATION] The format Fog::CDN::AWS is deprecated
```

Part of fog#466
@plribeiro3000
Copy link
Member

👍 from me.

Need someone active on this repo to look and merge tho

@jaredbeck
Copy link
Contributor Author

How should I run tests locally? I couldn't find any docs on it. So, I just pushed and hoped for CI to pass.

@jaredbeck
Copy link
Contributor Author

Also,

Add a new class that just aliases (and will raise the warning if anybody includes directly).

I don't know how to do a warning. ActiveSupport has deprecate_constant but I assumed you don't want that dependency.

@plribeiro3000
Copy link
Member

I believe you can just overwrite the constructor raising a deprecation notice and call super in the next line.

@jaredbeck
Copy link
Contributor Author

I believe you can just overwrite the constructor raising a deprecation notice and call super in the next line.

Sorry, I don't understand. Which constructor?

Also, the assignment ..

# fog/aws/cdn.rb
Fog::CDN::AWS = Fog::AWS::CDN

.. is "by reference", so overwriting a method would affect both constants, wouldn't it?

@plribeiro3000
Copy link
Member

Yeap, the construction you made is not gonna work.

You will have to open the class and inherit manually then overwrite the method initialize.

If you take a look at the Fog::Service module you will see it has a new method being defined here

Sou you can open the class and define it like:

class Fog::CDN::AWS < Fog::AWS::CDN
  def self.new(config = {})
    Fog::Logger.deprecation 'Your message here'
    super(config)
  end
end

@jaredbeck
Copy link
Contributor Author

You will have to open the class and inherit manually then overwrite the method initialize.

Done. Thanks.

@geemus
Copy link
Member

geemus commented Sep 7, 2018

Looks good to me, @plribeiro3000 does that match with what you were asking?

@geemus geemus merged commit d447be8 into fog:master Sep 18, 2018
@jaredbeck jaredbeck deleted the fix_cdn_dpr_warn branch September 19, 2018 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants