Download the PHP package etsy/try-lib without Composer

On this page you can find all versions of the php package etsy/try-lib. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package try-lib

TryLib Build Status

"try" your changes on your CI server before committing them to the repository!

TryLib is a simple PHP library that helps you generate a diff of your working copy and send it to Jenkins to run the test suite(s) on the latest code patched with your changes. You can read more about try on Etsy technical blog Code As Craft.

TryLib currently supports Freestyle projects, when your test suite consist of a single Jenkins job and MasterProject projects, when your test suite consist of multiple Jenkins jobs.

Example usage:

try --help output

$ try -h
usage: try [options...] [subjob] [subjob] ...

    -h, --help            Show help
    -n, --diff-only       Create diff, but do not send to Hudson
    -v, --verbose         Verbose (show shell commands as they're run)
    -p, --patch ...       Path to patch file to use instead of generating a diff
    -U, --lines-of-context ...  Generate a diff with n lines of context (like git-diff's -U option)
    -s, --staged          Use staged changes only to generate the diff
    -w, --safelist ...    Generate the patch for only the safelisted files
    -b, --branch ...      Remote branch to diff and try against [main]

    -c, --show-results    Show final try job results
    -P, --show-progress   Print subtasks progressively as they complete
    --extra-param ...     Extra parameters to send to jenkins - format key=value
    -C, --callback ...    Callback string to execute at the end of the try run.

Use ${status} and ${url} as placeholders for the try build status and url
Example: --callback 'echo "**Try status : [${status}](${url})**"'

    --jenkinsjob ...      Master Job Name in Jenkins  [try]
    --jenkinsjobprefix ...  Subjobs prefix              [try]
    --jenkinsserver ...   URL to the jenkins server   [localhost:8080]
    --wcpath ...          Working Copy Path           [.]

Run try on FreeStyle project and show the results in the console.

$ try --show-results
Started try-unit-tests #25
Completed try-unit-tests #25 : SUCCESS

Run the unit-tests and integration-tests only (MasterProject setup) and show the sub-jobs status as they complete

$ try --show-progress
Executing DEFAULT sub-jobs: try-functional-tests try-integration-tests try-unit-tests
......... try ( pending )
......... try ( pending )
......... try ( http://etsyny-l523.local:8080/job/try/13/console )

                  try-unit-tests SUCCESS
            try-functional-tests SUCCESS
           try-integration-tests SUCCESS

Try Status : SUCCESS (http://etsyny-l523.local:8080/job/try/13)

Run try and post the results to a github issue

try --callback "curl -s --user <login>:<password> --request POST --data '{\"body\":\"Try status : [${status}](${url})\"}'" https://github.com/api/v3/repos/etsy/try/issues/1/comments"

Run try with custom parameters defined in your jenkins job

try --extra-param foo=bar --extra-param baz=boo

Try script configuration

Feel free to re-use the boiler plate code in try and update the parameters to fit your environment. Depending on your setup (FreeStyle project or master-project), you may have to comment/uncomment some sections of the code - look for [Jenkins MasterProject only] in the comments.

# URL to your jenkins server (without http)
$jenkins_server = 'localhost:8080';

# Path to the jenkins cli.jar - download it from http://your.jenkins.instance/cli
$jenkins_cli_jar = '/usr/bin/jenkins-cli.jar';

# Jenkins job name
$default_jenkins_job = 'try';

# Working copy path (path to your local git repository)
$repo_path = '.';

Important : the try script generates the patch.diff file at the root of the working copy - add it to your .gitignore to avoid any conflicts in applying the patch.

Jenkins configuration

FreeStyle project

MasterProject

The master-project plugin provides a new project type where you can select a list of sub-projects which should be executed in one logical master project.

In order to run try on a master project, each sub-projects must be pre-fixed by the master project name. An example of setup would be:

try : master-project
    try-unit-tests : sub-project to run the unit tests
    try-integration-tests : sub-project to run the integrations tests
    try-functional-tests : sub-project to run the functional tests

If your subjobs are not prefixed with your master-job name, set the $jenkinsjobprefix accordingly, either in the the try script or via command line

$default_jenkins_job_prefix = 'foo';

./try --jenkinsjobprefix foo

More info can be found in the divide and concur Code As Craft blog entry.

Setting up the master-project in Jenkins

Working with branches (Git)

Try will work with your branches! The below scenarios are supported:

Working with pre-checks

Prior to generate the diff, you can configure try to run a list of pre-checks.

$pre_checks = array(
    new TryLib\Precheck\ScriptRunner('/path/to/some/script'),
    new TryLib\Precheck\GitCopyBehind(array('main')),
    new TryLib\Precheck\GitCopyAge(48, 96, $remote_branch)
    new TryLib\Precheck\GitReportUntracked(),
);

$repo_manager->runPrechecks($pre_checks);

Some pre-checks will just emit a warning, some can block the try execution.

Running the tests

You can run the unit test suite with:

phpunit

All versions of try-lib with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package etsy/try-lib contains the following files

Loading the files please wait ....