norad_cli 0.1.23 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7868dd41b4c03f1def4992618bf4fac8ad25154
4
- data.tar.gz: 52fa8e4e727bdbf8e18672e634bafe30c2d25a0b
3
+ metadata.gz: f1089ae2c3cec35a4c705bd1815a64d104947bf7
4
+ data.tar.gz: 8aa75600ab12c1f623ebadf2f6a322bd41c16cb7
5
5
  SHA512:
6
- metadata.gz: 36309ee5996ac99a248652d9929e257d5b1d193c4d4db636c4fb4577a83ae977ef3d20737d769093be24b01586a3474acaf10ae98ca5f59d4cf780b2f96d309c
7
- data.tar.gz: 91eee08fd2fdfe14465b61020685b4bad623d3f46d3a01b244272f4ac095df91bd4302d66d415070fd63d8f15fdd0143b38bab16232626193ebdc7551b85f04c
6
+ metadata.gz: 9f6e7dfbde96b1edf5c3ed35d3a536c5a8a8011380d066714e46f03f3e8c6c8a10e3723e119a300a0a021a761ba1c4638957366341184f540896291219f2e9ba
7
+ data.tar.gz: adef476de5591355f2bad229edb2cdf1cbef15fcfe18df170b8129d7c35f91f9701e005c26d703adb6343b20acd7c6fd3e5a41f8a9c955ed5e6b634b9e757844
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  # Specify your gem's dependencies in norad.gemspec
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundler/gem_tasks'
3
4
  require 'rspec/core/rake_task'
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'thor'
3
4
  require 'norad_cli/cli/secrepo'
4
5
  require 'norad_cli/cli/sectest'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'thor'
3
4
  require 'git'
4
5
  require 'docker'
@@ -20,7 +21,7 @@ class Repo < Thor
20
21
  Git.init(repo_name)
21
22
 
22
23
  # Create the necessary directories
23
- %w(base spec sectests).each do |dirrepo_name|
24
+ %w[base spec sectests].each do |dirrepo_name|
24
25
  empty_directory "#{repo_name}/#{dirrepo_name}"
25
26
  end
26
27
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'thor'
3
4
  require 'git'
4
5
  require 'docker'
@@ -38,7 +39,7 @@ class Sectest < Thor
38
39
  @@sectest_manifest['version'] = 'latest'
39
40
 
40
41
  # Dynamically add options and description based on the needs of the sectest container
41
- if %w(build build:all build:image build:specs execute).include?(ARGV[1]) && sectest_name && !sectest_name.start_with?('-', '--')
42
+ if %w[build build:all build:image build:specs execute].include?(ARGV[1]) && sectest_name && !sectest_name.start_with?('-', '--')
42
43
  # Read in the program arguments
43
44
  if File.exist?("sectests/#{sectest_name}/manifest.yml")
44
45
  @@sectest_manifest = YAML.safe_load(File.read("sectests/#{sectest_name}/manifest.yml"))
@@ -77,7 +78,7 @@ class Sectest < Thor
77
78
  repo_dir = Dir.pwd
78
79
 
79
80
  # Check for valid test types
80
- if !%w(authenticated web_application brute_force ssl_crypto ssh_crypto whole_host).include?(options[:test_type])
81
+ if !%w[authenticated web_application brute_force ssl_crypto ssh_crypto whole_host].include?(options[:test_type])
81
82
  say("#{options[:test_type]} is not a supported test type", :red)
82
83
  say('Exiting...', :red)
83
84
  exit(1)
@@ -277,25 +278,18 @@ class Sectest < Thor
277
278
 
278
279
  desc 'validate:image SECTESTNAME', 'Validate SECTESTNAME manifest.yml and readme.md'
279
280
  define_method 'validate:image' do |name|
280
- # Validate the readme file
281
- ENV['sectest_name'] = name
282
- RSpec.clear_examples
283
- RSpec::Core::Runner.run(["#{File.dirname(File.expand_path(__FILE__))}/../support/readme_spec.rb"], $stderr, $stdout)
284
-
285
- # Validate the manifest file
286
- RSpec.clear_examples
287
- RSpec::Core::Runner.run(["#{File.dirname(File.expand_path(__FILE__))}/../support/manifest_spec.rb"], $stderr, $stdout)
281
+ run_validations(name)
288
282
  end
289
283
 
290
284
  desc 'validate', 'Validate all manifest.yml and readme.md'
291
285
  def validate
292
286
  # Error check to ensure this is a plugin directory
293
- Dir.glob('sectests/*').select do |f|
287
+ files = Dir.glob('sectests/*').map do |f|
294
288
  if File.directory? f
295
- # Validate manifest and readme for the sectest
296
- send('validate:image', f.split('/')[-1])
289
+ f.split('/')[-1]
297
290
  end
298
- end
291
+ end.compact
292
+ run_validations(*files)
299
293
  end
300
294
 
301
295
  no_tasks do
@@ -320,7 +314,7 @@ class Sectest < Thor
320
314
 
321
315
  # Ensure commands are run from the root dir
322
316
  def root_dir?
323
- %w(base spec sectests).each do |dirrepo_name|
317
+ %w[base spec sectests].each do |dirrepo_name|
324
318
  if !File.exist?(dirrepo_name)
325
319
  say("Commands must be run from the root of the test repository\nExiting....", :red)
326
320
  exit(1)
@@ -359,5 +353,21 @@ class Sectest < Thor
359
353
  end
360
354
  exit(codes.detect(-> { 0 }, &:nonzero?))
361
355
  end
356
+
357
+ def run_validations(*files)
358
+ codes = files.map do |file|
359
+ ENV['sectest_name'] = file
360
+ # Validate the readme file
361
+ say("Validating README for #{file}")
362
+ RSpec.clear_examples
363
+ RSpec::Core::Runner.run(["#{File.dirname(File.expand_path(__FILE__))}/../support/readme_spec.rb"], $stderr, $stdout)
364
+
365
+ # Validate the manifest file
366
+ say("Validating manifest.yml for #{file}")
367
+ RSpec.clear_examples
368
+ RSpec::Core::Runner.run(["#{File.dirname(File.expand_path(__FILE__))}/../support/manifest_spec.rb"], $stderr, $stdout)
369
+ end
370
+ exit(codes.detect(-> { 0 }, &:nonzero?))
371
+ end
362
372
  end
363
373
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'yaml'
3
4
 
4
5
  module SeedGenerator
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'safe_yaml'
3
4
  SafeYAML::OPTIONS[:default_mode] = :safe
4
5
 
@@ -66,7 +67,6 @@ describe Manifest do
66
67
  CONFIG_SHIM = { ssh_user: '', ssh_key: '', target: '' }.freeze
67
68
  it 'validates the manifest file of all containers' do
68
69
  next if File.exist?("sectests/#{ENV['sectest_name']}/.parent_only")
69
- puts "Looking for valid manifest in: #{p}..."
70
70
  manifest = Manifest.new "sectests/#{ENV['sectest_name']}/manifest.yml"
71
71
  ok
72
72
  manifest_name_check(manifest)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Readme
3
4
  end
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module NoradCli
3
4
  class ResultsServer
4
5
  attr_accessor :container
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'norad_cli/support/results_server.rb'
3
4
  require 'net/http'
4
5
  require 'securerandom'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module NoradCli
3
- VERSION = '0.1.23'
4
+ VERSION = '0.1.24'
4
5
  end
data/lib/norad_cli.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'norad_cli/version'
3
4
  require 'norad_cli/cli/main'
4
5
 
data/norad_cli.gemspec CHANGED
@@ -1,5 +1,6 @@
1
1
  # coding: utf-8
2
2
  # frozen_string_literal: true
3
+
3
4
  lib = File.expand_path('../lib', __FILE__)
4
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
6
  require 'norad_cli/version'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norad_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.23
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Hitchcock
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-03-23 00:00:00.000000000 Z
13
+ date: 2017-05-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: git