tomkyle/tuplo

Configurabe upload script for use with CLI and/or Typora

1.0.9 2023-06-12 06:19 UTC

README

License: MIT Tests passing

tuplo is a CLI upload tool. It can be configured with YAML files. Currently, these upload methods are supported:

  • FTP
  • SFTP with username/password
  • SFTP with SSH key

Installation

Using Composer

Install tuplo as global command:

$ composer global require tomkyle/tuplo

Do not forget to make sure Composer’s global commands are available in $PATH:

# Unix, Linux, et al.
export PATH="/home/username/.config/composer/vendor/bin:${PATH}"
# MacOS
export PATH="/Users/you/.composer/vendor/bin:${PATH}"

Linux, Unix et.al.

Grab repo content and install dependencies. You may want to symlink it in your ~/bin directory:

$ git clone git@github.com:tomkyle/tuplo.git
$ cd tuplo

# Symlink if needed
$ ln -s "${PWD}/bin/tuplo" ~/bin/tuplo

MacOS

To be done, I'm working on it.

Configuration

Upload configurations can be stored in a .tuplo.yaml file, either in $HOME directory or in current work directory; with the latter preceding the first. See tuplo.dist.yaml for examples – here an example for a plain old FTP upload. In this example, “typora” is the name of a single upload configuration, it is used as CLI parameter.

typora:
	description : Just a plain FTP example
    method      : ftp
    downloadUrl : "https://test.com/typora"
    host        : 'ftp.test.com'
    port        : 21
    ssl         : false
    root        : 'path/to/typora'
    username    : 'ftp-username'
    password    : 'ftp-password'

Usage

According to the above configuration sample, CLI usage goes like this.

$ tuplo typora <file> [file] ...

Development and testing

This repo contains custom Git hooks to automate composer installs after composer.lock has changed after git pull. Read more here.

Bugs and issues

Any hints are welcome and appreciated! Open a ticket on GitHub’s issue tracker.

Unit tests

Default configuration is phpunit.xml.dist. If you like, create a custom phpunit.xml to apply your own settings. Also visit phpunit.readthedocs.io · Packagist

$ composer phpunit
# ... or
$ vendor/bin/phpunit

PhpStan

Default configuration is phpstan.neon.dist. If you like, create a custom phpstan.neon to apply your own settings. Also visit phpstan.org · GitHub · Packagist

$ composer phpstan
# ... which includes
$ vendor/bin/phpstan analyse

PhpCS

Default configuration is .php-cs-fixer.dist.php. If you like, create a custom .php-cs-fixer.php to apply your own settings. Also visit cs.symfony.com · GitHub · Packagist

$ composer phpcs
# ... which aliases
$ vendor/bin/php-cs-fixer fix --verbose --diff --dry-run

Apply all CS fixes:

$ composer phpcs:apply
# ... which aliases 
$ vendor/bin/php-cs-fixer fix --verbose --diff