-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #376 from JrGoodle/plugins
Add example plugin
- Loading branch information
Showing
20 changed files
with
293 additions
and
91 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Representation of clowder.yaml defaults | ||
.. codeauthor:: Joe Decapo <joe@polka.cat> | ||
""" | ||
|
||
|
||
class Defaults(object): | ||
"""clowder.yaml Defaults model class | ||
:ivar str ref: Default ref | ||
:ivar str remote: Default remote name | ||
:ivar str source: Default source name | ||
:ivar str protocol: Default git protocol | ||
:ivar int depth: Default depth | ||
:ivar bool recursive: Default recursive value | ||
:ivar str timestamp_author: Default timestamp author | ||
""" | ||
|
||
def __init__(self, defaults): | ||
"""Defaults __init__ | ||
:param dict defaults: Parsed YAML python object for defaults | ||
""" | ||
|
||
self.ref = defaults["ref"] | ||
self.protocol = defaults["protocol"] | ||
self.remote = defaults["remote"] | ||
self.source = defaults["source"] | ||
self.depth = defaults.get("depth", 0) | ||
self.recursive = defaults.get("recursive", False) | ||
self.timestamp_author = defaults.get("timestamp_author", None) | ||
|
||
def get_yaml(self): | ||
"""Return python object representation for saving yaml | ||
:return: YAML python object | ||
:rtype: dict | ||
""" | ||
|
||
defaults = {'ref': self.ref, | ||
'recursive': self.recursive, | ||
'remote': self.remote, | ||
'source': self.source, | ||
'depth': self.depth, | ||
'protocol': self.protocol} | ||
|
||
if self.timestamp_author: | ||
defaults['timestamp_author'] = self.timestamp_author | ||
|
||
return defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.