freckles-installed

Example:

# Install 'freckles' for current user.
- freckles-installed

Description

Internally, this uses the 'freck' bash script hosted on 'https://freckles.sh' to install frecklets.

Variables

Name Type Default Description

init

boolean False

Whether to run a dummy freckles job (to initialize dependencies).

update

boolean False

Whether to update 'freckles' if it is already installed.

user

string --

The user to install 'freckles' for.

version

string stable

Which version of 'freckles' to install.

Examples

Example 1

Install 'freckles' for current user.

Code
- freckles-installed

Example 2

Install the development version of 'freckles' for the current user, and run it once with a dummy job to pre-seed dependencies.

Code
- freckles-installed:
    version: dev
    init: true

Example 3

Install 'freckles' for user 'admin'. Create user if it doesn't exist, and overwrite the freckles binary if already present.

Code
- freckles-installed:
    update: true
    user: admin

Code

doc:
  short_help: Install 'freckles'.
  help: |
    Internally, this uses the 'freck' bash script hosted on 'https://freckles.sh' to install frecklets.
  examples:
  - title: Install 'freckles' for current user.
    vars: {}
  - title: Install the development version of 'freckles' for the current user, and
      run it once with a dummy job to pre-seed dependencies.
    vars:
      version: dev
      init: true
  - title: Install 'freckles' for user 'admin'. Create user if it doesn't exist, and
      overwrite the freckles binary if already present.
    vars:
      update: true
      user: admin

args:
  version:
    doc:
      short_help: Which version of 'freckles' to install.
    type: string
    required: false
    allowed:
    - stable
    - dev
    default: stable
  update:
    doc:
      short_help: Whether to update 'freckles' if it is already installed.
    type: boolean
    required: false
    default: false
    cli:
      param_decls:
      - --update
      - -u
  init:
    doc:
      short_help: Whether to run a dummy freckles job (to initialize dependencies).
    type: boolean
    required: false
    default: false
    cli:
      param_decls:
      - --init
      - -i
  user:
    doc:
      short_help: The user to install 'freckles' for.
    type: string
    required: false

frecklets:
- user-exists:
    frecklet::skip: '{{:: user | true_if_empty ::}}'
    name: '{{:: user ::}}'
- curl-installed
- execute-shell:
    command: 'curl https://freckles.sh | UPDATE={%:: if update ::%}true{%:: else ::%}false{%::
      endif ::%} VERSION={{:: version ::}} bash'
    become_user: '{{:: user ::}}'
- execute-shell:
    frecklet::skip: '{{:: init | true_if_empty ::}}'
    command: $HOME/.local/share/freckles/bin/frecklecute debug-var ansible_env
    become_user: '{{:: user ::}}'
frecklecute freckles-installed --help

Usage: frecklecute freckles-installed [OPTIONS]

  Internally, this uses the 'freck' bash script hosted on
  'https://freckles.sh' to install frecklets.

Options:
  -i, --init         Whether to run a dummy freckles job (to initialize
                     dependencies).
  -u, --update       Whether to update 'freckles' if it is already installed.
  --user USER        The user to install 'freckles' for.
  --version VERSION  Which version of 'freckles' to install.
  --help             Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.freckles_installed.FrecklesInstalled
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class FrecklesInstalled(AutoPycklet):
    """Internally, this uses the 'freck' bash script hosted on 'https://freckles.sh' to install frecklets.

       Args:
         init: Whether to run a dummy freckles job (to initialize dependencies).
         update: Whether to update 'freckles' if it is already installed.
         user: The user to install 'freckles' for.
         version: Which version of 'freckles' to install.

    """

    FRECKLET_ID = "freckles-installed"

    init: bool = None
    update: bool = None
    user: str = None
    version: str = None


    def __post_init__(self):
        super(FrecklesInstalled, self).__init__(var_names=["init", "update", "user", "version"])


frecklet_class = FrecklesInstalled
# -*- coding: utf-8 -*-


#
# module path: pycklets.freckles_installed.FrecklesInstalled
#


from pyckles import AutoPycklet

class FrecklesInstalled(AutoPycklet):
    """Internally, this uses the 'freck' bash script hosted on 'https://freckles.sh' to install frecklets.

       Args:
         init: Whether to run a dummy freckles job (to initialize dependencies).
         update: Whether to update 'freckles' if it is already installed.
         user: The user to install 'freckles' for.
         version: Which version of 'freckles' to install.

    """

    FRECKLET_ID = "freckles-installed"

    def __init__(self, init=None, update=None, user=None, version="stable"):

        super(FrecklesInstalled, self).__init__(var_names=["init", "update", "user", "version"])
        self._init = init
        self._update = update
        self._user = user
        self._version = version

    @property
    def init(self):
        return self._init

    @init.setter
    def init(self, init):
        self._init = init

    @property
    def update(self):
        return self._update

    @update.setter
    def update(self, update):
        self._update = update

    @property
    def user(self):
        return self._user

    @user.setter
    def user(self, user):
        self._user = user

    @property
    def version(self):
        return self._version

    @version.setter
    def version(self, version):
        self._version = version



frecklet_class = FrecklesInstalled