{
    "componentChunkName": "component---src-templates-blog-post-tsx",
    "path": "/blog/2011-05-12-what-it-take-to-bring-ruby-to-jenkins/",
    "result": {"data":{"blogPost":{"title":"What it takes to bring Ruby to Jenkins","slug":"/blog/2011-05-12-what-it-take-to-bring-ruby-to-jenkins/","authorNodes":[{"name":"Charles Lowell","slug":"/people/charles-lowell/"}],"markdown":{"html":"<p>\"Jenkins Ruby Plugins\" are at an important, yet fragile stage of their life. Over the past several months, we have made\ntremendous progress towards making extending Jenkins with nothing but Ruby a blissful reality. However, at this moment,\nthey exist only as a collection of hacks, or, to frame it more kindly, \"proofs of concept\" all buried quite deeply in a\n<a href=\"http://github.com/cowboyd/fog.hpi\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">terribly named repo on github</a>.</p>\n<p>To name a few of them, we are now able to</p>\n<ul>\n<li>automatically discover Ruby plugins and register them</li>\n<li>work with Jenkins internals like BuildWrapper, RootActions, etc.. via a native Ruby-like API</li>\n<li>persist mixed hierarchies of Java and Ruby objects transparently as Jenkins configuration</li>\n<li>use ERB to template views, while still having access to the standard UI helpers</li>\n<li>extend the Jenkins REST API from Ruby</li>\n</ul>\n<p>This is by no means an exhaustive list, but I want to stress just how far we've come before I talk about where it is that\nwe need to go.</p>\n<p>While the work done so far represents some phenomenal accomplishments, in the end, they are only technical accomplishments which do not together create a coherent developer experience. So now, for this endeavor to succeed, we must focus our attention on making that <em>entire experience</em>, from project start to release after release, as frictionless as possible.</p>\n<p>To that end, I propose the following high level goal for the Jenkins Ruby Plugins project:</p>\n<blockquote>\n<p>To provide the facility to create, develop and release extensions for Jenkins with nothing but knowledge of the language, tools and best practices of the Ruby community.</p>\n</blockquote>\n<p>This is, I think, the most important ideal to aspire to when claiming to provide a Ruby development experience. Unless it feels like the real McCoy, then you aren't really developing Ruby at all, you're just scripting Java with JRuby. You won't fool anybody, and there will be far less enthusiasm and adoption.</p>\n<p>That said, several things follow logically from this thesis, the first of which is:</p>\n<h3 id=\"absolutely-positively-no-maven\" style=\"position:relative;\"><a href=\"#absolutely-positively-no-maven\" aria-label=\"absolutely positively no maven permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Absolutely, Positively, No Maven!</h3>\n<p>This is not an ideological stance on the value of Maven as a <strike>wretched pile of toad sick</strike> software development tool. Rather, it is an explicit acknowledgement that it is not a Ruby tool, it doesn't fit with the community's style, and if you're using it\nyou might not be doing Java, but you <em>certainly</em> aren't doing Ruby. Instead, we should turn to the Ruby tools that\noccupy this same space: Rake for scripting the build, and Bundler for dependency management.</p>\n<h3 id=\"ruby-like-project-structure\" style=\"position:relative;\"><a href=\"#ruby-like-project-structure\" aria-label=\"ruby like project structure permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Ruby-Like Project Structure</h3>\n<p>If we aren't going to use Maven, then why should we be constrained by the project directory structure that it imposes. <code class=\"language-text\">src/main/resources/what?</code> Nope. Just one glance at Jenkins Ruby Plugin's layout in an editor or file system browser\nshould put a Rubyist's mind right at ease. You see that? There's your <code class=\"language-text\">Gemfile</code> just\nwhere you left him. And oh, your pals <code class=\"language-text\">lib/</code> and <code class=\"language-text\">spec/</code> are there too. Let's get right to work!</p>\n<h3 id=\"managing-the-project-life-cycle\" style=\"position:relative;\"><a href=\"#managing-the-project-life-cycle\" aria-label=\"managing the project life cycle permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Managing The Project Life-Cycle</h3>\n<p>From inception to release, you should be able to manage all aspects of your Jenkins plugin with Ruby. There must be single\ncommands (or rake tasks) to</p>\n<ul>\n<li>conjure a new plugin into existence</li>\n<li>generate model/view boilerplate</li>\n<li>run a server with the plugin loaded</li>\n<li>package, push, tag and release a plugin to update-center</li>\n</ul>\n<h3 id=\"testing\" style=\"position:relative;\"><a href=\"#testing\" aria-label=\"testing permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Testing</h3>\n<p>The importance of testing in the Ruby community cannot be overstated. The Ruby Tools need to provide a clear path to\ntesting the plugin at both the unit and functional levels.</p>\n<h3 id=\"documentation\" style=\"position:relative;\"><a href=\"#documentation\" aria-label=\"documentation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Documentation</h3>\n<p>The \"Ruby-like\" API that plugin development provides is similar, but not equivalent to its native Java equivalent.\nIt is critical that this API be well documented, so that developers can understand it, and do not find themselves constantly\nreferring to the JavaDoc, which they may very well not understand (it being Java), and might be misleading given the natural\nasymmetries of the two APIs.</p>\n<h2 id=\"heed-the-call\" style=\"position:relative;\"><a href=\"#heed-the-call\" aria-label=\"heed the call permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Heed the Call!</h2>\n<p>There are plenty of people who would love to see this project get done, but don't know where to start. I know this because I was one of them. The upshot is that now, as I've just described, there is plenty of work to be done that doesn't require any knowledge of Java and very little knowledge of Jenkins internals. That means that <em>you</em> can contribute in a meaningful way!</p>\n<p>Next week, I'll be publishing some specifications in the form of Cucumber scenarios for some of the features up above that we can discuss and then hopefully start implementing.</p>\n<p>But the most important thing that you can do is to join in on the conversation!</p>\n<p><a href=\"irc://freenode.net/jenkins\">irc</a>, and <a href=\"http://groups.google.com/group/jenkinsrb\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">email</a> are just a few of the ways to reach out!</p>\n<blockquote>\n<p>Update. I have posted the first scenario: <a href=\"https://github.com/cowboyd/jenkins.rb/blob/ruby-plugin-development/features/plugins/create-new-plugin.feature\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">creating a plugin</a>.\nThe first bounty is officially posted.</p>\n</blockquote>","frontmatter":{"date":"May 12, 2011","description":null,"tags":["java","ruby","jenkins"],"img":null}}}},"pageContext":{"id":"cc3ec349-5888-520a-a0b3-c199153ec49e"}},
    "staticQueryHashes": ["1241260443"]}