bcl 0.1.9 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bcl.rb +2 -0
- data/lib/bcl/bcl_xml.rb +130 -0
- data/lib/bcl/component_methods.rb +25 -29
- data/lib/bcl/component_spreadsheet.rb +9 -1
- data/lib/bcl/component_xml.rb +17 -130
- data/lib/bcl/current_taxonomy.json +0 -0
- data/lib/bcl/current_taxonomy.xml +5699 -1283
- data/lib/bcl/master_taxonomy.rb +476 -476
- data/lib/bcl/measure_xml.rb +54 -0
- data/lib/bcl/tar_ball.rb +17 -20
- data/lib/bcl/version.rb +1 -1
- metadata +27 -11
@@ -0,0 +1,54 @@
|
|
1
|
+
######################################################################
|
2
|
+
# Copyright (c) 2008-2013, 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 th e 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
|
+
# Provides programmatic access to the component.xsd schema needed for
|
21
|
+
# generating the component information that will be uploaded to
|
22
|
+
# the Building Component Library.
|
23
|
+
|
24
|
+
require 'rubygems'
|
25
|
+
require 'pathname'
|
26
|
+
require 'fileutils'
|
27
|
+
require 'csv'
|
28
|
+
|
29
|
+
# required gems
|
30
|
+
require 'builder' #gem install builder (creates xml files)
|
31
|
+
require 'bcl/tar_ball'
|
32
|
+
require 'bcl/bcl_xml'
|
33
|
+
|
34
|
+
module BCL
|
35
|
+
|
36
|
+
class Measure
|
37
|
+
def initialize(save_path)
|
38
|
+
super(save_path)
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
def read_measure_xml(filepath)
|
43
|
+
xmlfile = File.open(filepath, 'r').read
|
44
|
+
|
45
|
+
@xml = LibXML::XML::Document.string(xmlfile)
|
46
|
+
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/lib/bcl/tar_ball.rb
CHANGED
@@ -19,35 +19,32 @@
|
|
19
19
|
|
20
20
|
require 'rubygems'
|
21
21
|
|
22
|
-
# require gems
|
23
22
|
require 'zlib' #gem install zliby
|
24
23
|
require 'archive/tar/minitar' #gem install archive-tar-minitar
|
25
24
|
|
26
25
|
module BCL
|
27
26
|
|
28
|
-
|
27
|
+
module_function
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
puts "[TarBall] Could not file file: #{fi}"
|
40
|
-
end
|
29
|
+
def tarball(destination, paths)
|
30
|
+
Zlib::GzipWriter.open(destination) do |gzip|
|
31
|
+
out = Archive::Tar::Minitar::Output.new(gzip)
|
32
|
+
|
33
|
+
paths.each do |fi|
|
34
|
+
if File.exists?(fi)
|
35
|
+
Archive::Tar::Minitar.pack_file(fi, out)
|
36
|
+
else
|
37
|
+
puts "[TarBall] ERROR Could not file file: #{fi}"
|
41
38
|
end
|
42
|
-
puts "[TarBall] Finished #{destination}"
|
43
|
-
out.close
|
44
39
|
end
|
40
|
+
out.close
|
45
41
|
end
|
42
|
+
end
|
46
43
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
def extract_tarball(filename, destination)
|
45
|
+
Zlib::GzipReader.open(filename) {|gz|
|
46
|
+
Archive::Tar::Minitar.unpack(gz, destination)
|
47
|
+
}
|
48
|
+
end
|
52
49
|
|
53
50
|
end # module BCL
|
data/lib/bcl/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Macumber
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2013-03-
|
21
|
+
date: 2013-03-26 00:00:00 -06:00
|
22
22
|
default_executable:
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id001
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
39
|
+
name: libxml-ruby
|
40
40
|
prerelease: false
|
41
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
type: :runtime
|
51
51
|
version_requirements: *id002
|
52
52
|
- !ruby/object:Gem::Dependency
|
53
|
-
name:
|
53
|
+
name: builder
|
54
54
|
prerelease: false
|
55
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
@@ -64,7 +64,7 @@ dependencies:
|
|
64
64
|
type: :runtime
|
65
65
|
version_requirements: *id003
|
66
66
|
- !ruby/object:Gem::Dependency
|
67
|
-
name:
|
67
|
+
name: zliby
|
68
68
|
prerelease: false
|
69
69
|
requirement: &id004 !ruby/object:Gem::Requirement
|
70
70
|
none: false
|
@@ -78,7 +78,7 @@ dependencies:
|
|
78
78
|
type: :runtime
|
79
79
|
version_requirements: *id004
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
81
|
+
name: archive-tar-minitar
|
82
82
|
prerelease: false
|
83
83
|
requirement: &id005 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
@@ -92,7 +92,7 @@ dependencies:
|
|
92
92
|
type: :runtime
|
93
93
|
version_requirements: *id005
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
95
|
+
name: mongo
|
96
96
|
prerelease: false
|
97
97
|
requirement: &id006 !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
type: :runtime
|
107
107
|
version_requirements: *id006
|
108
108
|
- !ruby/object:Gem::Dependency
|
109
|
-
name:
|
109
|
+
name: json_pure
|
110
110
|
prerelease: false
|
111
111
|
requirement: &id007 !ruby/object:Gem::Requirement
|
112
112
|
none: false
|
@@ -119,6 +119,20 @@ dependencies:
|
|
119
119
|
version: "0"
|
120
120
|
type: :runtime
|
121
121
|
version_requirements: *id007
|
122
|
+
- !ruby/object:Gem::Dependency
|
123
|
+
name: rest-client
|
124
|
+
prerelease: false
|
125
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
hash: 3
|
131
|
+
segments:
|
132
|
+
- 0
|
133
|
+
version: "0"
|
134
|
+
type: :runtime
|
135
|
+
version_requirements: *id008
|
122
136
|
description: This gem contains helper methods for generating the Component XML file needed to upload files to the Building Component Library. It also contains the classes needed for logging in via the api and uploading generating components
|
123
137
|
email: Nicholas.Long@nrel.gov
|
124
138
|
executables: []
|
@@ -128,12 +142,14 @@ extensions: []
|
|
128
142
|
extra_rdoc_files: []
|
129
143
|
|
130
144
|
files:
|
145
|
+
- lib/bcl/bcl_xml.rb
|
131
146
|
- lib/bcl/component_methods.rb
|
132
147
|
- lib/bcl/component_spreadsheet.rb
|
133
148
|
- lib/bcl/component_xml.rb
|
134
149
|
- lib/bcl/current_taxonomy.json
|
135
150
|
- lib/bcl/current_taxonomy.xml
|
136
151
|
- lib/bcl/master_taxonomy.rb
|
152
|
+
- lib/bcl/measure_xml.rb
|
137
153
|
- lib/bcl/mongo_to_component.rb
|
138
154
|
- lib/bcl/tar_ball.rb
|
139
155
|
- lib/bcl/version.rb
|