os_map_ref 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e402a08b5f2575a30def6376c195855cdd1c4537
4
- data.tar.gz: 82f882c3c5cf7c12c54519747deee392f0ecfdda
3
+ metadata.gz: 408a8566ec988e46917ddec0ab4540092b446dcd
4
+ data.tar.gz: 91cbf8775320c6fab6668a02b8ef299e8c12525b
5
5
  SHA512:
6
- metadata.gz: '079ba362e43f0993c800a7db2cde7ffddb1e1ba9ac2fb9a654cfb848dd129c5492952df2fa9fbf3f049560d0588fa06a49fc34f88925135f722e1681ddbaa892'
7
- data.tar.gz: f49114adfdbbad429901f90e1df5b2050b2e778a487abadb76bdee5e753f12bd57d206a875806827e8521429ba4319085595e987865cc21e93d8f87a70430ab1
6
+ metadata.gz: 9a374de093e186f14ec61721c1652b25549d66ec66c027e1c9f9f2640a8bb778843c04a4954e60bde30fba3841b391e0d3ee08c53f8eb22c189b953c0bab324c
7
+ data.tar.gz: 82334f32ea0d3f8e0c7f9c1f528211e944a0cc34f79ea9ea1fa5c777b845cde1ad5adbf24b7de7917083ede26cc17a7d35233f23adc938ae37bf8ded92759be9
data/README.md CHANGED
@@ -1,10 +1,9 @@
1
1
  # OsMapRef
2
2
 
3
- [![Build Status](https://travis-ci.org/DEFRA/os_map_ref.svg?branch=master)](https://travis-ci.org/DEFRA/os_map_ref)
4
- [![Maintainability](https://api.codeclimate.com/v1/badges/759edb337395f3c0e9d2/maintainability)](https://codeclimate.com/github/DEFRA/os_map_ref/maintainability)
5
- [![Test Coverage](https://api.codeclimate.com/v1/badges/759edb337395f3c0e9d2/test_coverage)](https://codeclimate.com/github/DEFRA/os_map_ref/test_coverage)
6
- [![security](https://hakiri.io/github/DEFRA/os_map_ref/master.svg)](https://hakiri.io/github/DEFRA/os_map_ref/master)
7
- [![Dependency Status](https://dependencyci.com/github/DEFRA/os_map_ref/badge)](https://dependencyci.com/github/DEFRA/os_map_ref)
3
+ [![Build Status](https://travis-ci.org/DEFRA/os-map-ref.svg?branch=master)](https://travis-ci.org/DEFRA/os-map-ref)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/17df026b62cc3912f842/maintainability)](https://codeclimate.com/github/DEFRA/os-map-ref/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/17df026b62cc3912f842/test_coverage)](https://codeclimate.com/github/DEFRA/os-map-ref/test_coverage)
6
+ [![security](https://hakiri.io/github/DEFRA/os-map-ref/master.svg)](https://hakiri.io/github/DEFRA/os-map-ref/master)
8
7
  [![Gem Version](https://badge.fury.io/rb/os_map_ref.svg)](https://badge.fury.io/rb/os_map_ref)
9
8
 
10
9
  This gem allows you to gather U.K. Ordnance Survey Eastings, North, and Map
@@ -83,9 +82,7 @@ puts "Longitude = #{location.lon} in radians."
83
82
 
84
83
  ## Development
85
84
 
86
- After checking out the repo, run `bin/setup` to install dependencies.
87
- Then, run `rake test` to run the tests. You can also run `bin/console`
88
- for an interactive prompt that will allow you to experiment.
85
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
89
86
 
90
87
  To install this gem onto your local machine, run `bundle exec rake install`.
91
88
 
data/Rakefile CHANGED
@@ -1,16 +1,29 @@
1
- require "bundler/gem_tasks"
2
- require "github_changelog_generator/task"
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require "bundler/setup"
5
+ rescue LoadError
6
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
7
+ end
8
+
9
+ Bundler::GemHelper.install_tasks
3
10
 
11
+ # This is wrapped to prevent an error when rake is called in environments where
12
+ # rspec may not be available, e.g. production. As such we don't need to handle
13
+ # the error.
14
+ # rubocop:disable Lint/HandleExceptions
4
15
  begin
5
16
  require "rspec/core/rake_task"
17
+
6
18
  RSpec::Core::RakeTask.new(:spec)
7
- rescue LoadError => err
8
- puts "Load error: #{err}"
9
- end
10
19
 
11
- task test: :spec
20
+ task default: :spec
21
+ rescue LoadError
22
+ # no rspec available
23
+ end
24
+ # rubocop:enable Lint/HandleExceptions
12
25
 
13
- task default: :test
26
+ require "github_changelog_generator/task"
14
27
 
15
28
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
16
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "os_map_ref/error"
2
4
  require "os_map_ref/input_processor"
3
5
  require "os_map_ref/location"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OsMapRef
2
4
  class Error < StandardError; end
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OsMapRef
2
4
  class InputProcessor
3
5
  attr_reader :input
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "matrix"
2
4
 
3
5
  module OsMapRef
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OsMapRef
2
- VERSION = "0.4.2".freeze
4
+ VERSION = "0.5.0"
3
5
  end
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ describe OsMapRef::InputProcessor do
6
+
7
+ let(:map_reference) { "ST 58901 71053" }
8
+ let(:long_map_reference) { "HT 58901 71053" }
9
+ let(:easting) { "358901" }
10
+ let(:northing) { "171053" }
11
+
12
+ describe ".new" do
13
+ context "with map reference" do
14
+ it "should return formated map reference" do
15
+ input_cleaner = described_class.new(map_reference)
16
+ expect(input_cleaner.params[:map_reference]).to eq(map_reference)
17
+ end
18
+ end
19
+
20
+ context "with map reference without spaces" do
21
+ it "should return formated map reference" do
22
+ input_cleaner = described_class.new(map_reference.gsub(/\s+/, ""))
23
+ expect(input_cleaner.params[:map_reference]).to eq(map_reference)
24
+ end
25
+ end
26
+
27
+ context "with lower case map reference" do
28
+ it "should return formated map reference" do
29
+ input_cleaner = described_class.new(map_reference.downcase)
30
+ expect(input_cleaner.params[:map_reference]).to eq(map_reference)
31
+ end
32
+ end
33
+
34
+ context "with long map reference" do
35
+ it "should return formated map reference" do
36
+ input_cleaner = described_class.new(long_map_reference)
37
+ expect(input_cleaner.params[:map_reference]).to eq(long_map_reference)
38
+ end
39
+ end
40
+
41
+ context "with long map reference without spaces" do
42
+ it "should return formated map reference" do
43
+ input_cleaner = described_class.new(long_map_reference.gsub(/\s+/, ""))
44
+ expect(input_cleaner.params[:map_reference]).to eq(long_map_reference)
45
+ end
46
+ end
47
+
48
+ context "with six figure map reference" do
49
+ let(:map_reference) { "ST589710" }
50
+ it "should return formated map reference" do
51
+ input_cleaner = described_class.new(map_reference)
52
+ expect(input_cleaner.params[:map_reference]).to eq("ST 58900 71000")
53
+ end
54
+ end
55
+
56
+ context "with easting and northings" do
57
+ let(:expected) { { easting: easting, northing: northing } }
58
+
59
+ it "should handle easting and nothing separated by space" do
60
+ input = [easting, northing].join(" ")
61
+ input_cleaner = described_class.new(input)
62
+ expect(input_cleaner.params).to eq(expected)
63
+ end
64
+
65
+ it "should handle easting and nothing separated by comma" do
66
+ input = [easting, northing].join(",")
67
+ input_cleaner = described_class.new(input)
68
+ expect(input_cleaner.params).to eq(expected)
69
+ end
70
+
71
+ it "should handle easting and nothing separated by space and space" do
72
+ input = [easting, northing].join(", ")
73
+ input_cleaner = described_class.new(input)
74
+ expect(input_cleaner.params).to eq(expected)
75
+ end
76
+ end
77
+
78
+ context "with short eastings and northings" do
79
+ it "should pad out short input" do
80
+ input = "123 456"
81
+ input_cleaner = described_class.new(input)
82
+ expected = { easting: "123000", northing: "456000" }
83
+ expect(input_cleaner.params).to eq(expected)
84
+ end
85
+ end
86
+
87
+ context "with short eastings and northings, but longer northing" do
88
+ it "should pad out short input" do
89
+ input = "456 1234"
90
+ input_cleaner = described_class.new(input)
91
+ expected = { easting: "456000", northing: "1234000" }
92
+ expect(input_cleaner.params).to eq(expected)
93
+ end
94
+ end
95
+
96
+ context "with decimals in eastings and northings" do
97
+ it "should pass on the decimal elements" do
98
+ input = "308901.4,101053.3"
99
+ input_cleaner = described_class.new(input)
100
+ expected = { easting: "308901.4", northing: "101053.3" }
101
+ expect(input_cleaner.params).to eq(expected)
102
+ end
103
+ end
104
+
105
+ it "should raise error on unknown input" do
106
+ expect { described_class.new("unknown").params }.to raise_error(OsMapRef::Error)
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,237 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ describe OsMapRef::Location do
6
+
7
+ let(:map_reference) { "ST 58901 71053" }
8
+ let(:easting) { "358901" }
9
+ let(:northing) { "171053" }
10
+ let(:long_map_reference) { "HT 58901 71053" }
11
+ let(:long_northing) { "1171053" }
12
+
13
+ describe ".for" do
14
+ it "should accept a map reference" do
15
+ location = described_class.for map_reference
16
+ expect(location.map_reference).to eq(map_reference)
17
+ end
18
+
19
+ it "should accept a map reference without space" do
20
+ location = described_class.for map_reference.delete(" ")
21
+ expect(location.map_reference).to eq(map_reference)
22
+ end
23
+
24
+ it "should accept a downcase map reference" do
25
+ location = described_class.for map_reference.downcase
26
+ expect(location.map_reference).to eq(map_reference)
27
+ end
28
+
29
+ it "should accept easting and northing" do
30
+ location = described_class.for [easting, northing].join(" ")
31
+ expect(location.map_reference).to eq(map_reference)
32
+ end
33
+ end
34
+
35
+ describe ".new" do
36
+ it "should accept easting and northing strings" do
37
+ location = described_class.new easting: easting.to_s, northing: northing.to_s
38
+ expect(location.easting).to eq(easting)
39
+ expect(location.northing).to eq(northing)
40
+ end
41
+
42
+ context "when initiated with map_reference" do
43
+ let(:location) { described_class.new map_reference: map_reference }
44
+
45
+ describe ".map_reference" do
46
+ it "should return input" do
47
+ expect(location.map_reference).to eq(map_reference)
48
+ end
49
+ end
50
+
51
+ describe ".easting" do
52
+ it "should be calculated from map_reference" do
53
+ expect(location.easting).to eq(easting)
54
+ end
55
+ end
56
+
57
+ describe ".northing" do
58
+ it "should be calculated from map_reference" do
59
+ expect(location.northing).to eq(northing)
60
+ end
61
+ end
62
+ end
63
+
64
+ context "when initiated with easting and northing" do
65
+ let(:location) { described_class.new easting: easting, northing: northing }
66
+
67
+ describe ".map_reference" do
68
+ it "should be calculated from easting and northing" do
69
+ expect(location.map_reference).to eq(map_reference)
70
+ end
71
+ end
72
+
73
+ describe ".easting" do
74
+ it "should return input" do
75
+ expect(location.easting).to eq(easting)
76
+ end
77
+ end
78
+
79
+ describe ".northing" do
80
+ it "should return input" do
81
+ expect(location.northing).to eq(northing)
82
+ end
83
+ end
84
+
85
+ describe ".grid_easting" do
86
+ it "should be first number of easting" do
87
+ expect(location.grid_easting).to eq(3)
88
+ end
89
+ end
90
+
91
+ describe ".short_easting" do
92
+ it "should be number after first number of easting" do
93
+ expect(location.short_easting).to eq("58901")
94
+ end
95
+ end
96
+
97
+ describe ".grid_northing" do
98
+ it "should be first number of northing" do
99
+ expect(location.grid_northing).to eq(1)
100
+ end
101
+ end
102
+
103
+ describe ".short_northing" do
104
+ it "should be number after first number of northing" do
105
+ expect(location.short_northing).to eq("71053")
106
+ end
107
+ end
108
+ end
109
+
110
+ context "when initiated with easting and long northing" do
111
+ let(:location) { described_class.new easting: easting, northing: long_northing }
112
+
113
+ describe ".grid_northing" do
114
+ it "should be the first two numbers of northing" do
115
+ expect(location.grid_northing).to eq(11)
116
+ end
117
+ end
118
+
119
+ describe ".short_northing" do
120
+ it "should be the number after the first two numbers of northing" do
121
+ expect(location.short_northing).to eq("71053")
122
+ end
123
+ end
124
+ end
125
+
126
+ context "when eastings and northing second character a zero" do
127
+ let(:map_reference) { "ST 08901 01053" }
128
+ let(:easting) { "308901" }
129
+ let(:northing) { "101053" }
130
+ let(:location) { described_class.new easting: easting, northing: northing }
131
+
132
+ describe ".map_reference" do
133
+ it "should be calculated from easting and northing" do
134
+ expect(location.map_reference).to eq(map_reference)
135
+ end
136
+ end
137
+ end
138
+
139
+ context "when eastings and northing contain decimals" do
140
+ let(:map_reference) { "ST 08901 01053" }
141
+ let(:easting) { "308901.4" }
142
+ let(:northing) { "101053.3" }
143
+ let(:location) { described_class.new easting: easting, northing: northing }
144
+
145
+ describe ".map_reference" do
146
+ it "should be calculated from easting and northing" do
147
+ expect(location.map_reference).to eq(map_reference)
148
+ end
149
+ end
150
+ end
151
+
152
+ context "when eastings and northing is one unit into grid from origin" do
153
+ let(:map_reference) { "SV 00001 00001" }
154
+ let(:easting) { "000001" }
155
+ let(:northing) { "000001" }
156
+
157
+ context "and eastings and northings defined" do
158
+ let(:location) { described_class.new easting: easting, northing: northing }
159
+
160
+ describe ".map_reference" do
161
+ it "should be calculated from easting and northing" do
162
+ expect(location.map_reference).to eq(map_reference)
163
+ end
164
+ end
165
+ end
166
+
167
+ context "and map reference is defined" do
168
+ let(:location) { described_class.new map_reference: map_reference }
169
+
170
+ describe ".easting" do
171
+ it "should be calculated from map_reference" do
172
+ expect(location.easting).to eq(easting)
173
+ end
174
+ end
175
+
176
+ describe ".northing" do
177
+ it "should be calculated from map_reference" do
178
+ expect(location.northing).to eq(northing)
179
+ end
180
+ end
181
+ end
182
+
183
+ context "when grid_reference prefix not in grid" do
184
+ let(:map_reference) { "zz 00001 00001" }
185
+ let(:location) { described_class.new map_reference: map_reference }
186
+
187
+ it "should raise an exception" do
188
+ expect { location.easting }.to raise_error(OsMapRef::Error)
189
+ end
190
+
191
+ end
192
+ end
193
+
194
+ context "when northing is long" do
195
+ let(:map_reference) { long_map_reference }
196
+ let(:northing) { long_northing }
197
+
198
+ context "and eastings and northings defined" do
199
+ let(:location) { described_class.new easting: easting, northing: northing }
200
+
201
+ describe ".map_reference" do
202
+ it "should be calculated from easting and northing" do
203
+ expect(location.map_reference).to eq(map_reference)
204
+ end
205
+ end
206
+ end
207
+
208
+ context "and map reference is defined" do
209
+ let(:location) { described_class.new map_reference: map_reference }
210
+
211
+ describe ".easting" do
212
+ it "should be calculated from map_reference" do
213
+ expect(location.easting).to eq(easting)
214
+ end
215
+ end
216
+
217
+ describe ".northing" do
218
+ it "should be calculated from map_reference" do
219
+ expect(location.northing).to eq(northing)
220
+ end
221
+ end
222
+ end
223
+ end
224
+ end
225
+
226
+ describe ".remove_decimals" do
227
+ let(:location) { described_class.new map_reference: map_reference }
228
+
229
+ it "should return the number if no decimals" do
230
+ expect(location.remove_decimals("308901")).to eq("308901")
231
+ end
232
+
233
+ it "should return the number with decimals removed" do
234
+ expect(location.remove_decimals("308901.4")).to eq("308901")
235
+ end
236
+ end
237
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "spec_helper"
4
+
5
+ describe OsMapRef do
6
+
7
+ describe "::VERSION" do
8
+ it "should be a string" do
9
+ expect(described_class::VERSION).to be_a(String)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code coverage
4
+ require "simplecov"
5
+
6
+ SimpleCov.start do
7
+ # any custom configs like groups and filters can be here at a central place
8
+
9
+ # Standard filters
10
+ add_filter "lib/os_map_ref/version"
11
+ # It's standard to ignore the spec folder when determining coverage
12
+ add_filter "/spec/"
13
+
14
+ # You can make Simplecov ignore sections of by wrapping them in # :nocov:
15
+ # tags. However without knowledge of this `nocov` doesn't mean a lot so here
16
+ # we take advantage of a feature that allows us to use a custom token to do
17
+ # the same thing `nocov` does. Now in our code any sections we want to exclude
18
+ # from test coverage stats we wrap in # :simplecov_ignore: tokens.
19
+ # https://github.com/colszowka/simplecov#ignoringskipping-code
20
+ nocov_token "simplecov_ignore"
21
+ end
22
+
23
+ require_relative "../lib/os_map_ref"
24
+
25
+ RSpec.configure do |config|
26
+
27
+ config.expect_with :rspec do |expectations|
28
+ # This option will default to `true` in RSpec 4. It makes the `description`
29
+ # and `failure_message` of custom matchers include text for helper methods
30
+ # defined using `chain`, e.g.:
31
+ # be_bigger_than(2).and_smaller_than(4).description
32
+ # # => "be bigger than 2 and smaller than 4"
33
+ # ...rather than:
34
+ # # => "be bigger than 2"
35
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
36
+ end
37
+ config.mock_with :rspec do |mocks|
38
+ # Prevents you from mocking or stubbing a method that does not exist on
39
+ # a real object. This is generally recommended, and will default to
40
+ # `true` in RSpec 4.
41
+ mocks.verify_partial_doubles = true
42
+ end
43
+
44
+ # This setting enables warnings. It's recommended, but in some cases may
45
+ # be too noisy due to issues in dependencies.
46
+ config.warnings = true
47
+
48
+ # Many RSpec users commonly either run the entire suite or an individual
49
+ # file, and it's useful to allow more verbose output when running an
50
+ # individual spec file.
51
+ if config.files_to_run.one?
52
+ # Use the documentation formatter for detailed output,
53
+ # unless a formatter has already been configured
54
+ # (e.g. via a command-line flag).
55
+ config.default_formatter = "doc"
56
+ end
57
+
58
+ # Print the 10 slowest examples and example groups at the
59
+ # end of the spec run, to help surface which specs are running
60
+ # particularly slow.
61
+ # config.profile_examples = 2
62
+
63
+ # Run specs in random order to surface order dependencies. If you find an
64
+ # order dependency and want to debug it, you can fix the order by providing
65
+ # the seed, which is printed after each run.
66
+ # --seed 1234
67
+ config.order = :random
68
+
69
+ # Seed global randomization in this process using the `--seed` CLI option.
70
+ # Setting this allows you to use `--seed` to deterministically reproduce
71
+ # test failures related to randomization by passing the same `--seed` value
72
+ # as the one that triggered the failure.
73
+ Kernel.srand config.seed
74
+
75
+ end
metadata CHANGED
@@ -1,73 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: os_map_ref
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
- - Environment Agency
7
+ - Defra
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-30 00:00:00.000000000 Z
11
+ date: 2018-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: github_changelog_generator
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.11'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3.8'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3.8'
55
55
  - !ruby/object:Gem::Dependency
56
- name: simplecov
56
+ name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0.13'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0.13'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: github_changelog_generator
70
+ name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -88,13 +88,6 @@ executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
- - ".codeclimate.yml"
92
- - ".gitignore"
93
- - ".rspec"
94
- - ".rubocop.yml"
95
- - ".travis.yml"
96
- - CHANGELOG.md
97
- - Gemfile
98
91
  - LICENSE
99
92
  - README.md
100
93
  - Rakefile
@@ -105,10 +98,13 @@ files:
105
98
  - lib/os_map_ref/input_processor.rb
106
99
  - lib/os_map_ref/location.rb
107
100
  - lib/os_map_ref/version.rb
108
- - os_map_ref.gemspec
109
- homepage: https://github.com/DEFRA/os_map_ref
101
+ - spec/os_map_ref/input_processor_spec.rb
102
+ - spec/os_map_ref/location_spec.rb
103
+ - spec/os_map_ref_spec.rb
104
+ - spec/spec_helper.rb
105
+ homepage: https://github.com/DEFRA/os-map-ref
110
106
  licenses:
111
- - Nonstandard
107
+ - The Open Government Licence (OGL) Version 3
112
108
  metadata: {}
113
109
  post_install_message:
114
110
  rdoc_options: []
@@ -118,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
114
  requirements:
119
115
  - - ">="
120
116
  - !ruby/object:Gem::Version
121
- version: '1.9'
117
+ version: '2.4'
122
118
  required_rubygems_version: !ruby/object:Gem::Requirement
123
119
  requirements:
124
120
  - - ">="
@@ -126,9 +122,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
122
  version: '0'
127
123
  requirements: []
128
124
  rubyforge_project:
129
- rubygems_version: 2.6.11
125
+ rubygems_version: 2.6.14
130
126
  signing_key:
131
127
  specification_version: 4
132
128
  summary: A tool to help handle UK Ordnance Survey map references, in particular to
133
129
  convert them to other coordinate systems
134
- test_files: []
130
+ test_files:
131
+ - spec/spec_helper.rb
132
+ - spec/os_map_ref/location_spec.rb
133
+ - spec/os_map_ref/input_processor_spec.rb
134
+ - spec/os_map_ref_spec.rb
@@ -1,19 +0,0 @@
1
- ---
2
- engines:
3
- duplication:
4
- enabled: true
5
- config:
6
- languages:
7
- - ruby
8
- fixme:
9
- enabled: true
10
- rubocop:
11
- enabled: true
12
- reek:
13
- enabled: true
14
- ratings:
15
- paths:
16
- - "**.module"
17
- - "**.rb"
18
- exclude_paths:
19
- - spec/
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
@@ -1,122 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.2
3
- # Cop names are not displayed in offense messages by default. We find it useful to include this information so we can
4
- # use it to investigate what the fix may be.
5
- DisplayCopNames: true
6
- # Style guide URLs are not displayed in offense messages by default. Again we find it useful to go straight to the
7
- # documentation for a rule when investigating what the fix may be.
8
- DisplayStyleGuide: true
9
- Include:
10
- - "**/*.gemspec"
11
- - "**/*.rake"
12
- - "**/*.rb"
13
- - "**/Gemfile"
14
- - "**/Rakefile"
15
- Exclude:
16
- - "**/bin/*"
17
-
18
- # Rubymine disagrees and not sure how to fix Rubymine indentation right now
19
- Layout/CaseIndentation:
20
- Enabled: false
21
-
22
- # We believe it looks cluttered not having the ability to have empty lines after
23
- # the module, class, and block declarations
24
- Layout/EmptyLinesAroundBlockBody:
25
- Enabled: false
26
- Layout/EmptyLinesAroundModuleBody:
27
- Enabled: false
28
- Layout/EmptyLinesAroundClassBody:
29
- Enabled: false
30
-
31
- # Without this exclusion a line like this `expect { subject.call }` will get
32
- # flagged as an error by Rubocop. This is a deliberate idiom in rspec so rather
33
- # than add exceptions where it is used, we exclude spec's from this rule here.
34
- # https://github.com/bbatsov/rubocop/issues/4222
35
- Lint/AmbiguousBlockAssociation:
36
- Exclude:
37
- - "spec/**/*"
38
-
39
- # TODO: Understand what the issue is and whether this needs to be more formally disabled (i.e. the dev team agree)
40
- # We don't understand this for now - seems to prevent perfectly reasonable meta-programming
41
- Lint/NestedMethodDefinition:
42
- Enabled: false
43
-
44
- # We felt as a team that the default size of 15 was too low, and blocked what to us are sound methods which would not
45
- # add any value if broken up, for exampler composer type methods. Therefore we agreed to up the score to 20 to allow
46
- # for these types of methods
47
- Metrics/AbcSize:
48
- Max: 40
49
-
50
- # We don't feel we can help having a large gemspec, hence we exclude it.
51
- # We don't feel it makes sense to split specs and factories over multiple files,
52
- # or when in a context be forced to try and come up with slightly different ones
53
- # in order to reduce the block length. Hence we exclude specs and factories from
54
- # this rule.
55
- # Shared examples are the same as specs, but don't have the _spec.rb extension
56
- # hence they are listed separately
57
- Metrics/BlockLength:
58
- Exclude:
59
- - "**/*.gemspec"
60
- - "**/spec/**/*_spec.rb"
61
- - "**/spec/**/*_factory.rb"
62
- - "**/spec/shared_examples/*.rb"
63
-
64
- # We believe the default of 10 lines for a method length is too restrictive and often quickly hit just because we need
65
- # to specify the namesspace, class and method before then doing something with it.
66
- Metrics/MethodLength:
67
- Max: 30
68
- Metrics/ModuleLength:
69
- Max: 400
70
- Exclude:
71
- - "**/spec/**/*_spec.rb"
72
-
73
- # We believe the default 80 characters is too restrictive and that lines can still be readable and maintainable
74
- # when no more than 120 characters. This also allows us to maximise our screen space.
75
- Metrics/LineLength:
76
- Max: 120
77
- Exclude:
78
- - "**spec/factories/**/*.rb"
79
- - "**spec/features/**/*_spec.rb"
80
- - "**spec/models/**/*_spec.rb"
81
- - "**spec/policies/**/*_spec.rb"
82
- - "**spec/routing/**/*_spec.rb"
83
-
84
- # Turn these off as can totally mess with the expect{...}.to syntax
85
- # Also reports on model validations using Proc.new { style blocks but trying to use do .. end raises invalid syntax
86
- Style/BlockDelimiters:
87
- Exclude:
88
- - "**spec/**/*_spec.rb"
89
-
90
- # As a web app, as long as the team commit to using well named classes for
91
- # controllers, models etc it should not be necessary to add top-level class
92
- # documentation.
93
- Style/Documentation:
94
- Enabled: false
95
-
96
- # We've found the sprintf style for formatting strings can be useful when storing a formatted string as a template,
97
- # and passing in strings that can vary with context. Therefore we chose to disable this rule.
98
- Style/FormatString:
99
- Enabled: false
100
-
101
- # When using Ruby >= 2.3, Rubocop wants to add a comment to the top of *.rb
102
- # to aid migration to frozen literals in Ruby 3.0. We are not interested in
103
- # modifying every file at this point, so this cop is disabled for now.
104
- Style/FrozenStringLiteralComment:
105
- Enabled: false
106
-
107
- # In specs we like to use the pattern of updating within an expect do block and
108
- # then asserting a given attribute has changed as a result. This requires
109
- # chaining hence we exclude specs from this rule
110
- Style/MethodCalledOnDoEndBlock:
111
- Exclude:
112
- - "**/spec/**/*_spec.rb"
113
-
114
- # There are no relative performance improvements using '' over "", therefore we believe there is more
115
- # value in using "" for all strings irrespective of whether string interpolation is used
116
- Style/StringLiterals:
117
- EnforcedStyle: double_quotes
118
-
119
- # Rubocop 0.42 introduced this cop - disabling for now until we have time to resolve
120
- # the issues it raises.
121
- Style/MethodMissing:
122
- Enabled: false
@@ -1,31 +0,0 @@
1
- # Needed as part of submitting test coverage statistics to CodeClimate as part
2
- # of the build
3
- # https://docs.codeclimate.com/v1.0/docs/travis-ci-test-coverage
4
- env:
5
- global:
6
- - CC_TEST_REPORTER_ID=df8a9d5af846f573eb944b1e7ba0ea40ec79efe0f3350af095054e2d5a6f2d56
7
-
8
- language: ruby
9
- cache: bundler
10
-
11
- rvm:
12
- - 2.2.3
13
-
14
- # Travis CI clones repositories to a depth of 50 commits, which is only really
15
- # useful if you are performing git operations.
16
- # https://docs.travis-ci.com/user/customizing-the-build/#Git-Clone-Depth
17
- git:
18
- depth: 3
19
-
20
- before_script:
21
- # Setup to support the CodeClimate test coverage submission
22
- # As per CodeClimate's documentation, they suggest only running
23
- # ./cc-test-reporter commands on travis-ci push builds only. Hence we wrap all
24
- # the codeclimate test coverage related commands in a check that tests if we
25
- # are in a pull request or not.
26
- - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; fi
27
- - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then chmod +x ./cc-test-reporter; fi
28
- - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter before-build; fi
29
-
30
- after_script:
31
- - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
@@ -1,61 +0,0 @@
1
- # Change Log
2
-
3
- ## [v0.4.2](https://github.com/DEFRA/os_map_ref/tree/v0.4.2) (2017-10-30)
4
- [Full Changelog](https://github.com/DEFRA/os_map_ref/compare/v0.4.1...v0.4.2)
5
-
6
- **Merged pull requests:**
7
-
8
- - Bump version no. for release of v0.4.2 [\#19](https://github.com/DEFRA/os_map_ref/pull/19) ([Cruikshanks](https://github.com/Cruikshanks))
9
- - Add changelog and ability to auto generate it [\#18](https://github.com/DEFRA/os_map_ref/pull/18) ([Cruikshanks](https://github.com/Cruikshanks))
10
- - Fix badge links in README pointing 2 old EA Github [\#17](https://github.com/DEFRA/os_map_ref/pull/17) ([Cruikshanks](https://github.com/Cruikshanks))
11
- - Fix and update codeclimate and travis-ci config [\#16](https://github.com/DEFRA/os_map_ref/pull/16) ([Cruikshanks](https://github.com/Cruikshanks))
12
- - Add std rubocop config and resolve issues found [\#15](https://github.com/DEFRA/os_map_ref/pull/15) ([Cruikshanks](https://github.com/Cruikshanks))
13
- - Correct details in gemspec [\#14](https://github.com/DEFRA/os_map_ref/pull/14) ([Cruikshanks](https://github.com/Cruikshanks))
14
- - Integrate project with Hakiri [\#13](https://github.com/DEFRA/os_map_ref/pull/13) ([Cruikshanks](https://github.com/Cruikshanks))
15
-
16
- ## [v0.4.1](https://github.com/DEFRA/os_map_ref/tree/v0.4.1) (2016-05-17)
17
- [Full Changelog](https://github.com/DEFRA/os_map_ref/compare/v0.4.0...v0.4.1)
18
-
19
- **Merged pull requests:**
20
-
21
- - Confirm codeclimate api key [\#12](https://github.com/DEFRA/os_map_ref/pull/12) ([Cruikshanks](https://github.com/Cruikshanks))
22
- - Integrate project with codeclimate [\#11](https://github.com/DEFRA/os_map_ref/pull/11) ([Cruikshanks](https://github.com/Cruikshanks))
23
- - Add version badge to README [\#10](https://github.com/DEFRA/os_map_ref/pull/10) ([Cruikshanks](https://github.com/Cruikshanks))
24
-
25
- ## [v0.4.0](https://github.com/DEFRA/os_map_ref/tree/v0.4.0) (2016-04-05)
26
- [Full Changelog](https://github.com/DEFRA/os_map_ref/compare/v0.3.0...v0.4.0)
27
-
28
- **Merged pull requests:**
29
-
30
- - Correct error in grid: skipped K instead of I in right-hand portion [\#9](https://github.com/DEFRA/os_map_ref/pull/9) ([reggieb](https://github.com/reggieb))
31
- - Fix/improve range of inputs accepted [\#8](https://github.com/DEFRA/os_map_ref/pull/8) ([reggieb](https://github.com/reggieb))
32
-
33
- ## [v0.3.0](https://github.com/DEFRA/os_map_ref/tree/v0.3.0) (2016-04-04)
34
- [Full Changelog](https://github.com/DEFRA/os_map_ref/compare/v0.2.0...v0.3.0)
35
-
36
- **Closed issues:**
37
-
38
- - Convert tests to Rspec [\#2](https://github.com/DEFRA/os_map_ref/issues/2)
39
-
40
- **Merged pull requests:**
41
-
42
- - Changes tests over to rspec [\#7](https://github.com/DEFRA/os_map_ref/pull/7) ([reggieb](https://github.com/reggieb))
43
- - Update contribution section in README [\#6](https://github.com/DEFRA/os_map_ref/pull/6) ([Cruikshanks](https://github.com/Cruikshanks))
44
- - Update travis configuration for repo [\#5](https://github.com/DEFRA/os_map_ref/pull/5) ([Cruikshanks](https://github.com/Cruikshanks))
45
- - Bump version to 0.2.0 [\#4](https://github.com/DEFRA/os_map_ref/pull/4) ([reggieb](https://github.com/reggieb))
46
-
47
- ## [v0.2.0](https://github.com/DEFRA/os_map_ref/tree/v0.2.0) (2016-03-30)
48
- [Full Changelog](https://github.com/DEFRA/os_map_ref/compare/v0.1.1...v0.2.0)
49
-
50
- **Merged pull requests:**
51
-
52
- - fixed typo in prefix matrix [\#3](https://github.com/DEFRA/os_map_ref/pull/3) ([kennyevil](https://github.com/kennyevil))
53
- - Add license details to README [\#1](https://github.com/DEFRA/os_map_ref/pull/1) ([Cruikshanks](https://github.com/Cruikshanks))
54
-
55
- ## [v0.1.1](https://github.com/DEFRA/os_map_ref/tree/v0.1.1) (2016-03-24)
56
- [Full Changelog](https://github.com/DEFRA/os_map_ref/compare/v0.1.0...v0.1.1)
57
-
58
- ## [v0.1.0](https://github.com/DEFRA/os_map_ref/tree/v0.1.0) (2016-03-23)
59
-
60
-
61
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in os_map_ref.gemspec
4
- gemspec
@@ -1,33 +0,0 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
-
4
- require "os_map_ref/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "os_map_ref"
8
- spec.version = OsMapRef::VERSION
9
- spec.authors = ["Environment Agency"]
10
- spec.email = ["alan.cruikshanks@environment-agency.gov.uk"]
11
-
12
- # rubocop:disable Metrics/LineLength
13
- spec.summary = "A tool to help handle UK Ordnance Survey map references, in particular to convert them to other coordinate systems"
14
- spec.description = "This gem allows you to gather U.K. Ordnance Survey Eastings, North, and Map References from a range of text inputs; and output them in a consistent manner"
15
- # rubocop:enable Metrics/LineLength
16
- spec.homepage = "https://github.com/DEFRA/os_map_ref"
17
- spec.license = "Nonstandard"
18
-
19
- spec.files = `git ls-files -z`
20
- .split("\x0")
21
- .reject { |f| f.match(%r{^(test|spec|features)/}) }
22
- spec.bindir = "exe"
23
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
- spec.require_paths = ["lib"]
25
-
26
- spec.required_ruby_version = ">= 1.9"
27
-
28
- spec.add_development_dependency "bundler", "~> 1.11"
29
- spec.add_development_dependency "rake", "~> 10.0"
30
- spec.add_development_dependency "rspec"
31
- spec.add_development_dependency "simplecov", "~> 0.13"
32
- spec.add_development_dependency "github_changelog_generator"
33
- end