Code Monkey home page Code Monkey logo

asciidoctor-jenkins-extensions's Introduction

Asciidoctor::Jenkins::Extensions

Build status

This gem is a collection of Asciidoctor extensions which enable more advanced formatting in Jenkins-related content.

Installation

Add this line to your application’s Gemfile:

gem 'asciidoctor-jenkins-extensions'

And then execute:

$ bundle

Or install it yourself as:

$ gem install asciidoctor-jenkins-extensions

Usage

Using this gem inside of an existing Asciidoctor-based project is as straight-forward as requiring asciidoctor/jenkins/extensions, for example:

require 'asciidoctor/jenkins/extensions'

In Awestruct-based projects, this require statement should go in _ext/pipeline.rb.

[pipeline] block

An extension to Asciidoctor syntax adds the [pipeline] block for including Pipeline code. This block supports both Declarative Pipeline and Pipeline Script syntax. For example:

[pipeline]
----
// Script //
node {
    stage('Build') {
      checkout scm
      // Install dependencies
      sh 'npm install'
    }
}

// Declarative //
pipeline {
    agent docker: 'node:6.3'
    stages {
        stage('Build') {
            sh 'npm install'
        }
    }
}
----

This pipeline block will prefer the Declarative Pipeline syntax when rendering, and provide a link for toggling the Scripted Pipeline.

The // Declarative // or // Script // delimiters are MANDATORY, even when defining a [pipeline] block with only one syntax supported. These delimiters instruct the extension on how to render the given code.

the plugin macro

The plugin inline macro can be used to link to plugins on the plugins index at https://plugins.jenkins.io/.

Example:

plugin:git[The Git Plugin]

jenkinsdoc/staplerdoc/javadoc macros

The jenkinsdoc inline macro can be used to link to the Jenkins Javadoc at https://javadoc.jenkins.io/.

It supports a variety of different syntaxes. For classes in Jenkins core:

  • jenkinsdoc:hudson.scm.SCM[] links to the full URL for the class in Jenkins core.

  • jenkinsdoc:hudson.scm.SCM#all()[] links to the full URL for the class in Jenkins core, and includes a fragment.

  • jenkinsdoc:SCM[] links to the /byShortName URL for the class in Jenkins core. Due to the redirect, fragments won’t work here.

By default, all of these use the class name as label, but that can be customized if necessary by providing an alternative label between the square brackets.

jenkinsdoc:hudson.scm.SCM#all()[a list of all known SCM implementations]

For classes in plugins, the plugin’s name (artifactId) is put before the class name and separated by colon:

  • jenkinsdoc:git:hudson.plugins.git.GitSCM[] links to the full URL for the class in the git plugin.

  • jenkinsdoc:git:hudson.plugins.git.GitSCM#getRepositories--[] links to the full URL for the class in the git plugin, and includes a fragment.

These use a similar default label if none is set, but it also specified which plugin the class is in. For the previous example, that label would be hudson.plugins.git.GitSCM in git.

Two other inline macros, staplerdoc and javadoc exist and link to the Stapler API documentation and Java API documentation, respectively. These do not support the form of jenkinsci that only requires the short name, but otherwise work the same way. Examples:

javadoc:java.io.File#pathSeparator[the path separator]
staplerdoc:org.kohsuke.stapler.AncestorInPath[]

Other macros (jep/jira/security)

See [examples](./examples).

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Acceptance Tests

In order to make testing of extensions easier, there is a bit of support for live-page Asciidoc rendering with extensions live-reloaded on each page load.

In the examples/ directory you will find sample .adoc files which serve as test files for rendering with Asciidoctor and these extensions. To run the test server, assuming you have already executed bundle install, run:

shotgun

And then navigate to localhost:9393

asciidoctor-jenkins-extensions's People

Contributors

daniel-beck avatar dependabot[bot] avatar getjv avatar markewaite avatar notmyfault avatar oleg-nenashev avatar renovate[bot] avatar rtyler avatar slide avatar timja avatar vkotovv avatar zbynek avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asciidoctor-jenkins-extensions's Issues

Cut a release

Hi @timja and @MarkEWaite,

would anyone mind cutting a release, please? According to rubygems, you both are the owners of this gem.

Thanks in advance!

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

bundler
Gemfile
  • sinatra undefined
  • shotgun undefined
github-actions
.github/workflows/release-drafter.yml
  • release-drafter/release-drafter v6
regex
Jenkinsfile
  • ruby 3.3.1
ruby-version
.ruby-version
  • ruby 3.3.1

  • Check this box to trigger a request for Renovate to run again on this repository

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.