jasny_bundle_fixed 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b185825d38b4b34a98db4f1e5b37454bc79d9ca3
4
+ data.tar.gz: e8917b42fc8e1160fb9bf579f03d185984740e60
5
+ SHA512:
6
+ metadata.gz: c0985ea83eb31b8495309d91b2bc0fe23e100f66858a49f2ccaf3128e9a97d944765f96f3db36f769089063ed3f5441dc2cb470ac7a58c409d985cfc3a8fc567
7
+ data.tar.gz: 14b0252dc08542ca8dfc55fea0eaafda12416752285cf1500273a8e2bc01233f57da7d45307549780ed913b0c7e53e9dd37ad76b935a533ffdc43cef67758d7a
data/.editorconfig ADDED
@@ -0,0 +1,14 @@
1
+ # editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ indent_style = space
7
+ indent_size = 2
8
+ end_of_line = lf
9
+ charset = utf-8
10
+ trim_trailing_whitespace = true
11
+ insert_final_newline = true
12
+
13
+ [*.py]
14
+ indent_size = 4
data/.gitattributes ADDED
@@ -0,0 +1,9 @@
1
+ # Enforce Unix newlines
2
+ *.css text eol=lf
3
+ *.html text eol=lf
4
+ *.js text eol=lf
5
+ *.json text eol=lf
6
+ *.less text eol=lf
7
+ *.md text eol=lf
8
+ *.svg text eol=lf
9
+ *.yml text eol=lf
data/.gitignore ADDED
@@ -0,0 +1,32 @@
1
+ .ruby-version
2
+
3
+ # Numerous always-ignore extensions
4
+ *.diff
5
+ *.err
6
+ *.orig
7
+ *.log
8
+ *.rej
9
+ *.swo
10
+ *.swp
11
+ *.zip
12
+ *.vi
13
+ *~
14
+
15
+ # OS or Editor folders
16
+ .DS_Store
17
+ ._*
18
+ Thumbs.db
19
+ .cache
20
+ .project
21
+ .settings
22
+ .tmproj
23
+ *.esproj
24
+ nbproject
25
+ *.sublime-project
26
+ *.sublime-workspace
27
+ .idea
28
+
29
+ # Komodo
30
+ *.komodoproject
31
+ .komodotools
32
+
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ ruby '2.1.2'
2
+ #ruby=2.1.2@jasny
3
+ source "https://rubygems.org"
4
+
5
+ # Declare your gem's dependencies in jasny_bootstrap_extension_rails.gemspec.
6
+ # Bundler will treat runtime dependencies like base dependencies, and
7
+ # development dependencies will be added by default to the :development group.
8
+ gemspec
9
+
10
+ # Declare any dependencies that are still in development here instead of in
11
+ # your gemspec. These might include edge Rails or gems from your path or
12
+ # Git. Remember to move these dependencies to your gemspec before releasing
13
+ # your gem to rubygems.org.
14
+
15
+ # To use debugger
16
+ # gem 'debugger'
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2011-2014 Twitter, Inc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ [![Gem Version](https://badge.fury.io/rb/jasny_bundle.svg)](http://badge.fury.io/rb/jasny_bundle)
2
+
3
+ ## Jasny Bundle for Rails
4
+
5
+ A simple gem for jasny's bootstrap extensions which can be found here. The gem can be found on Ruby Gems and is tested and fully functional.
6
+
7
+ This gem includes the default Bootstrap files, so there's no need to install them seperately. As of version 2.0.0, this gem now includes font-awesome and the bootstrap-social features developed by @lipis.
8
+
9
+ If you're looking for a quick and easy way to get a rails app started with off-canvas navigation, then you should also download my basic framework, which is setup with the jasny off-canvas navigation and can be found here. If you feel like you could make an improvement to the framework, please submit a pull request as at the moment, any contribution that constitutes an improvement, would be more than welcome.
10
+
11
+ Detailed usage instructions can be found at the [Wiki](https://github.com/tipsforthings/jasny-bundle/wiki "Jasny Bundle Github Wiki").
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
Binary file
@@ -0,0 +1,21 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require 'jasny_bundle/version'
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = 'jasny_bundle_fixed'
9
+ s.version = JasnyBundle::VERSION
10
+ s.authors = ['Ilton Garcia']
11
+ s.email = ['ilton_unb@hotmail.com']
12
+ s.homepage = 'https://github.com/tipsforthings/jasny-bundle/'
13
+ s.summary = 'Complete bundle including the latest version of Bootstrap, Jasny Bootstrap extensions and as of version 2.0.0, it now includes the superb bootstrap-social extension provided by @lipis.'
14
+ s.description = 'This is a rails gem for the superb Jasny bootstrap extensions plus @lipis bootstrap-social extension.'
15
+
16
+ s.files = `git ls-files -z`.split("\x0")
17
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ s.test_files = s.files.grep(%r{^(test|s|features)/})
19
+ s.require_paths = ['lib']
20
+
21
+ end
@@ -0,0 +1,83 @@
1
+ require 'rack'
2
+ require 'jasny_bundle/mime_types'
3
+
4
+ module JasnyBundle
5
+ class Middleware
6
+
7
+ def initialize(app, origin, options={})
8
+ @app = app
9
+ @origin = origin
10
+ @options = options
11
+ @mime_types = JasnyBundle::MimeTypes.new(Rack::Mime::MIME_TYPES)
12
+ end
13
+
14
+ def access_control_headers
15
+ {
16
+ "Access-Control-Allow-Origin" => origin,
17
+ "Access-Control-Allow-Methods" => "GET",
18
+ "Access-Control-Allow-Headers" => "x-requested-with",
19
+ "Access-Control-Max-Age" => "3628800"
20
+ }
21
+ end
22
+
23
+ def call(env)
24
+ @ssl_request = Rack::Request.new(env).scheme == "https"
25
+ # intercept the "preflight" request
26
+ if env["REQUEST_METHOD"] == "OPTIONS"
27
+ return [200, access_control_headers, []]
28
+ else
29
+ code, headers, body = @app.call(env)
30
+ set_headers! headers, body, env["PATH_INFO"]
31
+ [code, headers, body]
32
+ end
33
+ end
34
+
35
+
36
+ private
37
+
38
+ def origin
39
+ if !wildcard_origin? and allow_ssl? and ssl_request?
40
+ uri = URI(@origin)
41
+ uri.scheme = "https"
42
+ uri.to_s
43
+ else
44
+ @origin
45
+ end
46
+ end
47
+
48
+ def wildcard_origin?
49
+ @origin == '*'
50
+ end
51
+
52
+ def ssl_request?
53
+ @ssl_request
54
+ end
55
+
56
+ def allow_ssl?
57
+ @options[:allow_ssl]
58
+ end
59
+
60
+ def extension(path)
61
+ if path.nil? || path.length == 0
62
+ nil
63
+ else
64
+ "." + path.split("?").first.split(".").last
65
+ end
66
+ end
67
+
68
+ def font_asset?(path)
69
+ @mime_types.font? extension(path)
70
+ end
71
+
72
+ def set_headers!(headers, body, path)
73
+ if ext = extension(path) and font_asset?(ext)
74
+ headers.merge!(access_control_headers)
75
+ headers.merge!('Content-Type' => mime_type(ext)) if headers['Content-Type']
76
+ end
77
+ end
78
+
79
+ def mime_type(extension)
80
+ @mime_types[extension]
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,39 @@
1
+ module JasnyBundle
2
+ class MimeTypes
3
+ DEFAULT_TYPE = 'application/octet-stream'
4
+ MIME_TYPES = {
5
+ '.eot' => 'application/vnd.ms-fontobject',
6
+ '.svg' => 'image/svg+xml',
7
+ '.ttf' => 'application/x-font-ttf',
8
+ '.otf' => 'application/x-font-otf',
9
+ '.woff' => 'application/x-font-woff'
10
+ }
11
+
12
+ def initialize(types, default = DEFAULT_TYPE.dup)
13
+ @types = types.dup
14
+ @default = default
15
+
16
+ MIME_TYPES.each_pair do |extension, type|
17
+ set extension, type
18
+ end
19
+ end
20
+
21
+ def [](extension)
22
+ @types.fetch(extension, DEFAULT_TYPE.dup).dup
23
+ end
24
+
25
+ def font?(extension)
26
+ MIME_TYPES.keys.include? extension
27
+ end
28
+
29
+ def set(extension, mime_type)
30
+ if @types[extension].nil? || @types[extension] == @default
31
+ set!(extension, mime_type)
32
+ end
33
+ end
34
+
35
+ def set!(extension, mime_type)
36
+ @types[extension] = mime_type
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,20 @@
1
+ require 'jasny_bundle/middleware'
2
+
3
+ module FontAssets
4
+ class Railtie < Rails::Railtie
5
+ config.font_assets = ActiveSupport::OrderedOptions.new
6
+
7
+ initializer "jasny_bundle.configure_rails_initialization" do |app|
8
+ config.font_assets.origin ||= "*"
9
+ config.font_assets.options ||= { allow_ssl: true }
10
+
11
+ insert_target = if defined?(ActionDispatch::Static)
12
+ 'ActionDispatch::Static'
13
+ else
14
+ 'Rack::Runtime'
15
+ end
16
+
17
+ app.middleware.insert_before insert_target, JasnyBundle::Middleware, config.font_assets.origin, config.font_assets.options
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ module JasnyBundle
2
+ MAJOR = 1
3
+ MINOR = 0
4
+ PATCH = 0
5
+ VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
6
+ end
7
+
@@ -0,0 +1,12 @@
1
+ require 'jasny_bundle/version'
2
+ require "jasny_bundle/railtie" if defined?(Rails)
3
+
4
+ module JasnyBundle
5
+ module Rails
6
+ if defined?(::Rails) and Gem::Requirement.new('>= 3.2').satisfied_by?(Gem::Version.new ::Rails.version)
7
+ class Rails::Engine < ::Rails::Engine
8
+ # this class enables the injection of files into the asset pipeline
9
+ config.assets.precompile += %w(*.woff *.ttf *.eot *.svg) end
10
+ end
11
+ end
12
+ end