leaflet_helper 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 764b4f62f21a26bf252db2bbe2d4e3a790af0a73
4
+ data.tar.gz: b0b0d1e5894155ae524d284c18e433362a012306
5
+ SHA512:
6
+ metadata.gz: f7d9e4ab4217d566e440a052d95b5b19786f81ec37e15230d13637d669dbd5e730ae4e587751db2688db997ca0add8c36479434a6816fb2be7c03a775e8251ee
7
+ data.tar.gz: 9e7b350e260e63028f1178b34963115f751e7f9a648f6216f7fa98f26f24b91274e86917491a55a034ab9ab4bd9e06b97b102906f8b7f0ce699dc55b3e3dfdec
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.12.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in leaflet_helper.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,3 @@
1
+ The YWI? IY! License (MIT)
2
+
3
+ You want it? Its yours!
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # LeafletHelper
2
+
3
+ I couldn't find any libraries that were ruby-centric geospatial map knowledgable that were not
4
+ specifically constructed for the rails framework. I wanted something more generic that could be used
5
+ with any framework.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'leaflet_helper'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install leaflet_helper
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ Of if that doesn't work try something.
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/leaflet_helper.
38
+
39
+
40
+ ## License
41
+
42
+ You want it? Its yours!
43
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "leaflet_helper"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'leaflet_helper/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "leaflet_helper"
8
+ spec.version = '0.0.1'
9
+ spec.authors = ["Dewayne VanHoozer"]
10
+ spec.email = ["dvanhoozer@gmail.com"]
11
+
12
+ spec.summary = %q{A Ruby-wrapper around leaflet.js}
13
+ spec.description = %q{Some Ruby-based helper methods around the leaflet.js library.}
14
+ spec.homepage = "http://github.com/MadBomber/leaflet_helper"
15
+ spec.license = "You want it? Its yours!"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ # end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.12"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "minitest", "~> 5.0"
33
+ end
@@ -0,0 +1,3 @@
1
+ module LeafletHelper
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,70 @@
1
+ # leaflet_helper.rb
2
+
3
+ module LeafletHelper
4
+ class L
5
+ VERSION = '0.7.3'
6
+ @@maps = []
7
+ @@initialized = false
8
+ class << self
9
+
10
+ # intended for the layout.haml file in the head section
11
+ def init
12
+ return '' if @@initialized
13
+ @@initialized = true
14
+ return <<~EOS
15
+ <script type="text/javascript" src="//cdn.leafletjs.com/leaflet-#{VERSION}/leaflet.js"></script>
16
+ <link rel="stylesheet" href="//cdn.leafletjs.com/leaflet-#{VERSION}/leaflet.css">
17
+ EOS
18
+ end # def init
19
+
20
+ # intended for the body of a web page
21
+ # hope to support multiple maps on a page
22
+ def map(id='map', options={})
23
+ @@maps << id
24
+ o = {
25
+ style: "width: 800px; height: 400px"
26
+ }.merge(options)
27
+ div_options = ""
28
+ o.each_pair do |k,v|
29
+ div_options += " #{k.to_s}=" + '"' + v + '"'
30
+ end
31
+ return <<~EOS
32
+ <div id="#{id}" #{div_options}></div>
33
+ EOS
34
+ end # def map(id='map')
35
+
36
+ # Intended for the body at the bottom
37
+ def show_with_openstreetmap_layer(id="map", options={})
38
+ o = {
39
+ latitude: 37.235,
40
+ longitude: -115.811111,
41
+ zoom: 9,
42
+ min_zoom: 2,
43
+ max_zoom: 22
44
+ }.merge(options)
45
+ var_name = "lh_#{id}"
46
+ return <<~EOS
47
+ <script>
48
+
49
+ // set up the map
50
+ #{var_name} = new L.Map('#{id}');
51
+
52
+ // create the tile layer with correct attribution
53
+ var osmUrl ='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
54
+ var osmAttrib ='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
55
+ var osm = new L.TileLayer(osmUrl, {minZoom: #{o[:min_zoom]}, maxZoom: #{o[:max_zoom]}, attribution: osmAttrib});
56
+
57
+ // start the map in South-East England
58
+ #{var_name}.setView(new L.LatLng(#{o[:latitude]}, #{o[:longitude]}), #{o[:zoom]});
59
+
60
+ #{var_name}.addLayer(osm);
61
+
62
+ </script>
63
+ EOS
64
+ end # def show_with_openstreetmap_layer(id="map", options={})
65
+
66
+
67
+
68
+ end # class << self
69
+ end # class L
70
+ end # module LeafletHelper
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: leaflet_helper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dewayne VanHoozer
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ description: Some Ruby-based helper methods around the leaflet.js library.
56
+ email:
57
+ - dvanhoozer@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - leaflet_helper.gemspec
71
+ - lib/leaflet_helper.rb
72
+ - lib/leaflet_helper/version.rb
73
+ homepage: http://github.com/MadBomber/leaflet_helper
74
+ licenses:
75
+ - You want it? Its yours!
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.6.4
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: A Ruby-wrapper around leaflet.js
97
+ test_files: []