Sushi

See https://github.com/mlhartme/sushi.

License

License

Categories

Categories

Net
GroupId

GroupId

net.oneandone
ArtifactId

ArtifactId

sushi
Last Version

Last Version

3.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

Sushi
See https://github.com/mlhartme/sushi.
Project URL

Project URL

https://github.com/mlhartme/sushi
Project Organization

Project Organization

1&1
Source Code Management

Source Code Management

https://github.com/mlhartme/sushi

Download sushi

How to add to project

<!-- https://jarcasting.com/artifacts/net.oneandone/sushi/ -->
<dependency>
    <groupId>net.oneandone</groupId>
    <artifactId>sushi</artifactId>
    <version>3.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.oneandone/sushi/
implementation 'net.oneandone:sushi:3.3.0'
// https://jarcasting.com/artifacts/net.oneandone/sushi/
implementation ("net.oneandone:sushi:3.3.0")
'net.oneandone:sushi:jar:3.3.0'
<dependency org="net.oneandone" name="sushi" rev="3.3.0">
  <artifact name="sushi" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.oneandone', module='sushi', version='3.3.0')
)
libraryDependencies += "net.oneandone" % "sushi" % "3.3.0"
[net.oneandone/sushi "3.3.0"]

Dependencies

compile (6)

Group / Artifact Type Version
com.jcraft : jsch Optional jar 0.1.54
com.jcraft : jsch.agentproxy.core Optional jar 0.0.9
com.jcraft : jsch.agentproxy.jsch Optional jar 0.0.9
com.jcraft : jsch.agentproxy.sshagent Optional jar 0.0.9
com.jcraft : jsch.agentproxy.usocket-jna Optional jar 0.0.9
org.tmatesoft.svnkit : svnkit Optional jar 1.9.3

test (2)

Group / Artifact Type Version
junit : junit jar 4.13.1
commons-codec : commons-codec jar 1.4

Project Modules

There are no modules declared in this project.

Build Status Current Release

Sushi

Sushi is a scripting library for Java. It provides a simple API for

  • file system operations
  • ssh-, http (incl webdav), and svn filesystems
  • process launching
  • Diff
  • ... x Rationale: I prefer to do my scripting stuff in Java, not with a scripting languages and not with a special-purpose-language like Ant. Sushi enables me to do so: it provides similar functionality like Ant or Apache Commons - but packaged in an API that makes my "scripts" almost as readable and concise as other approaches.

Note that Sushi releases are not necessarily backward compatible. In particular, if i find a better - but incompatible - api for a given task, I'll change the api. I can't keep old apis just for compatibility (not enough time) and I don't want to have multiple alternative api's if I have a clear preference. But I'll mark incompatible changes by bumping the minor or major version number. (Version number format is major.minor.micro)

Prerequisites

  • Linux or Mac OS (Windows might do, but it's untested)
  • Java 8
  • if you want to build Sushi: Maven 3

Usage

Sushi is available from Maven Central. To use it in a Maven project, add this dependency:

<dependency>
  <groupId>net.oneandone</groupId>
  <artifactId>sushi</artifactId>
  <version>3.0.0</version>
</dependency>

Optional Dependencies

Sushi itself has several transitive dependencies that are marked optional because not everybody needs them. You have to add them to your project if you want to use the respective sushi feature:

For SshNodes (e.g. world.node("ssh//user@host/my/path")):

  <dependency>
    <groupId>com.jcraft</groupId>
    <artifactId>jsch</artifactId>
    <version>0.1.53</version>
  </dependency>

Additionally, you can add

<dependency>
  <groupId>com.jcraft</groupId>
  <artifactId>jsch.agentproxy.core</artifactId>
  <version>0.0.7</version>
</dependency>
<dependency>
  <groupId>com.jcraft</groupId>
  <artifactId>jsch.agentproxy.jsch</artifactId>
  <version>0.0.7</version>
</dependency>
<dependency>
  <groupId>com.jcraft</groupId>
  <artifactId>jsch.agentproxy.sshagent</artifactId>
  <version>0.0.7</version>
</dependency>
<dependency>
  <groupId>com.jcraft</groupId>
  <artifactId>jsch.agentproxy.usocket-jna</artifactId>
  <version>0.0.7</version>
</dependency>

to make passphrases stored in ssh agent available to Sushi.

For SvnNodes (e.g. world.node("svn:https//host/my/path")):

<dependency>
  <groupId>org.tmatesoft.svnkit</groupId>
  <artifactId>svnkit</artifactId>
  <version>1.8.5</version>
</dependency>

Migrating from Sushi 2.8.x

  • Command line parsing has been moved into a separate project https://github.com/mlhartme/inline, see migration instructions there
  • replace Node.createReader/Writer with Node.newReader/Writer
  • replace new World() with World.create()

Tests

mvn clean testonly runs a subset of the available tests. Some of the test need special setup. To run them, adjust test.properties and run mvn test -Dfull

Ssh Setup

Make sure to can ssh to the host specified in test.properties, authenticating with your public key, not a password. If the key is protected with a passphrase, store this passphrase in ~/.ssh/passphrase to make if available to SshNodes.

Webdav Setup

Note: I used https://github.com/adamfisk/LittleProxy for proxy tests.

Ubuntu 10.10 or later

(see also: http://how-to.linuxcareer.com/webdav-server-setup-on-ubuntu-linux)

  • sudo apt-get install apache2
  • sudo a2enmod dav
  • sudo a2enmod dav_fs
  • sudo mkdir /var/www/webdav
  • sudo chown www-data:www-data /var/www/webdav
  • sudoedit /etc/apache2/mods-available/dav_fs.conf
DAVLockDB ${APACHE_LOCK_DIR}/DAVLock
<Directory "/var/www/webdav">
  Dav On
  Options +Indexes
</Directory>
Alias /webdav /var/www/webdav
  • ensure the lock file exists:
    • sudo touch /var/lock/apache2/DAVLock
    • sudo chown www-data:www-data /var/lock/apache2/DAVLock
  • sudo /etc/init.d/apache2 reload
  • point your browser to http://localhost/webdav to verify. You should get an empty directory listing

Mac OS

(tested with Mojave)

  • sudo apachectl start

  • /etc/apache2/httpd.conf: make sure the following lines are present

    • LoadModule dav_module
    • LoadModule dav_fs_module
    • LoadModule dav_lock_module
    • Include /private/etc/apache2/extra/httpd-dav.conf
  • In /private/etc/apache2/extra/httpd-dav.conf replace uploads config with

Alias /webdav "/Library/WebServer/WebDAV"
<Directory "/Library/WebServer/WebDAV">
   Dav On
   Options +Indexes
   Require all granted
</Directory>

and change the lock file to

DavLockDB "/var/webdav/DavLock"

  • sudo mkdir -p /var/webdav for lock file
  • sudo chown -R _www:_www /var/webdav
  • sudo mkdir -p /Library/WebServer/WebDAV for data
  • sudo chown -R _www:_www /Library/WebServer/WebDAV
  • sudo apachectl graceful
  • point your browser to http://localhost/webdav.
  • trouble shooting
    • try "apachectl -S" to check the apache config
    • open http://localhost:80 to check if apache starts
    • if you get 'permission denied', you forgot Options +Indexes

Versions

Version
3.3.0
3.2.2
3.2.1
3.2.0
3.1.7
3.1.6
3.1.5
3.1.4
3.1.3
3.1.2
3.1.1
3.1.0
3.0.2
3.0.1
3.0.0
2.8.19
2.8.18
2.8.17
2.8.16
2.8.15
2.8.14
2.8.13
2.8.12
2.8.11
2.8.10
2.8.9
2.8.8
2.8.7
2.8.6
2.8.5
2.8.4
2.8.3
2.8.2
2.8.1
2.8.0