saddler-reporter-support 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6851e629d8a3ccd548179f3306bb04e2668a278
4
- data.tar.gz: e869a1862e4490b6ae59accea7d6677eede631f3
3
+ metadata.gz: 8b503863e8c84a172963159aac112e6c9705b88b
4
+ data.tar.gz: c65a738b05a5d4e6d4ebcd2c8bdcf32740af221e
5
5
  SHA512:
6
- metadata.gz: daacb9d2245a6aee4cbbc5f806c604126a22414d785144e7bd0275485aef120d2056559fe608782c99ed3c64a21dcfac3f14a1726bcb78cd2830d5e612ef3005
7
- data.tar.gz: 2d1174cd66707c10a1d114eb685022eab569f8a7aac012ef81a736aadc8aae715a070089c4dcef0098f5b505f8d73ee9ea8c6a1db4a3339c72eed17fe8086517
6
+ metadata.gz: e31d7b315cee815b6e8898b1a99fd5c87a4c73f8fd7225459aedaddf796cd138f4bb49346c1f7a6add184aa0f63e206268630ff089aa562d8a9c1a4d00d31166
7
+ data.tar.gz: bccff7aa1a1e8710b6e7c20eb3aded3796b78503deaaba78abb238c84b473795c6a8571a189a9f809a4371211c4a3c537e25a3bf97f7d979013358c72572ef34
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+ var execSync = require('child_process').execSync;
3
+ var URI = require('urijs');
4
+
5
+ var gemspec = JSON.parse(execSync('bundle exec parse-gemspec-cli saddler-reporter-support.gemspec'));
6
+ var homepageUrl = gemspec.homepage;
7
+ var url = new URI(homepageUrl);
8
+ var host = url.protocol() + '://' + url.authority();
9
+ var owner = url.pathname().split('/')[1];
10
+ var repository = url.pathname().split('/')[2];
11
+
12
+ module.exports = {
13
+ version: gemspec.version,
14
+ host: host,
15
+ owner: owner,
16
+ repository: repository
17
+ };
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /node_modules/
data/.rubocop.yml CHANGED
@@ -12,6 +12,3 @@ Metrics/LineLength:
12
12
  Style/FileName:
13
13
  Exclude:
14
14
  - exe/*
15
-
16
- Style/RegexpLiteral:
17
- MaxSlashes: 0
data/.travis.yml CHANGED
@@ -1,15 +1,17 @@
1
- language: ruby
1
+ language: "ruby"
2
2
  sudo: false
3
3
  rvm:
4
- - 1.9
5
- - 2.0
6
- - 2.1
7
- - 2.2
4
+ - "1.9"
5
+ - "2.0"
6
+ - "2.1"
7
+ - "2.2"
8
+ - "ruby-head"
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: "ruby-head"
8
12
  before_install:
9
- - gem update bundler
13
+ - "gem update bundler"
14
+ - "bin/setup"
10
15
  notifications:
11
16
  email:
12
17
  - ogataken@gmail.com
13
- branches:
14
- only:
15
- - master
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in saddler-reporter-support.gemspec
4
4
  gemspec
5
+
6
+ gem 'rubocop'
7
+ gem 'yard'
8
+ gem 'parse_gemspec-cli'
data/README.md CHANGED
@@ -1,7 +1,45 @@
1
1
  # Saddler::Reporter::Support
2
2
 
3
- [![Gem Version](http://img.shields.io/gem/v/saddler-reporter-support.svg?style=flat)](http://badge.fury.io/rb/saddler-reporter-support)
4
- [![Build Status](http://img.shields.io/travis/packsaddle/ruby-saddler-reporter-support/master.svg?style=flat)](https://travis-ci.org/packsaddle/ruby-saddler-reporter-support)
3
+ [![Gem version][gem-image]][gem-url] [![Travis-CI Status][travis-image]][travis-url] [![yard docs][docs-image]][docs-url]
4
+
5
+ > Interface for saddler-reporter. And utilities for saddler-reporter.
6
+
7
+
8
+ ## API
9
+
10
+ Interface for saddler-reporter.
11
+
12
+ ### #initialize(output)
13
+
14
+ #### output
15
+
16
+ Type: `#puts`
17
+
18
+ output interface (defaults to: $stdout)
19
+
20
+
21
+ ### #report(messages, options) -> void
22
+
23
+ #### messages
24
+
25
+ Type: `String`
26
+
27
+ reporting message. checkstyle format.
28
+
29
+ #### options
30
+
31
+ Type: `Hash`
32
+
33
+ options from saddler cli.
34
+
35
+
36
+ And more *[details][docs-url]*.
37
+
38
+
39
+ ## Changelog
40
+
41
+ [changelog.md](./changelog.md).
42
+
5
43
 
6
44
  ## Installation
7
45
 
@@ -19,12 +57,14 @@ Or install it yourself as:
19
57
 
20
58
  $ gem install saddler-reporter-support
21
59
 
60
+
22
61
  ## Development
23
62
 
24
63
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
25
64
 
26
65
  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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
27
66
 
67
+
28
68
  ## Contributing
29
69
 
30
70
  1. Fork it ( https://github.com/packsaddle/ruby-saddler-reporter-support/fork )
@@ -32,3 +72,17 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
72
  3. Commit your changes (`git commit -am 'Add some feature'`)
33
73
  4. Push to the branch (`git push origin my-new-feature`)
34
74
  5. Create a new Pull Request
75
+
76
+
77
+ ## License
78
+
79
+ © [sanemat](http://sane.jp)
80
+
81
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
82
+
83
+ [travis-url]: https://travis-ci.org/packsaddle/ruby-saddler-reporter-support
84
+ [travis-image]: https://img.shields.io/travis/packsaddle/ruby-saddler-reporter-support/master.svg?style=flat-square&label=build%20%28linux%29
85
+ [gem-url]: https://rubygems.org/gems/saddler-reporter-support
86
+ [gem-image]: http://img.shields.io/gem/v/saddler-reporter-support.svg?style=flat-square
87
+ [docs-url]: http://www.rubydoc.info/gems/saddler-reporter-support
88
+ [docs-image]: https://img.shields.io/badge/yard-docs-blue.svg?style=flat-square
data/Rakefile CHANGED
@@ -7,3 +7,12 @@ Rake::TestTask.new(:test) do |t|
7
7
  end
8
8
 
9
9
  task default: :test
10
+
11
+ require 'yard'
12
+ require 'yard/rake/yardoc_task'
13
+ DOC_FILES = ['lib/**/*.rb']
14
+ DOC_OPTIONS = ['--debug', '--verbose']
15
+ YARD::Rake::YardocTask.new(:doc) do |t|
16
+ t.files = DOC_FILES
17
+ t.options = DOC_OPTIONS if Rake.application.options.trace
18
+ end
data/bin/setup CHANGED
@@ -1,7 +1,15 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
1
+ #!/usr/bin/env ruby
4
2
 
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
3
+ require 'open3'
4
+ unless ENV['CI']
5
+ out, err, status = Open3.capture3(*%w(bundle install))
6
+ $stdout.puts out
7
+ $stderr.puts err
8
+ exit status.exitstatus if !status.exitstatus.nil? && status.exitstatus != 0
9
+ end
10
+ unless ENV['CI']
11
+ out, err, status = Open3.capture3(*%w(npm install))
12
+ $stdout.puts out
13
+ $stderr.puts err
14
+ exit status.exitstatus if !status.exitstatus.nil? && status.exitstatus != 0
15
+ end
data/changelog.md ADDED
@@ -0,0 +1,4 @@
1
+ <a name="0.1.1"></a>
2
+ ## [0.1.1](https://github.com/packsaddle/ruby-saddler-reporter-support/compare/v0.1.0...v0.1.1) (2015-09-30)
3
+
4
+ * Improve document
@@ -1,7 +1,7 @@
1
1
  module Saddler
2
2
  module Reporter
3
3
  module Support
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
6
6
  end
7
7
  end
@@ -4,41 +4,180 @@ require 'saddler/reporter/support/version'
4
4
 
5
5
  module Saddler
6
6
  module Reporter
7
+ # Interface for saddler-reporter. And utilities for saddler-reporter
7
8
  module Support
9
+ # Interface for saddler-reporter
10
+ #
11
+ # @param output [Object] output interface (defaults to: $stdout).
12
+ # Use StringIO for testing.
8
13
  def initialize(output)
9
14
  @output = output
10
15
  end
11
16
 
12
- def report(messages, _options)
17
+ # Interface for saddler-reporter
18
+ #
19
+ # @param messages [String] reporting message. checkstyle format.
20
+ # @param options [Hash] options from saddler cli.
21
+ #
22
+ # @return [void]
23
+ def report(messages, options) # rubocop:disable Style/UnusedMethodArgument
13
24
  @output.puts messages
14
25
  end
15
26
 
16
- # {"checkstyle"=>
17
- # {"file"=>
18
- # [{"error"=>
19
- # [{"@column"=>"4",
20
- # "@line"=>"22",
21
- # "@message"=>"Assignment Branch Condition size for report is too high. [34.34/15]",
22
- # "@severity"=>"info",
23
- # "@source"=>"com.puppycrawl.tools.checkstyle.Metrics/AbcSize"},
24
- # {"@column"=>"4",
25
- # "@line"=>"22",
26
- # "@message"=>"Cyclomatic complexity for report is too high. [10/6]",
27
- # "@severity"=>"info",
28
- # "@source"=>"com.puppycrawl.tools.checkstyle.Metrics/CyclomaticComplexity"},
29
- # {"@column"=>"6",
30
- # "@line"=>"39",
31
- # "@message"=>"Use space after control keywords.",
32
- # "@severity"=>"info",
33
- # "@source"=>"com.puppycrawl.tools.checkstyle.Style/SpaceAfterControlKeyword"}],
34
- # "@name"=>"/Users/sane/work/ruby-study/saddler/lib/saddler/cli.rb"},
35
- # {"@name"=>"/Users/sane/work/ruby-study/saddler/lib/saddler/reporter.rb"}]}}
27
+ # Parser from xml to Plain Old Ruby Object with Nori
28
+ #
29
+ # @example one file no error
30
+ # xml = <<-XML
31
+ # <?xml version='1.0' encoding='UTF-8'?>
32
+ # <checkstyle version='4.3'>
33
+ # <file name='/home/travis/build/jser/jser.github.io/_i18n/ja/_posts/2015/2015-09-16-react-0.14-eslint-1.4-es5.md'/>
34
+ # </checkstyle>
35
+ # XML
36
+ #
37
+ # parse(xml)
38
+ # #=>
39
+ # {
40
+ # 'checkstyle' => {
41
+ # 'file' => {
42
+ # '@name' => '/home/travis/build/jser/jser.github.io/_i18n/ja/_posts/2015/2015-09-16-react-0.14-eslint-1.4-es5.md'
43
+ # },
44
+ # '@version' => '4.3'
45
+ # }
46
+ # }
47
+ #
48
+ # @example one foile one error
49
+ # xml = <<-XML
50
+ # <?xml version='1.0'?>
51
+ # <checkstyle>
52
+ # <file name='lib/example/travis_ci.rb'>
53
+ # <error column='120' line='7' message='Line is too long. [164/120]' severity='info' source='com.puppycrawl.tools.checkstyle.Metrics/LineLength'/>
54
+ # </file>
55
+ # </checkstyle>
56
+ # XML
57
+ #
58
+ # parse(xml)
59
+ # #=>
60
+ # {
61
+ # 'checkstyle' => {
62
+ # 'file' => {
63
+ # 'error' => {
64
+ # '@column' => '120',
65
+ # '@line' => '7',
66
+ # '@message' => 'Line is too long. [164/120]',
67
+ # '@severity' => 'info',
68
+ # '@source' => 'com.puppycrawl.tools.checkstyle.Metrics/LineLength'
69
+ # },
70
+ # '@name' => 'lib/example/travis_ci.rb'
71
+ # }
72
+ # }
73
+ # }
74
+ #
75
+ # @example two files multi errors
76
+ # xml = <<-XML
77
+ # <?xml version='1.0'?>
78
+ # <checkstyle>
79
+ # <file name='example/invalid.rb'>
80
+ # <error line='3' column='100' severity='info' message='Line is too long. [187/100]' source='com.puppycrawl.tools.checkstyle.Metrics/LineLength'/>
81
+ # </file>
82
+ # <file name='lib/checkstyle_filter/git/cli.rb'>
83
+ # <error line='14' column='6' severity='info' message='Assignment Branch Condition size for diff is too high. [38.21/15]' source='com.puppycrawl.tools.checkstyle.Metrics/AbcSize'/>
84
+ # <error line='14' column='6' severity='info' message='Cyclomatic complexity for diff is too high. [9/6]' source='com.puppycrawl.tools.checkstyle.Metrics/CyclomaticComplexity'/>
85
+ # <error line='14' column='6' severity='info' message='Method has too many lines. [26/10]' source='com.puppycrawl.tools.checkstyle.Metrics/MethodLength'/>
86
+ # <error line='14' column='6' severity='info' message='Perceived complexity for diff is too high. [10/7]' source='com.puppycrawl.tools.checkstyle.Metrics/PerceivedComplexity'/>
87
+ # <error line='65' column='8' severity='info' message='Assignment Branch Condition size for file_element_error_line_no_in_modified? is too high. [16.16/15]' source='com.puppycrawl.tools.checkstyle.Metrics/AbcSize'/>
88
+ # <error line='65' column='8' severity='info' message='Method has too many lines. [14/10]' source='com.puppycrawl.tools.checkstyle.Metrics/MethodLength'/>
89
+ # </file>
90
+ # </checkstyle>
91
+ # XML
92
+ #
93
+ # parse(xml)
94
+ # #=>
95
+ # {
96
+ # 'checkstyle' => {
97
+ # 'file' => [
98
+ # {
99
+ # 'error' => {
100
+ # '@line' => '3',
101
+ # '@column' => '100',
102
+ # '@severity' => 'info',
103
+ # '@message' => 'Line is too long. [187/100]',
104
+ # '@source' => 'com.puppycrawl.tools.checkstyle.Metrics/LineLength'
105
+ # },
106
+ # '@name' => 'example/invalid.rb'
107
+ # },
108
+ # {
109
+ # 'error' => [
110
+ # {
111
+ # '@line' => '14',
112
+ # '@column' => '6',
113
+ # '@severity' => 'info',
114
+ # '@message' => 'Assignment Branch Condition size for diff is too high. [38.21/15]',
115
+ # '@source' => 'com.puppycrawl.tools.checkstyle.Metrics/AbcSize'
116
+ # },
117
+ # {
118
+ # '@line' => '14',
119
+ # '@column' => '6',
120
+ # '@severity' => 'info',
121
+ # '@message' => 'Cyclomatic complexity for diff is too high. [9/6]',
122
+ # '@source' => 'com.puppycrawl.tools.checkstyle.Metrics/CyclomaticComplexity'
123
+ # },
124
+ # {
125
+ # '@line' => '14',
126
+ # '@column' => '6',
127
+ # '@severity' => 'info',
128
+ # '@message' => 'Method has too many lines. [26/10]',
129
+ # '@source' => 'com.puppycrawl.tools.checkstyle.Metrics/MethodLength'
130
+ # },
131
+ # {
132
+ # '@line' => '14',
133
+ # '@column' => '6',
134
+ # '@severity' => 'info',
135
+ # '@message' => 'Perceived complexity for diff is too high. [10/7]',
136
+ # '@source' => 'com.puppycrawl.tools.checkstyle.Metrics/PerceivedComplexity'
137
+ # },
138
+ # {
139
+ # '@line' => '65',
140
+ # '@column' => '8',
141
+ # '@severity' => 'info',
142
+ # '@message' => 'Assignment Branch Condition size for file_element_error_line_no_in_modified? is too high. [16.16/15]',
143
+ # '@source' => 'com.puppycrawl.tools.checkstyle.Metrics/AbcSize'
144
+ # },
145
+ # {
146
+ # '@line' => '65',
147
+ # '@column' => '8',
148
+ # '@severity' => 'info',
149
+ # '@message' => 'Method has too many lines. [14/10]',
150
+ # '@source' => 'com.puppycrawl.tools.checkstyle.Metrics/MethodLength'
151
+ # }
152
+ # ],
153
+ # '@name' => 'lib/checkstyle_filter/git/cli.rb'
154
+ # }
155
+ # ]
156
+ # }
157
+ # }
158
+ #
159
+ # @param xml [String] xml string
160
+ #
161
+ # @return [Object] parsed
162
+ #
163
+ # @see ::Nori#parse
164
+ # @see https://github.com/savonrb/nori
36
165
  def parse(xml)
37
166
  Nori
38
167
  .new(parser: :rexml)
39
168
  .parse(xml)
40
169
  end
41
170
 
171
+ # @example absolute path
172
+ # Dir.pwd #=> '/foo/bar'
173
+ # file_relative_path_string('/foo/bar/baz') #=> 'baz'
174
+ #
175
+ # @example relative path
176
+ # file_relative_path_string('./bar') #=> 'bar'
177
+ #
178
+ # @param file_name [String, #to_str] file path
179
+ #
180
+ # @return [String] file's relative path string from current
42
181
  def file_relative_path_string(file_name)
43
182
  if Pathname.new(file_name).absolute?
44
183
  Pathname.new(file_name).relative_path_from(Pathname.new(Dir.pwd)).to_s
data/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "devDependencies": {
3
+ "conventional-changelog": "0.4.3",
4
+ "npm-check-updates": "^2.2.3",
5
+ "urijs": "^1.16.1"
6
+ },
7
+ "scripts": {
8
+ "changelog": "conventional-changelog -i changelog.md --overwrite --preset angular --context .conventional-changelog.context.js",
9
+ "ncu": "ncu -u"
10
+ }
11
+ }
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ['sanemat']
10
10
  spec.email = ['o.gata.ken@gmail.com']
11
11
 
12
- spec.summary = 'Utilities for saddler-reporter'
13
- spec.description = 'Utilities for saddler-reporter'
12
+ spec.summary = 'Interface for saddler-reporter. And utilities for saddler-reporter.'
13
+ spec.description = 'Interface for saddler-reporter. And utilities for saddler-reporter.'
14
14
  spec.homepage = 'https://github.com/packsaddle/ruby-saddler-reporter-support'
15
15
  spec.license = 'MIT'
16
16
 
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_runtime_dependency 'nori'
23
23
 
24
- spec.add_development_dependency 'bundler', '~> 1.8'
25
- spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'bundler'
25
+ spec.add_development_dependency 'rake'
26
26
  spec.add_development_dependency 'test-unit'
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saddler-reporter-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sanemat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-02-24 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nori
@@ -28,30 +28,30 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.8'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.8'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: test-unit
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,13 +66,14 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: Utilities for saddler-reporter
69
+ description: Interface for saddler-reporter. And utilities for saddler-reporter.
70
70
  email:
71
71
  - o.gata.ken@gmail.com
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ".conventional-changelog.context.js"
76
77
  - ".gitignore"
77
78
  - ".rubocop.yml"
78
79
  - ".tachikoma.yml"
@@ -84,8 +85,10 @@ files:
84
85
  - Rakefile
85
86
  - bin/console
86
87
  - bin/setup
88
+ - changelog.md
87
89
  - lib/saddler/reporter/support.rb
88
90
  - lib/saddler/reporter/support/version.rb
91
+ - package.json
89
92
  - saddler-reporter-support.gemspec
90
93
  homepage: https://github.com/packsaddle/ruby-saddler-reporter-support
91
94
  licenses:
@@ -110,5 +113,6 @@ rubyforge_project:
110
113
  rubygems_version: 2.4.5
111
114
  signing_key:
112
115
  specification_version: 4
113
- summary: Utilities for saddler-reporter
116
+ summary: Interface for saddler-reporter. And utilities for saddler-reporter.
114
117
  test_files: []
118
+ has_rdoc: