so_far_so_good 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.md +22 -0
- data/README.md +40 -0
- data/Rakefile +13 -0
- data/lib/so_far_so_good/clause.rb +35 -0
- data/lib/so_far_so_good/clauses.rb +50 -0
- data/lib/so_far_so_good/version.rb +3 -0
- data/lib/so_far_so_good.rb +18 -0
- data/output.json +1 -0
- data/script/bootstrap +4 -0
- data/script/cibuild +5 -0
- data/script/console +3 -0
- data/script/release +3 -0
- data/script/vendor +4 -0
- data/so_far_so_good.gemspec +28 -0
- data/test/helper.rb +8 -0
- data/test/so_far_so_good_clauses_test.rb +30 -0
- data/test/so_far_so_good_test.rb +12 -0
- data/vendor/CFR-2010-title48-vol2-chap1-subchapH.xml +19549 -0
- metadata +151 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9521b2d0cb4777d080a409ff1631f60c70bff35e
|
4
|
+
data.tar.gz: 248816b662685c753f72d37e0ee42be875f7af8b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ef818c8d2c48bad1bd567654aa5f0e16b91063575d414afd63153d019239801ef160181b890072c84c5eeed87a89ef1fa26adf849fd72e054d266052a2f35f41
|
7
|
+
data.tar.gz: 1cdf454823ef2468c531c86d06e9e3a7a4e2e5e6b58e5bafb81a828f0aa9309b6c2ec38271e9b0da355aa3cea0308f5e16ad54606c11349aa96e39ba54a530e2
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Ben Balter
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# So FAR so Good
|
2
|
+
|
3
|
+
A Ruby Gem to parse and manipulate the Federal Acquisition Regulation
|
4
|
+
|
5
|
+
## What it does
|
6
|
+
|
7
|
+
Right now, it simply gives you a hash of FAR 52.2x clauses and their description, but soon, much, much more!
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
SoFarSoGood.clauses
|
13
|
+
> {"52.200"=>"Scope of subpart.",
|
14
|
+
"52.201"=>"[Reserved]",
|
15
|
+
"52.202-1"=>"Definitions.",
|
16
|
+
"52.203-1"=>"[Reserved]",...
|
17
|
+
}
|
18
|
+
```
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
Add this line to your application's Gemfile:
|
23
|
+
|
24
|
+
gem 'so_far_so_good'
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
$ bundle
|
29
|
+
|
30
|
+
Or install it yourself as:
|
31
|
+
|
32
|
+
$ gem install so_far_so_good
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
1. Fork it ( https://github.com/benbalter/so_far_so_good/fork )
|
37
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
38
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
39
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
40
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
Rake::TestTask.new(:test) do |test|
|
5
|
+
test.libs << 'lib' << 'test'
|
6
|
+
test.pattern = 'test/**/so_far_so_good*.rb'
|
7
|
+
test.verbose = true
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Open console with So FAR So Good loaded"
|
11
|
+
task :console do
|
12
|
+
exec "pry -r ./lib/so_far_so_good.rb"
|
13
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module SoFarSoGood
|
2
|
+
class Clause
|
3
|
+
|
4
|
+
attr_reader :number
|
5
|
+
attr_reader :subject
|
6
|
+
attr_reader :reserved
|
7
|
+
attr_reader :citation
|
8
|
+
attr_reader :extract
|
9
|
+
attr_reader :body
|
10
|
+
|
11
|
+
def initialize(node)
|
12
|
+
@number = node.css("SECTNO").text.strip
|
13
|
+
@subject = node.css("SUBJECT, RESERVED").text.strip
|
14
|
+
@reserved = !node.css("RESERVED").text.empty?
|
15
|
+
@citation = node.css("CITA").text.strip
|
16
|
+
@extract = node.css("EXTRACT").text.strip
|
17
|
+
@body = node.children.css("P").text.strip
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_hash
|
21
|
+
{
|
22
|
+
:number => @number,
|
23
|
+
:subject => @subject,
|
24
|
+
:reserverd => @reserved,
|
25
|
+
:citation => @citation,
|
26
|
+
:extract => @extract,
|
27
|
+
:body => @body
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_json(options = {})
|
32
|
+
to_hash.to_json(options)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module SoFarSoGood
|
2
|
+
class Clauses
|
3
|
+
class << self
|
4
|
+
|
5
|
+
HEADINGS = ["Clause", "Description"]
|
6
|
+
|
7
|
+
def numbers
|
8
|
+
@numbers ||= clauses.map { |c| c.number }
|
9
|
+
end
|
10
|
+
|
11
|
+
def subjects
|
12
|
+
@subjects ||= clauses.map { |c| c.subject }
|
13
|
+
end
|
14
|
+
alias_method :descriptions, :subjects
|
15
|
+
|
16
|
+
def clauses
|
17
|
+
@clauses ||= sections.map { |node| SoFarSoGood::Clause.new(node) }
|
18
|
+
end
|
19
|
+
alias_method :list, :clauses
|
20
|
+
|
21
|
+
def to_md
|
22
|
+
@md ||= Terminal::Table.new(:rows => rows, :style => { :border_i => "|" }, :headings => HEADINGS).to_s
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_json
|
26
|
+
@json ||= sections.to_json
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def source_path
|
32
|
+
File.expand_path "CFR-2010-title48-vol2-chap1-subchapH.xml", SoFarSoGood.vendor_directory
|
33
|
+
end
|
34
|
+
|
35
|
+
def doc
|
36
|
+
@doc ||= Nokogiri::XML(File.open(source_path)) do |config|
|
37
|
+
config.noblanks.nonet
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def sections
|
42
|
+
@subpart ||= doc.css("PART SUBPART")[4].children.css("SECTION")
|
43
|
+
end
|
44
|
+
|
45
|
+
def rows
|
46
|
+
@rows ||= clauses.reject { |c| c.reserved }.map { |c| [c.number, c.subject]}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "nokogiri"
|
2
|
+
require "terminal-table"
|
3
|
+
require "json"
|
4
|
+
require_relative "so_far_so_good/version"
|
5
|
+
require_relative "so_far_so_good/clauses"
|
6
|
+
require_relative "so_far_so_good/clause"
|
7
|
+
|
8
|
+
module SoFarSoGood
|
9
|
+
class << self
|
10
|
+
def vendor_directory
|
11
|
+
File.expand_path "../vendor", File.dirname(__FILE__)
|
12
|
+
end
|
13
|
+
|
14
|
+
def clauses
|
15
|
+
SoFarSoGood::Clauses.clauses
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|