This Rug archive has an example editors
that showcase some of the features of Rug. Take a look inside the
.atomist
folder.
The AddApacheSoftwareLicense20 Editor adds the Apache Software License Version 2.0 to a project.
Before running this Editor, you must have the following prerequisites satisfied.
- A git repository
This Editor has no parameters.
Run it as follows:
$ cd to/your/repo
$ rug edit atomist-rugs:common-editors:AddApacheSoftwareLicense20
This will add a file named LICENSE
to the top-level directory of the
project. If you are happy with the change, commit the changes made by
the Editor and push the commit to GitHub.
The AddChangeLog Editor adds a change log file named
CHANGELOG.md
to the top-level directory in a project.
Before running this Editor, you must have the following prerequisites satisfied.
- A GitHub repository
To run this editor, you must supply the following parameters.
repo_slug
: The GitHub repository "slug" of the form "repo-owner/repo-name" of the repository to which you are adding the change log.
Run it as follows:
$ cd to/your/repo
$ rug edit atomist-rugs:travis-editors:AddChangeLog \
repo_slug=myorg/myrepo
This will add the CHANGELOG.md
to the top-level directory of the
project. The change log will have initial formatting from which you
can begin to keep a log of important changes to your code. If you are
happy with the change, commit the changes made by the Editor and push
the commit to GitHub.
The AddReadme Editor adds a GitHub-like README.md
file to the
top-level directory in a project.
Before running this Editor, you must have the following prerequisites satisfied.
- A git repository
To run this editor, you must supply the following parameters.
project_name
: The name of the project, typically the repository name.description
: A one-sentence description of the project.
Run it as follows:
$ cd to/your/repo
$ rug edit atomist-rugs:travis-editors:AddReadme \
project_name=my-project \
description="Better put this description in quotes."
This will add the README.md
to the top-level directory of the
project. The README.md
will have the project name as a "h1" header
and the description as regular text beneath it. If you are happy with
the change, commit the changes made by the Editor and push the commit
to GitHub.
The AddScalaMavenGitIgnore Editor adds a .gitignore
file suitable for Scala projects built with Maven in
the top-level directory of the project.
Before running this Editor, you must have the following prerequisites satisfied.
- A git repository for a Scala project built with Maven
This Editor has no parameters.
Run it as follows:
$ cd to/your/repo
$ rug edit atomist-rugs:common-editors:AddScalaMavenGitIgnore
This will add a file named .gitignore
to the top-level directory of
the project. If you are happy with the change, commit the changes
made by the Editor and push the commit to GitHub.
The ClassRenamer Editor renames a Java class throughout an entire project. Currently this Editor is a bit brute force and replaces every occurrence of the current name with the new name.
Before running this Editor, you must have the following prerequisites satisfied.
- A git repository for a Java project
To run this editor, you must supply the following parameters.
old_class
: The name of the Java class to be renamed.new_class
: The new name for the Java class.
Run it as follows:
$ cd to/your/repo
$ rug edit atomist-rugs:travis-editors:ClassRenamer \
old_class=FooBar \
new_class=MoreDescriptiveName
This will change all occurrences of "FooBar" with "MoreDescriptiveName" throughout the code base. If you are happy with the change, commit the changes made by the Editor and push the commit to GitHub.
The PackageMove Editor renames a Java package throughout an entire project, relocating files as appropriate.
Before running this Editor, you must have the following prerequisites satisfied.
- A git repository for a Java project
To run this editor, you must supply the following parameters.
old_package
: The name of the Java package to be renamed.new_package
: The new name for the Java package.
Run it as follows:
$ cd to/your/repo
$ rug edit atomist-rugs:travis-editors:PackageMove \
old_package=com.pany.FooBar \
new_package=com.pany.MoreDescriptiveName
This will change all occurrences of "com.pany.FooBar" package with "com.pany.MoreDescriptiveName" throughout the code base, moving files as appropriate. If you are happy with the change, commit the changes made by the Editor and push the commit to GitHub.
The PomParameterizer Editor updates various project elements in the Maven Project Object Model (POM) file.
Before running this Editor, you must have the following prerequisites satisfied.
- A git repository for a project built with Maven
To run this editor, you must supply the following parameters.
artifact_id
: Optional Maven artifact ID, e.g., "fiddle-riddle". If a value is not provided, the value of theproject_name
parameter is used.group_id
: Maven group ID, e.g., "com.pany.project".name
: A valid GitHub repository name. It must be 21 characters or less to avoid truncating name when the its Slack channel is created.version
: Semantic version of the project. Default value is "0.1.0".description
: description.
Run it as follows:
$ cd to/your/repo
$ rug edit atomist-rugs:travis-editors:PomParameterizer \
artifact_id=hooray \
group_id=com.pany \
description="Hooray for company" \
name=hooray
This will update all these things in the Pom.
The RemoveApacheSoftwareLicense20 Editor removes the file named
LICENSE
from the project if that file looks like
the Apache Software License Version 2.0.
Before running this Editor, you must have the following prerequisites satisfied.
- A git repository with the Apache Software License Version 2.0 in a
file named
LICENSE
at the top-level directory of the repository
This Editor has no parameters.
Run it as follows:
$ cd to/your/repo
$ rug edit atomist-rugs:common-editors:RemoveApacheSoftwareLicense20
This will remove a file named LICENSE
at the top-level directory of
the project if it appears to contain the Apache Software License
Version 2.0. If you are happy with the change, commit the changes
made by the Editor and push the commit to GitHub.
The RemoveChangeLog Editor removes the file named CHANGELOG.md
from
the project if it exists.
Before running this Editor, you must have the following prerequisites satisfied.
- A repository with a file named
CHANGELOG.md
at the top-level directory of the repository
This Editor has no parameters.
Run it as follows:
$ cd to/your/repo
$ rug edit atomist-rugs:common-editors:RemoveChangeLog
This will remove a file named CHANGELOG.md
at the top-level
directory of the project if it exists.
The RemoveCodeOfConduct Editor removes the file named
CODE_OF_CONDUCT.md
from the project if it exists.
Before running this Editor, you must have the following prerequisites satisfied.
- A repository with a file named
CODE_OF_CONDUCT.md
at the top-level directory of the repository
This Editor has no parameters.
Run it as follows:
$ cd to/your/repo
$ rug edit atomist-rugs:common-editors:RemoveCodeOfConduct
This will remove a file named CODE_OF_CONDUCT.md
at the top-level
directory of the project if it exists.
The AddRugExtensionLanguageBackedByANTLR Editor adds a Rug extension language, formerly known as Type, to a Scala project.
Before running this Editor, you must have the following prerequisites satisfied.
- A scala project
To run this editor, you must supply the following parameters.
package_name
the Scala project where to add the new extension language into. If the package directory doesn't exist, it is created by the editorclass_name
the name of the Scala classfile_extension
the file extension this will supportgrammar_name
the name of the grammar, used to hold the ANTLR grammargrammar_production
the top-level production in your ANTLR grammar that will act as the main entry pointdescription
a short description of the nex extension language (optional)
Run it as follows:
$ cd to/your/repo
$ rug edit atomist-rugs:common-editors:AddRugExtensionLanguageBackedByANTLR \
package_name=com.atomist.rug.extension\
class_name=ErlangExtensionLanguage\
file_extension=.erl\
grammar_name=Erlang\
grammar_production=forms
This will create a new Scala class in
com.atomist.rug.extension.ErlangExtensionLanguage.scala
matching *.erl
files
with the Erlang.g4
grammar starting with the forms
production.
You should now:
- edit
src/main/resources/grammar/antlr/Erlang.g4
to start adding grammar rules - edit
src/test/scala/com/atomist/rug/extension/ErlangExtensionLanguageTest.scala
to edit tests for that new extension language
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.
You can build, test, and install the project locally with the Rug CLI.
$ rug test
$ rug 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