-
Install the latest version of OpenStudio
-
Install Ruby:
- On Mac:
- Install Ruby 2.2 using rbenv (
ruby -v
from command prompt to check installed version). - On Windows:
- Install Ruby 2.2.6 (
ruby -v
from command prompt to check installed version). - Install Ruby DevKit by following these installation instructions
- Using BTAP development Environment
- Do nothing.
-
Connect Ruby to OpenStudio:
- On Mac:
- Create a file called
openstudio.rb
- Contents:
require "/Applications/openstudio-2.1.0/Ruby/openstudio.rb"
Modify2.1.0
to the version you installed. - Save it here:
/usr/lib/ruby/site_ruby/openstudio.rb
- On Windows:
- Create a file called
openstudio.rb
- Contents:
require "C:/openstudio-2.1.0/Ruby/openstudio.rb"
Modify2.1.0
to the version you installed. - Save it here:
C:/Ruby22-x64/lib/ruby/site_ruby/openstudio.rb
- 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:\Ruby22-x64\lib\ruby\gems\2.2.0
. - Using BTAP development Environment
- Do nothing.
-
Install the
bundler
ruby gem. (gem install bundler
from command prompt) -
Install the
json
ruby gem. (gem install json
from command prompt) -
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).
-
Run all commands below from the
/openstudio-standards/openstudio-standards
directory -
On Windows, use the Git Bash instead of the default command prompt.
-
On Mac the default terminal is fine.
-
Using BTAP development Environment use the terminator terminal ideally.
-
Navigate to the
openstudio-standards
directory. -
Command prompt:
bundle install
. This will install all ruby gems necessary to develop this code. -
Sign up for an account at CircleCI and follow the
NREL/openstudio-standards
project. -
That's it, you are ready to make changes!
- 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.
rake -T
: List all available commands
rake build
# Build openstudio-standards-0.1.15.gem into the pkg directoryrake clean
# Remove any temporary productsrake clobber
# Remove any generated filesrake data:update
# Download OpenStudio_Standards from Google & export JSONsrake data:update:costing
# Update RS-Means Databaserake data:update:manual
# Export JSONs from OpenStudio_Standardsrake doc
# Generate the documentationrake doc:show
# Show the documentation in a web browserrake install
# Build and install openstudio-standards-0.1.15.gem into system gemsrake install:local
# Build and install openstudio-standards-0.1.15.gem into system gems without network accessrake release[remote
] # Create tag v0.1.15 and build and push openstudio-standards-0.1.15.gem to Rubygemsrake rubocop
# Check the code for style consistencyrake rubocop:auto_correct
# Auto-correct RuboCop offensesrake rubocop:show
# Show the rubocop output in a web browserrake test:btap_json_test
# Run tests for btap_json_testrake test:circ-90_1_general
# Run tests for circ-90_1_generalrake test:circ-90_1_prm
# Run tests for circ-90_1_prmrake test:circ-all-tests
# Run tests for circ-all-testsrake test:circ-doe_prototype
# Run tests for circ-doe_prototyperake test:circ-necb
# Run tests for circ-necbrake test:circ-necb_bldg
# Run tests for circ-necb_bldg
As you add to/modify the code, please try to fit changes into the current structure rather than bolting things on willy-nilly. See the {file:docs/CodeStructure.md Code 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.
- Modify the OpenStudio_Standards Google Spreadsheet
- To get edit access to this spreadsheet, contact mailto:[email protected].
rake data:update
to download the latest version of the spreadsheet from Google Drive and export the JSON files.
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.
ruby test/subdirectory/test_XX.rb
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 and the rest happens automagically. 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.
rake doc
Generate the documentation and document any undocumented methods that are listedrake 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.
- DO NOT push your code to the /Master branch!
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.
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 /Master, the continuous integration machine will run all the tests.
- Go to openstudio-standards Circle CI and look at the NREL/openstudio-standards project to check out the build status. If it is failing and your commit broke it, please fix it ASAP! Also, you can follow a project on Circle CI and you will get email updates when someone breaks the build.
- 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.