bcl 0.5.9 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +21 -0
  3. data/.rubocop.yml +9 -0
  4. data/CHANGELOG.md +66 -0
  5. data/Gemfile +11 -0
  6. data/License.txt +65 -0
  7. data/README.md +40 -0
  8. data/Rakefile +312 -0
  9. data/bcl.gemspec +39 -0
  10. data/lib/bcl.rb +2 -2
  11. data/lib/bcl/component_methods.rb +12 -13
  12. data/lib/bcl/version.rb +1 -1
  13. data/schemas/v2/component_2012_11_08.xsd +291 -0
  14. data/schemas/v2/measure_2013_3_26.xsd +153 -0
  15. data/schemas/v3/common_bcl_v3.xsd +422 -0
  16. data/schemas/v3/component_v3.xsd +445 -0
  17. data/schemas/v3/measure_v3.xsd +496 -0
  18. metadata +70 -77
  19. data/lib/files/downloads/40237ee0-5ea7-0130-ad9b-14109fdf0b37.tar.gz +0 -0
  20. data/lib/files/staged/components/Asphalt_Shingles_1_8_in/Asphalt_Shingles_1_8_in.tar.gz +0 -0
  21. data/lib/files/staged/components/Asphalt_Shingles_1_8_in/component.xml +0 -81
  22. data/lib/files/staged/components/Built_up_Roofing_3_8_in/Built_up_Roofing_3_8_in.tar.gz +0 -0
  23. data/lib/files/staged/components/Built_up_Roofing_3_8_in/component.xml +0 -76
  24. data/lib/files/staged/components/Metal_Surface_1_16_in/Metal_Surface_1_16_in.tar.gz +0 -0
  25. data/lib/files/staged/components/Metal_Surface_1_16_in/component.xml +0 -76
  26. data/lib/files/staged/components/Shingle_Backer_1_4_in/Shingle_Backer_1_4_in.tar.gz +0 -0
  27. data/lib/files/staged/components/Shingle_Backer_1_4_in/component.xml +0 -81
  28. data/lib/files/staged/components/Shingle_Backer_3_8_in/Shingle_Backer_3_8_in.tar.gz +0 -0
  29. data/lib/files/staged/components/Shingle_Backer_3_8_in/component.xml +0 -81
  30. data/lib/files/staged/components/Wood_Shingles_1_4_in/Wood_Shingles_1_4_in.tar.gz +0 -0
  31. data/lib/files/staged/components/Wood_Shingles_1_4_in/component.xml +0 -81
  32. data/lib/files/staged/gather/1/Asphalt_Shingles_1_8_in.tar.gz +0 -0
  33. data/lib/files/staged/gather/1/Built_up_Roofing_3_8_in.tar.gz +0 -0
  34. data/lib/files/staged/gather/1/Metal_Surface_1_16_in.tar.gz +0 -0
  35. data/lib/files/staged/gather/1/Shingle_Backer_1_4_in.tar.gz +0 -0
  36. data/lib/files/staged/gather/1/Shingle_Backer_3_8_in.tar.gz +0 -0
  37. data/lib/files/staged/gather/1/Wood_Shingles_1_4_in.tar.gz +0 -0
  38. data/lib/files/staged/gather/components_1.tar.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e73294b8462def2d2ff8831ec1b3e334efcf47e4
4
- data.tar.gz: 535c60ceb7b0095ec0fe6952d3b4ef0788c9b5d9
2
+ SHA256:
3
+ metadata.gz: f509d5e458bab1b477c6e4695a5333766e6f3e19be91ac2452d87452fcfcd981
4
+ data.tar.gz: ccd36a253abd3c64635959edf253ad4aac87789e95958787d11bda1b1e3dfb9c
5
5
  SHA512:
6
- metadata.gz: 8ebe642bcbf101803db171a0af1916a8bb9b4b883924bc07fd30c25c16614f34ef75733d333607eb1a511a1a70fcf5a8ec8ebae63c0893184f84d0059a54f1fd
7
- data.tar.gz: 7f61168eb018bd9db461ecbd8f96fd0b17d86fe600deaa908e88a1b6675101fb21901322bed63e81710d469bd9df3d51e668a7f2e2f7552385eb5958e0049828
6
+ metadata.gz: 7ebba6c382b8a2d2576a8ffff66c8571161df38a01c6ff5ff17cc0b834cecd995c96ffb29749cde7302aa0650cb957ff859607fc89247b5594f2e691f423e099
7
+ data.tar.gz: 37e1f02ffd32494cbf49f83c04b305e0b7782b6527fe549c758be26ef0f8a683e797e18c1b68a5ecaa809cf750e72cf2184d276e7108f26ce14c3a8025cd3a13
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ .DS_Store
2
+ .bundle
3
+ .idea
4
+ .ruby-version
5
+ .Rhistory
6
+ faraday.log
7
+ gems/
8
+ *.swp
9
+ *.gem
10
+ tmp/*
11
+ rubocop-results.xml
12
+ .rubocop-http*
13
+ Gemfile.lock
14
+ /spec/bcl/output
15
+ /spec/reports
16
+ /spec/api/resources/*.receipt
17
+ measures/
18
+ staged/
19
+ lib/files/staged/
20
+ lib/files/downloads/
21
+ .rubocop-https*
data/.rubocop.yml ADDED
@@ -0,0 +1,9 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'measures/**/*'
4
+ - 'spec/api/resources/measure_example/**/*'
5
+ - 'gems/**/*'
6
+
7
+ inherit_from:
8
+ - http://s3.amazonaws.com/openstudio-resources/styles/rubocop.yml
9
+
data/CHANGELOG.md ADDED
@@ -0,0 +1,66 @@
1
+ # Change Log
2
+
3
+ ## Version 0.6.0
4
+
5
+ * Support Ruby > 2.5
6
+ * Update dependencies
7
+
8
+ ## Version 0.5.9
9
+ * Update copyrights
10
+ * Update rubocop version (security)
11
+ * Updates to support OpenStudio Extension gem
12
+
13
+ ## Version 0.5.8
14
+ * Cleanup code (rubocop)
15
+
16
+ ## Version 0.5.7
17
+ * Update to_underscore method to not break apart EnergyPlus nor OpenStudio
18
+
19
+ ## Version 0.5.6
20
+ * Allow no display name when parsing measure arguments (measure argument does not have setDisplayName)
21
+ * Parse measure display name, description, modeler description, and argument units
22
+ * Add basic validation that prints to the terminal
23
+ * Upgrade spec and ci reporter
24
+ * New branch for development (develop)
25
+
26
+ ## Version 0.5.5
27
+ * Read as binary for .tar.gz
28
+ * When downloading and parsing measures, skip instance where the measure class name is already the directory name.
29
+
30
+ ## Version 0.5.2-4
31
+ * Remove libxml dependency
32
+ * Add OpenStudio static measure parsing method
33
+ * Add translate to CSV from static measures to support OpenStudio-analysis spreadsheet
34
+ * Fix Group ID
35
+ * Pull UUID out of tar.gz files
36
+ * More testing around measures and components API
37
+ * Rubocop
38
+
39
+ ## Version 0.5.1
40
+ * Fix bug when parsing BCL measures and nil arguments
41
+
42
+ ## Version 0.5.0
43
+ * Remove support for Ruby 1.8.7. Only supporting > 1.9.2
44
+ * Remove JSON gem. Using multi_json
45
+ * Removed obsolete tests
46
+ * Removed RestClient in favor of Faraday (used for testing)
47
+
48
+ ## Version 0.4.1
49
+ * Several fixes to previous gem
50
+ * Put required gems into the gemspec
51
+
52
+ ### New Features
53
+ * Able to specify the group_id when you create the component methods
54
+ * Added parsing of BCL measures for extracting arguments
55
+
56
+ ## Version 0.3.7
57
+
58
+ ### New Features
59
+ * Added a search for measures that returns the JSON
60
+ * Added the ability to download a component (measure or component). Result returns the file data that needes to be persisted.
61
+
62
+ ## Version 0.1.7
63
+
64
+ ### New Features
65
+ * Added rspec for testing
66
+ * Made a datatype method in BCL class to resolve the appropriate values per BCL convention (i.e. int, float, string)
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'http://rubygems.org'
2
+ gemspec
3
+
4
+ gem 'rake'
5
+
6
+ group :test do
7
+ gem 'ci_reporter_rspec'
8
+ gem 'rspec', '~> 3.7.0'
9
+ gem 'rubocop', '~> 0.54'
10
+ gem 'rubocop-checkstyle_formatter', '~> 0.4'
11
+ end
data/License.txt ADDED
@@ -0,0 +1,65 @@
1
+ Copyright (c) 2008-2019, Alliance for Sustainable Energy.
2
+ All rights reserved.
3
+
4
+ NOTICE
5
+
6
+ This computer software (Software) is code in development prepared by the
7
+ Alliance for Sustainable Energy, (hereinafter the "Contractor"), under
8
+ Contract DE-AC36-08GO28308 (Contract) with the Department of Energy (DOE).
9
+ The United States Government has been granted for itself and others acting
10
+ on its behalf a paid-up, non-exclusive, irrevocable, worldwide license in
11
+ the Software to reproduce, prepare derivative works, and perform publicly
12
+ and display publicly. Beginning five (5) years after the date permission
13
+ to assert copyright is obtained from the DOE, and subject to any
14
+ subsequent five (5) year renewals, the United States Government is granted
15
+ for itself and others acting on its behalf a paid-up, non-exclusive,
16
+ irrevocable, worldwide license in the Software to reproduce, prepare
17
+ derivative works, distribute copies to the public, perform publicly and
18
+ display publicly, and to permit others to do so. If the Contractor ceases
19
+ to make this computer software available, it may be obtained from DOE's
20
+ Office of Scientific and Technical Information's Energy Science and
21
+ Technology Software Center (ESTSC) at P.O. Box 1020, Oak Ridge, TN 37831-
22
+ 1020.
23
+
24
+ DISCLAIMER
25
+
26
+ THIS SOFTWARE IS PROVIDED BY THE CONTRACTOR "AS IS" AND ANY EXPRESS OR
27
+ IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
29
+ NO EVENT SHALL THE CONTRACTOR OR THE U.S. GOVERNMENT BE LIABLE FOR ANY
30
+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER,
31
+ INCLUDING BUT NOT LIMITED TO CLAIMS ASSOCIATED WITH THE LOSS OF DATA OR
32
+ PROFITS, WHICH MAY RESULT FROM AN ACTION IN CONTRACT, NEGLIGENCE OR OTHER
33
+ TORTIOUS CLAIM THAT ARISES OUT OF OR IN CONNECTION WITH THE ACCESS, USE OR
34
+ PERFORMANCE OF THIS SOFTWARE.
35
+
36
+ YOU AGREE TO INDEMNIFY DOE/NREL/ALLIANCE, AND ITS SUBSIDIARIES,
37
+ AFFILIATES, OFFICERS, AGENTS, AND EMPLOYEES AGAINST ANY CLAIM OR DEMAND,
38
+ INCLUDING REASONABLE ATTORNEYS' FEES, RELATED TO YOUR USE OF THESE DATA.
39
+
40
+ DOE/NREL/Alliance is not obligated to provide the user with any support,
41
+ consulting, training or assistance of any kind with regard to the use of
42
+ these Data or to provide the user with any updates, revisions or new
43
+ versions of these Data.
44
+
45
+ The names DOE/NREL/Alliance may not be used in any advertising or
46
+ publicity to endorse or promote any products or commercial entities unless
47
+ specific written permission is obtained from DOE/NREL/Alliance.
48
+
49
+
50
+ OPEN SOURCE LICENSE
51
+
52
+ This library is free software; you can redistribute it and/or
53
+ modify it under the terms of the GNU Lesser General Public
54
+ License as published by the Free Software Foundation; either
55
+ version 2.1 of the License, or (at your option) any later version.
56
+
57
+ This library is distributed in the hope that it will be useful,
58
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
59
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
60
+ Lesser General Public License for more details here.
61
+
62
+ You should have received a copy of the GNU Lesser General Public
63
+ License along with this library; if not, write to the Free Software
64
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
65
+
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # BCL Gem
2
+
3
+ All the methods to build, test, and release the gem available as rake tasks via bundler/gem_tasks. Note that you can see all the rake tasks by calling `rake -T` at the command line.
4
+
5
+ ## Building BCL Gem
6
+
7
+ If this is a new version that will be release first edit the ./lib/bcl/version.rb file and increment the version number. This will automatically propagate through the build process.
8
+
9
+ `rake build`
10
+
11
+ To install:
12
+
13
+ `rake install`
14
+
15
+ ## Releasing Gem
16
+
17
+ Note: Releasing the gem will call the build command, tag it in Git, and push to rubygems.
18
+
19
+ run `rake release`
20
+
21
+ ## Testing
22
+
23
+ `rake spec`
24
+
25
+ ## Uninstall
26
+
27
+ run `gem uninstall bcl -a`
28
+
29
+ ## Workflow for pushing content to BCL
30
+
31
+ run `rake bcl:stage_and_upload[/path/to/content, resetFlag]`
32
+
33
+ where `path/to/content` is a path to the directory of measures or components to upload and `resetFlag` is a boolean flag indicating whether to clear already staged content and receipt files (true), or to keep the staged content and receipt files (false).
34
+
35
+ Staging and Uploading tasks can be called separately:
36
+
37
+ `rake bcl:stage_content[/path/to/content, resetFlag]`
38
+
39
+ `rake bcl:upload_content[resetFlag]`
40
+
data/Rakefile ADDED
@@ -0,0 +1,312 @@
1
+ require 'bundler'
2
+ Bundler.setup
3
+
4
+ require 'rake'
5
+ require 'rspec/core/rake_task'
6
+ require 'bundler/gem_tasks'
7
+
8
+ require 'pathname'
9
+
10
+ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
11
+ require 'bcl'
12
+ require 'bcl/version'
13
+
14
+ RSpec::Core::RakeTask.new('spec') do |spec|
15
+ puts 'running tests...'
16
+ spec.rspec_opts = ['--format', 'progress']
17
+ spec.pattern = 'spec/**/*_spec.rb'
18
+ end
19
+
20
+ namespace :test do
21
+ desc 'test search all functionality'
22
+ task :search_all do
23
+ # search with all=true
24
+ # ensure that a) results are returned (> 0) and b) [:measure][:name] is a string
25
+ # search with all=false
26
+ # ensure the same a) and b) as above
27
+ bcl = BCL::ComponentMethods.new
28
+ bcl.login
29
+ results = bcl.search('Add', 'show_rows=10', false)
30
+ puts "there are #{results[:result].count} results"
31
+ results[:result].each do |res|
32
+ puts (res[:measure][:name]).to_s
33
+ end
34
+ end
35
+
36
+ desc 'test measure upload'
37
+ task :measure_upload do
38
+ bcl = BCL::ComponentMethods.new
39
+ bcl.login
40
+ filename = "#{File.dirname(__FILE__)}/spec/api/resources/measure_original.tar.gz"
41
+ valid, res = bcl.push_content(filename, false, 'nrel_measure')
42
+ end
43
+
44
+ desc 'test the BCL login credentials defined in .bcl/config.yml'
45
+ task :bcl_login do
46
+ bcl = BCL::ComponentMethods.new
47
+ bcl.login
48
+ end
49
+
50
+ desc 'test component spreadsheet'
51
+ task :spreadsheet do
52
+ bclcomponents = BCL::ComponentFromSpreadsheet.new(File.expand_path('lib/files/Components.xls', __dir__), ['Roofing'])
53
+ bclcomponents.save(File.expand_path('lib/files/staged', __dir__))
54
+ end
55
+
56
+ desc 'test measure download'
57
+ task :measure_download do
58
+ # find a component with keyword 'Ashrae'
59
+ query = 'ashrae'
60
+ filter = 'fq[]=bundle:nrel_component&show_rows=3'
61
+
62
+ bcl = BCL::ComponentMethods.new
63
+ bcl.login
64
+
65
+ results = bcl.search(query, filter)
66
+ uids = []
67
+ results[:result].each do |result|
68
+ uids << result[:component][:uuid]
69
+ end
70
+
71
+ content = bcl.download_component(uids[0])
72
+
73
+ # save as tar.gz
74
+ download_path = File.expand_path('lib/files/downloads', __dir__)
75
+ FileUtils.mkdir(download_path) if !File.exist? download_path
76
+ f = File.open("#{download_path}/#{uids[0]}.tar.gz", 'wb')
77
+ f.write(content)
78
+ end
79
+ end
80
+
81
+ namespace :bcl do
82
+ STAGED_PATH = Pathname.new(Dir.pwd + '/staged')
83
+
84
+ # initialize BCL and login
85
+ bcl = BCL::ComponentMethods.new
86
+ bcl.login
87
+
88
+ # to call: rake "bcl:stage_and_upload[/path/to/your/content/directory, true]"
89
+ # content_path arg: path to components or measures to upload
90
+ # reset flag:
91
+ # If TRUE: content in the staged directory will be re-generated and receipt files will be deleted.
92
+ # If FALSE, content that already exists in the staged directory will remain and content with receipt files will not be re-uploaded.
93
+ desc 'stage and push/update all content in a repo'
94
+ task :stage_and_upload, [:content_path, :reset] do |t, args|
95
+ options = { reset: false }
96
+ options[:content_path] = Pathname.new args[:content_path]
97
+ if args[:reset].to_s == 'true'
98
+ options[:reset] = true
99
+ end
100
+
101
+ current_dir = Dir.pwd
102
+
103
+ # stage content
104
+ Rake.application.invoke_task("bcl:stage_content[#{options[:content_path]}, #{options[:reset]}]")
105
+ Dir.chdir(current_dir)
106
+
107
+ # upload (new and updated). pass in skip flag
108
+ Rake.application.invoke_task("bcl:upload_content[#{options[:reset]}]")
109
+ end
110
+
111
+ # to call: rake "bcl:upload_content[true]"
112
+ # TODO: catch errors and continue
113
+ desc 'upload/update BCL content'
114
+ task :upload_content, [:reset] do |t, args|
115
+ # process options
116
+ options = { reset: false }
117
+ if args[:reset].to_s == 'true'
118
+ options[:reset] = true
119
+ end
120
+
121
+ total_count = 0
122
+ successes = 0
123
+ errors = 0
124
+ skipped = 0
125
+
126
+ # grab all the new measure and component tar files and push to bcl
127
+ ['measure', 'component'].each do |content_type|
128
+ items = []
129
+ paths = Pathname.glob(STAGED_PATH.to_s + "/push/#{content_type}/*.tar.gz")
130
+ paths.each do |path|
131
+ # puts path
132
+ items << path.to_s
133
+ end
134
+
135
+ items.each do |item|
136
+ puts item.split('/').last
137
+ total_count += 1
138
+
139
+ receipt_file = File.dirname(item) + '/' + File.basename(item, '.tar.gz') + '.receipt'
140
+ if !options[:reset] && File.exist?(receipt_file)
141
+ skipped += 1
142
+ puts 'SKIP: receipt file found'
143
+ next
144
+ end
145
+
146
+ valid, res = bcl.push_content(item, true, "nrel_#{content_type}")
147
+ if valid
148
+ successes += 1
149
+ else
150
+ errors += 1
151
+ if res.key?(:error)
152
+ puts " ERROR MESSAGE: #{res[:error]}"
153
+ else
154
+ puts "ERROR: #{res.inspect.chomp}"
155
+ end
156
+ end
157
+ puts '', '---'
158
+ end
159
+ end
160
+
161
+ # grab all the updated content (measures and components) tar files and push to bcl
162
+ items = []
163
+ paths = Pathname.glob(STAGED_PATH.to_s + '/update/*.tar.gz')
164
+ paths.each do |path|
165
+ # puts path
166
+ items << path.to_s
167
+ end
168
+ items.each do |item|
169
+ puts item.split('/').last
170
+ total_count += 1
171
+
172
+ receipt_file = File.dirname(item) + '/' + File.basename(item, '.tar.gz') + '.receipt'
173
+ if !options[:reset] && File.exist?(receipt_file)
174
+ skipped += 1
175
+ puts 'SKIP: receipt file found'
176
+ next
177
+ end
178
+
179
+ valid, res = bcl.update_content(item, true)
180
+ if valid
181
+ successes += 1
182
+ else
183
+ errors += 1
184
+ if res.key?(:error)
185
+ puts " ERROR MESSAGE: #{res[:error]}"
186
+ else
187
+ puts "ERROR MESSAGE: #{res.inspect.chomp}"
188
+ end
189
+ end
190
+ puts '', '---'
191
+ end
192
+
193
+ puts "****UPLOAD DONE**** #{total_count} total, #{successes} success, #{errors} failures, #{skipped} skipped"
194
+ end
195
+
196
+ # to call: rake "bcl:stage_content[/path/to/your/content/directory, true]"
197
+ desc 'stage content for BCL'
198
+ task :stage_content, [:content_path, :reset] do |t, args|
199
+ # process options
200
+ options = { reset: false }
201
+ options[:content_path] = Pathname.new args[:content_path]
202
+ if args[:reset].to_s == 'true'
203
+ options[:reset] = true
204
+ end
205
+ puts "OPTIONS -- content_path: #{options[:content_path]}, reset: #{options[:reset]}"
206
+
207
+ FileUtils.mkdir_p(STAGED_PATH)
208
+
209
+ # delete existing tarballs if reset is true
210
+ if options[:reset]
211
+ FileUtils.rm_rf(Dir.glob("#{STAGED_PATH}/*"))
212
+ end
213
+
214
+ # create new and existing directories
215
+ FileUtils.mkdir_p(STAGED_PATH.to_s + '/update')
216
+ FileUtils.mkdir_p(STAGED_PATH.to_s + '/push/component')
217
+ FileUtils.mkdir_p(STAGED_PATH.to_s + '/push/measure')
218
+
219
+ # keep track of noop, update, push
220
+ noops = 0
221
+ new_ones = 0
222
+ updates = 0
223
+
224
+ # get all content directories to process
225
+ dirs = Dir.glob("#{options[:content_path]}/*")
226
+
227
+ dirs.each do |dir|
228
+ next if dir.include?('Rakefile')
229
+
230
+ current_d = Dir.pwd
231
+ content_name = File.basename(dir)
232
+ puts '', '---'
233
+ puts "Generating #{content_name}"
234
+
235
+ Dir.chdir(dir)
236
+
237
+ # figure out whether to upload new or update existing
238
+ files = Pathname.glob('**/*')
239
+ uuid = nil
240
+ vid = nil
241
+ content_type = 'measure'
242
+
243
+ paths = []
244
+ files.each do |file|
245
+ # don't tar tests/outputs directory
246
+ next if file.to_s.start_with?('tests/output') # From measure testing process
247
+ next if file.to_s.start_with?('tests/test') # From openstudio-measure-tester-gem
248
+ next if file.to_s.start_with?('tests/coverage') # From openstudio-measure-tester-gem
249
+ next if file.to_s.start_with?('test_results') # From openstudio-measure-tester-gem
250
+
251
+ paths << file.to_s
252
+ if file.to_s =~ /^.{0,2}component.xml$/ || file.to_s =~ /^.{0,2}measure.xml$/
253
+ if file.to_s =~ /^.{0,2}component.xml$/
254
+ content_type = 'component'
255
+ end
256
+ # extract uuid and vid
257
+ uuid, vid = bcl.uuid_vid_from_xml(file)
258
+ end
259
+ end
260
+ puts "UUID: #{uuid}, VID: #{vid}"
261
+
262
+ # note: if uuid is missing, will assume new content
263
+ action = bcl.search_by_uuid(uuid, vid)
264
+ puts "#{content_name} ACTION TO TAKE: #{action}"
265
+ # new content functionality needs to know if measure or component. update is agnostic.
266
+ if action == 'noop' # ignore up-to-date content
267
+ puts " - WARNING: local #{content_name} uuid and vid match BCL... no update will be performed"
268
+ noops += 1
269
+ next
270
+ elsif action == 'update'
271
+ # puts "#{content_name} labeled as update for BCL"
272
+ destination = STAGED_PATH.join(action, "#{content_name}.tar.gz")
273
+ updates += 1
274
+ elsif action == 'push'
275
+ # puts "#{content_name} labeled as new content for BCL"
276
+ destination = STAGED_PATH.join(action, content_type, "#{content_name}.tar.gz")
277
+ new_ones += 1
278
+ end
279
+
280
+ puts "destination: #{destination}"
281
+
282
+ # copy over only if 'reset_receipts' is set to TRUE. otherwise ignore if file exists already
283
+ if File.exist?(destination)
284
+ if options[:reset]
285
+ FileUtils.rm(destination)
286
+ BCL.tarball(destination, paths)
287
+ else
288
+ puts "*** WARNING: File #{content_name}.tar.gz already exists in staged directory... keeping existing file. To overwrite, set reset_receipts arg to true ***"
289
+ end
290
+ else
291
+ BCL.tarball(destination, paths)
292
+ end
293
+ Dir.chdir(current_d)
294
+ end
295
+ puts '', "****STAGING DONE**** #{new_ones} new content, #{updates} updates, #{noops} skipped (already up-to-date on BCL)", ''
296
+ end
297
+ end
298
+
299
+ require 'rubocop/rake_task'
300
+ desc 'Run RuboCop on the lib directory'
301
+ RuboCop::RakeTask.new(:rubocop) do |task|
302
+ # only show the files with failures
303
+ task.options = ['--no-color', '--out=rubocop-results.xml']
304
+ task.formatters = ['RuboCop::Formatter::CheckstyleFormatter']
305
+ task.requires = ['rubocop/formatter/checkstyle_formatter']
306
+ # don't abort rake on failure
307
+ task.fail_on_error = false
308
+ end
309
+
310
+ desc 'Default task run rspec tests'
311
+ task test: :spec
312
+ task default: :spec