-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also updates the README and a few other misc things
- Loading branch information
1 parent
e6b6397
commit caf6caf
Showing
23 changed files
with
199 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require: | ||
- rubocop-rspec | ||
- rubocop-rails | ||
- rubocop-rspec_rails | ||
|
||
AllCops: | ||
TargetRubyVersion: 3.2 | ||
DisplayCopNames: true | ||
Exclude: | ||
- "Gemfile" | ||
- "*.gemspec" | ||
- "bin/**/*" | ||
- "db/**/*" | ||
- "tmp/**/*" | ||
- "storage/**/*" | ||
- "node_modules/**/*" | ||
- "vendor/**/*" | ||
|
||
Rails: | ||
Enabled: true | ||
|
||
Metrics/AbcSize: | ||
Enabled: false | ||
Metrics/MethodLength: | ||
Enabled: false | ||
Layout/LineLength: | ||
Enabled: false | ||
RSpec/ExampleLength: | ||
Enabled: false | ||
RSpec/MultipleExpectations: | ||
Enabled: false | ||
Naming/VariableNumber: | ||
EnforcedStyle: snake_case |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module GeoMonitor | ||
## | ||
# GeoMonitor Installer | ||
class Install < Rails::Generators::Base | ||
source_root File.expand_path('../templates', __FILE__) | ||
source_root File.expand_path('templates', __dir__) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
require "geo_monitor/engine" | ||
# frozen_string_literal: true | ||
|
||
require 'geo_monitor/engine' | ||
|
||
# Main module for the engine | ||
module GeoMonitor | ||
extend ActiveSupport::Autoload | ||
|
||
|
||
# A simple structure to conform to Faraday::Response | ||
FailedResponse = Struct.new(:env, :status, :headers) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module GeoMonitor | ||
module Constants | ||
R = 6_378_137 # Radius of Earth in meters | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails/all' | ||
require 'faraday' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module GeoMonitor | ||
VERSION = '0.8.0'.freeze | ||
VERSION = '0.8.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe GeoMonitor::BoundingBox do | ||
subject do | ||
subject(:box) do | ||
described_class.new( | ||
north: 4.234077, | ||
south: -1.478794, | ||
west: 29.572742, | ||
east: 35.000308 | ||
) | ||
end | ||
|
||
describe '#to_s' do | ||
it 'w,s,e,n' do | ||
expect(subject.to_s).to eq '29.572742,-1.478794,35.000308,4.234077' | ||
expect(box.to_s).to eq '29.572742,-1.478794,35.000308,4.234077' | ||
end | ||
end | ||
|
||
describe '#zoom_level' do | ||
it 'calculates the preferred zoom level' do | ||
expect(subject.zoom_level).to eq 6 | ||
expect(box.zoom_level).to eq 6 | ||
end | ||
end | ||
|
||
describe '#tile_number' do | ||
it '' do | ||
expect(subject.tile_number).to include(x: 37, y: 32) | ||
it do | ||
expect(box.tile_number).to include(x: 37, y: 32) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe GeoMonitor::LatLngPoint do | ||
subject do | ||
subject(:point) do | ||
described_class.new(lat: 21.943045533438177, lng: -103.359375) | ||
end | ||
|
||
describe '#to_3857' do | ||
it { expect(subject.to_3857.lat).to eq(2504688.542848655) } | ||
it { expect(subject.to_3857.lng).to eq(-11505912.99371101) } | ||
it { expect(point.to_3857.lat).to eq(2_504_688.542848655) } | ||
it { expect(point.to_3857.lng).to eq(-11_505_912.99371101) } | ||
end | ||
end |
Oops, something went wrong.