sprockets-plugin 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 +4 -0
- data/Appraisals +11 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +73 -0
- data/Rakefile +6 -0
- data/gemfiles/sprockets-2.0.gemfile +7 -0
- data/gemfiles/sprockets-2.0.gemfile.lock +40 -0
- data/gemfiles/sprockets-2.1.gemfile +7 -0
- data/gemfiles/sprockets-2.1.gemfile.lock +40 -0
- data/gemfiles/sprockets-2.2.gemfile +7 -0
- data/gemfiles/sprockets-2.2.gemfile.lock +42 -0
- data/lib/sprockets-plugin.rb +1 -0
- data/lib/sprockets/plugin.rb +61 -0
- data/lib/sprockets/plugin/aware.rb +35 -0
- data/lib/sprockets/plugin/version.rb +5 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/sprockets-plugin_spec.rb +165 -0
- data/sprockets-plugin.gemspec +25 -0
- metadata +123 -0
data/.gitignore
ADDED
data/Appraisals
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Peter Browne
|
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
@@ -0,0 +1,73 @@
|
|
1
|
+
sprockets-plugin
|
2
|
+
================
|
3
|
+
|
4
|
+
Package assets into gems for non-Rails applications.
|
5
|
+
|
6
|
+
|
7
|
+
Installation
|
8
|
+
------------
|
9
|
+
|
10
|
+
``` bash
|
11
|
+
$ gem install sprockets-plugin
|
12
|
+
```
|
13
|
+
|
14
|
+
|
15
|
+
Usage
|
16
|
+
-----
|
17
|
+
|
18
|
+
Sprockets::Plugin is meant to be used within gems, to package assets for reuse. So the first step is to add it as a dependency in your gemspec:
|
19
|
+
|
20
|
+
``` ruby
|
21
|
+
Gem::Specification.new do |s|
|
22
|
+
# ...
|
23
|
+
s.add_runtime_dependency "sprockets-plugin"
|
24
|
+
end
|
25
|
+
```
|
26
|
+
|
27
|
+
And then extend Sprockets::Plugin and add the necessary asset paths:
|
28
|
+
|
29
|
+
``` ruby
|
30
|
+
require "sprockets-plugin"
|
31
|
+
|
32
|
+
class MyPlugin < Sprockets::Plugin
|
33
|
+
# Set the root path to use relative paths in `.append_path`
|
34
|
+
root File.expand_path("../..", __FILE__)
|
35
|
+
append_path "lib/assets/images"
|
36
|
+
append_path "lib/assets/javascripts"
|
37
|
+
append_path "lib/assets/stylesheets"
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
Now any assets in the "lib/assets" directory will be available to applications that require this gem:
|
42
|
+
|
43
|
+
``` ruby
|
44
|
+
require "sprockets"
|
45
|
+
require "my_plugin"
|
46
|
+
|
47
|
+
map "/assets" do
|
48
|
+
environment = Sprockets::Environment.new
|
49
|
+
# The assets from MyPlugin will be automatically appended.
|
50
|
+
environment.append_path "assets/images"
|
51
|
+
environment.append_path "assets/javascripts"
|
52
|
+
environment.append_path "assets/stylesheets"
|
53
|
+
run environment
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
Advanced Usage
|
58
|
+
--------------
|
59
|
+
|
60
|
+
You can package assets for Rails and non-Rails applications in the following way:
|
61
|
+
|
62
|
+
``` ruby
|
63
|
+
if defined? Rails
|
64
|
+
require "my_assets/engine"
|
65
|
+
elsif defined? Sprockets::Plugin
|
66
|
+
require "my_assets/plugin"
|
67
|
+
end
|
68
|
+
```
|
69
|
+
|
70
|
+
Copyright
|
71
|
+
---------
|
72
|
+
|
73
|
+
Copyright (c) 2011 [Peter Browne](http://petebrowne.com). See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/Pete/Code/sprockets-plugin
|
3
|
+
specs:
|
4
|
+
sprockets-plugin (0.0.1)
|
5
|
+
sprockets (~> 2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
appraisal (0.4.0)
|
11
|
+
bundler
|
12
|
+
rake
|
13
|
+
diff-lcs (1.1.3)
|
14
|
+
hike (1.2.1)
|
15
|
+
rack (1.4.0)
|
16
|
+
rake (0.9.2.2)
|
17
|
+
rspec (2.6.0)
|
18
|
+
rspec-core (~> 2.6.0)
|
19
|
+
rspec-expectations (~> 2.6.0)
|
20
|
+
rspec-mocks (~> 2.6.0)
|
21
|
+
rspec-core (2.6.4)
|
22
|
+
rspec-expectations (2.6.0)
|
23
|
+
diff-lcs (~> 1.1.2)
|
24
|
+
rspec-mocks (2.6.0)
|
25
|
+
sprockets (2.0.3)
|
26
|
+
hike (~> 1.2)
|
27
|
+
rack (~> 1.0)
|
28
|
+
tilt (!= 1.3.0, ~> 1.1)
|
29
|
+
test-construct (1.2.0)
|
30
|
+
tilt (1.3.3)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
appraisal (~> 0.4.0)
|
37
|
+
rspec (~> 2.6.0)
|
38
|
+
sprockets (~> 2.0.0)
|
39
|
+
sprockets-plugin!
|
40
|
+
test-construct (~> 1.2.0)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/Pete/Code/sprockets-plugin
|
3
|
+
specs:
|
4
|
+
sprockets-plugin (0.0.1)
|
5
|
+
sprockets (~> 2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
appraisal (0.4.0)
|
11
|
+
bundler
|
12
|
+
rake
|
13
|
+
diff-lcs (1.1.3)
|
14
|
+
hike (1.2.1)
|
15
|
+
rack (1.4.0)
|
16
|
+
rake (0.9.2.2)
|
17
|
+
rspec (2.6.0)
|
18
|
+
rspec-core (~> 2.6.0)
|
19
|
+
rspec-expectations (~> 2.6.0)
|
20
|
+
rspec-mocks (~> 2.6.0)
|
21
|
+
rspec-core (2.6.4)
|
22
|
+
rspec-expectations (2.6.0)
|
23
|
+
diff-lcs (~> 1.1.2)
|
24
|
+
rspec-mocks (2.6.0)
|
25
|
+
sprockets (2.1.2)
|
26
|
+
hike (~> 1.2)
|
27
|
+
rack (~> 1.0)
|
28
|
+
tilt (!= 1.3.0, ~> 1.1)
|
29
|
+
test-construct (1.2.0)
|
30
|
+
tilt (1.3.3)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
appraisal (~> 0.4.0)
|
37
|
+
rspec (~> 2.6.0)
|
38
|
+
sprockets (~> 2.1.0)
|
39
|
+
sprockets-plugin!
|
40
|
+
test-construct (~> 1.2.0)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/Pete/Code/sprockets-plugin
|
3
|
+
specs:
|
4
|
+
sprockets-plugin (0.0.1)
|
5
|
+
sprockets (~> 2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
appraisal (0.4.0)
|
11
|
+
bundler
|
12
|
+
rake
|
13
|
+
diff-lcs (1.1.3)
|
14
|
+
hike (1.2.1)
|
15
|
+
multi_json (1.0.4)
|
16
|
+
rack (1.4.0)
|
17
|
+
rake (0.9.2.2)
|
18
|
+
rspec (2.6.0)
|
19
|
+
rspec-core (~> 2.6.0)
|
20
|
+
rspec-expectations (~> 2.6.0)
|
21
|
+
rspec-mocks (~> 2.6.0)
|
22
|
+
rspec-core (2.6.4)
|
23
|
+
rspec-expectations (2.6.0)
|
24
|
+
diff-lcs (~> 1.1.2)
|
25
|
+
rspec-mocks (2.6.0)
|
26
|
+
sprockets (2.2.0.beta)
|
27
|
+
hike (~> 1.2)
|
28
|
+
multi_json (~> 1.0)
|
29
|
+
rack (~> 1.0)
|
30
|
+
tilt (~> 1.1, != 1.3.0)
|
31
|
+
test-construct (1.2.0)
|
32
|
+
tilt (1.3.3)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
appraisal (~> 0.4.0)
|
39
|
+
rspec (~> 2.6.0)
|
40
|
+
sprockets (>= 2.2.0.beta)
|
41
|
+
sprockets-plugin!
|
42
|
+
test-construct (~> 1.2.0)
|
@@ -0,0 +1 @@
|
|
1
|
+
require "sprockets/plugin"
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
3
|
+
module Sprockets
|
4
|
+
class Plugin
|
5
|
+
require "sprockets/plugin/version"
|
6
|
+
require "sprockets/plugin/aware"
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def inherited(plugin)
|
10
|
+
plugins << plugin
|
11
|
+
end
|
12
|
+
|
13
|
+
# Returns all of the plugins inheriting from
|
14
|
+
# Sprockets::Plugin.
|
15
|
+
def plugins
|
16
|
+
@@plugins ||= []
|
17
|
+
end
|
18
|
+
|
19
|
+
# Sets the root path or returns the current one.
|
20
|
+
# A root path is required for appending relative
|
21
|
+
# paths.
|
22
|
+
def root(path = nil)
|
23
|
+
if path
|
24
|
+
@root = Pathname.new(path).expand_path
|
25
|
+
else
|
26
|
+
@root
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Appends a path to the Plugin. The path will
|
31
|
+
# later be appended to the Sprockets::Environment.
|
32
|
+
def append_paths(*paths)
|
33
|
+
self.paths.push *normalize_paths(paths)
|
34
|
+
end
|
35
|
+
alias_method :append_path, :append_paths
|
36
|
+
|
37
|
+
# Prepends a path to the Plugin. The path will
|
38
|
+
# later be appended to the Sprockets::Environment.
|
39
|
+
def prepend_paths(*paths)
|
40
|
+
self.paths.unshift *normalize_paths(paths)
|
41
|
+
end
|
42
|
+
alias_method :prepend_path, :prepend_paths
|
43
|
+
|
44
|
+
# All of the paths registered by the plugin.
|
45
|
+
def paths
|
46
|
+
@paths ||= []
|
47
|
+
end
|
48
|
+
|
49
|
+
protected
|
50
|
+
|
51
|
+
def normalize_paths(paths)
|
52
|
+
paths.inject([]) do |normalized_paths, path|
|
53
|
+
path = Pathname.new(path)
|
54
|
+
path = root.join(path) if root && path.relative?
|
55
|
+
path = path.expand_path
|
56
|
+
normalized_paths.push(path.to_s) if path.exist?
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "sprockets/environment"
|
2
|
+
|
3
|
+
module Sprockets
|
4
|
+
class Plugin
|
5
|
+
module Aware
|
6
|
+
def self.included(base)
|
7
|
+
base.extend ClassMethods
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
# Overrides .new to append Plugin paths after
|
12
|
+
# initialization.
|
13
|
+
#
|
14
|
+
# Is there a better way to do this?
|
15
|
+
def new(root = ".")
|
16
|
+
super(root) do |env|
|
17
|
+
env.append_plugin_paths
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Appends the paths from each Sprockets::Plugin
|
23
|
+
# to the Sprockets::Environment.
|
24
|
+
def append_plugin_paths
|
25
|
+
Plugin.plugins.each do |plugin|
|
26
|
+
plugin.paths.each do |path|
|
27
|
+
self.append_path(path) unless self.paths.include?(path)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Sprockets::Environment.send :include, Sprockets::Plugin::Aware
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "sprockets"
|
2
|
+
require "sprockets-plugin"
|
3
|
+
require "construct"
|
4
|
+
|
5
|
+
# Requires supporting files with custom matchers and macros, etc,
|
6
|
+
# in ./support/ and its subdirectories.
|
7
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
include Construct::Helpers
|
11
|
+
|
12
|
+
config.before :each do
|
13
|
+
@sandbox = create_construct
|
14
|
+
end
|
15
|
+
|
16
|
+
config.after :each do
|
17
|
+
@sandbox.destroy!
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Sprockets::Plugin do
|
4
|
+
after :each do
|
5
|
+
Sprockets::Plugin.class_variable_set :@@plugins, nil
|
6
|
+
end
|
7
|
+
|
8
|
+
it "adds paths from plugins to newly created environments" do
|
9
|
+
dir_1 = @sandbox.directory "plugin_1/assets"
|
10
|
+
dir_2 = @sandbox.directory "plugin_2/assets"
|
11
|
+
dir_3 = @sandbox.directory "plugin_3/assets"
|
12
|
+
|
13
|
+
plugin_1 = Class.new Sprockets::Plugin
|
14
|
+
plugin_1.append_path dir_1
|
15
|
+
plugin_2 = Class.new Sprockets::Plugin
|
16
|
+
plugin_2.append_path dir_2
|
17
|
+
plugin_3 = Class.new Sprockets::Plugin
|
18
|
+
plugin_3.append_path dir_3
|
19
|
+
|
20
|
+
env = Sprockets::Environment.new
|
21
|
+
env.paths.should == [dir_1, dir_2, dir_3].map(&:to_s)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "adds a #append_plugin_paths method for adding paths from plugins" do
|
25
|
+
dir_1 = @sandbox.directory "plugin_1/assets"
|
26
|
+
dir_2 = @sandbox.directory "plugin_2/assets"
|
27
|
+
dir_3 = @sandbox.directory "plugin_3/assets"
|
28
|
+
|
29
|
+
plugin_1 = Class.new Sprockets::Plugin
|
30
|
+
plugin_1.append_path dir_1
|
31
|
+
|
32
|
+
env = Sprockets::Environment.new
|
33
|
+
env.paths.should == [dir_1].map(&:to_s)
|
34
|
+
|
35
|
+
plugin_2 = Class.new Sprockets::Plugin
|
36
|
+
plugin_2.append_path dir_2
|
37
|
+
plugin_3 = Class.new Sprockets::Plugin
|
38
|
+
plugin_3.append_path dir_3
|
39
|
+
|
40
|
+
env.append_plugin_paths
|
41
|
+
env.paths.should == [dir_1, dir_2, dir_3].map(&:to_s)
|
42
|
+
end
|
43
|
+
|
44
|
+
describe ".append_path" do
|
45
|
+
it "adds paths" do
|
46
|
+
dir_1 = @sandbox.directory "plugin/assets/images"
|
47
|
+
dir_2 = @sandbox.directory "plugin/assets/javascripts"
|
48
|
+
dir_3 = @sandbox.directory "plugin/assets/stylesheets"
|
49
|
+
|
50
|
+
plugin = Class.new Sprockets::Plugin
|
51
|
+
plugin.append_path dir_1
|
52
|
+
plugin.append_path dir_2
|
53
|
+
plugin.append_path dir_3
|
54
|
+
plugin.paths.should == [dir_1, dir_2, dir_3].map(&:to_s)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "adds the paths relative to the plugin root" do
|
58
|
+
dir_1 = @sandbox.directory "plugin/assets/images"
|
59
|
+
dir_2 = @sandbox.directory "plugin/assets/javascripts"
|
60
|
+
dir_3 = @sandbox.directory "plugin/assets/stylesheets"
|
61
|
+
|
62
|
+
plugin = Class.new Sprockets::Plugin
|
63
|
+
plugin.root @sandbox.join "plugin"
|
64
|
+
plugin.append_path "assets/images"
|
65
|
+
plugin.append_path "assets/javascripts"
|
66
|
+
plugin.append_path "assets/stylesheets"
|
67
|
+
plugin.paths.should == [dir_1, dir_2, dir_3].map(&:to_s)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "only adds existing paths" do
|
71
|
+
dir_1 = @sandbox.directory "plugin/assets/images"
|
72
|
+
dir_2 = @sandbox.directory "plugin/assets/javascripts"
|
73
|
+
dir_3 = @sandbox.join "plugin/assets/stylesheets"
|
74
|
+
|
75
|
+
plugin = Class.new Sprockets::Plugin
|
76
|
+
plugin.append_path dir_1
|
77
|
+
plugin.append_path dir_2
|
78
|
+
plugin.append_path dir_3
|
79
|
+
plugin.paths.should == [dir_1, dir_2].map(&:to_s)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe ".appends_paths" do
|
84
|
+
it "adds multiple paths at once" do
|
85
|
+
dir_1 = @sandbox.directory "plugin/assets/images"
|
86
|
+
dir_2 = @sandbox.directory "plugin/assets/javascripts"
|
87
|
+
dir_3 = @sandbox.directory "plugin/assets/stylesheets"
|
88
|
+
|
89
|
+
plugin = Class.new Sprockets::Plugin
|
90
|
+
plugin.append_path dir_1, dir_2 ,dir_3
|
91
|
+
plugin.paths.should == [dir_1, dir_2, dir_3].map(&:to_s)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe ".prepend_path" do
|
96
|
+
it "adds paths" do
|
97
|
+
dir_1 = @sandbox.directory "plugin/assets/images"
|
98
|
+
dir_2 = @sandbox.directory "plugin/assets/javascripts"
|
99
|
+
dir_3 = @sandbox.directory "plugin/assets/stylesheets"
|
100
|
+
|
101
|
+
plugin = Class.new Sprockets::Plugin
|
102
|
+
plugin.prepend_path dir_1
|
103
|
+
plugin.prepend_path dir_2
|
104
|
+
plugin.prepend_path dir_3
|
105
|
+
plugin.paths.should == [dir_3, dir_2, dir_1].map(&:to_s)
|
106
|
+
end
|
107
|
+
|
108
|
+
it "adds the paths relative to the plugin root" do
|
109
|
+
dir_1 = @sandbox.directory "plugin/assets/images"
|
110
|
+
dir_2 = @sandbox.directory "plugin/assets/javascripts"
|
111
|
+
dir_3 = @sandbox.directory "plugin/assets/stylesheets"
|
112
|
+
|
113
|
+
plugin = Class.new Sprockets::Plugin
|
114
|
+
plugin.root @sandbox.join "plugin"
|
115
|
+
plugin.prepend_path "assets/images"
|
116
|
+
plugin.prepend_path "assets/javascripts"
|
117
|
+
plugin.prepend_path "assets/stylesheets"
|
118
|
+
plugin.paths.should == [dir_3, dir_2, dir_1].map(&:to_s)
|
119
|
+
end
|
120
|
+
|
121
|
+
it "only adds existing paths" do
|
122
|
+
dir_1 = @sandbox.directory "plugin/assets/images"
|
123
|
+
dir_2 = @sandbox.directory "plugin/assets/javascripts"
|
124
|
+
dir_3 = @sandbox.join "plugin/assets/stylesheets"
|
125
|
+
|
126
|
+
plugin = Class.new Sprockets::Plugin
|
127
|
+
plugin.prepend_path dir_1
|
128
|
+
plugin.prepend_path dir_2
|
129
|
+
plugin.prepend_path dir_3
|
130
|
+
plugin.paths.should == [dir_2, dir_1].map(&:to_s)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe ".prepends_paths" do
|
135
|
+
it "adds multiple paths at once" do
|
136
|
+
dir_1 = @sandbox.directory "plugin/assets/images"
|
137
|
+
dir_2 = @sandbox.directory "plugin/assets/javascripts"
|
138
|
+
dir_3 = @sandbox.directory "plugin/assets/stylesheets"
|
139
|
+
|
140
|
+
plugin = Class.new Sprockets::Plugin
|
141
|
+
plugin.append_path dir_1
|
142
|
+
plugin.prepend_paths dir_2 ,dir_3
|
143
|
+
plugin.paths.should == [dir_2, dir_3, dir_1].map(&:to_s)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
describe ".root" do
|
148
|
+
it "converts the given path to a Pathname object" do
|
149
|
+
plugin_path = @sandbox.join "plugin"
|
150
|
+
plugin = Class.new Sprockets::Plugin
|
151
|
+
plugin.root plugin_path.to_s
|
152
|
+
plugin.root.should be_an_instance_of(Pathname)
|
153
|
+
plugin.root.should == plugin_path
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
describe ".plugins" do
|
158
|
+
it "returns all of the plugins" do
|
159
|
+
plugin_1 = Class.new Sprockets::Plugin
|
160
|
+
plugin_2 = Class.new Sprockets::Plugin
|
161
|
+
plugin_3 = Class.new Sprockets::Plugin
|
162
|
+
Sprockets::Plugin.plugins.should == [ plugin_1, plugin_2, plugin_3 ]
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "sprockets/plugin/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "sprockets-plugin"
|
7
|
+
s.version = Sprockets::Plugin::VERSION
|
8
|
+
s.authors = ["Pete Browne"]
|
9
|
+
s.email = ["me@petebrowne.com"]
|
10
|
+
s.homepage = "https://github.com/petebrowne/sprockets-plugin"
|
11
|
+
s.summary = %q{Package assets into gems for non-Rails applications.}
|
12
|
+
s.description = %q{Package assets into gems for non-Rails applications.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "sprockets-plugin"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_runtime_dependency "sprockets", "~> 2.0"
|
22
|
+
s.add_development_dependency "appraisal", "~> 0.4.0"
|
23
|
+
s.add_development_dependency "rspec", "~> 2.6.0"
|
24
|
+
s.add_development_dependency "test-construct", "~> 1.2.0"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sprockets-plugin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Pete Browne
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2012-01-02 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: sprockets
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "2.0"
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: appraisal
|
28
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.4.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.6.0
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: test-construct
|
50
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.2.0
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *id004
|
59
|
+
description: Package assets into gems for non-Rails applications.
|
60
|
+
email:
|
61
|
+
- me@petebrowne.com
|
62
|
+
executables: []
|
63
|
+
|
64
|
+
extensions: []
|
65
|
+
|
66
|
+
extra_rdoc_files: []
|
67
|
+
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- Appraisals
|
71
|
+
- Gemfile
|
72
|
+
- LICENSE
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- gemfiles/sprockets-2.0.gemfile
|
76
|
+
- gemfiles/sprockets-2.0.gemfile.lock
|
77
|
+
- gemfiles/sprockets-2.1.gemfile
|
78
|
+
- gemfiles/sprockets-2.1.gemfile.lock
|
79
|
+
- gemfiles/sprockets-2.2.gemfile
|
80
|
+
- gemfiles/sprockets-2.2.gemfile.lock
|
81
|
+
- lib/sprockets-plugin.rb
|
82
|
+
- lib/sprockets/plugin.rb
|
83
|
+
- lib/sprockets/plugin/aware.rb
|
84
|
+
- lib/sprockets/plugin/version.rb
|
85
|
+
- spec/spec_helper.rb
|
86
|
+
- spec/sprockets-plugin_spec.rb
|
87
|
+
- sprockets-plugin.gemspec
|
88
|
+
homepage: https://github.com/petebrowne/sprockets-plugin
|
89
|
+
licenses: []
|
90
|
+
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 3383115453657503844
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
hash: 3383115453657503844
|
111
|
+
segments:
|
112
|
+
- 0
|
113
|
+
version: "0"
|
114
|
+
requirements: []
|
115
|
+
|
116
|
+
rubyforge_project: sprockets-plugin
|
117
|
+
rubygems_version: 1.8.8
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: Package assets into gems for non-Rails applications.
|
121
|
+
test_files:
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
- spec/sprockets-plugin_spec.rb
|