map-kit-wrapper 0.0.1 → 0.0.2
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.
- data/Gemfile +1 -1
- data/README.md +1 -0
- data/Rakefile +7 -9
- data/lib/map-kit-wrapper.rb +17 -0
- data/lib/map-kit-wrapper/core_location_data_types.rb +51 -0
- data/{motion → lib/map-kit-wrapper}/map_kit_data_types.rb +2 -0
- data/{motion → lib/map-kit-wrapper}/map_type.rb +0 -0
- data/{motion → lib/map-kit-wrapper}/map_view.rb +4 -0
- data/{motion → lib/map-kit-wrapper}/test_suite_delegate.rb +0 -0
- data/lib/map-kit-wrapper/version.rb +3 -0
- data/{motion → lib/map-kit-wrapper}/zoom_level.rb +0 -0
- data/map_kit_wrapper.gemspec +4 -5
- data/spec/{core_location_data_types_spec.rb → lib/core_location_data_types_spec.rb} +16 -1
- data/spec/{map_kit_data_types_spec.rb → lib/map_kit_data_types_spec.rb} +0 -0
- data/spec/{map_view_spec.rb → lib/map_view_spec.rb} +0 -0
- data/spec/{zoom_level_spec.rb → lib/zoom_level_spec.rb} +0 -0
- data/spec/main_spec.rb +9 -0
- metadata +30 -26
- data/lib/map_kit_wrapper.rb +0 -1
- data/lib/map_kit_wrapper/version.rb +0 -3
- data/motion/core_location_data_types.rb +0 -35
data/Gemfile
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
$:.unshift("/Library/RubyMotion/lib")
|
2
2
|
require 'motion/project'
|
3
|
-
require '
|
4
|
-
|
3
|
+
require 'lib/map-kit-wrapper'
|
4
|
+
|
5
|
+
require "bundler/gem_tasks"
|
5
6
|
Bundler.require
|
6
|
-
require 'bubble-wrap/test'
|
7
7
|
|
8
8
|
Motion::Project::App.setup do |app|
|
9
|
-
|
10
|
-
app.
|
11
|
-
app.
|
12
|
-
|
13
|
-
app.frameworks += ['CoreLocation', 'MapKit']
|
14
|
-
end
|
9
|
+
app.name = 'testSuite'
|
10
|
+
app.identifier = 'com.rubymotion.testSuite'
|
11
|
+
app.delegate_class = 'TestSuiteDelegate'
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'codependency'
|
2
|
+
unless defined?(Motion::Project::Config)
|
3
|
+
raise "This file must be required within a RubyMotion project Rakefile."
|
4
|
+
end
|
5
|
+
|
6
|
+
Motion::Project::App.setup do |app|
|
7
|
+
base_path = "#{File.dirname(__FILE__)}/map-kit-wrapper"
|
8
|
+
graph = Codependency::Graph.new("#{base_path}/map_view.rb")
|
9
|
+
|
10
|
+
files = (graph.files + Dir.glob(File.join(File.dirname(__FILE__), 'map-kit-wrapper/*.rb')).map { |file| file }).uniq
|
11
|
+
files.reverse.each do |file|
|
12
|
+
app.files.unshift(file)
|
13
|
+
end
|
14
|
+
|
15
|
+
app.frameworks += ['CoreLocation', 'MapKit']
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module CoreLocation
|
2
|
+
# Wrappers for the Core Location Data Types
|
3
|
+
# http://developer.apple.com/library/mac/#documentation/CoreLocation/Reference/CoreLocationDataTypesRef/Reference/reference.html
|
4
|
+
module DataTypes
|
5
|
+
|
6
|
+
# Ruby wrapper for CLLocationCoordinate2D
|
7
|
+
class LocationCoordinate
|
8
|
+
attr_reader :sdk
|
9
|
+
|
10
|
+
# LocationCoordinate.new(1,2)
|
11
|
+
# LocationCoordinate.new([1,2])
|
12
|
+
# LocationCoordinate.new(LocationCoordinate)
|
13
|
+
# LocationCoordinate.new(CLLocationCoordinate2D)
|
14
|
+
def initialize(*args)
|
15
|
+
latitude, longitude = nil, nil
|
16
|
+
args.flatten!
|
17
|
+
if args.size == 1
|
18
|
+
arg = args.first
|
19
|
+
if arg.is_a?(CLLocationCoordinate2D)
|
20
|
+
latitude, longitude = arg.latitude, arg.longitude
|
21
|
+
elsif arg.is_a?(LocationCoordinate)
|
22
|
+
latitude, longitude = arg.sdk.latitude, arg.sdk.longitude
|
23
|
+
end
|
24
|
+
elsif args.size == 2
|
25
|
+
latitude, longitude = args[0], args[1]
|
26
|
+
end
|
27
|
+
@sdk = CLLocationCoordinate2DMake(latitude, longitude)
|
28
|
+
end
|
29
|
+
|
30
|
+
def latitude
|
31
|
+
@sdk.latitude
|
32
|
+
end
|
33
|
+
|
34
|
+
def latitude=(latitude)
|
35
|
+
@sdk.latitude = latitude
|
36
|
+
end
|
37
|
+
|
38
|
+
def longitude
|
39
|
+
@sdk.longitude
|
40
|
+
end
|
41
|
+
|
42
|
+
def longitude=(longitude)
|
43
|
+
@sdk.longitude = longitude
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_array
|
47
|
+
[latitude, longitude]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
data/map_kit_wrapper.gemspec
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path('../lib/
|
2
|
+
require File.expand_path('../lib/map-kit-wrapper/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Kasper Weibel Nielsen-Refs"]
|
6
6
|
gem.email = ["weibel@gmail.com"]
|
7
|
-
gem.summary = %q{This is a MapKit wrapper for RubyMotion. It's
|
8
|
-
purpose is to make make dealing with MapKit less painfull}
|
7
|
+
gem.summary = %q{This is a MapKit wrapper for RubyMotion. It's purpose is to make make dealing with MapKit less painful}
|
9
8
|
gem.homepage = "https://github.com/weibel/MapKitWrapper"
|
10
9
|
|
11
10
|
gem.files = `git ls-files`.split($\)
|
@@ -15,6 +14,6 @@ purpose is to make make dealing with MapKit less painfull}
|
|
15
14
|
gem.require_paths = ["lib"]
|
16
15
|
gem.version = MapKit::VERSION
|
17
16
|
|
18
|
-
gem.add_dependency '
|
19
|
-
gem.
|
17
|
+
gem.add_dependency 'codependency', '0.2.0'
|
18
|
+
gem.add_dependency 'rake'
|
20
19
|
end
|
@@ -3,7 +3,8 @@ describe 'LocationCoordinate' do
|
|
3
3
|
lc_1 = CoreLocation::DataTypes::LocationCoordinate.new(5, 8)
|
4
4
|
lc_2 = CoreLocation::DataTypes::LocationCoordinate.new([5, 8])
|
5
5
|
lc_3 = CoreLocation::DataTypes::LocationCoordinate.new(CLLocationCoordinate2DMake(5, 8))
|
6
|
-
|
6
|
+
lc_4 = CoreLocation::DataTypes::LocationCoordinate.new(lc_3)
|
7
|
+
@array = [lc_1, lc_2, lc_3, lc_4]
|
7
8
|
end
|
8
9
|
|
9
10
|
it 'should return the latitude' do
|
@@ -12,12 +13,26 @@ describe 'LocationCoordinate' do
|
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
16
|
+
it 'should assign the latitude' do
|
17
|
+
@array.each do |lc|
|
18
|
+
lc.latitude = 10
|
19
|
+
lc.latitude.should.equal 10
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
15
23
|
it 'should return the longitude' do
|
16
24
|
@array.each do |lc|
|
17
25
|
lc.longitude.should.equal 8
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
29
|
+
it 'should assign the longitude' do
|
30
|
+
@array.each do |lc|
|
31
|
+
lc.longitude = 10
|
32
|
+
lc.longitude.should.equal 10
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
21
36
|
it 'should return an array' do
|
22
37
|
@array.each do |lc|
|
23
38
|
lc.to_array.should.equal [5, 8]
|
File without changes
|
File without changes
|
File without changes
|
data/spec/main_spec.rb
ADDED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: map-kit-wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kasper Weibel Nielsen-Refs
|
@@ -15,20 +15,22 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-08-22 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
21
|
+
name: codependency
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
|
-
- - "
|
26
|
+
- - "="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
28
|
+
hash: 23
|
29
29
|
segments:
|
30
30
|
- 0
|
31
|
-
|
31
|
+
- 2
|
32
|
+
- 0
|
33
|
+
version: 0.2.0
|
32
34
|
type: :runtime
|
33
35
|
version_requirements: *id001
|
34
36
|
- !ruby/object:Gem::Dependency
|
@@ -43,7 +45,7 @@ dependencies:
|
|
43
45
|
segments:
|
44
46
|
- 0
|
45
47
|
version: "0"
|
46
|
-
type: :
|
48
|
+
type: :runtime
|
47
49
|
version_requirements: *id002
|
48
50
|
description:
|
49
51
|
email:
|
@@ -60,19 +62,20 @@ files:
|
|
60
62
|
- LICENSE
|
61
63
|
- README.md
|
62
64
|
- Rakefile
|
63
|
-
- lib/
|
64
|
-
- lib/
|
65
|
+
- lib/map-kit-wrapper.rb
|
66
|
+
- lib/map-kit-wrapper/core_location_data_types.rb
|
67
|
+
- lib/map-kit-wrapper/map_kit_data_types.rb
|
68
|
+
- lib/map-kit-wrapper/map_type.rb
|
69
|
+
- lib/map-kit-wrapper/map_view.rb
|
70
|
+
- lib/map-kit-wrapper/test_suite_delegate.rb
|
71
|
+
- lib/map-kit-wrapper/version.rb
|
72
|
+
- lib/map-kit-wrapper/zoom_level.rb
|
65
73
|
- map_kit_wrapper.gemspec
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
- motion/zoom_level.rb
|
72
|
-
- spec/core_location_data_types_spec.rb
|
73
|
-
- spec/map_kit_data_types_spec.rb
|
74
|
-
- spec/map_view_spec.rb
|
75
|
-
- spec/zoom_level_spec.rb
|
74
|
+
- spec/lib/core_location_data_types_spec.rb
|
75
|
+
- spec/lib/map_kit_data_types_spec.rb
|
76
|
+
- spec/lib/map_view_spec.rb
|
77
|
+
- spec/lib/zoom_level_spec.rb
|
78
|
+
- spec/main_spec.rb
|
76
79
|
homepage: https://github.com/weibel/MapKitWrapper
|
77
80
|
licenses: []
|
78
81
|
|
@@ -105,9 +108,10 @@ rubyforge_project:
|
|
105
108
|
rubygems_version: 1.8.24
|
106
109
|
signing_key:
|
107
110
|
specification_version: 3
|
108
|
-
summary: This is a MapKit wrapper for RubyMotion. It's
|
111
|
+
summary: This is a MapKit wrapper for RubyMotion. It's purpose is to make make dealing with MapKit less painful
|
109
112
|
test_files:
|
110
|
-
- spec/core_location_data_types_spec.rb
|
111
|
-
- spec/map_kit_data_types_spec.rb
|
112
|
-
- spec/map_view_spec.rb
|
113
|
-
- spec/zoom_level_spec.rb
|
113
|
+
- spec/lib/core_location_data_types_spec.rb
|
114
|
+
- spec/lib/map_kit_data_types_spec.rb
|
115
|
+
- spec/lib/map_view_spec.rb
|
116
|
+
- spec/lib/zoom_level_spec.rb
|
117
|
+
- spec/main_spec.rb
|
data/lib/map_kit_wrapper.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'map_kit_wrapper/version' unless defined?(MapKit::VERSION)
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module CoreLocation
|
2
|
-
# Wrappers for the Core Location Data Types
|
3
|
-
# http://developer.apple.com/library/mac/#documentation/CoreLocation/Reference/CoreLocationDataTypesRef/Reference/reference.html
|
4
|
-
module DataTypes
|
5
|
-
|
6
|
-
# Ruby wrapper for CLLocationCoordinate2D
|
7
|
-
class LocationCoordinate
|
8
|
-
attr_reader :sdk
|
9
|
-
|
10
|
-
# LocationCoordinate.new(1,2)
|
11
|
-
# LocationCoordinate.new([1,2])
|
12
|
-
# CoordinateSpan.new(CLLocationCoordinate2D)
|
13
|
-
def initialize(*args)
|
14
|
-
args.flatten!
|
15
|
-
if args.first.is_a?(CLLocationCoordinate2D)
|
16
|
-
@sdk = args.first
|
17
|
-
else
|
18
|
-
@sdk = CLLocationCoordinate2DMake(args[0], args[1])
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def latitude
|
23
|
-
@sdk.latitude
|
24
|
-
end
|
25
|
-
|
26
|
-
def longitude
|
27
|
-
@sdk.longitude
|
28
|
-
end
|
29
|
-
|
30
|
-
def to_array
|
31
|
-
[latitude, longitude]
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|