pdd 0.5.2 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
data/.coveralls.yml CHANGED
@@ -1,2 +1,2 @@
1
- ervice_name: travis-pro
1
+ service_name: travis-pro
2
2
  repo_token: cZjWSm2veNxj30lzlfMLKXdLQ1XCkKk9H
data/.rultor.yml CHANGED
@@ -19,4 +19,4 @@ release:
19
19
  - "pdd --source=$(pwd) --verbose --file=pdd.xml -e=test/** -e=features/** -e=README.md"
20
20
  - "s3cmd --no-progress put pdd.xml --config=../s3cfg s3://pdd.teamed.io/pdd.xml"
21
21
  - "s3cmd --no-progress put assets/puzzles.xsd --acl-public --config=../s3cfg s3://pdd-xsd.teamed.io/${tag}.xsd"
22
- - "s3cmd --no-progress put assets/puzzles.xsl --acl-public --config=../s3cfg s3://pdd-xsd.teamed.io/${tag}.xsl"
22
+ - "s3cmd --no-progress put assets/puzzles.xsl --acl-public --config=../s3cfg s3://pdd-xsl.teamed.io/${tag}.xsl"
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Made By Teamed.io](http://img.teamed.io/btn.svg)](http://www.teamed.io)
2
+ [![DevOps By Rultor.com](http://www.rultor.com/b/teamed/pdd)](http://www.rultor.com/p/teamed/pdd)
2
3
 
3
4
  [![Build Status](https://travis-ci.org/teamed/pdd.svg)](https://travis-ci.org/teamed/pdd)
4
5
  [![Gem Version](https://badge.fury.io/rb/pdd.svg)](http://badge.fury.io/rb/pdd)
data/assets/puzzles.xsl CHANGED
@@ -32,10 +32,30 @@
32
32
  <meta name="keywords" content="puzzle driven development"/>
33
33
  <meta name="author" content="teamed.io"/>
34
34
  <title><xsl:text>PDD Summary Report</xsl:text></title>
35
+ <style type="text/css">
36
+ body {
37
+ background-color: #e6e1ce;
38
+ font-family: Arial, sans-serif;
39
+ margin: 2em;
40
+ font-size: 22px;
41
+ }
42
+ table {
43
+ border-spacing: 0px;
44
+ border-collapse: collapse;
45
+ }
46
+ th, td {
47
+ vertical-align: top;
48
+ padding: 1em;
49
+ border: 1px solid gray;
50
+ }
51
+ th {
52
+ text-align: left;
53
+ }
54
+ </style>
35
55
  </head>
36
56
  <body>
37
57
  <div>
38
- <h1>Puzzle Driven Development (PDD) Summary Report</h1>
58
+ <h1>PDD Summary</h1>
39
59
  <table>
40
60
  <colgroup>
41
61
  <col/>
@@ -50,7 +70,7 @@
50
70
  <th><xsl:text>ticket</xsl:text></th>
51
71
  <th><xsl:text>body</xsl:text></th>
52
72
  <th><xsl:text>estimate</xsl:text></th>
53
- <th><xsl:text>owner</xsl:text></th>
73
+ <th><xsl:text>role</xsl:text></th>
54
74
  </tr>
55
75
  </thead>
56
76
  <tbody>
@@ -74,7 +94,7 @@
74
94
  <xsl:value-of select="body"/>
75
95
  </td>
76
96
  <td><xsl:value-of select="estimate"/></td>
77
- <td><xsl:value-of select="owner"/></td>
97
+ <td><xsl:value-of select="role"/></td>
78
98
  </tr>
79
99
  </xsl:template>
80
100
  </xsl:stylesheet>
data/bin/pdd CHANGED
@@ -27,6 +27,7 @@ STDOUT.sync = true
27
27
  require 'pdd'
28
28
  require 'slop'
29
29
  require 'pdd/version'
30
+ require 'nokogiri'
30
31
 
31
32
  opts = Slop.parse(ARGV, strict: true, help: true) do
32
33
  banner "Usage (#{PDD::VERSION}): pdd [options]"
@@ -34,15 +35,30 @@ opts = Slop.parse(ARGV, strict: true, help: true) do
34
35
  on 's', 'source', 'Source directory to parse', argument: :required
35
36
  on 'f', 'file', 'File to save XML into', argument: :required
36
37
  on 'e', 'exclude', 'Glob pattern to exclude', as: Array, argument: :required
38
+ on 't', 'format', 'Format to use (xml|html)', argument: :required
37
39
  end
38
40
 
39
41
  fail '-f is mandatory when using -v' if opts.verbose? && !opts.file?
40
42
 
41
43
  if opts.help?
42
44
  puts opts
43
- else
44
- Encoding.default_external = Encoding::UTF_8
45
- Encoding.default_internal = Encoding::UTF_8
46
- file = opts.file? ? File.new(opts[:file], 'w') : STDOUT
47
- file << PDD::Base.new(opts).xml
45
+ exit
48
46
  end
47
+
48
+ Encoding.default_external = Encoding::UTF_8
49
+ Encoding.default_internal = Encoding::UTF_8
50
+ file = opts.file? ? File.new(opts[:file], 'w') : STDOUT
51
+ output = PDD::Base.new(opts).xml
52
+ if opts[:format]
53
+ if opts[:format] == 'html'
54
+ xslt = File.join(
55
+ File.dirname(File.dirname(__FILE__)),
56
+ 'assets', 'puzzles.xsl'
57
+ )
58
+ output = Nokogiri::XSLT(File.read(xslt)).transform(Nokogiri::XML(output))
59
+ else
60
+ fail 'invalid format, use html or xml' if opts[:format] != 'xml'
61
+ end
62
+ output
63
+ end
64
+ file << output
@@ -0,0 +1,22 @@
1
+ Feature: HTML output
2
+ As a source code writer I want to be able to
3
+ call PDD as a command line tool, and retrieve an
4
+ HTML report
5
+
6
+ Scenario: HTML report building
7
+ Given I have a "Sample.java" file with content:
8
+ """
9
+ public class Main {
10
+ /**
11
+ * @todo #13 Let's do it later, dude
12
+ * or maybe even never :)
13
+ */
14
+ public void main(String[] args) {
15
+ // later
16
+ }
17
+ }
18
+ """
19
+ When I run bin/pdd with "-v -s . -f out.html --format=html"
20
+ Then Exit code is zero
21
+ And Stdout contains "reading ."
22
+ And XML file "out.html" matches "/html/body"
@@ -85,6 +85,7 @@ end
85
85
  Then(/^XML file "([^"]+)" matches "([^"]+)"$/) do |file, xpath|
86
86
  fail "File #{file} doesn't exit" unless File.exist?(file)
87
87
  xml = Nokogiri::XML.parse(File.read(file))
88
+ xml.remove_namespaces!
88
89
  if xml.xpath(xpath).empty?
89
90
  fail "XML file #{file} doesn't match \"#{xpath}\":\n#{xml}"
90
91
  end
data/lib/pdd/version.rb CHANGED
@@ -26,5 +26,5 @@
26
26
  # Copyright:: Copyright (c) 2014 Yegor Bugayenko
27
27
  # License:: MIT
28
28
  module PDD
29
- VERSION = '0.5.2'
29
+ VERSION = '0.6'
30
30
  end
data/lib/pdd.rb CHANGED
@@ -123,7 +123,7 @@ module PDD
123
123
  xsd = Nokogiri::XML::Schema(
124
124
  File.read(File.join(File.dirname(__FILE__), '../assets/puzzles.xsd'))
125
125
  )
126
- errors = xsd.validate(Nokogiri::XML(xml)).map { |error| error.message }
126
+ errors = xsd.validate(Nokogiri::XML(xml)).map(&:message)
127
127
  errors.each { |e| PDD.log.error e }
128
128
  PDD.log.error(xml) unless errors.empty?
129
129
  fail SchemaError, errors.join('; ') unless errors.empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: '0.6'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-13 00:00:00.000000000 Z
12
+ date: 2014-10-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -255,6 +255,7 @@ files:
255
255
  - features/avoiding_duplicates.feature
256
256
  - features/cli.feature
257
257
  - features/gem_package.feature
258
+ - features/html_output.feature
258
259
  - features/parsing.feature
259
260
  - features/step_definitions/steps.rb
260
261
  - features/support/env.rb
@@ -265,7 +266,6 @@ files:
265
266
  - lib/pdd/sources.rb
266
267
  - lib/pdd/version.rb
267
268
  - pdd.gemspec
268
- - pdd.xml
269
269
  - test/test_helper.rb
270
270
  - test/test_pdd.rb
271
271
  - test/test_source.rb
@@ -300,6 +300,7 @@ test_files:
300
300
  - features/avoiding_duplicates.feature
301
301
  - features/cli.feature
302
302
  - features/gem_package.feature
303
+ - features/html_output.feature
303
304
  - features/parsing.feature
304
305
  - features/step_definitions/steps.rb
305
306
  - features/support/env.rb
data/pdd.xml DELETED
@@ -1,3 +0,0 @@
1
- <?xml version="1.0"?>
2
- <?xml-stylesheet type="text/xsl" href="puzzles.xsl"?>
3
- <puzzles version="1.0.snapshot" date="2014-08-13T12:52:38Z"/>