- Install the latest version of OpenStudio. We recommend a minimum version of OpenStudio 3.7.0.
- Install the Ruby version that corresponds to your OpenStudio install. See the OpenStudio SDK Version Compatibility Matrix of the correct version. OpenStudio versions 3.2.0 through 3.7.0 use Ruby 2.7.2, OpenStudio 3.8.0 and above uses Ruby 3.2.2.
- On Mac: Install Ruby 2.7.2 using rbenv
- On Windows: Install Ruby+Devkit 2.7.2
- On Linux: Use rbenv or your package manger to install ruby
- Using BTAP development Environment: Do nothing.
- Call
ruby -v
from command prompt to check installed version.
- Connect Ruby to OpenStudio:
- On Mac:
- Create a file called
openstudio.rb
- Contents:
require "/Applications/openstudio-3.7.0/Ruby/openstudio.rb"
. Modify3.7.0
to the OpenStudio version you installed. - Save it here:
/usr/lib/ruby/site_ruby/openstudio.rb
- Create a file called
- On Windows:
- Create a file called
openstudio.rb
- Contents:
require "C:/openstudio-3.7.0/Ruby/openstudio.rb"
. Modify3.7.0
to the OpenStudio version you installed. - Save it here:
C:/Ruby27-x64/lib/ruby/site_ruby/openstudio.rb
. ModifyRuby27-x64
to the Ruby version you installed. - Start > right click Computer > Properties > Advanced system settings > Environment variables. In the User variables section (top) add a new Variable with the name
GEM_PATH
and the ValueC:\Ruby27-x64\lib\ruby\gems\2.5.0
. ModifyRuby27-x64
to the Ruby version you installed.
- Create a file called
- On Linux:
- Create a file called
openstudio.rb
- Contents:
require "/usr/local/openstudio-3.7.0/Ruby/openstudio.rb"
. Modify3.7.0
to the OpenStudio version you installed. - Save it here:
/usr/local/lib/ruby/site_ruby/openstudio.rb
.
- If you are having trouble locating the paths in your specific linux setup, you can find the ruby version with
gem environment
in command prompt and the location of openstudio withwhich openstudio
.
- Create a file called
- Using BTAP development Environment:
- Do nothing.
- On Mac:
- Install Git.
- Install GitHub desktop or another GUI that makes Git easier to use.
- Clone the source code using GitHub desktop (easier) or Git (harder).
- Install the
bundler
ruby gem. (gem install bundler
from command prompt) - Run
bundle install
in command prompt from the top levelopenstudio-standards
directory. This will install the correct ruby gem versions necessary for development.
- Modify the code
- Test the code (new code plus old code to make sure you didn't break anything)
- Document the code
- Push branch to GitHub repository
- Continuous automation runs tests
- Pull request
- Code review and merge
This project uses Rake to run tasks from the terminal.
bundle exec rake -T
: List all available commands
bundle exec rake build
# Build openstudio-standards-X.X.XX.gem into the pkg directorybundle exec rake clean
# Remove any temporary productsbundle exec rake clobber
# Remove any generated filesbundle exec rake data:update
# Generate JSONs from OpenStudio_Standards spreadsheets locally downloaded to data/standardsbundle exec rake data:export:jsons
# Export JSONs from OpenStudio_Standards to data librarybundle exec rake data:update:costing
# Update RS-Means Databasebundle exec rake doc
# Generate the documentationbundle exec rake doc:show
# Generate the documentation and show in a web browserbundle exec rake install
# Build and install openstudio-standards-X.X.XX.gem into system gemsbundle exec rake install:local
# Build and install openstudio-standards-X.X.XX.gem into system gems without network accessbundle exec rake library:export
# Export libraries for the OpenStudio Applicationbundle exec rake release[remote]
# Create tag vX.X.XX and build and push openstudio-standards-X.X.XX.gem to Rubygemsbundle exec rake rubocop
# Check the code for style consistencybundle exec rake rubocop:auto_correct
# Auto-correct RuboCop offensesbundle exec rake rubocop:show
# Show the rubocop output in a web browserbundle exec rake test:btap_json_test
# Run tests for btap_json_testbundle exec rake test:circ-90_1_general
# Run tests for circ-90_1_generalbundle exec rake test:circ-90_1_prm
# Run tests for circ-90_1_prmbundle exec rake test:circ-all-tests
# Run tests for circ-all-testsbundle exec rake test:circ-doe_prototype
# Run tests for circ-doe_prototypebundle exec rake test:circ-necb
# Run tests for circ-necbbundle exec rake test:circ-necb_bldg
# Run tests for circ-necb_bldgbundle exec rake test:necb_local_bldgs_regression_tests
# Run tests for necb_local_bld...`
As you add to/modify the code, please follow the code architecture. See the {file:docs/RepositoryStructure.md Repository Structure page} to see how the code is organized. If you don't understand something or want to discuss your plan before you get started, contact mailto:[email protected].
- Make a new branch for your changes.
- Modify the code on your branch.
- 90.1 standards data is available in this database. All 90.1 changes happen on that database. Data for other standards or templates lives in the .json files in openstudio-standards.
- If you have data, modify the .json files and run commands to update the database, as appropriate. Historically, openstudio-standards data used a series of google spreadsheets, and is still used for non-90.1-standards. See OpenStudio_Standards Google Spreadsheet. Contact mailto:[email protected] for access.
- You may edit the spreadsheet or modify a copy of the data, then download the spreadsheet to the
data/standards
directory, and runbundle exec rake data:update:manual
to update the JSONs.
Tests prove that your code works as expected, but more importantly they help make sure that changes don't break other code. If your code doesn't have tests and someone else makes changes that break it, it's your own fault.
- Create a new file called
test_XX.rb
in the/test/subdirectory
directory. - Put tests into your file. See other test files for examples.
- Call
ruby test/sub_directory/test_XX.rb
to run your new test file. - Fix your code and make sure your tests pass.
Good documentation is critical. Changes or additions without good documentation will not be accepted. This library uses YARD to generate documentation. You simply write the documentation inline as specially tagged comments. This YARD cheat sheet quickly shows you how to document things. You can also look at the other methods documented in the code.
- Make sure your methods are documented.
bundle exec rake doc
Generate the documentation and document any undocumented methods that are listedbundle exec rake doc:show
Inspect the documentation in a browser to make sure it looks right.
- Commit your changes to your branch.
- Merge /Master into your branch and resolve any conflicts.
- Push your branch to GitHub.
Once your code is done and the tests are passing locally on your branch with Master merged in, go to GitHub and create a Pull Request. This tells the main developers that you have changes to bring into the main code. They will review and suggest edits or merge.
The main developers will review your changes and either approve the pull request or give you some comments. If they approve the pull request, you are done and your changes are now part of the main code!
- When a commit is made to any branch, the continuous integration machine will run all the tests.
- For pull requests, the status of the tests will automatically be posted to GitHub.
- Developers will need to be given access to the continuous integration system to see detailed results.
- Issues and feature requests are reported on the GitHub Repository Issues Page.
- Issues should be labeled according to the OpenStudio Issue Prioritization Guide.
- Failing tests do not need to be listed as issues; they should be fixed if they fail.