Skip to content

Instantly share code, notes, and snippets.

@NigelThorne
Created August 12, 2016 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NigelThorne/db54fccb979cecf4229ee662e4dc2e74 to your computer and use it in GitHub Desktop.
Save NigelThorne/db54fccb979cecf4229ee662e4dc2e74 to your computer and use it in GitHub Desktop.
Print Jira to cards
require 'rubygems'
require 'jira-ruby'
require 'slim'
# args [name, pass, projectid]
def get_jira_client()
options = {
:username => ARGV[0],
:password => ARGV[1],
:site => 'http://mydomain.atlassian.net:443/',
:context_path => '',
:auth_type => :basic,
:use_ssl => false
}
JIRA::Client.new(options)
end
@template =Slim::Template.new(){File.read("story_template.slim")}
client = get_jira_client
project = client.Project.find(ARGV[2])
puts @template.render(project)
doctype html
html
head
title Slim Examples
meta name="keywords" content="template language"
meta name="author" content="nigel"
link href='https://fonts.googleapis.com/css?family=Bangers' rel='stylesheet' type='text/css'
link href='https://fonts.googleapis.com/css?family=Nunito' rel='stylesheet' type='text/css'
link href="https://fonts.googleapis.com/css?family=Russo+One" rel="stylesheet"
css:
body { background-color: white; }
h1 {
color: #00c12b;
font-family: 'Russo One', sans-serif;
font-size: 53pt;
margin-bottom: 0;
margin-top: 23px;
}
h2 {
color: black;
font-family: 'Nunito', sans-serif;
font-size: 28pt;
margin-top: 0px;
}
.story {
height: 385px;
width: 600px;
border: 1px solid black;
padding-left: 2em;
background-color: #8fff96;
}
@media all {
.page-break { display: none; }
}
@media print {
.page-break { display: block; page-break-before: always; }
}
body
#content
- for page in issues.each_slice(4).to_a
- for issue in page
div.story
h1 = issue.key
h2 = issue.summary
.page-break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment