Finished gem-izing it
This commit is contained in:
parent
12c82281dc
commit
fd803a090a
@ -1,9 +1,7 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
require_relative 'rubyqa/overrides'
|
require_relative 'rubyqa/overrides'
|
||||||
require_relative 'rubyqa/templates/report'
|
require_relative 'rubyqa/templates'
|
||||||
require_relative 'rubyqa/templates/test'
|
|
||||||
require_relative 'rubyqa/interaction'
|
|
||||||
require_relative 'rubyqa/manager'
|
require_relative 'rubyqa/manager'
|
||||||
require_relative 'rubyqa/resource'
|
require_relative 'rubyqa/resource'
|
||||||
require_relative 'rubyqa/runner'
|
require_relative 'rubyqa/runner'
|
||||||
|
@ -48,14 +48,14 @@ module RubyQA
|
|||||||
end
|
end
|
||||||
|
|
||||||
def report (template = nil)
|
def report (template = nil)
|
||||||
if template
|
if not template.nil?
|
||||||
template.result(binding)
|
template.result(binding)
|
||||||
else
|
else
|
||||||
@@tests.map(&:report).join("\n")
|
render
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RubyQA::Template::BASE_REPORT_TEMPLATE.def_method(RubyQA::Manager, 'render')
|
RubyQA::Template::BASE_REPORT_TEMPLATE.def_method(RubyQA::Manager.class, 'render')
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module RubyQA::Overrides
|
module RubyQA
|
||||||
class ::String
|
class ::String
|
||||||
def red () "\e[0;31m#{self}\e[0m" end
|
def red () "\e[0;31m#{self}\e[0m" end
|
||||||
def red_background ()"\e[0;41m#{self}\e[0m" end
|
def red_background ()"\e[0;41m#{self}\e[0m" end
|
||||||
|
40
lib/rubyqa/templates.rb
Executable file
40
lib/rubyqa/templates.rb
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
module RubyQA
|
||||||
|
module Template
|
||||||
|
require 'erb'
|
||||||
|
BASE_REPORT_TEMPLATE=ERB.new(<<ERB, trim_mode: '-')
|
||||||
|
RubyQA Test Report
|
||||||
|
|
||||||
|
QA Date: <%= Time.now.strftime("%Y/%m/%d %l:%M:%S %p %Z") %>
|
||||||
|
QA Runner: <%= ENV['USER'] %>
|
||||||
|
QA Tests: <%= Manager.tests.count %>
|
||||||
|
<% Manager.tests.each do |test| -%>
|
||||||
|
- "<%= test.name %>"
|
||||||
|
<% end -%>
|
||||||
|
QA Hosts:
|
||||||
|
<% Manager.hosts.each do |host| -%>
|
||||||
|
- <%= host.name %> (<%= host[:ip] %>)
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
###############
|
||||||
|
# Tests Begin #
|
||||||
|
###############
|
||||||
|
|
||||||
|
<% Manager.tests.each do |test| -%>
|
||||||
|
<%= test.report %>
|
||||||
|
<% end -%>
|
||||||
|
ERB
|
||||||
|
|
||||||
|
BASE_TEST_TEMPLATE = ERB.new(<<EOF, :trim_mode => '-')
|
||||||
|
==============================================
|
||||||
|
Test : "<%= @name %>"
|
||||||
|
<%- if not @description.empty? -%>
|
||||||
|
Description : "<%= @description %>"
|
||||||
|
<% end -%>
|
||||||
|
==============================================
|
||||||
|
<% @tests.each do |hostname,data| -%>
|
||||||
|
<%= hostname %> : <%= data[:status] %> <% if data[:context].has_key? :note %> (<%= data[:context][:note] %>) <% end %>
|
||||||
|
<% end -%>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
@ -1,24 +0,0 @@
|
|||||||
module RubyQA::Templates
|
|
||||||
require 'erb'
|
|
||||||
BASE_REPORT=ERB.new(<<ERB, trim_mode: '-')
|
|
||||||
RubyQA Test Report
|
|
||||||
|
|
||||||
QA Date: <%= Time.now.strftime("%Y/%m/%d %l:%M:%S %p %Z") %>
|
|
||||||
QA Runner: <%= ENV['USER'] %>
|
|
||||||
QA Tests: <%= Manager.tests.count %>
|
|
||||||
<% Manager.tests.each do |test| -%>
|
|
||||||
- "<%= test.name %>"
|
|
||||||
<% end -%>
|
|
||||||
QA Hosts:
|
|
||||||
<% Manager.hosts.each do |host| -%>
|
|
||||||
- <%= host.name %> (<%= host[:ip] %>)
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
###############
|
|
||||||
# Tests Begin #
|
|
||||||
###############
|
|
||||||
|
|
||||||
<% Manager.tests.each do |test| -%>
|
|
||||||
<%= test.report %>
|
|
||||||
<% end -%>
|
|
||||||
ERB
|
|
@ -1,12 +0,0 @@
|
|||||||
module RubyQA::Template
|
|
||||||
BASE_TEST_TEMPLATE = ERB.new <<EOF, :trim_mode => '-'
|
|
||||||
==============================================
|
|
||||||
Test : "<%= @name %>"
|
|
||||||
<%- if not @description.empty? -%>
|
|
||||||
Description : "<%= @description %>"
|
|
||||||
<% end -%>
|
|
||||||
==============================================
|
|
||||||
<% @tests.each do |hostname,data| -%>
|
|
||||||
<%= hostname %> : <%= data[:status] %> <% if data[:context].has_key? :note %> (<%= data[:context][:note] %>) <% end %>
|
|
||||||
<% end -%>
|
|
||||||
EOF
|
|
@ -6,9 +6,11 @@ Gem::Specification.new do |s|
|
|||||||
s.description = 'A Ruby based framework defining & orchestrating tests against a host or hosts'
|
s.description = 'A Ruby based framework defining & orchestrating tests against a host or hosts'
|
||||||
s.authors = ['Tristan Ancelet']
|
s.authors = ['Tristan Ancelet']
|
||||||
s.email = 'tristanancelet@yahoo.com'
|
s.email = 'tristanancelet@yahoo.com'
|
||||||
s.homepatge = 'https://git.arcanium.tech/tristan/RubyQA'
|
s.homepage = 'https://git.arcanium.tech/tristan/RubyQA'
|
||||||
s.executables += [ 'generate-qa','impromptu-qa']
|
s.executables += [ 'generate-qa','impromptu-qa']
|
||||||
s.files = Find::find('lib').select{|file| file =~ /rb/}
|
s.files = Find::find('lib').select{|file| file =~ /rb/}
|
||||||
|
s.license = 'MIT'
|
||||||
|
s.required_ruby_version = ">= 2.7.0"
|
||||||
|
|
||||||
s.add_dependency 'net-ssh', '~> 7.1', '>= 7.1.0'
|
s.add_dependency 'net-ssh', '~> 7.1', '>= 7.1.0'
|
||||||
s.add_dependency 'net-ssh-telnet', '~> 0.3', '>= 0.3.0'
|
s.add_dependency 'net-ssh-telnet', '~> 0.3', '>= 0.3.0'
|
||||||
|
Loading…
Reference in New Issue
Block a user