bcl 0.5.3 → 0.5.4
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.
- checksums.yaml +4 -4
- data/lib/bcl/base_xml.rb +33 -16
- data/lib/bcl/component.rb +388 -390
- data/lib/bcl/component_from_spreadsheet.rb +34 -37
- data/lib/bcl/component_methods.rb +864 -790
- data/lib/bcl/component_spreadsheet.rb +295 -309
- data/lib/bcl/core_ext.rb +38 -6
- data/lib/bcl/master_taxonomy.rb +533 -552
- data/lib/bcl/tar_ball.rb +78 -80
- data/lib/bcl/version.rb +2 -2
- data/lib/bcl.rb +41 -34
- metadata +84 -14
data/lib/bcl/tar_ball.rb
CHANGED
@@ -1,80 +1,78 @@
|
|
1
|
-
######################################################################
|
2
|
-
# Copyright (c) 2008-
|
3
|
-
# All rights reserved.
|
4
|
-
#
|
5
|
-
# This library is free software; you can redistribute it and/or
|
6
|
-
# modify it under the terms of the GNU Lesser General Public
|
7
|
-
# License as published by the Free Software Foundation; either
|
8
|
-
# version 2.1 of the License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This library is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
# Lesser General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Lesser General Public
|
16
|
-
# License along with this library; if not, write to the Free Software
|
17
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
-
######################################################################
|
19
|
-
|
20
|
-
module BCL
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
full_destination
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
#
|
57
|
-
# - The
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
fileList
|
75
|
-
fileList
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
1
|
+
######################################################################
|
2
|
+
# Copyright (c) 2008-2014, Alliance for Sustainable Energy.
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
######################################################################
|
19
|
+
|
20
|
+
module BCL
|
21
|
+
module_function
|
22
|
+
|
23
|
+
# tarball multiple paths recursively to destination
|
24
|
+
def tarball(destination, paths)
|
25
|
+
# check for filepath length limit
|
26
|
+
full_destination = File.expand_path(destination)
|
27
|
+
if full_destination.length > 259 # 256 chars max; "C:\" doesn't count
|
28
|
+
puts "[TarBall] ERROR cannot generate #{destination} because path exceeds 256 char limit. shorten component name by at least by #{full_destination.length - 259} chars"
|
29
|
+
return
|
30
|
+
end
|
31
|
+
|
32
|
+
Zlib::GzipWriter.open(destination) do |gzip|
|
33
|
+
out = Archive::Tar::Minitar::Output.new(gzip)
|
34
|
+
|
35
|
+
paths.each do |fi|
|
36
|
+
if File.exist?(fi)
|
37
|
+
Archive::Tar::Minitar.pack_file(fi, out)
|
38
|
+
else
|
39
|
+
puts "[TarBall] ERROR Could not file file: #{fi}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
out.close
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def extract_tarball(filename, destination)
|
47
|
+
Zlib::GzipReader.open(filename) do |gz|
|
48
|
+
Archive::Tar::Minitar.unpack(gz, destination)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def create_zip(_destination, paths)
|
53
|
+
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
|
54
|
+
paths.each do |fi|
|
55
|
+
# Two arguments:
|
56
|
+
# - The name of the file as it will appear in the archive
|
57
|
+
# - The original file, including the path to find it
|
58
|
+
zipfile.add(fi.basename, fi)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def extract_zip(filename, destination, delete_zip = false)
|
64
|
+
Zip::File.open(filename) do |zip_file|
|
65
|
+
zip_file.each do |f|
|
66
|
+
f_path = File.join(destination, f.name)
|
67
|
+
FileUtils.mkdir_p(File.dirname(f_path))
|
68
|
+
zip_file.extract(f, f_path) unless File.exist? f_path
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
if delete_zip
|
73
|
+
fileList = []
|
74
|
+
fileList << filename
|
75
|
+
FileUtils.rm(fileList)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/lib/bcl/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
######################################################################
|
2
|
-
# Copyright (c) 2008-
|
2
|
+
# Copyright (c) 2008-2014, Alliance for Sustainable Energy.
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
@@ -18,5 +18,5 @@
|
|
18
18
|
######################################################################
|
19
19
|
|
20
20
|
module BCL
|
21
|
-
VERSION =
|
21
|
+
VERSION = '0.5.4'
|
22
22
|
end
|
data/lib/bcl.rb
CHANGED
@@ -1,34 +1,41 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require 'base64'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'openstudio'
|
6
|
-
$openstudio_gem = true
|
7
|
-
rescue LoadError => e
|
8
|
-
$openstudio_gem = false
|
9
|
-
puts 'OpenStudio did not load, but most functionality is still available. Will continue...'
|
10
|
-
end
|
11
|
-
|
12
|
-
# file formatters
|
13
|
-
require 'yaml'
|
14
|
-
require 'multi_json'
|
15
|
-
require '
|
16
|
-
require '
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
require '
|
21
|
-
require '
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
require '
|
26
|
-
|
27
|
-
require 'bcl/
|
28
|
-
require 'bcl/
|
29
|
-
require 'bcl/
|
30
|
-
require 'bcl/
|
31
|
-
require 'bcl/
|
32
|
-
require 'bcl/
|
33
|
-
require 'bcl/
|
34
|
-
|
1
|
+
require 'pathname'
|
2
|
+
require 'base64'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'openstudio'
|
6
|
+
$openstudio_gem = true
|
7
|
+
rescue LoadError => e
|
8
|
+
$openstudio_gem = false
|
9
|
+
puts 'OpenStudio did not load, but most functionality is still available. Will continue...'
|
10
|
+
end
|
11
|
+
|
12
|
+
# file formatters
|
13
|
+
require 'yaml'
|
14
|
+
require 'multi_json'
|
15
|
+
require 'builder'
|
16
|
+
require 'uuid'
|
17
|
+
require 'net/https'
|
18
|
+
|
19
|
+
# TODO: can we condense these into one?
|
20
|
+
require 'archive/tar/minitar'
|
21
|
+
require 'zlib'
|
22
|
+
require 'zip'
|
23
|
+
|
24
|
+
# ability to write spreadsheets
|
25
|
+
require 'rubyXL'
|
26
|
+
|
27
|
+
require 'bcl/core_ext'
|
28
|
+
require 'bcl/base_xml'
|
29
|
+
require 'bcl/component_spreadsheet'
|
30
|
+
require 'bcl/component_from_spreadsheet'
|
31
|
+
require 'bcl/component'
|
32
|
+
require 'bcl/component_methods'
|
33
|
+
require 'bcl/tar_ball'
|
34
|
+
require 'bcl/master_taxonomy'
|
35
|
+
require 'bcl/version'
|
36
|
+
|
37
|
+
# Some global structures
|
38
|
+
|
39
|
+
WorksheetStruct = Struct.new(:name, :components)
|
40
|
+
HeaderStruct = Struct.new(:name, :children)
|
41
|
+
ComponentStruct = Struct.new(:row, :name, :uid, :version_id, :headers, :values)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Macumber
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-07-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: uuid
|
@@ -84,7 +84,7 @@ dependencies:
|
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
|
-
name:
|
87
|
+
name: yamler
|
88
88
|
requirement: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
90
|
- - '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
|
-
name:
|
101
|
+
name: faraday
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
104
|
- - '>='
|
@@ -112,7 +112,7 @@ dependencies:
|
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
|
-
name:
|
115
|
+
name: roo
|
116
116
|
requirement: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
118
|
- - '>='
|
@@ -126,7 +126,7 @@ dependencies:
|
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
128
|
- !ruby/object:Gem::Dependency
|
129
|
-
name:
|
129
|
+
name: nokogiri
|
130
130
|
requirement: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
132
|
- - '>='
|
@@ -140,7 +140,7 @@ dependencies:
|
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
- !ruby/object:Gem::Dependency
|
143
|
-
name:
|
143
|
+
name: rubyzip
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
145
145
|
requirements:
|
146
146
|
- - '>='
|
@@ -154,7 +154,7 @@ dependencies:
|
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: '0'
|
156
156
|
- !ruby/object:Gem::Dependency
|
157
|
-
name:
|
157
|
+
name: rubyXL
|
158
158
|
requirement: !ruby/object:Gem::Requirement
|
159
159
|
requirements:
|
160
160
|
- - '>='
|
@@ -168,19 +168,89 @@ dependencies:
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
- !ruby/object:Gem::Dependency
|
171
|
-
name:
|
171
|
+
name: rake
|
172
172
|
requirement: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
|
-
- -
|
174
|
+
- - ~>
|
175
175
|
- !ruby/object:Gem::Version
|
176
|
-
version: '
|
177
|
-
type: :
|
176
|
+
version: '10.1'
|
177
|
+
type: :development
|
178
178
|
prerelease: false
|
179
179
|
version_requirements: !ruby/object:Gem::Requirement
|
180
180
|
requirements:
|
181
|
-
- -
|
181
|
+
- - ~>
|
182
182
|
- !ruby/object:Gem::Version
|
183
|
-
version: '
|
183
|
+
version: '10.1'
|
184
|
+
- !ruby/object:Gem::Dependency
|
185
|
+
name: rspec
|
186
|
+
requirement: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ~>
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '3.0'
|
191
|
+
type: :development
|
192
|
+
prerelease: false
|
193
|
+
version_requirements: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - ~>
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '3.0'
|
198
|
+
- !ruby/object:Gem::Dependency
|
199
|
+
name: rubocop
|
200
|
+
requirement: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - ~>
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: 0.24.1
|
205
|
+
type: :development
|
206
|
+
prerelease: false
|
207
|
+
version_requirements: !ruby/object:Gem::Requirement
|
208
|
+
requirements:
|
209
|
+
- - ~>
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: 0.24.1
|
212
|
+
- !ruby/object:Gem::Dependency
|
213
|
+
name: rubocop-checkstyle_formatter
|
214
|
+
requirement: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - ~>
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: 0.1.1
|
219
|
+
type: :development
|
220
|
+
prerelease: false
|
221
|
+
version_requirements: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - ~>
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: 0.1.1
|
226
|
+
- !ruby/object:Gem::Dependency
|
227
|
+
name: ci_reporter
|
228
|
+
requirement: !ruby/object:Gem::Requirement
|
229
|
+
requirements:
|
230
|
+
- - ~>
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: 1.9.1
|
233
|
+
type: :development
|
234
|
+
prerelease: false
|
235
|
+
version_requirements: !ruby/object:Gem::Requirement
|
236
|
+
requirements:
|
237
|
+
- - ~>
|
238
|
+
- !ruby/object:Gem::Version
|
239
|
+
version: 1.9.1
|
240
|
+
- !ruby/object:Gem::Dependency
|
241
|
+
name: rspec-legacy_formatters
|
242
|
+
requirement: !ruby/object:Gem::Requirement
|
243
|
+
requirements:
|
244
|
+
- - ~>
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: 1.0.0
|
247
|
+
type: :development
|
248
|
+
prerelease: false
|
249
|
+
version_requirements: !ruby/object:Gem::Requirement
|
250
|
+
requirements:
|
251
|
+
- - ~>
|
252
|
+
- !ruby/object:Gem::Version
|
253
|
+
version: 1.0.0
|
184
254
|
description: This gem contains helper methods for generating the Component XML file
|
185
255
|
needed to upload files to the Building Component Library. It also contains the classes
|
186
256
|
needed for logging in via the api and uploading generating components
|