mapbox-gl-rails 0.44.0 → 0.44.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/LICENSE +21 -21
- data/README.md +113 -113
- data/Rakefile +18 -18
- data/app/assets/javascripts/mapbox-gl.js +83 -39
- data/app/assets/stylesheets/mapbox-gl.scss +602 -602
- data/lib/mapbox-gl-rails.rb +3 -3
- data/lib/mapbox-gl/rails.rb +9 -9
- data/lib/mapbox-gl/rails/engine.rb +8 -8
- data/lib/mapbox-gl/rails/version.rb +25 -25
- data/lib/mapbox-gl/updater.rb +24 -24
- data/mapbox-gl-rails.gemspec +28 -28
- data/test/dummy/.gitignore +2 -2
- data/test/dummy/app/assets/stylesheets/sass-import.css.sass +1 -1
- data/test/dummy/app/assets/stylesheets/scss-import.css.scss +1 -1
- data/test/dummy/app/assets/stylesheets/sprockets-require.css +3 -3
- data/test/dummy/app/controllers/pages_controller.rb +2 -2
- data/test/dummy/config.ru +4 -4
- data/test/dummy/config/application.rb +19 -19
- data/test/dummy/config/boot.rb +10 -10
- data/test/dummy/config/environment.rb +5 -5
- data/test/dummy/config/initializers/secret_token.rb +8 -8
- data/test/dummy/config/routes.rb +3 -3
- data/test/mapbox-gl-rails_test.rb +55 -55
- data/test/test_helper.rb +5 -5
- metadata +3 -3
data/lib/mapbox-gl-rails.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'mapbox-gl/rails'
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mapbox-gl/rails'
|
data/lib/mapbox-gl/rails.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'mapbox-gl/rails/version'
|
4
|
-
require 'mapbox-gl/rails/engine'
|
5
|
-
|
6
|
-
module MapboxGl
|
7
|
-
module Rails
|
8
|
-
end
|
9
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mapbox-gl/rails/version'
|
4
|
+
require 'mapbox-gl/rails/engine'
|
5
|
+
|
6
|
+
module MapboxGl
|
7
|
+
module Rails
|
8
|
+
end
|
9
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module MapboxGl
|
4
|
-
module Rails
|
5
|
-
class Engine < ::Rails::Engine
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MapboxGl
|
4
|
+
module Rails
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
@@ -1,25 +1,25 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module MapboxGl
|
4
|
-
module Rails
|
5
|
-
##
|
6
|
-
# Mapbox GL JS & gem version.
|
7
|
-
def self.gem_version
|
8
|
-
Gem::Version.new VERSION::STRING
|
9
|
-
end
|
10
|
-
|
11
|
-
##
|
12
|
-
# ProxyFetcher gem semantic versioning.
|
13
|
-
module VERSION
|
14
|
-
# Major version number
|
15
|
-
MAJOR = 0
|
16
|
-
# Minor version number
|
17
|
-
MINOR = 44
|
18
|
-
# Smallest version number
|
19
|
-
TINY =
|
20
|
-
|
21
|
-
# Full version number
|
22
|
-
STRING = [MAJOR, MINOR, TINY].compact.join('.')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MapboxGl
|
4
|
+
module Rails
|
5
|
+
##
|
6
|
+
# Mapbox GL JS & gem version.
|
7
|
+
def self.gem_version
|
8
|
+
Gem::Version.new VERSION::STRING
|
9
|
+
end
|
10
|
+
|
11
|
+
##
|
12
|
+
# ProxyFetcher gem semantic versioning.
|
13
|
+
module VERSION
|
14
|
+
# Major version number
|
15
|
+
MAJOR = 0
|
16
|
+
# Minor version number
|
17
|
+
MINOR = 44
|
18
|
+
# Smallest version number
|
19
|
+
TINY = 1
|
20
|
+
|
21
|
+
# Full version number
|
22
|
+
STRING = [MAJOR, MINOR, TINY].compact.join('.')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/mapbox-gl/updater.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'thor'
|
4
|
-
|
5
|
-
class Updater < Thor
|
6
|
-
include Thor::Actions
|
7
|
-
|
8
|
-
# Base assets storage URL
|
9
|
-
BASE_URL = 'https://api.tiles.mapbox.com/mapbox-gl-js'.freeze
|
10
|
-
|
11
|
-
desc 'update assets', 'update assets from the MapBox S3 storage'
|
12
|
-
def update
|
13
|
-
self.destination_root = 'app/assets'
|
14
|
-
|
15
|
-
get File.join(BASE_URL, "v#{MapboxGl::Rails::VERSION::STRING}/mapbox-gl-dev.js"), 'javascripts/mapbox-gl.js'
|
16
|
-
get File.join(BASE_URL, "v#{MapboxGl::Rails::VERSION::STRING}/mapbox-gl.css"), 'stylesheets/mapbox-gl.css'
|
17
|
-
|
18
|
-
inside destination_root do
|
19
|
-
run('sass-convert -F css -T scss stylesheets/mapbox-gl.css stylesheets/mapbox-gl.scss')
|
20
|
-
end
|
21
|
-
|
22
|
-
remove_file 'stylesheets/mapbox-gl.css'
|
23
|
-
end
|
24
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
class Updater < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
# Base assets storage URL
|
9
|
+
BASE_URL = 'https://api.tiles.mapbox.com/mapbox-gl-js'.freeze
|
10
|
+
|
11
|
+
desc 'update assets', 'update assets from the MapBox S3 storage'
|
12
|
+
def update
|
13
|
+
self.destination_root = 'app/assets'
|
14
|
+
|
15
|
+
get File.join(BASE_URL, "v#{MapboxGl::Rails::VERSION::STRING}/mapbox-gl-dev.js"), 'javascripts/mapbox-gl.js'
|
16
|
+
get File.join(BASE_URL, "v#{MapboxGl::Rails::VERSION::STRING}/mapbox-gl.css"), 'stylesheets/mapbox-gl.css'
|
17
|
+
|
18
|
+
inside destination_root do
|
19
|
+
run('sass-convert -F css -T scss stylesheets/mapbox-gl.css stylesheets/mapbox-gl.scss')
|
20
|
+
end
|
21
|
+
|
22
|
+
remove_file 'stylesheets/mapbox-gl.css'
|
23
|
+
end
|
24
|
+
end
|
data/mapbox-gl-rails.gemspec
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
2
|
-
require File.expand_path('../lib/mapbox-gl/rails/version', __FILE__)
|
3
|
-
|
4
|
-
Gem::Specification.new do |gem|
|
5
|
-
gem.name = 'mapbox-gl-rails'
|
6
|
-
gem.version = MapboxGl::Rails.gem_version
|
7
|
-
gem.date = '2018-
|
8
|
-
|
9
|
-
gem.authors = ['Nikita Bulai']
|
10
|
-
gem.email = ['bulajnikita@gmail.com']
|
11
|
-
gem.description = 'mapbox-gl-rails provides Mapbox GL JS sources and stylesheets as a ' \
|
12
|
-
'Rails engine for use with the asset pipeline.'
|
13
|
-
gem.summary = 'an asset gemification of the Mapbox GL JS library'
|
14
|
-
gem.homepage = 'https://github.com/nbulaj/mapbox-gl-rails'
|
15
|
-
gem.license = 'MIT'
|
16
|
-
|
17
|
-
gem.files = `git ls-files`.split("\n").reject { |f| f =~ /^gemfiles|^\..+/ }
|
18
|
-
gem.test_files = `git ls-files -- test/*`.split("\n")
|
19
|
-
gem.require_paths = ['lib']
|
20
|
-
|
21
|
-
gem.add_dependency 'railties', '>= 3.2', '< 5.3'
|
22
|
-
|
23
|
-
gem.add_development_dependency 'activesupport'
|
24
|
-
gem.add_development_dependency 'sass-rails'
|
25
|
-
gem.add_development_dependency 'thor'
|
26
|
-
|
27
|
-
gem.required_ruby_version = '>= 1.9.3'
|
28
|
-
end
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
2
|
+
require File.expand_path('../lib/mapbox-gl/rails/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'mapbox-gl-rails'
|
6
|
+
gem.version = MapboxGl::Rails.gem_version
|
7
|
+
gem.date = '2018-02-25'
|
8
|
+
|
9
|
+
gem.authors = ['Nikita Bulai']
|
10
|
+
gem.email = ['bulajnikita@gmail.com']
|
11
|
+
gem.description = 'mapbox-gl-rails provides Mapbox GL JS sources and stylesheets as a ' \
|
12
|
+
'Rails engine for use with the asset pipeline.'
|
13
|
+
gem.summary = 'an asset gemification of the Mapbox GL JS library'
|
14
|
+
gem.homepage = 'https://github.com/nbulaj/mapbox-gl-rails'
|
15
|
+
gem.license = 'MIT'
|
16
|
+
|
17
|
+
gem.files = `git ls-files`.split("\n").reject { |f| f =~ /^gemfiles|^\..+/ }
|
18
|
+
gem.test_files = `git ls-files -- test/*`.split("\n")
|
19
|
+
gem.require_paths = ['lib']
|
20
|
+
|
21
|
+
gem.add_dependency 'railties', '>= 3.2', '< 5.3'
|
22
|
+
|
23
|
+
gem.add_development_dependency 'activesupport'
|
24
|
+
gem.add_development_dependency 'sass-rails'
|
25
|
+
gem.add_development_dependency 'thor'
|
26
|
+
|
27
|
+
gem.required_ruby_version = '>= 1.9.3'
|
28
|
+
end
|
data/test/dummy/.gitignore
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
/log
|
2
|
-
/tmp
|
1
|
+
/log
|
2
|
+
/tmp
|
@@ -1 +1 @@
|
|
1
|
-
@import mapbox-gl
|
1
|
+
@import mapbox-gl
|
@@ -1 +1 @@
|
|
1
|
-
@import 'mapbox-gl';
|
1
|
+
@import 'mapbox-gl';
|
@@ -1,3 +1,3 @@
|
|
1
|
-
/*
|
2
|
-
*= require mapbox-gl
|
3
|
-
*/
|
1
|
+
/*
|
2
|
+
*= require mapbox-gl
|
3
|
+
*/
|
@@ -1,2 +1,2 @@
|
|
1
|
-
class PagesController < ActionController::Base
|
2
|
-
end
|
1
|
+
class PagesController < ActionController::Base
|
2
|
+
end
|
data/test/dummy/config.ru
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is used by Rack-based servers to start the application.
|
2
|
-
|
3
|
-
require ::File.expand_path('../config/environment', __FILE__)
|
4
|
-
run Dummy::Application
|
1
|
+
# This file is used by Rack-based servers to start the application.
|
2
|
+
|
3
|
+
require ::File.expand_path('../config/environment', __FILE__)
|
4
|
+
run Dummy::Application
|
@@ -1,19 +1,19 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
# require 'rails/all'
|
4
|
-
require 'sprockets/railtie'
|
5
|
-
|
6
|
-
Bundler.require(:default, :development)
|
7
|
-
|
8
|
-
module Dummy
|
9
|
-
class Application < Rails::Application
|
10
|
-
config.encoding = 'utf-8'
|
11
|
-
config.assets.enabled = true
|
12
|
-
config.assets.version = '1.0'
|
13
|
-
|
14
|
-
# replacement for environments/*.rb
|
15
|
-
config.active_support.deprecation = :stderr
|
16
|
-
config.eager_load = false
|
17
|
-
config.active_support.test_order = :random rescue nil
|
18
|
-
end
|
19
|
-
end
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
# require 'rails/all'
|
4
|
+
require 'sprockets/railtie'
|
5
|
+
|
6
|
+
Bundler.require(:default, :development)
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
config.encoding = 'utf-8'
|
11
|
+
config.assets.enabled = true
|
12
|
+
config.assets.version = '1.0'
|
13
|
+
|
14
|
+
# replacement for environments/*.rb
|
15
|
+
config.active_support.deprecation = :stderr
|
16
|
+
config.eager_load = false
|
17
|
+
config.active_support.test_order = :random rescue nil
|
18
|
+
end
|
19
|
+
end
|
data/test/dummy/config/boot.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
|
3
|
-
|
4
|
-
if File.exist?(gemfile)
|
5
|
-
ENV['BUNDLE_GEMFILE'] = gemfile
|
6
|
-
require 'bundler'
|
7
|
-
Bundler.setup
|
8
|
-
end
|
9
|
-
|
10
|
-
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
1
|
+
require 'rubygems'
|
2
|
+
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
|
3
|
+
|
4
|
+
if File.exist?(gemfile)
|
5
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
6
|
+
require 'bundler'
|
7
|
+
Bundler.setup
|
8
|
+
end
|
9
|
+
|
10
|
+
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Load the rails application
|
2
|
-
require File.expand_path('../application', __FILE__)
|
3
|
-
|
4
|
-
# Initialize the rails application
|
5
|
-
Dummy::Application.initialize!
|
1
|
+
# Load the rails application
|
2
|
+
require File.expand_path('../application', __FILE__)
|
3
|
+
|
4
|
+
# Initialize the rails application
|
5
|
+
Dummy::Application.initialize!
|
@@ -1,8 +1,8 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
# Make sure the secret is at least 30 characters and all random,
|
6
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Dummy::Application.config.secret_token = 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
|
8
|
-
Dummy::Application.config.secret_key_base = 'deadbeef' if Dummy::Application.config.respond_to?(:secret_key_base)
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
Dummy::Application.config.secret_token = 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
|
8
|
+
Dummy::Application.config.secret_key_base = 'deadbeef' if Dummy::Application.config.respond_to?(:secret_key_base)
|
data/test/dummy/config/routes.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
Dummy::Application.routes.draw do
|
2
|
-
root to: 'pages#index'
|
3
|
-
end
|
1
|
+
Dummy::Application.routes.draw do
|
2
|
+
root to: 'pages#index'
|
3
|
+
end
|
@@ -1,55 +1,55 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class MapboxRailsTest < ActionDispatch::IntegrationTest
|
4
|
-
teardown { clean_sprockets_cache }
|
5
|
-
|
6
|
-
test 'engine is loaded' do
|
7
|
-
assert_equal ::Rails::Engine, MapboxGl::Rails::Engine.superclass
|
8
|
-
end
|
9
|
-
|
10
|
-
test 'javascript are served' do
|
11
|
-
get '/assets/mapbox-gl.js'
|
12
|
-
assert_mapbox_gl_js(response)
|
13
|
-
end
|
14
|
-
|
15
|
-
test 'javascript of valid version' do
|
16
|
-
get '/assets/mapbox-gl.js'
|
17
|
-
assert_mapbox_gl_js(response, MapboxGl::Rails::VERSION::STRING)
|
18
|
-
end
|
19
|
-
|
20
|
-
test 'stylesheets are served' do
|
21
|
-
get '/assets/mapbox-gl.css'
|
22
|
-
assert_mapbox_gl_css(response)
|
23
|
-
end
|
24
|
-
|
25
|
-
test 'stylesheet is available in a css sprockets require' do
|
26
|
-
get '/assets/sprockets-require.css'
|
27
|
-
assert_mapbox_gl_css(response)
|
28
|
-
end
|
29
|
-
|
30
|
-
test 'stylesheet is available in a sass import' do
|
31
|
-
get '/assets/sass-import.css'
|
32
|
-
assert_mapbox_gl_css(response)
|
33
|
-
end
|
34
|
-
|
35
|
-
test 'stylesheet is available in a scss import' do
|
36
|
-
get '/assets/scss-import.css'
|
37
|
-
assert_mapbox_gl_css(response)
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def clean_sprockets_cache
|
43
|
-
FileUtils.rm_rf File.expand_path('../dummy/tmp', __FILE__)
|
44
|
-
end
|
45
|
-
|
46
|
-
def assert_mapbox_gl_css(response, pattern = /mapboxgl-map/)
|
47
|
-
assert_response :success
|
48
|
-
assert_match(pattern, response.body)
|
49
|
-
end
|
50
|
-
|
51
|
-
def assert_mapbox_gl_js(response, pattern = /window\.mapboxgl/)
|
52
|
-
assert_response :success
|
53
|
-
assert_match(pattern, response.body)
|
54
|
-
end
|
55
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class MapboxRailsTest < ActionDispatch::IntegrationTest
|
4
|
+
teardown { clean_sprockets_cache }
|
5
|
+
|
6
|
+
test 'engine is loaded' do
|
7
|
+
assert_equal ::Rails::Engine, MapboxGl::Rails::Engine.superclass
|
8
|
+
end
|
9
|
+
|
10
|
+
test 'javascript are served' do
|
11
|
+
get '/assets/mapbox-gl.js'
|
12
|
+
assert_mapbox_gl_js(response)
|
13
|
+
end
|
14
|
+
|
15
|
+
test 'javascript of valid version' do
|
16
|
+
get '/assets/mapbox-gl.js'
|
17
|
+
assert_mapbox_gl_js(response, MapboxGl::Rails::VERSION::STRING)
|
18
|
+
end
|
19
|
+
|
20
|
+
test 'stylesheets are served' do
|
21
|
+
get '/assets/mapbox-gl.css'
|
22
|
+
assert_mapbox_gl_css(response)
|
23
|
+
end
|
24
|
+
|
25
|
+
test 'stylesheet is available in a css sprockets require' do
|
26
|
+
get '/assets/sprockets-require.css'
|
27
|
+
assert_mapbox_gl_css(response)
|
28
|
+
end
|
29
|
+
|
30
|
+
test 'stylesheet is available in a sass import' do
|
31
|
+
get '/assets/sass-import.css'
|
32
|
+
assert_mapbox_gl_css(response)
|
33
|
+
end
|
34
|
+
|
35
|
+
test 'stylesheet is available in a scss import' do
|
36
|
+
get '/assets/scss-import.css'
|
37
|
+
assert_mapbox_gl_css(response)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def clean_sprockets_cache
|
43
|
+
FileUtils.rm_rf File.expand_path('../dummy/tmp', __FILE__)
|
44
|
+
end
|
45
|
+
|
46
|
+
def assert_mapbox_gl_css(response, pattern = /mapboxgl-map/)
|
47
|
+
assert_response :success
|
48
|
+
assert_match(pattern, response.body)
|
49
|
+
end
|
50
|
+
|
51
|
+
def assert_mapbox_gl_js(response, pattern = /window\.mapboxgl/)
|
52
|
+
assert_response :success
|
53
|
+
assert_match(pattern, response.body)
|
54
|
+
end
|
55
|
+
end
|