Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Alfalfa Gem from alfalfa-lib folder #448

Merged
merged 7 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions alfalfa_worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ RUN poetry install --only main
ENV PYTHONPATH="/alfalfa:${PYTHONPATH}"

COPY ./alfalfa_worker /alfalfa/alfalfa_worker
RUN cd alfalfa_worker/jobs/openstudio/lib/alfalfa \
&& gem build alfalfa.gemspec \
&& gem install ./alfalfa-0.0.0.gem
COPY ./deploy /alfalfa/deploy
COPY ./deploy/wait-for-it.sh /usr/local/wait-for-it.sh

Expand Down
2 changes: 1 addition & 1 deletion alfalfa_worker/jobs/openstudio/create_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def exec(self):
check_output(['openstudio', str(lib_dir / 'merge_osws.rb'), str(default_workflow_path), str(submitted_osw_path)])

# run workflow
check_output(['openstudio', '--include', '/alfalfa/alfalfa_worker/jobs/openstudio/lib/alfalfa-lib/', 'run', '-m', '-w', str(submitted_osw_path)])
check_output(['openstudio', '--gem_path', '/var/lib/gems/2.7.0', 'run', '-m', '-w', str(submitted_osw_path)])

self.logger.info('Generating variables from measure reports')
self.variables = Variables(self.run)
Expand Down
10 changes: 0 additions & 10 deletions alfalfa_worker/jobs/openstudio/lib/alfalfa-lib/alfalfa.rb

This file was deleted.

21 changes: 21 additions & 0 deletions alfalfa_worker/jobs/openstudio/lib/alfalfa/alfalfa.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'version'

Gem::Specification.new do |spec|
spec.name = 'alfalfa'
spec.version = OpenStudio::Alfalfa::VERSION
spec.authors = ['Tobias Shapinsky']
spec.email = ['tobias.shapinsky@nrel.gov']

spec.summary = 'Create input and output points in Aflalfa'
spec.description = 'Library and measures to create input and output points in Alfalfa'
spec.homepage = 'https://github.com/NREL/alfalfa'

# Specify which files should be added to the gem when it is released.
spec.files = ["lib/alfalfa_mixin.rb", "lib/alfalfa.rb", "lib/energy_plus_mixin.rb", "lib/input.rb", "lib/openstudio_mixin.rb", "lib/output.rb", "lib/point.rb", "lib/utils.rb", "lib/version.rb"]
spec.require_paths = ['lib']

spec.required_ruby_version = '~> 2.7.0'

end
6 changes: 6 additions & 0 deletions alfalfa_worker/jobs/openstudio/lib/alfalfa/lib/alfalfa.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'alfalfa_mixin'
require 'energy_plus_mixin'
require 'input'
require 'openstudio_mixin'
require 'output'
require 'point'
5 changes: 5 additions & 0 deletions alfalfa_worker/jobs/openstudio/lib/alfalfa/lib/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module OpenStudio
module Alfalfa
VERSION = '0.0.0'.freeze
end
end