sprockets-gem-paths 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.travis.yml +12 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +10 -0
- data/lib/sprockets-gem-paths.rb +1 -0
- data/lib/sprockets/gem_paths.rb +41 -0
- data/lib/sprockets/gem_paths/version.rb +5 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/sprockets_gem_paths_spec.rb +12 -0
- data/sprockets-gem-paths.gemspec +27 -0
- metadata +146 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Eric J. Holmes
|
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,34 @@
|
|
1
|
+
# Sprockets::GemPaths
|
2
|
+
|
3
|
+
Adds a `.append_gem_paths` method to `Sprockets::Environment`, which adds paths
|
4
|
+
to vendored gems (think bourbon), when using sprockets outside of rails.
|
5
|
+
Extracted from [Middleman](https://github.com/middleman/middleman).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'sprockets-gem-paths'
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Build your sprockets environment.
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
environment = Sprockets::Environment.new
|
19
|
+
environment.add_path 'assets'
|
20
|
+
```
|
21
|
+
|
22
|
+
Append paths to gems.
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
environment.append_gem_paths
|
26
|
+
```
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
1. Fork it
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'sprockets/gem_paths'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'sprockets'
|
2
|
+
|
3
|
+
module Sprockets
|
4
|
+
module GemPaths
|
5
|
+
def self.rubygems_latest_specs
|
6
|
+
# If newer Rubygems
|
7
|
+
if ::Gem::Specification.respond_to? :latest_specs
|
8
|
+
::Gem::Specification.latest_specs
|
9
|
+
else
|
10
|
+
::Gem.source_index.latest_specs
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def append_gem_paths
|
15
|
+
try_paths = [
|
16
|
+
%w{ assets },
|
17
|
+
%w{ app },
|
18
|
+
%w{ app assets },
|
19
|
+
%w{ vendor },
|
20
|
+
%w{ vendor assets },
|
21
|
+
%w{ lib },
|
22
|
+
%w{ lib assets }
|
23
|
+
].inject([]) do |sum, v|
|
24
|
+
sum + [
|
25
|
+
File.join(v, 'javascripts'),
|
26
|
+
File.join(v, 'stylesheets'),
|
27
|
+
File.join(v, 'images'),
|
28
|
+
File.join(v, 'fonts')
|
29
|
+
]
|
30
|
+
end
|
31
|
+
|
32
|
+
(Sprockets::GemPaths.rubygems_latest_specs.map(&:full_gem_path)).each do |root_path|
|
33
|
+
try_paths.map {|p| File.join(root_path, p) }.
|
34
|
+
select {|p| File.directory?(p) }.
|
35
|
+
each {|path| append_path(path) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
Sprockets::Environment.send :include, Sprockets::GemPaths
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Sprockets::Environment do
|
4
|
+
let(:environment) { described_class.new }
|
5
|
+
|
6
|
+
describe '.append_gem_paths' do
|
7
|
+
it 'adds paths to gems' do
|
8
|
+
environment.append_gem_paths
|
9
|
+
environment.paths.should have(1).path
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -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 'sprockets/gem_paths/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sprockets-gem-paths"
|
8
|
+
spec.version = Sprockets::GemPaths::VERSION
|
9
|
+
spec.authors = ["Eric J. Holmes"]
|
10
|
+
spec.email = ["eric@ejholmes.net"]
|
11
|
+
spec.description = %q{Add gem paths to your sprockets environment outside of rails}
|
12
|
+
spec.summary = %q{Add gem paths to your sprockets environment outside of rails}
|
13
|
+
spec.homepage = "https://github.com/ejholmes/sprockets-gem-paths"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
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 "sprockets"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "bourbon"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sprockets-gem-paths
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Eric J. Holmes
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-06-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sprockets
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.3'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: bourbon
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: Add gem paths to your sprockets environment outside of rails
|
95
|
+
email:
|
96
|
+
- eric@ejholmes.net
|
97
|
+
executables: []
|
98
|
+
extensions: []
|
99
|
+
extra_rdoc_files: []
|
100
|
+
files:
|
101
|
+
- .gitignore
|
102
|
+
- .travis.yml
|
103
|
+
- Gemfile
|
104
|
+
- LICENSE.txt
|
105
|
+
- README.md
|
106
|
+
- Rakefile
|
107
|
+
- lib/sprockets-gem-paths.rb
|
108
|
+
- lib/sprockets/gem_paths.rb
|
109
|
+
- lib/sprockets/gem_paths/version.rb
|
110
|
+
- spec/spec_helper.rb
|
111
|
+
- spec/sprockets_gem_paths_spec.rb
|
112
|
+
- sprockets-gem-paths.gemspec
|
113
|
+
homepage: https://github.com/ejholmes/sprockets-gem-paths
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
segments:
|
127
|
+
- 0
|
128
|
+
hash: -4215461269891460089
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
segments:
|
136
|
+
- 0
|
137
|
+
hash: -4215461269891460089
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 1.8.23
|
141
|
+
signing_key:
|
142
|
+
specification_version: 3
|
143
|
+
summary: Add gem paths to your sprockets environment outside of rails
|
144
|
+
test_files:
|
145
|
+
- spec/spec_helper.rb
|
146
|
+
- spec/sprockets_gem_paths_spec.rb
|