GithubHelp home page GithubHelp logo

atomist-attic / rug-rugs Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 457 KB

Atomist Rugs for Rug projects

License: Apache License 2.0

Shell 5.37% TypeScript 69.11% Gherkin 25.53%
atomist typescript rug

rug-rugs's Introduction

Atomist 'rug-rugs'

Build Status

This Rug project contains generators for creating a Rug archive project, editors to create a Rug archive project from an existing project, editors to add Rugs to Rug projects, and various Rug handlers. Most meta.

Rugs

Rugs are typically run using the Atomist Bot in Slack. To run Rugs locally, you must first install the following tools:

Once those tools are installed, you can clone this repository and install its dependencies with the following command.

$ ( cd .atomist && npm install )

AddLicense

The AddLicense editor adds a LICENSE file to a project and license header comments to TypeScript files in a project.

Prerequisites

A source code project.

Parameters

This Rug takes following parameters.

Name Required Default Description
include No "" Comma-separated list of paths under which to search for files, search under all paths if empty
license No "aslv2" License to add, currently only "aslv2" is supported

Running

Run this Rug as follows:

$ cd project/directory
$ rug edit atomist:rug-rugs:AddLicense \
    include=src,test \
    license=aslv2

This will add the ASLv2 license as LICENSE to the file and add a license header comment to all TypeScript files under the src and test directories in the project.

AddLocalEditor

The AddLocalEditor editor adds an editor for modifying the local project, initiating a Rug archive if needed.

Prerequisites

A source code project.

Parameters

This Rug takes following parameters.

Name Required Default Description
editorName Yes Name of the editor to add, it should start with a capital letter and contain only alphanumeric characters
description No "an editor for modifying this project" A short description of what the editor will do

Running

Run this Rug as follows:

$ cd project/directory
$ rug edit atomist:rug-rugs:AddLocalEditor \
    editorName=MyLocalEditor \
    description='does something useful'

This will add a Rug editor as .atomist/editors/MyLocalEditor.ts. If the project is currently set up for Atomist, it will also create the .atomist directory with appropriate initial contents like the manifest.yml and package.json files.

AddTypeScriptEditor

The AddTypeScriptEditor editor adds a sample TypeScript editor and corresponding test to your Rug project.

Prerequisites

Before running this editor, you must have the following prerequisites satisfied.

  • A Rug archive source code repository set up for TypeScript

Parameters

To run this editor, you must supply the following parameters.

Name Required Default Description
editorName Yes A valid Rug editor name between 1-100 characters, starting with a capital letter, and containing only alphanumeric characters
description Yes A description of the generator being added

Running

Run it as follows:

$ cd rug/project/directory
$ rug edit atomist:rug-rugs:AddTypeScriptEditor \
    editorName=MyNewEditor \
    description="This is my newest editor... in TypeScript!"

This will add the files .atomist/editors/MyNewEditor.ts and .atomist/tests/MyNewEditor.rt to the project.

AddTypeScriptGenerator

The AddTypeScriptGenerator editor adds a sample TypeScript generator and corresponding test to your Rug project.

Prerequisites

Before running this editor, you must have the following prerequisites satisfied.

  • A Rug archive source code repository set up for TypeScript

Parameters

To run this editor, you must supply the following parameters.

Name Required Default Description
generatorName Yes A valid Rug generator name between 1-100 characters, starting with a capital letter, and containing only alphanumeric characters
description Yes A description of the generator being added

Running

Run it as follows:

$ cd rug/project/directory
$ rug edit atomist:rug-rugs:AddTypeScriptGenerator \
    generatorName=MyNewGenerator \
    description="This is my newest generator."

This will add the files .atomist/editors/MyNewGenerator.ts and .atomist/tests/MyNewGenerator.rt to the project.

AddTypeScriptCommandHandler

The AddTypeScriptCommandHandler editor adds a simple TypeScript command handler and test to your Rug project.

Prerequisites

Before running this editor, you must have the following prerequisites satisfied.

  • A Rug archive source code repository set up for TypeScript

Parameters

To run this editor, you must supply the following parameters.

Name Required Default Description
handlerName Yes A valid Rug handler name between 1-100 characters, starting with a capital letter, and containing only alphanumeric characters
description Yes A description of the handler being added
intent Yes Message the bot will associate with this command

Running

Run it as follows:

$ cd rug/project/directory
$ rug edit atomist:rug-rugs:AddTypeScriptCommandHandler \
    handlerName=MyNewCommandHandler \
    description="new command handler" \
    intent="run this"

This will add a sample command handler at .atomist/handlers/command/MyNewCommandHandler.ts and corresponding tests to the project.

AddTypeScriptEventHandler

The AddTypeScriptEventHandler editor adds a simple TypeScript event handler and test to your Rug project.

Prerequisites

Before running this editor, you must have the following prerequisites satisfied.

  • A Rug archive source code repository set up for TypeScript

Parameters

To run this editor, you must supply the following parameters.

Name Required Default Description
handlerName Yes A valid Rug handler name between 1-100 characters, starting with a capital letter, and containing only alphanumeric characters
description Yes A description of the handler being added
pathExpression No /Tag() Path expression to the event in Atomist that will trigger this handler

Running

Run it as follows:

$ cd rug/project/directory
$ rug edit atomist:rug-rugs:AddTypeScriptEventHandler \
    handlerName=MyNewEventHandler \
    description="new event handler" \
    pathExpression="/Issue()"

This will add the an event handler at .atomist/handlers/event/MyNewEventHandler.ts and corresponding tests to the project.

BumpVersion

The BumpVersion editor increments one of the elements of the semantic version your Rug project, setting all trailing elements to zero.

Prerequisites

Before running this editor, you must have the following prerequisites satisfied.

  • A Rug project with a .atomist/manifest.yml file having a version

Parameters

To run this editor, you must supply the following parameters.

Name Required Default Description
component No minor Element of the semantic version of the project to increment.

Running

Run it as follows:

$ cd project/directory
$ rug edit atomist:rug-rugs:BumpVersion component=patch

This will increment the last element of the version in .atomist/manifest.yml.

ConvertExistingProjectToGenerator

The ConvertExistingProjectToGenerator editor creates a valid Rug generator from the current project. It does not make sense to run this more than once on a project.

Prerequisites

Before running this editor, you must have the following prerequisites satisfied.

  • A source code repository for a "model" project that does not have a .atomist/manifest.yml

Parameters

To run this editor, you must supply the following parameters.

Name Required Default Description
archiveName Yes Name of the new Rug archive, typically the same as the repo name
groupId Yes Maven group ID, e.g., "company-rugs", typically the GitHub owner of the repo
version No 0.1.0 Semantic version of the project.
generatorName Yes A valid Rug generator name between 1-100 characters, starting with a capital letter, and containing only alphanumeric characters
description Yes A description of the generator being added

Running

Run it as follows:

$ cd project/directory
$ rug edit atomist:rug-rugs:ConvertExistingProjectToGenerator \
    archiveName=my-new-archive \
    groupId=my-rugs \
    version=2.71.828 \
    generatorName=MyNewGenerator \
    description="This is my newest generator."

This will create a .atomist directory to the root of the project. The .atomist directory will have valid manifest.yml and TypeScript files, the generator script in editors/MyNewGenerator.ts, and its test in tests/MyNewGenerator.rt. You will need to install the node dependencies using NPM.

$ ( cd .atomist && npm install )

ConvertExistingProjectToRugArchive

The ConvertExistingProjectToRugArchive editor creates a valid Rug archive in the current project. It does not make sense to run this more than once on a project.

Prerequisites

Before running this editor, you must have the following prerequisites satisfied.

  • A source code repository that does not have a .atomist/manifest.yml

Parameters

To run this editor, you must supply the following parameters.

Name Required Default Description
archiveName Yes Name of the new Rug archive, typically the same as the repo name
groupId Yes Maven group ID, e.g., "company-rugs", typically the GitHub owner of the repo
version No 0.1.0 Semantic version of the project.

Running

Run it as follows:

$ cd project/directory
$ rug edit atomist:rug-rugs:ConvertExistingProjectToRugArchive \
    archiveName=my-new-archive \
    groupId=my-rugs \
    version=2.71.828

This will add the file .atomist/manifest.yml to the project.

ConvertManifestToPackageJson

The ConvertManifestToPackageJson editor converts a maniest.yml into a package.json. After conversation the manifest.yml file will get deleted.

Prerequisites

Before running this editor, you must have the following prerequisites satisfied.

  • A source code repository that does not have a .atomist/manifest.yml

Parameters

This editor does not need any parameters.

Running

Run it as follows:

$ cd project/directory
$ rug edit atomist:rug-rugs:ConvertManifestToPackageJson \

This will convert the .atomist/manifest.yml to .atomist/package.yml.

NewRugProject

The NewRugProject generator creates a new empty Rug archive project. The generated project will have a .atomist directory and an appropriate .atomist/manifest.yml and TypeScript files, but no Rugs. If you want a simple way to create a more complete Rug project with a sample Rugs and tests, see NewStarterRugProject.

Prerequisites

There are no prerequisites to running this generator.

Parameters

To run this generator, you must supply the following parameters.

Name Required Default Description
Project Name Yes A valid GitHub repository name, which contains alphanumeric, _, and - characters
groupId Yes Maven group ID, e.g., "company-rugs", typically the GitHub owner of the repo being created is used
description Yes A brief description of the project
version No 0.1.0 Semantic version of the project

Running

Run it as follows:

$ cd parent/directory
$ rug generate atomist:rug-rugs:NewRugProject \
    ruggery \
    groupId=persian-rugs \
    description="Rug archive to hold my Rugs" \
    version=0.1.0

Note the first parameter, the projectName, is different in that you do not need to supply the name of the parameter, just the value. This is because the projectName parameter is required for all generators. This will create a directory named ruggery and populate it with a working Rug archive project. You can use the other editors in this project to add Rugs to the generated project.

NewStarterRugProject

The NewStarterRugProject generator creates a new Rug archive project using a standard layout and sensible defaults and adds the TypeScript dependencies, a simple TypeScript editor, a simple TypeScript command handler, a simple TypeScriptEventHandler, and tests. It is a great way to get started writing Rugs!

Prerequisites

There are no prerequisites to running this generator.

Parameters

To run this generator, you must supply the following parameters.

Name Required Default Description
Project Name Yes A valid GitHub repository name, which contains alphanumeric, _, and - characters

Running

Run it as follows:

$ cd parent/directory
$ rug generate atomist:rug-rugs:NewStarterRugProject ruggery

Note the project name parameter is different in that you do not need to supply the name of the parameter, just the value. This is because the project name parameter is required for all generators. This will create a directory named ruggery and populate it with a working Rug archive project with a standard layout, TypeScript dependencies, a few Rugs, and tests. It will also contain supporting files, e.g., a license and code of conduct. You can use the editors in this project to add more Rugs to the generated project. Before you start editing Rugs, you should install the NPM dependencies with the following command:

$ ( cd .atomist && npm install )

ShowLatestVersions

The ShowLatestVerrsions command handler displays the latest versions of com.atomist:rug and @atomist/rugs in Slack.

Parameters

This command handler has no parameters.

Running

Run it as follows:

@atomist show latest versions

This will print the following output:

Lastest version of com.atomist:rug is 1.0.0-m.2 and @atomist/rugs is 1.0.0-m.3.
In .atomist/manifest.yml use:

requires: "[1.0.0-m.2,2.0.0)"

and in .atomist/package.json use:

{
    "dependencies": {
        "@atomist/rugs": "^1.0.0-m.3"
   }
}

Latest Rug CLI version is 1.0.0-m.1.

UpdateRug

The UpdateRug editor updates the Rug dependencies and support files of a Rug project to the values in this Rug archive project.

Prerequisites

Before running this editor, you must have the following prerequisites satisfied.

  • A Rug project with a .atomist/manifest.yml file

Parameters

This editor has no parameters.

Running

Run it as follows:

$ cd project/directory
$ rug edit atomist:rug-rugs:UpdateRug

This will update the required version in the .atomist/manifest.yml file and the @atomist/rugs dependency in the .atomist/package.json file. It will also update all the Rug support files, see UpdateSupportFiles.

UpdateSupportFiles

The UpdateSupportFiles editor updates the TypeScript support and build files to the latest versions.

Prerequisites

Before running this editor, you must have the following prerequisites satisfied.

  • A Rug archive source code repository

Parameters

This editor has no parameters.

Running

Run it as follows:

$ cd rug/project/directory
$ rug edit atomist:rug-rugs:UpdateSupportFiles

This will update package.json, tsconfig.json, tslint.json, and .gitignore files to the .atomist directory in the project. It will also update the Travis CI build files under .atomist/build. It will modify the .travis.yml to make sure [Node.js][] is installed. You should update your Node.js dependencies after running this.

$ ( cd .atomist && npm install )

Support

General support questions should be discussed in the #support channel on our community Slack team at atomist-community.slack.com.

If you find a problem, please create an issue.

Contributing

If you are interested in contributing to the Atomist open source projects, please see our contributing guidelines and our code of conduct.

Development

You can build, test, and install the project locally with the Rug CLI.

$ ( cd .atomist && npm test )
$ rug install

To clean up cached files run:

$ ( cd .atomist && npm run clean )

To return this project to its distributed state run:

$ ( cd .atomist && npm run distclean )

You will need to install its dependencies again after this:

$ ( cd .atomist && npm install )

To create a new release of the project, simply push a tag of the form M.N.P where M, N, and P are integers that form the next appropriate semantic version for release. For example:

$ git tag -a 1.2.3

The Travis CI build (see badge at the top of this page) will automatically create a GitHub release using the tag name for the release and the comment provided on the annotated tag as the contents of the release notes. It will also automatically upload the needed artifacts.


Created by Atomist. Need Help? Join our Slack team.

rug-rugs's People

Contributors

atomist-bot avatar cdupuis avatar ddgenome avatar jessitron avatar kipz avatar lawouach avatar russmiles avatar whostolebenfrog avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

justinedelson

rug-rugs's Issues

Migrate tests to Gherkin

With the release of rug 0.13.0, all the tests need to be migrated to the TypeScript testing framework since the Rug DSL BDD testing is gone.

Consider creating a "CopyExistingRugEditorEditor"

It might be useful to have an editor that takes an existing editor and copies all it's artifacts over into a new editor, replacing the original editors references etc.

This has become a common case when working with ever-expanding archives of editors.

When working with a growing collection of editors I've found I typically don't wish to start from a default/empty Rug editor but in fact take one of the editors I've been working on and copy that over instead as the baseline for the next editor I am going to write.

Doc issues - Wrong parameters are present on the README.md

In the README.md file, the recommended command to run the "ConvertExistingProjectToRugArchiveWithGenerator" editor is:

 rug edit atomist-rugs:rug-editors:ConvertExistingProjectToRugArchiveWithGenerator \
    generator_name=MyNewGenerator \
    rug_archive_name=my-new-generator \
    group_id=my-rugs \
    version=3.1.4 \
    description="This is going to create something great."

The CLI complains, as it is expecting rug_archive_group_id.

The describe shows the output as:

ConvertExistingProjectToRugArchiveWithGenerator
atomist-rugs:rug-editors:0.3.0
adds default Rug Archive starter files and directories for a Rug Generator to an existing project

> Tags
  rug (rug)
  atomist (atomist)
> Parameters (required)
  rug_archive_name (Rug Archive Name)
    name of your new Rug Archive, typically the same as the repo name
      pattern: ^[-\w.]+$, min length: 1, max length: 21
  rug_archive_group_id (Group ID)
    Maven group identifier, often used to provide a namespace for your rugs, e.g., company-rugs,
    typically the GitHub owner
      pattern: ^(?:[A-Za-z_][\w]*\.)*[-A-Za-z_][-\w]*$, min length: not defined, max length: not defined
  generator_name (Generator Name)
    name of the generator to be added to the project
      pattern: ^[A-Z][A-Za-z0-9]*$, min length: 1, max length: 100
> Parameters (optional)
  version (Version)
    initial version of the project, e.g., 1.2.3
      pattern: ^v?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:[1-9]\d*|[-A-Za-z\d]*[-A-Za-z][-A-Za-z\d]*)(?:\.(?:[1-9]\d*|[-A-Za-z\d]*[-A-Za-z][-A-Za-z\d]*))*)?(?:\+[-A-Za-z\d]+(?:\.[-A-Za-z\d]+)*)?$, min length: not defined, max length: not defined, default: 0.1.0
  description (Project Description)
    short descriptive text describing the new project
      pattern: ^[\s\S]*$, min length: 1, max length: not defined, default: My new project


To invoke the ConvertExistingProjectToRugArchiveWithGenerator editor, run:
  rug edit "atomist-rugs:rug-editors:ConvertExistingProjectToRugArchiveWithGenerator" -a 0.3.0 rug_archive_name=VALUE rug_archive_group_id=VALUE version=VALUE description=VALUE generator_name=VALUE

`

Hide the handler

We are currently between the rug 0.12.0 and 0.13.0 releases in a sense. The latest CLI only supports 0.13.0 but the bot/runner only supports 0.12.0. We cannot update the handler in this repo until the bot/runner gets updated, but that handler will not compile using the latest CLI. We need to hide the sample handler in this repo so it does not get picked up by the CLI when it is compiling things.

Fail when prerequisites not met

As @kipz pointed out, when you run an editor whose prerequisites are not met, a console.log is output, but this is lost in the bot. We think the editor should fail in this case. Current thinking is that the best way to fail in this case is to throw an exception.

Support private repository builds on Travis CI

Currently the Travis CI build script assumes public repositories that provide a GitHub personal access token with repo scope as the value of the GITHUB_TOKEN environment variable. When private repositories are built on Travis CI, you can just push to origin, since the build already has repo access. Support this in the build script.

Description for AddTypeScript is wrong

The description is currently "adds a new Rug Generator to an existing Rug Archive project" which was copied from another editor.

We should probably also add a "typescript" tag.

AddTypeScript should not include node_modules

We've changed our mind here and, by default we do not want the AddTypeScript editor to add the node_modules directory.

We will only include it in the NewStarterRugProject generator.

Exception with latest rug snapshot

Parameter include default value () is not valid: Parameter{name='include', description='if provided, editor will only add license headers to *.ts files under specified paths, e.g., "typescript/src,typescript/test"', defaultValue='', defaultRef='null', pattern='^[\s\S]*$', validInputDescription='a comma separated list of paths to search', required=false, displayable=true, tags=ListBuffer(), maxLength=100, minLength=1, displayName='Search Path', allowedValues=ListBuffer()}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.