diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000000..6bcce42f549 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/issue.md b/.github/ISSUE_TEMPLATE/issue.md new file mode 100644 index 00000000000..81b1400103d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue.md @@ -0,0 +1,36 @@ +--- +name: Issue +about: Create a new issue + +--- + + + +## Version of HACS + + + +## Describe the bug +A clear and concise description of what the bug is. + + +## Debug log + + + +```text + +Add your logs here. + +``` \ No newline at end of file diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 00000000000..6b75ccc1f6b --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,23 @@ +repository: + private: false + has_issues: true + has_projects: false + has_wiki: false + has_downloads: false + default_branch: master + allow_squash_merge: true + allow_merge_commit: false + allow_rebase_merge: false +labels: + - name: "Feature Request" + color: "fbca04" + - name: "Bug" + color: "b60205" + - name: "Wont Fix" + color: "ffffff" + - name: "Enhancement" + color: a2eeef + - name: "Documentation" + color: "008672" + - name: "Stale" + color: "930191" \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000000..eadefd3e17f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Joakim Sørensen @ludeeus + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/custom_components/hacs/__init__.py b/custom_components/hacs/__init__.py index eaa8efa700c..07754ce9d7e 100644 --- a/custom_components/hacs/__init__.py +++ b/custom_components/hacs/__init__.py @@ -2,16 +2,7 @@ Custom element manager for community created elements. For more details about this component, please refer to the documentation at -https://github.com/custom-components/hacs (eventually) - -For now: -in configuration.yaml: -hacs: - token: xxxxxxxxxxxxxxxxxx -------------------------------------- -The token is a GitHub Access token, you can create one here: -https://github.com/settings/tokens -You don't have to check any of the boxes. +https://custom-components.github.io/hacs/ """ import logging import os.path @@ -59,6 +50,9 @@ INTERVAL = timedelta(minutes=500) +# TODO: Requirements are not loaded from manifest, needs investigation. +REQUIREMENTS = ["PyGithub", "markdown"] + _LOGGER = logging.getLogger(__name__) CONFIG_SCHEMA = vol.Schema( @@ -144,6 +138,9 @@ async def startup_tasks(self): self.hass.data[DOMAIN_DATA]["repos"] = returndata["repos"] self.hass.data[DOMAIN_DATA]["hacs"] = returndata["hacs"] + # Make sure we have the correct version + self.hass.data[DOMAIN_DATA]["hacs"]["local"] = VERSION + # Reset restart_pending flag self.hass.data[DOMAIN_DATA]["hacs"]["restart_pending"] = False for element in self.hass.data[DOMAIN_DATA]["elements"]: diff --git a/custom_components/hacs/const.py b/custom_components/hacs/const.py index 2f3e8e0b6a5..aded3a2f560 100644 --- a/custom_components/hacs/const.py +++ b/custom_components/hacs/const.py @@ -1,5 +1,5 @@ """Constants for HACS""" -VERSION = None +VERSION = "0.1.0" NAME_LONG = "HACS (Home Assistant Community Store)" NAME_SHORT = "HACS" STORENAME = "hacs" diff --git a/custom_components/hacs/element.py b/custom_components/hacs/element.py index d08ccd8279c..1b1e738c002 100644 --- a/custom_components/hacs/element.py +++ b/custom_components/hacs/element.py @@ -15,8 +15,7 @@ def __init__(self, element_type, name): self.isinstalled = False self.installed_version = None self.avaiable_version = None - self.example_config = None - self.example_image = None + self.info = None self.manifest = None self.remote_dir_location = None self.authors = [] diff --git a/custom_components/hacs/frontend/elements/generate.py b/custom_components/hacs/frontend/elements/generate.py index 76ef54e3816..eb231709a06 100644 --- a/custom_components/hacs/frontend/elements/generate.py +++ b/custom_components/hacs/frontend/elements/generate.py @@ -48,6 +48,7 @@ async def avaiable_version(self):
Available version: {}
+ """.format( self.element.avaiable_version ) @@ -136,14 +137,12 @@ async def element_note(self): When installed, this will be located in '{config}/www/community/{element}', you still need to add it to your lovelace configuration ('ui-lovelace.yaml' or the raw UI config editor). - + When you add this to your configuration use this as the URL: - - '/community_plugin/{element}/{file_name}.js' - +url: /community_plugin/{element}/{file_name}.jsTo learn more about how to configure this, @@ -157,40 +156,35 @@ async def element_note(self): else: return "" - async def example_config(self): - """Generate example config.""" - _LOGGER.debug("Generating example config for %s", self.element.element_id) + async def info(self): + """Generate info.""" + import markdown - if self.element.example_config is None: - return "" + _LOGGER.debug("Generating info for %s", self.element.element_id) - return """ - -
- Example configuration: -
-- - """.format( - self.element.example_config - ) - - async def example_image(self): - """Generate example image.""" - _LOGGER.debug("Generating example image for %s", self.element.element_id) - - if self.element.example_image is None: + if self.element.info is None: return "" - return """ - -" + ) + markdown_render = markdown_render.replace( + "- - """.format( - self.element.example_image + markdown_render = markdown.markdown( + self.element.info, + extensions=["markdown.extensions.tables", "markdown.extensions.codehilite"], ) + markdown_render = markdown_render.replace("
", "
", "" + ) + markdown_render = markdown_render.replace("").replace( + "
", "
", "" + ) + markdown_render = markdown_render.replace("").replace( + "
", "
", "" + ) + markdown_render = markdown_render.replace("").replace( + "
", "
", "").replace( + "