direct_inject 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +16 -0
- data/MIT-LICENSE +20 -0
- data/README.md +16 -0
- data/Rakefile +34 -0
- data/direct_inject.gemspec +27 -0
- data/lib/direct_inject/errors/asset_not_found.rb +16 -0
- data/lib/direct_inject/errors/not_configured.rb +16 -0
- data/lib/direct_inject/errors.rb +2 -0
- data/lib/direct_inject/internal_helpers.rb +66 -0
- data/lib/direct_inject/public_api.rb +76 -0
- data/lib/direct_inject/rails/view_helpers.rb +17 -0
- data/lib/direct_inject/railtie.rb +16 -0
- data/lib/direct_inject/templates/abstract.rb +31 -0
- data/lib/direct_inject/templates/image.rb +11 -0
- data/lib/direct_inject/templates/javascript.rb +11 -0
- data/lib/direct_inject/templates/stylesheet.rb +11 -0
- data/lib/direct_inject/templates.rb +3 -0
- data/lib/direct_inject/version.rb +3 -0
- data/lib/direct_inject.rb +22 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/images/headshot.png +0 -0
- data/test/dummy/app/assets/javascripts/application.js +1 -0
- data/test/dummy/app/assets/javascripts/wut.js.erb +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +4 -0
- data/test/dummy/app/assets/stylesheets/wut.css.scss +5 -0
- data/test/dummy/app/controllers/pages_controller.rb +6 -0
- data/test/dummy/app/views/layouts/application.html.erb +9 -0
- data/test/dummy/app/views/pages/image_test.html.erb +1 -0
- data/test/dummy/app/views/pages/index.html.erb +6 -0
- data/test/dummy/app/views/pages/javascript_test.html.erb +1 -0
- data/test/dummy/app/views/pages/stylesheet_test.html.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +24 -0
- data/test/dummy/config/boot.rb +3 -0
- data/test/dummy/config/environment.rb +2 -0
- data/test/dummy/config/environments/development.rb +9 -0
- data/test/dummy/config/environments/test.rb +11 -0
- data/test/dummy/config/initializers/assets.rb +1 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +1 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +1 -0
- data/test/dummy/config/initializers/session_store.rb +1 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +3 -0
- data/test/dummy/config/routes.rb +7 -0
- data/test/dummy/config/secrets.yml +5 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/image_test.rb +8 -0
- data/test/integration/javascript_test.rb +8 -0
- data/test/integration/stylesheet_test.rb +8 -0
- data/test/test_helper.rb +15 -0
- metadata +211 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b9e281f54fb9f6b80e88e0341cc921f30ac69114
|
4
|
+
data.tar.gz: bc35d48472e01577272e3af63e25eba9bb30cc7c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 30d7c17427ecce6b6a226d4a76d6665c07cc84044ea5329a8b719a822364b57d8a653470e13ceac92b1b63603df82175f6d62f7119fe9a3b82f8b60228c98536
|
7
|
+
data.tar.gz: b93c1a99a8c07585381b69f2d53d1df5908abd49f243a5dee527d46647957e2db47cc7fef8d3d7021c4817e81b73055ae5700a3419982d983131aed8e5afc933
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in direct_inject.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use debugger
|
14
|
+
# gem 'debugger'
|
15
|
+
gem 'pry'
|
16
|
+
gem 'sass-rails', '5.0.0.beta1'
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 Ryan Cook
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'DirectInject'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'direct_inject/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do | spec |
|
7
|
+
spec.name = 'direct_inject'
|
8
|
+
spec.version = DirectInject::VERSION
|
9
|
+
spec.authors = [ 'Ryan Cook' ]
|
10
|
+
spec.email = [ 'cookrn@gmail.com' ]
|
11
|
+
spec.homepage = 'https://github.com/cookrn/direct_inject'
|
12
|
+
spec.summary = %q{Sprockets/Rails helpers for directly injecting assets onto the page.}
|
13
|
+
spec.description = %q{Sprockets/Rails helpers for directly injecting assets onto the page as an alternative to linking/sourcing an asset by URL.}
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = [ 'lib' ]
|
20
|
+
|
21
|
+
spec.add_dependency 'map'
|
22
|
+
spec.add_dependency 'tagz'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler' , '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rails' , '>= 3.1'
|
26
|
+
spec.add_development_dependency 'rake' , '~> 10.0'
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module DirectInject
|
2
|
+
module Errors
|
3
|
+
class AssetNotFound < StandardError
|
4
|
+
attr_accessor :missing_source
|
5
|
+
|
6
|
+
def initialize( missing_source )
|
7
|
+
self.missing_source = missing_source
|
8
|
+
super message_template % missing_source
|
9
|
+
end
|
10
|
+
|
11
|
+
def message_template
|
12
|
+
'Unable to find "%s" in your Sprockets environment!'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module DirectInject
|
2
|
+
module Errors
|
3
|
+
class NotConfigured < StandardError
|
4
|
+
attr_accessor :missing_property
|
5
|
+
|
6
|
+
def initialize( missing_property )
|
7
|
+
self.missing_property = missing_property
|
8
|
+
super message_template % missing_property
|
9
|
+
end
|
10
|
+
|
11
|
+
def message_template
|
12
|
+
'Unable to determine "%s". Please double check your configuration!'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'direct_inject'
|
2
|
+
require 'direct_inject/errors'
|
3
|
+
require 'map'
|
4
|
+
|
5
|
+
module DirectInject
|
6
|
+
module InternalHelpers
|
7
|
+
ASSET_EXTENSIONS =
|
8
|
+
{
|
9
|
+
:javascript => '.js',
|
10
|
+
:stylesheet => '.css'
|
11
|
+
}
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def asset_for!( source , options )
|
16
|
+
environment =
|
17
|
+
options.fetch 'sprockets_environment' do
|
18
|
+
DirectInject.sprockets_environment
|
19
|
+
end
|
20
|
+
|
21
|
+
path = source
|
22
|
+
|
23
|
+
if extname = compute_asset_extname( path , options )
|
24
|
+
path = "#{ path }#{ extname }"
|
25
|
+
end
|
26
|
+
|
27
|
+
asset = environment.find_asset path
|
28
|
+
|
29
|
+
if asset.nil?
|
30
|
+
raise Errors::AssetNotFound , source
|
31
|
+
end
|
32
|
+
|
33
|
+
asset
|
34
|
+
end
|
35
|
+
|
36
|
+
def compute_asset_extname(source, options = {})
|
37
|
+
return if options[ :extname ] == false
|
38
|
+
extname = options[ :extname ] || ASSET_EXTENSIONS[ options[ :type ] ]
|
39
|
+
extname if extname && File.extname( source ) != extname
|
40
|
+
end
|
41
|
+
|
42
|
+
def image_prefix_for( asset )
|
43
|
+
"data:image/#{ asset.pathname.extname[ 1 .. -1 ] };base64,"
|
44
|
+
end
|
45
|
+
|
46
|
+
def render( *sources )
|
47
|
+
options = Map.opts! sources
|
48
|
+
|
49
|
+
sources.map do | source |
|
50
|
+
asset = asset_for! source , options
|
51
|
+
|
52
|
+
options.set \
|
53
|
+
'data',
|
54
|
+
'direct_inject_source',
|
55
|
+
source
|
56
|
+
|
57
|
+
result =
|
58
|
+
if block_given?
|
59
|
+
yield( asset , options ).to_s
|
60
|
+
else
|
61
|
+
''
|
62
|
+
end
|
63
|
+
end.join "\n"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'direct_inject/internal_helpers'
|
3
|
+
require 'direct_inject/templates'
|
4
|
+
require 'map'
|
5
|
+
|
6
|
+
module DirectInject
|
7
|
+
module PublicApi
|
8
|
+
include InternalHelpers
|
9
|
+
|
10
|
+
def render_image( *sources )
|
11
|
+
render *sources do | asset , options |
|
12
|
+
options.set \
|
13
|
+
'data',
|
14
|
+
'direct_inject_type',
|
15
|
+
'image'
|
16
|
+
|
17
|
+
prefix = image_prefix_for asset
|
18
|
+
encoded = "#{ prefix }#{ Base64.encode64( asset.to_s ) }"
|
19
|
+
|
20
|
+
Templates::Image.render \
|
21
|
+
encoded,
|
22
|
+
options
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def render_javascript( *sources )
|
27
|
+
options = Map.opts! sources
|
28
|
+
|
29
|
+
options.set \
|
30
|
+
'type',
|
31
|
+
:javascript
|
32
|
+
|
33
|
+
sources.push options
|
34
|
+
|
35
|
+
render *sources do | asset , options |
|
36
|
+
options.set \
|
37
|
+
'data',
|
38
|
+
'direct_inject_type',
|
39
|
+
'javascript'
|
40
|
+
|
41
|
+
options.set \
|
42
|
+
'type',
|
43
|
+
'text/javascript'
|
44
|
+
|
45
|
+
Templates::Javascript.render \
|
46
|
+
asset.to_s,
|
47
|
+
options
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def render_stylesheet( *sources )
|
52
|
+
options = Map.opts! sources
|
53
|
+
|
54
|
+
options.set \
|
55
|
+
'type',
|
56
|
+
:stylesheet
|
57
|
+
|
58
|
+
sources.push options
|
59
|
+
|
60
|
+
render *sources do | asset , options |
|
61
|
+
options.set \
|
62
|
+
'data',
|
63
|
+
'direct_inject_type',
|
64
|
+
'stylesheet'
|
65
|
+
|
66
|
+
options.set \
|
67
|
+
'type',
|
68
|
+
'text/css'
|
69
|
+
|
70
|
+
Templates::Stylesheet.render \
|
71
|
+
asset.to_s,
|
72
|
+
options
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module DirectInject
|
2
|
+
module Rails
|
3
|
+
module ViewHelpers
|
4
|
+
def direct_inject_image( *sources )
|
5
|
+
DirectInject.render_image( *sources ).html_safe
|
6
|
+
end
|
7
|
+
|
8
|
+
def direct_inject_javascript( *sources )
|
9
|
+
DirectInject.render_javascript( *sources ).html_safe
|
10
|
+
end
|
11
|
+
|
12
|
+
def direct_inject_stylesheet( *sources )
|
13
|
+
DirectInject.render_stylesheet( *sources ).html_safe
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'direct_inject/rails/view_helpers'
|
2
|
+
require 'rails/railtie'
|
3
|
+
|
4
|
+
module DirectInject
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
|
+
initializer 'direct_inject.sprockets_environment' do | app |
|
7
|
+
DirectInject.sprockets_environment = app.assets
|
8
|
+
end
|
9
|
+
|
10
|
+
initializer 'direct_inject.view_helpers' do
|
11
|
+
ActiveSupport.on_load :action_view do
|
12
|
+
include Rails::ViewHelpers
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'map'
|
2
|
+
require 'tagz'
|
3
|
+
|
4
|
+
Tagz.i_know_what_the_hell_i_am_doing!
|
5
|
+
|
6
|
+
module DirectInject
|
7
|
+
module Templates
|
8
|
+
class Abstract
|
9
|
+
include Tagz
|
10
|
+
|
11
|
+
def self.render( *args , &block )
|
12
|
+
new( *args , &block ).render
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_reader \
|
16
|
+
:source,
|
17
|
+
:options
|
18
|
+
|
19
|
+
def initialize( source , options )
|
20
|
+
@source = source
|
21
|
+
@options = options
|
22
|
+
end
|
23
|
+
|
24
|
+
def tag_options( options )
|
25
|
+
map_options = Map.for options
|
26
|
+
options_keys = map_options.depth_first_keys.map { | k | k.map( &:to_s ).join '-' }
|
27
|
+
Hash[ options_keys.zip map_options.depth_first_values ]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'direct_inject/errors'
|
2
|
+
require 'direct_inject/public_api'
|
3
|
+
|
4
|
+
module DirectInject
|
5
|
+
extend \
|
6
|
+
self,
|
7
|
+
PublicApi
|
8
|
+
|
9
|
+
attr_writer :sprockets_environment
|
10
|
+
|
11
|
+
def sprockets_environment
|
12
|
+
if @sprockets_environment.nil?
|
13
|
+
raise \
|
14
|
+
Errors::NotConfigured,
|
15
|
+
:sprockets_environment
|
16
|
+
end
|
17
|
+
|
18
|
+
@sprockets_environment
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'direct_inject/railtie' if defined?( Rails::Railtie )
|
data/test/dummy/Rakefile
ADDED
File without changes
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree .
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= direct_inject_image 'headshot.png' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= direct_inject_javascript 'application' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= direct_inject_stylesheet 'application' %>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails'
|
4
|
+
|
5
|
+
%w(
|
6
|
+
action_controller
|
7
|
+
action_view
|
8
|
+
rails/test_unit
|
9
|
+
sprockets
|
10
|
+
).each do | framework |
|
11
|
+
begin
|
12
|
+
require "#{ framework }/railtie"
|
13
|
+
rescue LoadError
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Bundler.require(*Rails.groups)
|
18
|
+
require 'direct_inject'
|
19
|
+
|
20
|
+
module Dummy
|
21
|
+
class Application < Rails::Application
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
config.cache_classes = false
|
3
|
+
config.eager_load = false
|
4
|
+
config.consider_all_requests_local = true
|
5
|
+
config.action_controller.perform_caching = false
|
6
|
+
config.active_support.deprecation = :log
|
7
|
+
config.assets.debug = true
|
8
|
+
config.assets.raise_runtime_errors = true
|
9
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
config.cache_classes = true
|
3
|
+
config.eager_load = false
|
4
|
+
config.serve_static_assets = true
|
5
|
+
config.static_cache_control = 'public, max-age=3600'
|
6
|
+
config.consider_all_requests_local = true
|
7
|
+
config.action_controller.perform_caching = false
|
8
|
+
config.action_dispatch.show_exceptions = false
|
9
|
+
config.action_controller.allow_forgery_protection = false
|
10
|
+
config.active_support.deprecation = :stderr
|
11
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.assets.version = '1.0'
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.action_dispatch.cookies_serializer = :json
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.filter_parameters += [:password]
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.session_store :cookie_store, key: '_dummy_session'
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
root 'pages#index'
|
3
|
+
|
4
|
+
get 'test/image' => 'pages#image_test' , :as => :image_test
|
5
|
+
get 'test/javascript' => 'pages#javascript_test' , :as => :javascript_test
|
6
|
+
get 'test/stylesheet' => 'pages#stylesheet_test' , :as => :stylesheet_test
|
7
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
development:
|
2
|
+
secret_key_base: e00fd0db4a1d4b8638150b393d02b34438282c19bced06b396ccf42b6453382bd518ed3d28eb787010f5054dd4c8aa09af0b13025fa2d40b8f35bc16732566cf
|
3
|
+
|
4
|
+
test:
|
5
|
+
secret_key_base: a22cb0a872752609d8fd6ea9d54101044ee016b1bc79eadccc44adeebd7b51efb61523ecf2c66e7a30c4ca1454e5c0471784b53350f8e56cced4cd320eb922c7
|
File without changes
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
8
|
+
|
9
|
+
# Load support files
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
11
|
+
|
12
|
+
# Load fixtures from the engine
|
13
|
+
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
14
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,211 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: direct_inject
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Cook
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: map
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tagz
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
description: Sprockets/Rails helpers for directly injecting assets onto the page as
|
84
|
+
an alternative to linking/sourcing an asset by URL.
|
85
|
+
email:
|
86
|
+
- cookrn@gmail.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- Gemfile
|
93
|
+
- MIT-LICENSE
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- direct_inject.gemspec
|
97
|
+
- lib/direct_inject.rb
|
98
|
+
- lib/direct_inject/errors.rb
|
99
|
+
- lib/direct_inject/errors/asset_not_found.rb
|
100
|
+
- lib/direct_inject/errors/not_configured.rb
|
101
|
+
- lib/direct_inject/internal_helpers.rb
|
102
|
+
- lib/direct_inject/public_api.rb
|
103
|
+
- lib/direct_inject/rails/view_helpers.rb
|
104
|
+
- lib/direct_inject/railtie.rb
|
105
|
+
- lib/direct_inject/templates.rb
|
106
|
+
- lib/direct_inject/templates/abstract.rb
|
107
|
+
- lib/direct_inject/templates/image.rb
|
108
|
+
- lib/direct_inject/templates/javascript.rb
|
109
|
+
- lib/direct_inject/templates/stylesheet.rb
|
110
|
+
- lib/direct_inject/version.rb
|
111
|
+
- test/dummy/Rakefile
|
112
|
+
- test/dummy/app/assets/images/.keep
|
113
|
+
- test/dummy/app/assets/images/headshot.png
|
114
|
+
- test/dummy/app/assets/javascripts/application.js
|
115
|
+
- test/dummy/app/assets/javascripts/wut.js.erb
|
116
|
+
- test/dummy/app/assets/stylesheets/application.css
|
117
|
+
- test/dummy/app/assets/stylesheets/wut.css.scss
|
118
|
+
- test/dummy/app/controllers/pages_controller.rb
|
119
|
+
- test/dummy/app/views/layouts/application.html.erb
|
120
|
+
- test/dummy/app/views/pages/image_test.html.erb
|
121
|
+
- test/dummy/app/views/pages/index.html.erb
|
122
|
+
- test/dummy/app/views/pages/javascript_test.html.erb
|
123
|
+
- test/dummy/app/views/pages/stylesheet_test.html.erb
|
124
|
+
- test/dummy/bin/bundle
|
125
|
+
- test/dummy/bin/rails
|
126
|
+
- test/dummy/bin/rake
|
127
|
+
- test/dummy/config.ru
|
128
|
+
- test/dummy/config/application.rb
|
129
|
+
- test/dummy/config/boot.rb
|
130
|
+
- test/dummy/config/environment.rb
|
131
|
+
- test/dummy/config/environments/development.rb
|
132
|
+
- test/dummy/config/environments/test.rb
|
133
|
+
- test/dummy/config/initializers/assets.rb
|
134
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
135
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
136
|
+
- test/dummy/config/initializers/session_store.rb
|
137
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
138
|
+
- test/dummy/config/routes.rb
|
139
|
+
- test/dummy/config/secrets.yml
|
140
|
+
- test/dummy/log/.keep
|
141
|
+
- test/dummy/public/404.html
|
142
|
+
- test/dummy/public/422.html
|
143
|
+
- test/dummy/public/500.html
|
144
|
+
- test/dummy/public/favicon.ico
|
145
|
+
- test/integration/image_test.rb
|
146
|
+
- test/integration/javascript_test.rb
|
147
|
+
- test/integration/stylesheet_test.rb
|
148
|
+
- test/test_helper.rb
|
149
|
+
homepage: https://github.com/cookrn/direct_inject
|
150
|
+
licenses:
|
151
|
+
- MIT
|
152
|
+
metadata: {}
|
153
|
+
post_install_message:
|
154
|
+
rdoc_options: []
|
155
|
+
require_paths:
|
156
|
+
- lib
|
157
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
requirements: []
|
168
|
+
rubyforge_project:
|
169
|
+
rubygems_version: 2.4.3
|
170
|
+
signing_key:
|
171
|
+
specification_version: 4
|
172
|
+
summary: Sprockets/Rails helpers for directly injecting assets onto the page.
|
173
|
+
test_files:
|
174
|
+
- test/dummy/Rakefile
|
175
|
+
- test/dummy/app/assets/images/.keep
|
176
|
+
- test/dummy/app/assets/images/headshot.png
|
177
|
+
- test/dummy/app/assets/javascripts/application.js
|
178
|
+
- test/dummy/app/assets/javascripts/wut.js.erb
|
179
|
+
- test/dummy/app/assets/stylesheets/application.css
|
180
|
+
- test/dummy/app/assets/stylesheets/wut.css.scss
|
181
|
+
- test/dummy/app/controllers/pages_controller.rb
|
182
|
+
- test/dummy/app/views/layouts/application.html.erb
|
183
|
+
- test/dummy/app/views/pages/image_test.html.erb
|
184
|
+
- test/dummy/app/views/pages/index.html.erb
|
185
|
+
- test/dummy/app/views/pages/javascript_test.html.erb
|
186
|
+
- test/dummy/app/views/pages/stylesheet_test.html.erb
|
187
|
+
- test/dummy/bin/bundle
|
188
|
+
- test/dummy/bin/rails
|
189
|
+
- test/dummy/bin/rake
|
190
|
+
- test/dummy/config.ru
|
191
|
+
- test/dummy/config/application.rb
|
192
|
+
- test/dummy/config/boot.rb
|
193
|
+
- test/dummy/config/environment.rb
|
194
|
+
- test/dummy/config/environments/development.rb
|
195
|
+
- test/dummy/config/environments/test.rb
|
196
|
+
- test/dummy/config/initializers/assets.rb
|
197
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
198
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
199
|
+
- test/dummy/config/initializers/session_store.rb
|
200
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
201
|
+
- test/dummy/config/routes.rb
|
202
|
+
- test/dummy/config/secrets.yml
|
203
|
+
- test/dummy/log/.keep
|
204
|
+
- test/dummy/public/404.html
|
205
|
+
- test/dummy/public/422.html
|
206
|
+
- test/dummy/public/500.html
|
207
|
+
- test/dummy/public/favicon.ico
|
208
|
+
- test/integration/image_test.rb
|
209
|
+
- test/integration/javascript_test.rb
|
210
|
+
- test/integration/stylesheet_test.rb
|
211
|
+
- test/test_helper.rb
|