sprockets-vendor_gems 0.1.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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +36 -0
- data/Rakefile +2 -0
- data/lib/sprockets-vendor_gems.rb +31 -0
- data/sprockets-vendor_gems.gemspec +18 -0
- metadata +52 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 John Bintz
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Get at available assets in loaded gems in Sprockets
|
2
|
+
|
3
|
+
Either get the list of asset paths:
|
4
|
+
|
5
|
+
``` ruby
|
6
|
+
require 'sprockets-vendor_gems'
|
7
|
+
|
8
|
+
env = Sprockets::Environment.new('.')
|
9
|
+
Sprockets.find_gem_vendor_paths(:for => :javascript).each do |path|
|
10
|
+
env.append_path path
|
11
|
+
end
|
12
|
+
```
|
13
|
+
|
14
|
+
or get an Environment with those paths in there already:
|
15
|
+
``` ruby
|
16
|
+
require 'sprockets-vendor_gems'
|
17
|
+
|
18
|
+
env = Sprockets::EnvironmentWithVendoredGems.new('.')
|
19
|
+
```
|
20
|
+
|
21
|
+
Yeah!
|
22
|
+
|
23
|
+
## Installation
|
24
|
+
|
25
|
+
Add this line to your application's Gemfile:
|
26
|
+
|
27
|
+
gem 'sprockets-vendor_gems'
|
28
|
+
|
29
|
+
And then execute:
|
30
|
+
|
31
|
+
$ bundle
|
32
|
+
|
33
|
+
Or install it yourself as:
|
34
|
+
|
35
|
+
$ gem install sprockets-vendor_gems
|
36
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'sprockets'
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
module ::Sprockets
|
5
|
+
class << self
|
6
|
+
def find_gem_vendor_paths(options = {})
|
7
|
+
for_types = [ options[:for] || [ 'javascripts', 'stylesheets' ] ].flatten
|
8
|
+
|
9
|
+
paths = []
|
10
|
+
|
11
|
+
Gem::Specification.each do |gemspec|
|
12
|
+
%w{vendor lib app}.product(for_types).each do |base_dir, type|
|
13
|
+
path = File.join(gemspec.gem_dir, base_dir, "assets", type.to_s)
|
14
|
+
|
15
|
+
paths << path if File.directory?(path)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
paths
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class EnvironmentWithVendoredGems < Environment
|
24
|
+
def initialize(*args)
|
25
|
+
super(*args)
|
26
|
+
|
27
|
+
Sprockets.find_gem_vendor_paths.each { |path| append_path(path) }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
Gem::Specification.new do |gem|
|
3
|
+
gem.authors = ["John Bintz"]
|
4
|
+
gem.email = ["john@coswellproductions.com"]
|
5
|
+
gem.description = %q{Get the vendored assets paths in gems.}
|
6
|
+
gem.summary = %q{Get the vendored assets paths in gems.}
|
7
|
+
gem.homepage = ""
|
8
|
+
|
9
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
10
|
+
gem.files = `git ls-files`.split("\n")
|
11
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
12
|
+
gem.name = "sprockets-vendor_gems"
|
13
|
+
gem.require_paths = ["lib"]
|
14
|
+
gem.version = '0.1.0'
|
15
|
+
|
16
|
+
gem.required_rubygems_version = '1.8.0'
|
17
|
+
end
|
18
|
+
|
metadata
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sprockets-vendor_gems
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- John Bintz
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-08 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Get the vendored assets paths in gems.
|
15
|
+
email:
|
16
|
+
- john@coswellproductions.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/sprockets-vendor_gems.rb
|
27
|
+
- sprockets-vendor_gems.gemspec
|
28
|
+
homepage: ''
|
29
|
+
licenses: []
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - =
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.8.0
|
46
|
+
requirements: []
|
47
|
+
rubyforge_project:
|
48
|
+
rubygems_version: 1.8.15
|
49
|
+
signing_key:
|
50
|
+
specification_version: 3
|
51
|
+
summary: Get the vendored assets paths in gems.
|
52
|
+
test_files: []
|