sprockets-gem-paths 0.0.1

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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - jruby-18mode
8
+ - jruby-19mode
9
+ - ree
10
+ - rbx-18mode
11
+ - rbx-19mode
12
+ script: bundle exec rake
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sprockets-gem-paths.gemspec
4
+ gemspec
@@ -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.
@@ -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
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ task :default => [:spec]
5
+
6
+ require 'rspec/core/rake_task'
7
+ desc "Run specs"
8
+ RSpec::Core::RakeTask.new do |t|
9
+ t.pattern = 'spec/**/*_spec.rb'
10
+ end
@@ -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
@@ -0,0 +1,5 @@
1
+ module Sprockets
2
+ module GemPaths
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require 'bundler/setup'
2
+ Bundler.require
@@ -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