Module: ECSBundler
- Defined in:
- lib/ecs_bundler.rb,
lib/ecs_bundler/scan.rb,
lib/ecs_bundler/config.rb,
lib/ecs_bundler/version.rb,
lib/ecs_bundler/rest_client.rb,
lib/ecs_bundler/bundler_scanner.rb,
lib/ecs_bundler/project_specification.rb
Defined Under Namespace
Classes: BundlerScanner, Config, ProjectSpecification, RestClient, Scan
Constant Summary collapse
- VERSION =
Contains version string
File.exist?('VERSION') ? File.read('VERSION') : ''
Class Method Summary collapse
-
.config ⇒ Object
Return config class.
-
.rest_client(options = {}) ⇒ Object
Return rest-client class.
-
.run(options = {}) ⇒ Object
Run application.
-
.run_cli ⇒ Object
Run cli application.
Class Method Details
.config ⇒ Object
Return config class
16 17 18 |
# File 'lib/ecs_bundler.rb', line 16 def config @@config ||= Config.new end |
.rest_client(options = {}) ⇒ Object
Return rest-client class
21 22 23 |
# File 'lib/ecs_bundler.rb', line 21 def rest_client( = {}) @@rest_client ||= RestClient.new() end |
.run(options = {}) ⇒ Object
Run application
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ecs_bundler.rb', line 46 def run( = {}) config.load([:config] ? [:config] : nil) = config.data.merge() () rest_client() scan = Scan.create(BundlerScanner.run) if scan.id print "ecs-bundler successfully transferred scan to server: scanId => #{scan.id}\n" else print "ecs-bundler error transferring scan: #{scan.message}\n" end end |
.run_cli ⇒ Object
Run cli application
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ecs_bundler.rb', line 26 def run_cli require 'cli' cli = ::CLI.new do version(ECSBundler::VERSION) option :apiKey, short: :k, description: 'api key' option :userName, short: :u, description: 'user name' option :url, description: 'Base url' option :project, short: :p, description: 'Project name' option :config, short: :c, description: 'Config path' end settings = cli.parse print settings.help if settings.help print settings.version.gsub('"', '') if settings.version exit 0 if settings.help || settings.version run(settings.to_h.compact) rescue CLI::ParsingError => pe cli.usage!(pe) end |