Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ GEM
remote: https://rubygems.org/
specs:
asciidoctor (1.5.6.1)
power_assert (1.1.0)
rake (12.1.0)
bundler-audit (0.6.0)
bundler (~> 1.2)
thor (~> 0.18)
power_assert (1.1.1)
rake (12.2.1)
test-unit (3.2.6)
power_assert
thor (0.20.0)

PLATFORMS
ruby

DEPENDENCIES
bundler (>= 1.15.4)
bundler-audit (>= 0.6.0)
jekyll_aspec!
rake (>= 12.1.0)
test-unit (>= 3.2.6)
Expand Down
12 changes: 12 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require 'bundler/audit/task'
require 'bundler/gem_tasks'
require 'test/unit'

Bundler::Audit::Task.new

task default: :test

task :test do
Expand All @@ -13,3 +16,12 @@ task :rubocop do
sh 'rubocop'
sh 'htmlproofer test'
end

task audit: 'bundle:audit'

desc 'Run tests, perform security audit of dependencies and ruby style check'
task :full do
Rake::Task["test"].invoke
Rake::Task["audit"].invoke
Rake::Task["rubocop"].invoke
end
1 change: 1 addition & 0 deletions jekyll_aspec.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'bundler', '>= 1.15.4'
spec.add_development_dependency 'rake', '>= 12.1.0'
spec.add_development_dependency 'test-unit', '>=3.2.6'
spec.add_development_dependency 'bundler-audit', '>= 0.6.0'
spec.add_runtime_dependency 'asciidoctor', '>= 1.5.0'
end
2 changes: 1 addition & 1 deletion lib/extensions/definition_block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# " = "
# & = &
downcased_title = attrs['title'].downcase.tr(' ', '_').gsub('"', '"')
san_title = attrs['title'].gsub(/&/, '&').gsub(/\`/, '').gsub(/\'/, '').gsub(/\*/, '')
san_title = attrs['title'].gsub(/&/, '&').delete('`').delete("'").delete('*')
rescue Exception => msg
puts msg
# If no title exists on the Def block, throw an exception
Expand Down
10 changes: 5 additions & 5 deletions lib/extensions/requirement_appendix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ def trim(s)
adoc_files.each do |f|
inc = false
commented = false
i = 0
i = 0
File.read(f).each_line do |li|
i += 1
incommentblock ^= true if li[CommentBlockRx]
commented = true if li[CommentLineRx]
inc = true if li[/published: false/]

doctitle = /(?<=title:\s).+/.match(li) if li[/^title:\s+\w.+/] if i < 8
doctitle = /(?<=title:\s).+/.match(li) if i < 8 && li[/^title:\s+\w.+/]
chapter = /(?<=chapter:\s).+/.match(li) if li[/^chapter:\s+\w.+/]

if li[/\[\s*req\s*,\s*id\s*=\s*\w+-?[0-9]+\s*,.*/]
Expand Down Expand Up @@ -83,9 +83,9 @@ def trim(s)
i = 0
reqs.each do |req, f, title, chapter, doctitle|
i += 1
# TODO - find better solution for sanitized titles:
title = title.gsub(/\`/, '').gsub(/\'/, '').gsub(/\*/, '')
# TODO: - find better solution for sanitized titles:
title = title.delete('`').delete("'").delete('*')

id = /[^,]*\s*id\s*=\s*(\w+-?[0-9]+)\s*,.*/.match(req)[1]
version = /(?<=version=)\d+/.match(req)

Expand Down
2 changes: 1 addition & 1 deletion lib/extensions/requirement_block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# &quot; = "
# &amp; = &
downcased_title = attrs['title'].downcase.tr(' ', '_').gsub('"', '&quot;')
san_title = attrs['title'].gsub(/&/, '&amp;').gsub(/\`/, '').gsub(/\'/, '').gsub(/\*/, '')
san_title = attrs['title'].gsub(/&/, '&amp;').delete('`').delete("'").delete('*')
rescue Exception => msg
puts msg
# If no title exists on the Req block, throw an exception
Expand Down
2 changes: 1 addition & 1 deletion test/definition_block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'asciidoctor'
require_relative '../lib/extensions/requirement_block'

class TestRequirementBlock < Test::Unit::TestCase
class TestDefinitionBlock < Test::Unit::TestCase
def test_delimited_with_title
input = "\n.Roundness\n[def]\n--\nRoundness is the measure of how closely the shape of an object approaches that of a mathematically perfect circle.\n--\n"

Expand Down