diff --git a/lib/inferno/apps/cli/new.rb b/lib/inferno/apps/cli/new.rb index ef55bccd6..13c5f6e60 100644 --- a/lib/inferno/apps/cli/new.rb +++ b/lib/inferno/apps/cli/new.rb @@ -71,6 +71,7 @@ def create_test_kit inside(root_name) do bundle_install inferno_migrate + initialize_git_repo load_igs end @@ -106,6 +107,10 @@ def inferno_migrate run 'bundle exec inferno migrate', verbose: !options['quiet'], capture: options['quiet'] end + def initialize_git_repo + run 'git init -q && git add . && git commit -aqm "initial commit"' + end + def load_igs config = { verbose: !options['quiet'] } options['implementation_guide']&.each_with_index do |ig, idx| diff --git a/lib/inferno/apps/cli/templates/%library_name%.gemspec.tt b/lib/inferno/apps/cli/templates/%library_name%.gemspec.tt index 432f4864b..f96df338b 100644 --- a/lib/inferno/apps/cli/templates/%library_name%.gemspec.tt +++ b/lib/inferno/apps/cli/templates/%library_name%.gemspec.tt @@ -21,13 +21,7 @@ Gem::Specification.new do |spec| spec.metadata['inferno_test_kit'] = 'true' # spec.metadata['homepage_uri'] = spec.homepage # spec.metadata['source_code_uri'] = 'TODO' - spec.files = [ - Dir['lib/**/*.rb'], - Dir['lib/**/*.json'], - Dir['config/presets/*.json'], - Dir['config/presets/*.json.erb'], - 'LICENSE' - ].flatten + spec.files = `[ -d .git ] && git ls-files -z lib config/presets LICENSE`.split("\x0") spec.require_paths = ['lib'] end diff --git a/spec/inferno/cli/new_spec.rb b/spec/inferno/cli/new_spec.rb index 5ca7a39ef..0609a30cc 100644 --- a/spec/inferno/cli/new_spec.rb +++ b/spec/inferno/cli/new_spec.rb @@ -27,6 +27,7 @@ expect { described_class.start(cli_args) }.to_not raise_error expect(Dir).to exist('test-fhir-app') + expect(Dir).to exist('test-fhir-app/.git') expect(File).to exist('test-fhir-app/Gemfile') expect(File).to exist('test-fhir-app/test_fhir_app.gemspec') expect(File).to exist('test-fhir-app/lib/test_fhir_app.rb')