Skip to content

Commit

Permalink
Merge pull request #164 from irobayna/pr-reorganize
Browse files Browse the repository at this point in the history
Reorganization
  • Loading branch information
kputnam authored Mar 27, 2019
2 parents 0aaefad + 7b887e9 commit f4beb3d
Show file tree
Hide file tree
Showing 2,241 changed files with 106,277 additions and 173,265 deletions.
8 changes: 8 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "2"
exclude_patterns:
- "spec/"
- "**/segment_defs/*.rb"
- "**/element_defs.rb"
- "**/implementations/*.rb"
- "**/standards/*.rb"
- "lib/stupidedi/editor/"
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.yardoc
doc/generated
coverage
build/generated
.bundle
.ruby-version
144 changes: 144 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
require "base64"
require "simplecov-inline-html"
require "term/ansicolor"

SimpleCov.start do
coverage_dir "build/generated/coverage"

add_filter %r{/spec}
add_filter %r{/segment_defs}
add_filter %r{/element_defs}
add_filter %r{/transaction_sets/[0-9]+/[A-Z0-9-]+\.rb}
add_filter %r{/stupidedi/editor}

add_group "Refinements", "lib/ruby"
add_group "Config", "lib/stupidedi/config"
add_group "Editor", "lib/stupidedi/editor"
add_group "Exceptions", "lib/stupidedi/exceptions"
add_group "Interchanges", "lib/stupidedi/interchanges"
add_group "Parser", "lib/stupidedi/parser"
add_group "Reader", "lib/stupidedi/reader"
add_group "Schema", "lib/stupidedi/schema"
add_group "TransactionSets", "lib/stupidedi/transaction_sets"
add_group "Values", "lib/stupidedi/values"
add_group "Versions", "lib/stupidedi/versions"
add_group "Writer", "lib/stupidedi/writer"
add_group "Zipper", "lib/stupidedi/zipper"
end

# Based on https://github.com/inossidabile/simplecov-summary/edit/master/lib/simplecov-summary.rb
class SimpleCov::Formatter::SummaryFormatter
def format(result)
puts "SimpleCov summary:"
name_width = (result.groups.keys + ["SUMMARY"]).map(&:length).max
count_width = result.groups.values.map(&:missed_lines).max.to_i.to_s.length

result.groups.sort.each do |name, files|
print_group(name, files, name_width, count_width)
end

print_group("SUMMARY", result.files, name_width, count_width)
end

def print_group(name, files, name_width, count_width)
pct = files.covered_percent
clr = case pct
when 90..100 then :green
when 80..90 then :yellow
else :red
end
puts Term::ANSIColor.send(clr,
(" % #{name_width}s: % 5s%% " +
"% #{count_width}s missed lines, " +
"% #{count_width + 2}s lines total") %
[name, pct.round(1), files.missed_lines.to_i, files.lines_of_code.to_i])
end
end

class SimpleCov::Formatter::CustomHtmlFormatter < SimpleCov::Formatter::InlineHTMLFormatter
def output_message(result)
end

# This image is missing from simplecov-inline-html
BORDER = <<-EOF.gsub(/\s/, '')
iVBORw0KGgoAAAANSUhEUgAAAAEAAABLCAIAAAA+tHrUAAAAUklEQVR4AcXH
sQ3AIAwFUfuDYADSMQkrMiVdqKGzLDnCRTaIUjzpjnvvodaKtRbM7KWqTkT4
PBF9Yu+NMQauUvx/Eu45Q0oJOWd3OsbomBmttQc0NiOlCz/4pgAAAABJRU5E
rkJggg==
EOF

# This image is missing from simplecov-inline-html
CONTROLS = <<-EOF.gsub(/\s/, '')
iVBORw0KGgoAAAANSUhEUgAAAOEAAABLCAMAAACx6hDAAAABj1BMVEVPT0/e
3t7b29vS0tK7urq5uLjq6uqZmZmSkpJaWlrU1NTj4+PFxcWvr6+goKBbW1u3
t7c9PT27u7vCwsKsrKxiYWGqqqq5ublbWlpeXV2Xl5fExMSbmpq6ubmNjY18
fHzy8vIrKystLS0sLCxNTU0uLi4wMDDNzc05OTns6+vl5eUvLy/q6ekqKipM
TExDQ0M4ODgyMjI2NjbZ2dk6OjrY2NjMzMxLS0vAwMBCQkLo5+dHR0cxMTFK
SkpBQUHv7u43NzdISEhFRUVRUVHx8fE7Ozs8PDwzMzNJSUnp6elGRkZQUFDr
6upeXl7t7e1gYGCoqKjv7+81NTWKiorn5uZERESCgoJdXV3p6OhOTk51dXVA
QEA+Pj6np6fu7e2+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LGB2EjGh4ll9Bg4RISj3ZGa93uVjHd
brQ22uFAI4WK1i7s69rFxq7j3htzhfL2vKQ37yU25+ElNFJIWiwxgv7KY95g
aaaQG3vyHlkEmitEI0bV52yikOe7KnygYcK/0sK5wtrjpuMAAAAASUVORK5C
YII=
EOF

def file(path)
if path.end_with?("application.css")
css = super(path)
css.gsub!("url(colorbox/border.png)", "url(data:image/png;base64,#{BORDER})")
css.gsub!("url(colorbox/controls.png)", "url(data:image/png;base64,#{CONTROLS})")

# Fit more stuff without scroll bars, don't linewrap filenames
css << <<-EOF
body { padding:0 !important; }
.src_link { white-space:nowrap; }
.file_list { font-size: .8rem; }
.ui-icon { width:0px !important; height:0px !important; }
th { font-size:.7rem; overflow:hidden; white-space:normal !important; }
EOF
css
else
super(path)
end
end
end

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::SummaryFormatter,
SimpleCov::Formatter::CustomHtmlFormatter
])
37 changes: 20 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
language: ruby
before_install:
gem install bundler
before_install:
- if [[ $(ruby -v) < "ruby 2.3" ]];
then
gem install bundler -v "< 2";
else
gem update --system;
gem install bundler;
fi

rvm:
# 1.9.3
# 1.9.2
# 2.0.0
# 2.1.0
# 2.1.1
# 2.1.2
# 2.1.3
# 2.1.4
# 2.1.5
# 2.1.6
# 2.1.7
- 2.1.0
- 2.1.1
- 2.1.2
- 2.1.3
- 2.1.4
- 2.1.5
- 2.1.6
- 2.1.7
- 2.1.8
# 2.2.0
# 2.2.1
# 2.2.2
# 2.2.3
- 2.2.0
- 2.2.1
- 2.2.2
- 2.2.3
- 2.2.4
- 2.3.0
- 2.3.1
Expand All @@ -29,5 +33,4 @@ rvm:
- 2.5.0
- 2.5.1
- 2.5.3
# jruby
- 2.6.0
17 changes: 10 additions & 7 deletions .yardopts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
--default-return ''
--hide-void-return
--no-private
--output-dir doc/generated
--asset doc/images:images
--load ./yard/rspec-plugin/lib/yard-rspec.rb
--load ./yard/meta-plugin/lib/yard-meta.rb
--db build/generated/.yardoc
--output-dir build/generated/doc
--load ./build/doc/lib/rspec-plugin/lib/yard-rspec.rb
--load ./build/doc/lib/meta-plugin/lib/yard-meta.rb
--asset doc/images:images
--files doc/**/*.md
--exclude 'element_defs\.rb'
--exclude 'segment_defs\.rb'
--exclude 'segment_defs\/'

lib/**/*.rb
spec/examples/**/*.example

- doc/*.md
spec/examples/**/*_spec.rb
22 changes: 13 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ gem "cantor", "~> 1.2.1"

group :development do
gem "rake"
gem "rspec" , "3.8.0"
gem "term-ansicolor"

gem "rspec", "3.8.0"
gem "rspec-collection_matchers"
gem "yard" ,"~> 0.9.12"
gem "redcarpet" ,"~> 3.4.0", :platforms => [:mri]


gem "term-ansicolor"
gem "blankslate" ,:platforms => [:ruby_18, :mri_18, :mingw_18]

gem "rcov" ,"~> 1.0.0" ,:platforms => [:mri_18]
gem "yard","~> 0.9.12"
# gem "redcarpet","~> 3.4.0", :platforms => [:mri]

# https://github.com/colszowka/simplecov#ruby-version-compatibility
gem "simplecov" ,:platforms => [:ruby_25]
gem "simplecov", :platforms => [:ruby_24, :ruby_25]
gem "simplecov-inline-html", :platforms => [:ruby_24, :ruby_25]

# gem "stackprof"
# gem "fasterer"
# gem "benchmark-ips"
# gem "memory_profiler"
# gem "allocation_stats"
# gem "heapy"

# We're using a patched version installed in yard/ until the
# maintainer improves the plugin. The patch has been submitted
Expand Down
12 changes: 4 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
GEM
remote: http://rubygems.org/
specs:
blankslate (3.1.3)
cantor (1.2.1)
diff-lcs (1.3)
docile (1.3.1)
json (2.1.0)
rake (12.3.2)
rcov (1.0.0)
redcarpet (3.4.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
Expand All @@ -29,7 +26,8 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
term-ansicolor (1.7.0)
simplecov-inline-html (0.0.1)
term-ansicolor (1.7.1)
tins (~> 1.0)
tins (1.20.2)
yard (0.9.16)
Expand All @@ -39,16 +37,14 @@ PLATFORMS
ruby

DEPENDENCIES
blankslate
cantor (~> 1.2.1)
rake
rcov (~> 1.0.0)
redcarpet (~> 3.4.0)
rspec (= 3.8.0)
rspec-collection_matchers
simplecov
simplecov-inline-html
term-ansicolor
yard (~> 0.9.12)

BUNDLED WITH
1.16.6
1.17.2
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ memory allocation. The steady increase in throughput on JRuby and Rubinus is
probably attributable optimizations performed by the JIT compiler.

Lastly, these results should approximate the performance of document generation
with BuilderDSL, except BuilderDSL API should have less overhead, as it skips
the tokenizer. On the other hand, BuilderDSL frequently queries the call stack
with BuilderDsl, except BuilderdsL API should have less overhead, as it skips
the tokenizer. On the other hand, BuilderDsl frequently queries the call stack
to track provenance of elements in the parse tree. In common real-world use,
custom application logic and database access are going to bottleneck performance,
rather than Stupidedi.
Expand Down Expand Up @@ -241,7 +241,7 @@ require "stupidedi"
# You can customize this to delegate to your own grammar definitions, if needed.
config = Stupidedi::Config.hipaa

b = Stupidedi::Builder::BuilderDsl.build(config)
b = Stupidedi::Parser::BuilderDsl.build(config)

# These methods perform error checking: number of elements, element types, min/max
# length requirements, conditionally required elements, valid segments, number of
Expand Down Expand Up @@ -333,7 +333,7 @@ Please refer to [this readme](https://github.com/irobayna/stupidedi/blob/master/
require "stupidedi"

config = Stupidedi::Config.hipaa
parser = Stupidedi::Builder::StateMachine.build(config)
parser = Stupidedi::Parser.build(config)

input = if RUBY_VERSION > "1.8"
File.open("spec/fixtures/X221-HP835/1-good.txt", :encoding => "ISO-8859-1")
Expand Down
Loading

0 comments on commit f4beb3d

Please sign in to comment.