Skip to content

Commit

Permalink
FI-1247: Remove suites (#12)
Browse files Browse the repository at this point in the history
* WIP reorganize inferno

* wip

* working

* require runnables to require their imported runnables

* make bin/console work when used as gem

* update config for puma

* update suite loading

* remove real suites

* add initial gemspec

* add missing require to fixture suite

* correct dry-system version

* only use in-memory db until db config is updated

* add factories to gem

* rename console command

* make db configurable in suite repos

* fix rack config

* update logging path

* ignore coverage for migrations

* update gemspec

* update readme and package-lock.json
  • Loading branch information
Jammjammjamm authored Jun 15, 2021
1 parent bce89e9 commit 1d604fa
Show file tree
Hide file tree
Showing 175 changed files with 239 additions and 3,401 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/db/*.db
/public/assets*
/tmp
.env.local
.env.*.local
Expand All @@ -14,8 +13,9 @@
.idea

/coverage
/data
/docs/yard
.yardoc
/.yardoc
/node_modules
/.git
/.github
Expand Down
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
LOAD_DEV_SUITES=true
LOAD_UI_SUITES=true
VALIDATOR_URL=https://inferno.healthit.gov/validatorapi
JS_HOST=http://localhost:3000
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
LOAD_DEV_SUITES=true
VALIDATOR_URL=https://example.com/validatorapi
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/data/*.db
/db/*.db
/public/assets*
/lib/inferno/public/assets*
/lib/inferno/public/*.js
/lib/inferno/public/*.LICENSE.txt
/lib/inferno/public/*.png
!/lib/inferno/public/logo*.png
/tmp
.env.local
.env.*.local
Expand Down
7 changes: 3 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ AllCops:
Layout/LineLength:
Max: 120
Exclude:
- 'dev_suites/onc_program/**/*'
- 'suites/ips/**/*'
- 'dev_suites/smart_scheduling_links/**/*'
- 'ui_suites/onc_program/**/*'
- 'ui_suites/smart_scheduling_links/**/*'

Layout/MultilineMethodCallIndentation:
EnforcedStyle: 'indented'

Lint/EmptyBlock:
Exclude:
- 'dev_suites/onc_program/**/*'
- 'ui_suites/onc_program/**/*'

Style/BlockComments:
Exclude:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.0.1

* Initial gem release
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

ruby '2.7.2'

gem 'dry-system', '~> 0.17', require: 'dry/system/container'
gem 'dry-system', '0.18.1'

gem 'sqlite3'
gem 'sequel'
Expand All @@ -13,7 +13,7 @@ gem 'hanami-router', '~> 1.3'
gem 'oj'
gem 'puma'

gem 'activesupport', require: 'active_support/all'
gem 'activesupport'
gem 'dotenv'
gem 'fhir_client'
gem 'rake'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ DEPENDENCIES
codecov
database_cleaner-sequel
dotenv
dry-system (~> 0.17)
dry-system (= 0.18.1)
factory_bot
faraday
fhir_client
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ GET http://localhost:4567/api/test_sessions/TEST_SESSION_ID/results
```

## Development
To get to an interactive console, run `bundle exec bin/console`
To get to an interactive console, run `bundle exec bin/inferno-console`

## License
Copyright 2021 The MITRE Corporation
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end
namespace :db do
desc 'Apply changes to the database'
task :migrate do
require_relative 'config/application'
require_relative 'lib/inferno/app/config/application'

Inferno::Application.start(:db)
end
Expand Down
7 changes: 0 additions & 7 deletions bin/console

This file was deleted.

8 changes: 8 additions & 0 deletions bin/inferno-console
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env ruby

require 'pry'
require_relative '../lib/inferno'

Inferno::Application.finalize!

Pry.start
4 changes: 2 additions & 2 deletions config.ru
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative 'config/application'
require_relative 'lib/inferno'

use Rack::Static, urls: ['/public']
use Rack::Static, urls: ['/public'], root: 'lib/inferno'

Inferno::Application.finalize!

Expand Down
7 changes: 0 additions & 7 deletions config/boot.rb

This file was deleted.

11 changes: 0 additions & 11 deletions config/boot/entities.rb

This file was deleted.

50 changes: 0 additions & 50 deletions config/boot/suites.rb

This file was deleted.

4 changes: 2 additions & 2 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
development:
adapter: sqlite
database: db/inferno_development.db
database: data/inferno_development.db
max_connections: 10
# user:
# password:
Expand All @@ -9,7 +9,7 @@ development:

production:
adapter: sqlite
database: db/inferno_production.db
database: ':memory:'
max_connections: 10

test:
Expand Down
Empty file added data/.keep
Empty file.
2 changes: 2 additions & 0 deletions dev_suites/demo_ig_stu1/demo_suite.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'groups/demo_group'

module DemoIG_STU1 # rubocop:disable Naming/ClassAndModuleCamelCase
class DemoSuite < Inferno::TestSuite
title 'Demonstration Suite'
Expand Down
2 changes: 2 additions & 0 deletions dev_suites/infrastructure_test/external_inner_group.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'external_test1'

module InfrastructureTest
class ExternalInnerGroup < Inferno::TestGroup
id 'external_inner_group'
Expand Down
2 changes: 2 additions & 0 deletions dev_suites/infrastructure_test/external_outer_group.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'external_inner_group'

module InfrastructureTest
class ExternalOuterGroup < Inferno::TestGroup
id 'external_outer_group'
Expand Down
2 changes: 2 additions & 0 deletions dev_suites/infrastructure_test/infrastructure_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'external_outer_group'

module InfrastructureTest
class Suite < Inferno::TestSuite
id 'infra_test'
Expand Down
64 changes: 64 additions & 0 deletions inferno_core.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# frozen_string_literal: true

require_relative 'lib/inferno/version'
require 'rake'

Gem::Specification.new do |spec|
spec.name = 'inferno_core'
spec.version = Inferno::VERSION
spec.authors = ['Stephen MacVicar', 'Robert Scanlon', 'Chase Zhou']
spec.email = ['inferno@groups.mitre.org']
spec.date = Time.now.utc.strftime('%Y-%m-%d')
spec.summary = 'Inferno Core is an open source tool for testing data exchanges enabled by the FHIR standand'
spec.description = 'Inferno Core is an open source tool for testing data exchanges enabled by the FHIR standand'
spec.homepage = 'https://github.com/inferno_community/inferno-core'
spec.license = 'Apache 2.0'
spec.add_runtime_dependency 'activesupport'
spec.add_runtime_dependency 'blueprinter'
spec.add_runtime_dependency 'dotenv'
spec.add_runtime_dependency 'dry-system', '0.18.1'
spec.add_runtime_dependency 'faraday'
spec.add_runtime_dependency 'fhir_client'
spec.add_runtime_dependency 'hanami-controller', '~> 1.3'
spec.add_runtime_dependency 'hanami-router', '~> 1.3'
spec.add_runtime_dependency 'oj'
spec.add_runtime_dependency 'pry'
spec.add_runtime_dependency 'pry-byebug'
spec.add_runtime_dependency 'puma'
spec.add_runtime_dependency 'rake'
spec.add_runtime_dependency 'sequel'
spec.add_runtime_dependency 'sqlite3'
spec.add_development_dependency 'codecov'
spec.add_development_dependency 'database_cleaner-sequel'
spec.add_development_dependency 'factory_bot'
spec.add_development_dependency 'rack-test'
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rubocop', '~> 1.9'
spec.add_development_dependency 'rubocop-rake'
spec.add_development_dependency 'rubocop-rspec'
spec.add_development_dependency 'rubocop-sequel'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'webmock'
spec.add_development_dependency 'yard'
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/inferno_community/inferno-core'
spec.metadata['changelog_uri'] = 'https://github.com/inferno_community/inferno-core/CHANGELOG.md'
spec.files = [
'lib/inferno.rb',
'LICENSE.txt',
Dir['lib/inferno/**/*.rb'],
'bin/inferno-console',
Dir['lib/inferno/public/*.png'],
Dir['lib/inferno/public/*.ico'],
Dir['lib/inferno/public/*.js'],
'lib/inferno/public/bundle.js.LICENSE.txt',
'lib/inferno/public/assets.json',
'spec/support/factory_bot.rb',
Dir['spec/support/factories/**.*.rb']
].flatten

spec.bindir = 'bin'
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.require_paths = ['lib', 'spec']
end
13 changes: 13 additions & 0 deletions lib/inferno.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
require 'active_support/all'
require 'dotenv'
require 'dry/system/container'
require 'sequel'
require_relative 'inferno/config/application'
require_relative 'inferno/dsl'
require_relative 'inferno/entities'
require_relative 'inferno/exceptions'
require_relative 'inferno/repositories'
require_relative 'inferno/spec_support'
require_relative 'inferno/test_runner'
require_relative 'inferno/version'

module Inferno
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion apps/web/router.rb → lib/inferno/apps/web/router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

module Inferno
module Web
client_page = ERB.new(File.read(File.join(Inferno::Application.root, 'apps', 'web', 'index.html.erb'))).result
client_page = ERB.new(File.read(File.join(Inferno::Application.root, 'lib', 'inferno', 'apps', 'web',
'index.html.erb'))).result

Router = Hanami::Router.new(namespace: Inferno::Web::Controllers) do
namespace 'api' do
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions config/application.rb → lib/inferno/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

module Inferno
class Application < Dry::System::Container
::Inferno::Import = injector

use :env, inferrer: -> { ENV.fetch('APP_ENV', :development).to_sym }

configure do |config|
config.root = File.expand_path('..', __dir__)
config.root = File.expand_path('../../..', __dir__)
config.default_namespace = 'inferno'
config.system_dir = 'config'
config.bootable_dirs = [File.join('config', 'boot')]
config.system_dir = File.join('lib', 'inferno', 'config')
config.bootable_dirs = [File.join('lib', 'inferno', 'config', 'boot')]

config.auto_register = ['lib', 'apps']
config.auto_register = 'lib'
end

Application.register('js_host', ENV.fetch('JS_HOST', ''))

load_paths!('lib', 'apps')
load_paths!('lib')
end

Import = Application.injector
end
5 changes: 5 additions & 0 deletions lib/inferno/config/boot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ENV['APP_ENV'] ||= 'development'

root_path = Dir.pwd

Dotenv.load(File.join(root_path, '.env'), File.join(root_path, ".env.#{ENV['APP_ENV']}"))
4 changes: 2 additions & 2 deletions config/boot/db.rb → lib/inferno/config/boot/db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Sequel::Model.plugin :json_serializer

config_path = File.expand_path('database.yml', File.join(Inferno::Application.root, 'config'))
config_path = File.expand_path('database.yml', File.join(Dir.pwd, 'config'))
config = YAML.load_file(config_path)[ENV['APP_ENV']]
.merge(logger: Inferno::Application['logger'])
connection = Sequel.connect(config)
Expand All @@ -17,7 +17,7 @@

start do
Sequel.extension :migration
migration_path = File.join(Inferno::Application.root, 'db', 'migrations')
migration_path = File.join(Inferno::Application.root, 'lib', 'inferno', 'db', 'migrations')
Sequel::Migrator.run(Inferno::Application['db.connection'], migration_path)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
init do
logger =
if Inferno::Application.env == :test
log_file_directory = File.join(Inferno::Application.root, 'tmp')
log_file_directory = File.join(Dir.pwd, 'tmp')
FileUtils.mkdir_p(log_file_directory)
log_file_path = File.join(log_file_directory, 'test.log')
log_file = File.open(log_file_path, File::WRONLY | File::APPEND | File::CREAT)
Expand Down
Loading

0 comments on commit 1d604fa

Please sign in to comment.