danger-xcprofiler 0.1.0 → 0.2.0

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: 4517483c48363b161682735098cb155421e85f2a
4
- data.tar.gz: 1d83c34b91abe07910c18828b5995146c69106a3
3
+ metadata.gz: 58787f96f3db5f505748ca1532c89bc7686fc084
4
+ data.tar.gz: fbe9fd4ef7f9e6e970b2a4ac2e86af6ae8639967
5
5
  SHA512:
6
- metadata.gz: 834d6a44e9f21f0822392719f81b8bb81714ab624a07df1f47bbaf2771a9cb0080b09a0b355553bf2f3c5da4f2cd2822716f497e8cfda64b79108e3ee8ee13d4
7
- data.tar.gz: a22b24a903276c06eeaad1b36d2f363cec26b5c5c74875456678b2f8c49d73253191c9c6d406962cfbd91e519031bf8b1d8eb97ede8bb2994f45dfab6dba7119
6
+ metadata.gz: 17e3d2e656fac5bb7ae49c74ac8a51427f71abf96a4cee082c7e1515c40dab02aa284d37bcd6ab85949e652d19d2b8803af09b109f72b2608b7411e0cb2328d3
7
+ data.tar.gz: ee1878fb82f7845d4540d3661d199e62f1735b25d0f730e291a2ead922f7f7846e41769777b6e5b9b3f2ef4b9d6710a752b2caac3ac94ad8feed195042279e0b
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore CHANGED
@@ -1,5 +1,54 @@
1
- .DS_Store
2
- pkg
3
- .idea/
1
+ ### https://raw.github.com/github/gitignore//Ruby.gitignore
2
+
3
+ *.gem
4
+ *.rbc
5
+ /.config
6
+ /coverage/
7
+ /InstalledFiles
8
+ /pkg/
9
+ /spec/reports/
10
+ /spec/examples.txt
11
+ /test/tmp/
12
+ /test/version_tmp/
13
+ /tmp/
14
+
15
+ # Used by dotenv library to load environment variables.
16
+ # .env
17
+
18
+ ## Specific to RubyMotion:
19
+ .dat*
20
+ .repl_history
21
+ build/
22
+ *.bridgesupport
23
+ build-iPhoneOS/
24
+ build-iPhoneSimulator/
25
+
26
+ ## Specific to RubyMotion (use of CocoaPods):
27
+ #
28
+ # We recommend against adding the Pods directory to your .gitignore. However
29
+ # you should judge for yourself, the pros and cons are mentioned at:
30
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
31
+ #
32
+ # vendor/Pods/
33
+
34
+ ## Documentation cache and generated files:
35
+ /.yardoc/
36
+ /_yardoc/
37
+ /doc/
38
+ /rdoc/
39
+
40
+ ## Environment normalization:
41
+ /.bundle/
42
+ /vendor/bundle
43
+ /lib/bundler/man/
44
+
45
+ # for a library or gem, you might want to ignore these files since the code is
46
+ # intended to run in multiple environments; otherwise, check them in:
4
47
  Gemfile.lock
5
- .yardoc/*
48
+ # .ruby-version
49
+ # .ruby-gemset
50
+
51
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
52
+ .rvmrc
53
+
54
+
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # danger-xcprofiler
2
2
  [![Build Status](https://travis-ci.org/giginet/danger-xcprofiler.svg?branch=master)](https://travis-ci.org/giginet/danger-xcprofiler)
3
+ [![Coverage Status](https://coveralls.io/repos/github/giginet/danger-xcprofiler/badge.svg?branch=master)](https://coveralls.io/github/giginet/danger-xcprofiler?branch=master)
4
+ [![Gem Version](https://badge.fury.io/rb/danger-xcprofiler.svg)](https://badge.fury.io/rb/danger-xcprofiler)
3
5
 
4
6
  [danger](https://github.com/danger/danger) plugin for asserting Swift compilation time.
5
7
 
@@ -29,6 +29,9 @@ Gem::Specification.new do |spec|
29
29
  # Testing support
30
30
  spec.add_development_dependency 'rspec', '~> 3.4'
31
31
 
32
+ # Calculating code coverage
33
+ spec.add_development_dependency 'coveralls'
34
+
32
35
  # Linting code and docs
33
36
  spec.add_development_dependency 'rubocop', '~> 0.41'
34
37
  spec.add_development_dependency 'yard', '~> 0.8'
@@ -18,7 +18,8 @@ module Danger
18
18
  options[:file] = relative_path(execution.path)
19
19
  options[:line] = execution.line
20
20
  end
21
- message = "`#{execution.method_name}` takes #{execution.time} ms to build"
21
+ message = message(execution)
22
+
22
23
  if execution.time >= @thresholds[:fail]
23
24
  @dangerfile.fail(message, options)
24
25
  elsif execution.time >= @thresholds[:warn]
@@ -29,6 +30,12 @@ module Danger
29
30
 
30
31
  private
31
32
 
33
+ def message(execution)
34
+ message = "`#{execution.method_name}` takes #{execution.time} ms to build"
35
+ return message if @inline_mode
36
+ "[#{execution.filename}] #{message}"
37
+ end
38
+
32
39
  def relative_path(path)
33
40
  working_dir = Pathname.new(@working_dir)
34
41
  Pathname.new(path).relative_path_from(working_dir).to_s
@@ -1,3 +1,3 @@
1
1
  module DangerXcprofiler
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  require 'pathname'
2
5
  ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
6
  $LOAD_PATH.unshift((ROOT + 'lib').to_s)
@@ -13,8 +13,8 @@ module Danger
13
13
  let(:profiler) { Xcprofiler::Profiler.new(derived_data) }
14
14
  let(:location) { 'path/to/Source.swift:20:30' }
15
15
  let(:method_name) { 'doSomething()' }
16
- let(:time0) { 0 }
17
- let(:time1) { 0 }
16
+ let(:time0) { 99.9 }
17
+ let(:time1) { 100 }
18
18
  let(:execution0) { Xcprofiler::Execution.new(time0, location, method_name) }
19
19
  let(:execution1) { Xcprofiler::Execution.new(time1, location, method_name) }
20
20
 
@@ -45,8 +45,6 @@ module Danger
45
45
  end
46
46
 
47
47
  context 'with very slow execution' do
48
- let(:time0) { 99.9 }
49
- let(:time1) { 100 }
50
48
  it 'asserts failure' do
51
49
  @xcprofiler.report(product_name)
52
50
  expect(@dangerfile).to have_received(:fail).with('`doSomething()` takes 100.0 ms to build',
@@ -96,16 +94,16 @@ module Danger
96
94
  let(:time1) { 50 }
97
95
  it 'asserts warning' do
98
96
  @xcprofiler.report(product_name)
99
- expect(@dangerfile).to have_received(:warn).with('`doSomething()` takes 50.0 ms to build', {})
97
+ expect(@dangerfile).to have_received(:warn)
98
+ .with('[Source.swift] `doSomething()` takes 50.0 ms to build', {})
100
99
  end
101
100
  end
102
101
 
103
102
  context 'with very slow execution' do
104
- let(:time0) { 99.9 }
105
- let(:time1) { 100 }
106
103
  it 'asserts failure' do
107
104
  @xcprofiler.report(product_name)
108
- expect(@dangerfile).to have_received(:fail).with('`doSomething()` takes 100.0 ms to build', {})
105
+ expect(@dangerfile).to have_received(:fail)
106
+ .with('[Source.swift] `doSomething()` takes 100.0 ms to build', {})
109
107
  end
110
108
  end
111
109
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-xcprofiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - giginet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-27 00:00:00.000000000 Z
11
+ date: 2017-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcprofiler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: coveralls
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rubocop
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -171,6 +185,7 @@ executables: []
171
185
  extensions: []
172
186
  extra_rdoc_files: []
173
187
  files:
188
+ - ".coveralls.yml"
174
189
  - ".gitignore"
175
190
  - ".rubocop.yml"
176
191
  - ".travis.yml"
@@ -208,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
223
  version: '0'
209
224
  requirements: []
210
225
  rubyforge_project:
211
- rubygems_version: 2.5.2
226
+ rubygems_version: 2.5.1
212
227
  signing_key:
213
228
  specification_version: 4
214
229
  summary: danger plugin for asserting Swift compilation time.