so_far_so_good 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab77e766152edb727d4513fc59371d119f0339b3
4
- data.tar.gz: fd27195a2227fa669f86d93593a5eeded9c8310c
3
+ metadata.gz: c3de507b8e6d2e3821b5683474725eaffa542e24
4
+ data.tar.gz: 543852db29e69e7521469bf315e0d078fa5e139e
5
5
  SHA512:
6
- metadata.gz: 305cdec6f88a0555b7af3504414b48814e8927efc19b42e93746f553a69f9b9d181e5bfe748db258ed242b7c51bd5d758faf47fa236f07fbf28329d5acb3263f
7
- data.tar.gz: 09d6f2de3a92e53f8f3e7079b89fa18793fd588d522738ead0e9969f48a8ebd5ef09216d28365df55845b7dcc66470d43914d541566ffb8348126fb8149d2475
6
+ metadata.gz: 7f902bb7820a3bc257a77f04e1b627f8c59d0690ee4169bd8ac4b6e4e2360edc523cdd0e5205fea3700359694237d6424c14af3e3d951eb3ef7e303f8afba984
7
+ data.tar.gz: 1c731803816dea74afab78fec805e65f30113597cf3a33199cc7124c99a07151734415d7d4eca8fac74a6f3bc62cb200e58b0868b17b2a15e3f36b71b6e2440d
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # So FAR so Good
2
2
 
3
- A Ruby Gem to parse and manipulate the Federal Acquisition Regulation (FAR) and Defense Federal Acquisition Regulation Supplement (DFARs)
3
+ A Ruby Gem to parse and manipulate the Federal Acquisition Regulation (FAR) and Defense Federal Acquisition Regulation Supplement (DFARS)
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/so_far_so_good.svg)](http://badge.fury.io/rb/so_far_so_good) [![Build Status](https://travis-ci.org/benbalter/so_far_so_good.svg)](https://travis-ci.org/benbalter/so_far_so_good)
6
6
 
7
7
  ## What it does
8
8
 
9
- So FAR so Good is a Ruby Gem to interact with the Federal Acquisition Regulation (FAR) and Defense Federal Acquisition Regulation Supplement (DFARs). Right now, it supports section 52.20x and 252.20x, the FAR and DFARs standard contracting clause templates.
9
+ So FAR so Good is a Ruby Gem to interact with the Federal Acquisition Regulation (FAR) and Defense Federal Acquisition Regulation Supplement (DFARS). Right now, it supports section 52.20x and 252.20x, the FAR and DFARS standard contracting clause templates.
10
10
 
11
11
  For any contract clause, it will provide:
12
12
 
@@ -27,7 +27,7 @@ It will give you access to this information in object-oriented Ruby, as JSON, or
27
27
  ```ruby
28
28
  subchapters = SoFarSoGood.subchapters
29
29
  => [#<SoFarSoGood::Subchapter year=2013 title=48 volume=2 chapter=1 name="FAR">,
30
- #<SoFarSoGood::Subchapter year=2013 title=48 volume=3 chapter=2 name="DFARs">]
30
+ #<SoFarSoGood::Subchapter year=2013 title=48 volume=3 chapter=2 name="DFARS">]
31
31
 
32
32
  # Get the FAR's subparts
33
33
  subparts = SoFarSoGood.far.subparts
data/bin/far ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../lib/so_far_so_good"
4
+ clause = SoFarSoGood[ARGV[0]]
5
+
6
+ if ARGV[0].nil? || ARGV[0] == "--help"
7
+ puts "Usage: far [CLAUSE NUMBER]"
8
+ elsif clause
9
+ puts clause.extract(:format => :markdown)
10
+ else
11
+ puts "Not found."
12
+ end
@@ -75,8 +75,12 @@ module SoFarSoGood
75
75
  @source_path ||= File.expand_path filename, SoFarSoGood.vendor_directory
76
76
  end
77
77
 
78
+ def source_contents
79
+ File.open(source_path, :encoding => 'utf-8')
80
+ end
81
+
78
82
  def doc
79
- @doc ||= Nokogiri::XML(File.open(source_path)) do |config|
83
+ @doc ||= Nokogiri::XML(source_contents) do |config|
80
84
  config.noblanks.nonet
81
85
  end
82
86
  end
@@ -6,15 +6,15 @@ module SoFarSoGood
6
6
  attr_reader :title
7
7
  attr_reader :volume
8
8
  attr_reader :chapter
9
- attr_reader :document
9
+ attr_reader :subchapter
10
10
 
11
11
  def initialize(hash)
12
- @year = hash[:year]
13
- @title = hash[:title]
14
- @volume = hash[:volume]
15
- @chapter = hash[:chapter]
16
- @document = hash[:name]
17
- @node = hash[:node]
12
+ @year = hash[:year]
13
+ @title = hash[:title]
14
+ @volume = hash[:volume]
15
+ @chapter = hash[:chapter]
16
+ @subchapter = hash[:name]
17
+ @node = hash[:node]
18
18
  normalize!
19
19
  end
20
20
 
@@ -61,18 +61,18 @@ module SoFarSoGood
61
61
 
62
62
  def to_hash(options={})
63
63
  {
64
- :year => year,
65
- :title => title,
66
- :volume => volume,
67
- :chapter => chapter,
68
- :number => number,
69
- :subject => subject,
70
- :reserverd => reserved,
71
- :citation => citation,
72
- :extract => extract(options),
73
- :body => body(options),
74
- :link => link,
75
- :document => document,
64
+ :year => year,
65
+ :title => title,
66
+ :volume => volume,
67
+ :chapter => chapter,
68
+ :number => number,
69
+ :subject => subject,
70
+ :reserverd => reserved,
71
+ :citation => citation,
72
+ :extract => extract(options),
73
+ :body => body(options),
74
+ :link => link,
75
+ :subchapter => subchapter,
76
76
  }
77
77
  end
78
78
 
@@ -81,7 +81,7 @@ module SoFarSoGood
81
81
  end
82
82
 
83
83
  def inspect
84
- "#<SoFarSoGood::Subpart year=#{year} title=#{title} volume=#{volume} chapter=#{chapter} number=\"#{number}\" subject=\"#{subject}\" document=\"#{document}\" reserved=#{reserved}>"
84
+ "#<SoFarSoGood::Subpart year=#{year} title=#{title} volume=#{volume} chapter=#{chapter} number=\"#{number}\" subject=\"#{subject}\" subchapter=\"#{subchapter}\" reserved=#{reserved}>"
85
85
  end
86
86
 
87
87
  private
@@ -1,3 +1,3 @@
1
1
  module SoFarSoGood
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -19,7 +19,7 @@ module SoFarSoGood
19
19
  end
20
20
 
21
21
  def dfars
22
- @dfars ||= SoFarSoGood::Subchapter.new(:name => "DFARs", :volume => 3, :chapter => 2)
22
+ @dfars ||= SoFarSoGood::Subchapter.new(:name => "DFARS", :volume => 3, :chapter => 2)
23
23
  end
24
24
 
25
25
  def subchapters
@@ -0,0 +1,8 @@
1
+ require 'helper'
2
+
3
+ class TestSoFarSoGoodBin < Minitest::Test
4
+ should "work via CLI" do
5
+ output = `bundle exec far 52.222-3`
6
+ assert output.include? "Convict Labor"
7
+ end
8
+ end
@@ -12,7 +12,7 @@ class TestSoFarSoGood < Minitest::Test
12
12
 
13
13
  should "know the DFARs" do
14
14
  assert_equal SoFarSoGood::Subchapter, SoFarSoGood.dfars.class
15
- assert_equal "DFARs", SoFarSoGood.dfars.name
15
+ assert_equal "DFARS", SoFarSoGood.dfars.name
16
16
  end
17
17
 
18
18
  should "return subchapters" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: so_far_so_good
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-23 00:00:00.000000000 Z
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -111,7 +111,8 @@ dependencies:
111
111
  description: ''
112
112
  email:
113
113
  - ben.balter@github.com
114
- executables: []
114
+ executables:
115
+ - far
115
116
  extensions: []
116
117
  extra_rdoc_files: []
117
118
  files:
@@ -121,6 +122,7 @@ files:
121
122
  - LICENSE.md
122
123
  - README.md
123
124
  - Rakefile
125
+ - bin/far
124
126
  - lib/so_far_so_good.rb
125
127
  - lib/so_far_so_good/subchapter.rb
126
128
  - lib/so_far_so_good/subpart.rb
@@ -132,6 +134,7 @@ files:
132
134
  - script/vendor
133
135
  - so_far_so_good.gemspec
134
136
  - test/helper.rb
137
+ - test/so_far_so_good_bin_test.rb
135
138
  - test/so_far_so_good_subchapter_test.rb
136
139
  - test/so_far_so_good_subpart_test.rb
137
140
  - test/so_far_so_good_test.rb
@@ -163,6 +166,7 @@ specification_version: 4
163
166
  summary: ''
164
167
  test_files:
165
168
  - test/helper.rb
169
+ - test/so_far_so_good_bin_test.rb
166
170
  - test/so_far_so_good_subchapter_test.rb
167
171
  - test/so_far_so_good_subpart_test.rb
168
172
  - test/so_far_so_good_test.rb