openstudio_measure_tester 0.1.6 → 0.1.7

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: 114965f771ab5429ff6e0a47f9469143723f957a
4
- data.tar.gz: 6880af89a1126f2474f503722ce73746074bf04d
3
+ metadata.gz: 873523e54e5442f1468b7398b0dff3e773fbe280
4
+ data.tar.gz: 04e7b34c93d47e3af0554718bfaf52a8b97e4bb4
5
5
  SHA512:
6
- metadata.gz: 65c48c6e8ebe186696f5a2322dde5899e84bacfadd95510b75cf03e8982bee6137f9ea4d2e36fabb7b103e9211cedb8d228c70ffe6a7f17cc16fadd850299fa2
7
- data.tar.gz: aeb836feeafb27e169a38e1569b0f2fe606ba8df68d8133dd2c29627df23b5084d70f8245af706c09aba56621342b30fcb1192477bf2fe37887cc9e162090688
6
+ metadata.gz: 34d5ee8f5ee06c1c06cca5768e280cc0bead1fae7e3bbb85410e7c5d5256bc3bf1dd681a8cae61ee1ea7b1d258d37652fbe28113b5557967d5db136b958cdf0a
7
+ data.tar.gz: b11fef30aed043abec4a4ea1931620ad8249df59e490870e17f8c13df7bbd5910203f7197b969ac51fcca48ded5dfd3e7263d860757c6c76749f1e7f2b08a870
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # Version 0.1.7
2
+
3
+ * Support running measure tester in the directory of the measure.rb with OpenStudio CLI (e.g. `openstudio measure -r .`)
4
+
1
5
  # Version 0.1.6
2
6
 
3
7
  * Do not require git to run
@@ -76,6 +76,6 @@ class Minitest::Test
76
76
  after = ObjectSpace.count_objects
77
77
  delta = {}
78
78
  before.each { |k, v| delta[k] = v - after[k] if after.key? k }
79
- puts "GC Delta: #{delta}"
79
+ # puts "GC Delta: #{delta}"
80
80
  end
81
81
  end
@@ -65,7 +65,7 @@ module OpenStudioMeasureTester
65
65
  end
66
66
 
67
67
  def parse_results
68
- Dir["#{@path_to_results}/rubocop-results.xml"].each do |file|
68
+ Dir[File.join(@path_to_results,'rubocop-results.xml')].each do |file|
69
69
  puts "Parsing Rubocop report #{file}"
70
70
 
71
71
  measure_names = []
@@ -76,13 +76,22 @@ module OpenStudioMeasureTester
76
76
  puts "Finished reading #{file}"
77
77
 
78
78
  # Go through the XML and find all the measure names first
79
- doc.elements.each('file') do |rc_file|
79
+ doc.elements.each('//checkstyle/file') do |rc_file|
80
80
  @total_files += 1
81
81
  measure_name = rc_file.attributes['name']
82
82
  if measure_name
83
- parts = measure_name.split('/')
84
- if parts.last == 'measure.rb'
85
- measure_names << parts[-2]
83
+ # If the user runs the tests from within the directory (where the measure.rb) file exists, then the
84
+ # measure name is not included in the XML. Therefore, the measure_name will need to be abstracted by
85
+ # the name of the directory relative to where the test_results are.
86
+ if measure_name.include? File::SEPARATOR
87
+ parts = measure_name.split(File::SEPARATOR)
88
+ if parts.last == 'measure.rb'
89
+ measure_names << parts[-2]
90
+ end
91
+ elsif measure_name == 'measure.rb'
92
+ # the measure name must be extracted from the directory
93
+ parts = file.split(File::SEPARATOR)
94
+ measure_names << parts[-4]
86
95
  end
87
96
  end
88
97
  end
@@ -99,12 +108,21 @@ module OpenStudioMeasureTester
99
108
  mhash['files'] = []
100
109
 
101
110
  cn = ''
102
- doc.elements.each('file') do |rc_file|
103
- next unless rc_file.attributes['name'].include? measure_name
111
+ doc.elements.each('//checkstyle/file') do |rc_file|
112
+ # Allow processing when the file is just the measure.rb
113
+ if rc_file.attributes['name'] != 'measure.rb'
114
+ if !rc_file.attributes['name'].include? measure_name
115
+ next
116
+ end
117
+ end
104
118
 
105
119
  # Save off the file information
106
120
  fhash = {}
107
- fhash['file_name'] = rc_file.attributes['name'].split('/')[-1]
121
+ if rc_file.attributes['name'].include? File::SEPARATOR
122
+ fhash['file_name'] = rc_file.attributes['name'].split(File::SEPARATOR)[-1]
123
+ else
124
+ fhash['file_name'] = rc_file.attributes['name']
125
+ end
108
126
  fhash['violations'] = []
109
127
 
110
128
  # get the class name out of the measure file! wow, okay... sure why not.
@@ -27,5 +27,5 @@
27
27
  ########################################################################################################################
28
28
 
29
29
  module OpenStudioMeasureTester
30
- VERSION = '0.1.6'.freeze
30
+ VERSION = '0.1.7'.freeze
31
31
  end
@@ -25,7 +25,6 @@ Gem::Specification.new do |spec|
25
25
  if /^2\.2/.match(RUBY_VERSION)
26
26
  spec.add_dependency 'rubocop', '0.54.0'
27
27
  elsif /^2\.0/.match(RUBY_VERSION)
28
- spec.add_dependency 'nokogiri', '1.6.8'
29
28
  spec.add_dependency 'rainbow', '2.2.2'
30
29
  spec.add_dependency 'rubocop', '0.50.0'
31
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstudio_measure_tester
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Long
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2018-11-05 00:00:00.000000000 Z
14
+ date: 2018-12-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler