diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 26e3bec..8e233a0 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,5 @@ -name-template: 'v$NEXT_PATCH_VERSION' -tag-template: 'v$NEXT_PATCH_VERSION' +name-template: '$NEXT_PATCH_VERSION' +tag-template: '$NEXT_PATCH_VERSION' categories: - title: 'Features' labels: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7853971..3d8eb7e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,9 +34,9 @@ jobs: run: | gem push --KEY rubygems --host https://rubygems.org *.gem gem push --KEY rubygems --host https://rubygems.org emass_client/ruby_client/*.gem - - name: Publish to GPR - run: | - gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem - gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} emass_client/ruby_client/*.gem - env: - OWNER: mitre + # - name: Publish to GPR + # run: | + # gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem + # gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} emass_client/ruby_client/*.gem + # env: + # OWNER: mitre diff --git a/Gemfile.lock b/Gemfile.lock index e73c621..d14aca3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,11 +3,11 @@ PATH specs: emasser (1.0.1) activesupport (~> 6.1.4) - colorize - dotenv - emass_client - rubyzip - thor + colorize (~> 0.8.1) + dotenv (~> 2.7.6) + emass_client (~> 1.0) + rubyzip (~> 2.3.2) + thor (~> 1.1.0) PATH remote: emass_client/ruby_client @@ -36,7 +36,7 @@ GEM dotenv (2.7.6) ethon (0.15.0) ffi (>= 1.15.0) - ffi (1.15.4) + ffi (1.15.4-x64-mingw32) i18n (1.8.11) concurrent-ruby (~> 1.0) json (2.6.1) @@ -97,7 +97,7 @@ PLATFORMS DEPENDENCIES bundler (~> 2.1) bundler-audit (~> 0.7) - byebug + byebug (~> 11.1.3) emass_client! emasser! rake (~> 13.0) @@ -109,4 +109,4 @@ DEPENDENCIES yaml (~> 0.2.0) BUNDLED WITH - 2.2.32 + 2.3.4 diff --git a/emass_client/config.json b/emass_client/config.json deleted file mode 100644 index 0769995..0000000 --- a/emass_client/config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "gemName": "emass_client", - "gemVersion": "1.0.1" -} diff --git a/emass_client/swagger-codegen/config.json b/emass_client/swagger-codegen/config.json new file mode 100644 index 0000000..e7118b3 --- /dev/null +++ b/emass_client/swagger-codegen/config.json @@ -0,0 +1,5 @@ +{ + "gemName": "emass_client", + "gemVersion": "1.0.1", + "gemLicense": "Apache-2.0" +} diff --git a/emasser.gemspec b/emasser.gemspec index d3dbfc0..b57d447 100644 --- a/emasser.gemspec +++ b/emasser.gemspec @@ -7,6 +7,7 @@ Gem::Specification.new do |spec| spec.version = Emasser::VERSION spec.authors = ['Amndeep Singh Mann', 'George Dias', 'Kyle Fagan', 'Robert Clark', 'Aaron Lippold'] spec.email = ['saf@mitre.org'] + spec.licenses = ['Apache-2.0'] spec.summary = 'Provide an automated capability for invoving eMASS API endpoints' spec.description = 'emasser can be used as a gem or used from the command line to access eMASS via thei API.' @@ -22,15 +23,15 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.add_runtime_dependency 'activesupport', '~> 6.1.4' - spec.add_runtime_dependency 'colorize' - spec.add_runtime_dependency 'dotenv' - spec.add_runtime_dependency 'rubyzip' - spec.add_runtime_dependency 'emass_client' - spec.add_runtime_dependency 'thor' + spec.add_runtime_dependency 'colorize', '~> 0.8.1' + spec.add_runtime_dependency 'dotenv', '~> 2.7.6' + spec.add_runtime_dependency 'rubyzip', '~> 2.3.2' + spec.add_runtime_dependency 'thor', '~> 1.1.0' + spec.add_runtime_dependency 'emass_client', '~> 1.0' spec.add_development_dependency 'bundler', '~> 2.1' spec.add_development_dependency 'bundler-audit', '~> 0.7' - spec.add_development_dependency 'byebug' + spec.add_development_dependency 'byebug', '~> 11.1.3' spec.add_development_dependency 'rspec', '~>3.10.0' spec.add_development_dependency 'yaml', '~>0.2.0' spec.add_development_dependency 'rake', '~> 13.0' diff --git a/lib/emasser/cli.rb b/lib/emasser/cli.rb index 408cef0..474106e 100644 --- a/lib/emasser/cli.rb +++ b/lib/emasser/cli.rb @@ -16,6 +16,14 @@ class CLI < Thor elsif ARGV[0].to_s.include? 'del' require 'emasser/delete' register(Emasser::Delete, 'delete', 'delete [RESOURCE]', 'Deletes resources') + elsif (ARGV[0].to_s.include? '-v') || (ARGV[0].to_s.include? '-V') + puts Emasser::VERSION.green + exit + end + + def help + puts 'Emasser commands:' + puts ' emasser [get, put, post, delete, -v, or -V]' end def self.exit_on_failure? diff --git a/lib/emasser/configuration.rb b/lib/emasser/configuration.rb index 9036963..cf010cb 100644 --- a/lib/emasser/configuration.rb +++ b/lib/emasser/configuration.rb @@ -8,8 +8,13 @@ class Configuration def self.raise_unless_present(env) ENV.fetch(env) { raise Emasser::ConfigurationMissingError.new(env) } rescue Emasser::ConfigurationMissingError => e - puts e.message.red - puts 'See emasser environment variables requirements in emasser CLI Features' + if (ARGV[0].to_s.include? '-v') || (ARGV[0].to_s.include? '-V') + puts Emasser::VERSION.green + else + puts "\n", e.message.red + puts 'Create a .env file with the necessary variables, place it in the root directory where the emasser command'.yellow + puts 'is executed. See emasser environment variables requirements in emasser CLI Features for more information'.yellow, "\n" + end exit end # rubocop: enable Style/RaiseArgs @@ -24,9 +29,9 @@ def self.raise_unless_present(env) config.key_file = raise_unless_present('EMASSER_KEY_FILE_PATH') config.cert_file = raise_unless_present('EMASSER_CERT_FILE_PATH') config.key_password = raise_unless_present('EMASSER_KEY_PASSWORD') - config.client_side_validation = (raise_unless_present('EMASSER_CLIENT_SIDE_VALIDATION') == 'false') ? false : true - config.verify_ssl = (raise_unless_present('EMASSER_VERIFY_SSL') == 'false') ? false : true - config.verify_ssl_host = (raise_unless_present('EMASSER_VERIFY_SSL_HOST') == 'false') ? false : true + config.client_side_validation = (ENV.fetch('EMASSER_CLIENT_SIDE_VALIDATION', false) == 'false') ? false : true + config.verify_ssl = (ENV.fetch('EMASSER_VERIFY_SSL', false) == 'false') ? false : true + config.verify_ssl_host = (ENV.fetch('EMASSER_VERIFY_SSL_HOST', false) == 'false') ? false : true config.debugging = (ENV.fetch('EMASSER_DEBUGGING', false) == 'true') ? true : false end # rubocop: enable Style/TernaryParentheses, Style/IfWithBooleanLiteralBranches