building_sync_rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +32 -0
- data/README.rdoc +3 -0
- data/Rakefile +37 -0
- data/WARRANTY.txt +22 -0
- data/app/assets/config/manifest.js +3 -0
- data/bin/rails +12 -0
- data/config/initializers/BuildingSync_initializer.rb +11 -0
- data/config/initializers/soap4r_ns_fix.rb +55 -0
- data/config/initializers/soap4r_xsd_datatypes_fix.rb +28 -0
- data/config/routes.rb +2 -0
- data/lib/BuildingSync.rb +33688 -0
- data/lib/BuildingSync_mapper.rb +8 -0
- data/lib/BuildingSync_mapping_registry.rb +15362 -0
- data/lib/building_sync_rails/engine.rb +15 -0
- data/lib/building_sync_rails/version.rb +3 -0
- data/lib/building_sync_rails.rb +5 -0
- data/lib/building_sync_tk/factory.rb +186 -0
- data/lib/building_sync_tk/inflector.rb +27 -0
- data/lib/building_sync_tk/memoization.rb +50 -0
- data/lib/building_sync_tk/model.rb +37 -0
- data/lib/building_sync_tk/version.rb +3 -0
- data/lib/building_sync_tk.rb +12 -0
- data/lib/tasks/building_sync_rails_tasks.rake +157 -0
- data/public/BuildingSync.xsd +16859 -0
- data/public/GreenBuildingXML_Ver6.01.xsd +7113 -0
- data/test/building_sync_rails_test.rb +7 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +3 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +25 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/to_time_preserves_timezone.rb +10 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/log/development.log +24 -0
- data/test/dummy/log/test.log +48 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/test_helper.rb +21 -0
- metadata +226 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1fe3d5f6d03ac7aba8e573fe13ba5eeb034dba5ad73618ba2f031774ce542aa0
|
4
|
+
data.tar.gz: 65372a476e097980bfc6b46f7bfb61e4882bf73df3dac1b9613958db99200bc8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d1e7ee3306bc267d8b8cab773c54922552e1a672b5453d126c5fb2a7ecec4863fd6df5d790f29c8bb38c253f6871bd41ddf6ec005984b61ddcbba544538d9347
|
7
|
+
data.tar.gz: '083669f78cca1efbd08c31cc8279e42336db6100afd4d80f3a026837d4d6636e725a3b53b1a5375fd8c8fbbbad1133063824f65ae69122ebb6ac4609d3118861'
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
building_sync_rails
|
2
|
+
|
3
|
+
Copyright (c) 2019-2024, Battelle Memorial Institute
|
4
|
+
All rights reserved.
|
5
|
+
|
6
|
+
1. Battelle Memorial Institute (hereinafter Battelle) hereby grants permission
|
7
|
+
to any person or entity lawfully obtaining a copy of this software and
|
8
|
+
associated documentation files (hereinafter "the Software") to redistribute
|
9
|
+
and use the Software in source and binary forms, with or without
|
10
|
+
modification. Such person or entity may use, copy, modify, merge, publish,
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and may permit
|
12
|
+
others to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
* Redistributions of source code must retain the above copyright notice, this
|
15
|
+
list of conditions and the following disclaimers.
|
16
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
17
|
+
this list of conditions and the following disclaimer in the documentation
|
18
|
+
and/or other materials provided with the distribution.
|
19
|
+
* Other than as used herein, neither the name Battelle Memorial Institute or
|
20
|
+
Battelle may be used in any form whatsoever without the express written
|
21
|
+
consent of Battelle.
|
22
|
+
|
23
|
+
2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
+
DISCLAIMED. IN NO EVENT SHALL BATTELLE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
27
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
28
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
30
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
31
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
32
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'BuildingSyncRails'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Bundler::GemHelper.install_tasks
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task default: :test
|
data/WARRANTY.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
This material was prepared as an account of work sponsored by an agency of the
|
2
|
+
United States Government. Neither the United States Government nor the United
|
3
|
+
States Department of Energy, nor Battelle, nor any of their employees, nor any
|
4
|
+
jurisdiction or organization that has cooperated in the development of these
|
5
|
+
materials, makes any warranty, express or implied, or assumes any legal
|
6
|
+
liability or responsibility for the accuracy, completeness, or usefulness or any
|
7
|
+
information, apparatus, product, software, or process disclosed, or represents
|
8
|
+
that its use would not infringe privately owned rights.
|
9
|
+
|
10
|
+
Reference herein to any specific commercial product, process, or service by
|
11
|
+
trade name, trademark, manufacturer, or otherwise does not necessarily
|
12
|
+
constitute or imply its endorsement, recommendation, or favoring by the United
|
13
|
+
States Government or any agency thereof, or Battelle Memorial Institute. The
|
14
|
+
views and opinions of authors expressed herein do not necessarily state or
|
15
|
+
reflect those of the United States Government or any agency thereof.
|
16
|
+
|
17
|
+
PACIFIC NORTHWEST NATIONAL LABORATORY
|
18
|
+
operated by
|
19
|
+
BATTELLE
|
20
|
+
for the
|
21
|
+
UNITED STATES DEPARTMENT OF ENERGY
|
22
|
+
under Contract DE-AC05-76RL01830
|
data/bin/rails
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/building_sync_rails/engine', __FILE__)
|
6
|
+
|
7
|
+
# Set up gems listed in the Gemfile.
|
8
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
9
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
10
|
+
|
11
|
+
require 'rails/all'
|
12
|
+
require 'rails/engine/commands'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative "../../lib/BuildingSync.rb"
|
2
|
+
require_relative "../../lib/BuildingSync_mapper.rb"
|
3
|
+
require_relative "../../lib/BuildingSync_mapping_registry.rb"
|
4
|
+
|
5
|
+
if defined?(BuildingSyncMapper)
|
6
|
+
require "singleton"
|
7
|
+
|
8
|
+
unless BuildingSyncMapper.included_modules.include?(::Singleton)
|
9
|
+
BuildingSyncMapper.send(:include, ::Singleton)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Add "options" Argument to XSD Mapper/Mapping Methods
|
2
|
+
#
|
3
|
+
# @see https://github.com/rubyjedi/soap4r/pull/22
|
4
|
+
|
5
|
+
require "soap/mapping"
|
6
|
+
require "soap/parser"
|
7
|
+
require "xsd/mapping"
|
8
|
+
require "xsd/qname"
|
9
|
+
|
10
|
+
XSD::Mapping.instance_eval do
|
11
|
+
undef :obj2xml
|
12
|
+
|
13
|
+
undef :xml2obj
|
14
|
+
end
|
15
|
+
|
16
|
+
XSD::Mapping::Mapper.class_eval do
|
17
|
+
undef :obj2xml
|
18
|
+
|
19
|
+
undef :xml2obj
|
20
|
+
end
|
21
|
+
|
22
|
+
XSD::Mapping.send(:define_singleton_method, :obj2xml) do |*args|
|
23
|
+
XSD::Mapping::Mapper.new(XSD::Mapping::MappingRegistry).obj2xml(*args)
|
24
|
+
end
|
25
|
+
|
26
|
+
XSD::Mapping.send(:define_singleton_method, :xml2obj) do |*args|
|
27
|
+
XSD::Mapping::Mapper.new(XSD::Mapping::MappingRegistry).xml2obj(*args)
|
28
|
+
end
|
29
|
+
|
30
|
+
XSD::Mapping::Mapper.send(:define_method, :obj2xml) do |obj, elename = nil, io = nil, opts = {}|
|
31
|
+
opt = XSD::Mapping::Mapper::MAPPING_OPT.dup.merge(opts)
|
32
|
+
registry = instance_variable_get(:"@registry")
|
33
|
+
unless elename
|
34
|
+
if definition = registry.elename_schema_definition_from_class(obj.class)
|
35
|
+
elename = definition.elename
|
36
|
+
opt[:root_type_hint] = false
|
37
|
+
end
|
38
|
+
end
|
39
|
+
elename = SOAP::Mapping.to_qname(elename) if elename
|
40
|
+
soap = SOAP::Mapping.obj2soap(obj, registry, elename, opt)
|
41
|
+
if soap.elename.nil? or soap.elename == XSD::QName::EMPTY
|
42
|
+
soap.elename =
|
43
|
+
XSD::QName.new(nil, SOAP::Mapping.name2elename(obj.class.to_s))
|
44
|
+
end
|
45
|
+
generator = SOAP::Generator.new(opt)
|
46
|
+
generator.generate(soap, io)
|
47
|
+
end
|
48
|
+
|
49
|
+
XSD::Mapping::Mapper.send(:define_method, :xml2obj) do |stream, klass = nil, opts = {}|
|
50
|
+
opt = XSD::Mapping::Mapper::MAPPING_OPT.dup.merge(opts)
|
51
|
+
registry = instance_variable_get(:"@registry")
|
52
|
+
parser = SOAP::Parser.new(opt)
|
53
|
+
soap = parser.parse(stream)
|
54
|
+
SOAP::Mapping.soap2obj(soap, registry, klass)
|
55
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "date"
|
2
|
+
require "xsd/datatypes"
|
3
|
+
|
4
|
+
# Fix bug in "soap4r-ng" gem, where representation of "xsd:gYear" datatype is,
|
5
|
+
# incorrectly, delegated to `DateTime.to_datetime` in first clause of
|
6
|
+
# `XSD::XSDDateTimeImpl#screen_data` instance method (c.f.,
|
7
|
+
# https://github.com/rubyjedi/soap4r/blob/master/lib/xsd/datatypes.rb#L579).
|
8
|
+
|
9
|
+
XSD::XSDDateTimeImpl.class_eval do
|
10
|
+
undef :screen_data
|
11
|
+
end
|
12
|
+
|
13
|
+
XSD::XSDDateTimeImpl.send(:define_method, :screen_data) do |t|
|
14
|
+
if t.is_a?(::DateTime)
|
15
|
+
t
|
16
|
+
elsif t.is_a?(::Date)
|
17
|
+
t = send(:screen_data_str, t)
|
18
|
+
t <<= 12 if t.year < 0
|
19
|
+
t
|
20
|
+
elsif t.is_a?(::Time)
|
21
|
+
jd = ::DateTime.send(:civil_to_jd, t.year, t.mon, t.mday, ::DateTime::ITALY)
|
22
|
+
fr = ::DateTime.send(:time_to_day_fraction, t.hour, t.min, [t.sec, 59].min) + t.usec.to_r / XSD::XSDDateTimeImpl::DayInMicro
|
23
|
+
of = t.utc_offset.to_r / XSD::XSDDateTimeImpl::DayInSec
|
24
|
+
::DateTime.new!(::DateTime.send(:jd_to_ajd, jd, fr, of), of, ::DateTime::ITALY)
|
25
|
+
else
|
26
|
+
send(:screen_data_str, t)
|
27
|
+
end
|
28
|
+
end
|
data/config/routes.rb
ADDED