sinatra-sprockets-chain 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/MIT-LICENSE +20 -0
- data/README.md +169 -0
- data/lib/sinatra-sprockets-chain.rb +1 -0
- data/lib/sinatra/sprockets.rb +84 -0
- data/lib/sinatra/sprockets/helpers.rb +27 -0
- data/lib/sinatra/sprockets/server.rb +27 -0
- data/lib/sinatra/sprockets/task.rb +32 -0
- data/lib/sinatra/sprockets/version.rb +5 -0
- data/test/app/assets/application.css +6 -0
- data/test/app/assets/application.js +4 -0
- data/test/app/assets/image.gif +0 -0
- data/test/app/assets/other.css +1 -0
- data/test/app/assets/other.js +1 -0
- data/test/app/mock.rb +6 -0
- data/test/sinatra/sprockets/helpers_test.rb +27 -0
- data/test/sinatra/sprockets/server_test.rb +38 -0
- data/test/sinatra/sprockets/task_test.rb +45 -0
- data/test/sinatra/sprockets_test.rb +8 -0
- data/test/test_helper.rb +32 -0
- metadata +173 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ba1701991fb4e0cb8faed0e744674ce9e01fff51
|
4
|
+
data.tar.gz: 5828e408a899f66feff358adbc64d43b94304673
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 16f3abdafc6d13227db0c417ddcdc5e6104e53e99d5c694a7d0fdfab33b093ae803bdc91db508aa726f578e7d6969917986b5049b4a8b862dde8a22dd12903ce
|
7
|
+
data.tar.gz: 48007b5b3d7d4200908f105a8dfdc3f89b6ebe8fc678654e9a99afe741f1b17ebcf6a0b3b817d5b527926acf1b8fccad1cd469509386acf7bd16f21152734f94
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 Edson Hilios
|
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,169 @@
|
|
1
|
+
Sinatra::Sprockets
|
2
|
+
==================
|
3
|
+
|
4
|
+
Plug and play extension for sinatra that mimic rails assets pipeline through Sprockets.
|
5
|
+
|
6
|
+
This gem allows you easly deploy assets via Sprockets assets pipeline just as Rails does, also help you configure the rake tasks for compression. The goal is to have a headless configuration extension and be tested (all other aren't) to give users a fast access to all Sprockets goodness.
|
7
|
+
|
8
|
+
Installation & Usage
|
9
|
+
--------------------
|
10
|
+
|
11
|
+
Set on your Gemset file if you are using Bundler:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'sinatra-sprockets-wheel'
|
15
|
+
# Don't forget the js evaluator: gem 'therubyracer'
|
16
|
+
```
|
17
|
+
|
18
|
+
If you are using the Classic style just require the extension.
|
19
|
+
|
20
|
+
```
|
21
|
+
require 'sinatra'
|
22
|
+
require 'sinatra/sprockets'
|
23
|
+
|
24
|
+
# ... Your app
|
25
|
+
```
|
26
|
+
|
27
|
+
On the other hand if you use the Modular approach, besides requiring register the extension on your Sinatra application.
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require 'sinatra/base'
|
31
|
+
require 'sinatra/sprockets'
|
32
|
+
|
33
|
+
class Hello < Sinatra::Base
|
34
|
+
register Sinatra::Sprockets
|
35
|
+
|
36
|
+
# ... Your app
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
Following the default configuration you just need to create the `/assets` folder and Sprockets will search for `application.js` and `application.css` to precompile (if you want to set-up a different structure jump to the [configuration](#configuration) chapter). The default folder schema is:
|
41
|
+
|
42
|
+
```
|
43
|
+
hello/
|
44
|
+
| assets/
|
45
|
+
| | application.js
|
46
|
+
| | application.css
|
47
|
+
|
|
48
|
+
| sinatra_app.rb
|
49
|
+
```
|
50
|
+
|
51
|
+
In the application.(js|css) you can include your requirements:
|
52
|
+
|
53
|
+
```css
|
54
|
+
/*
|
55
|
+
*= require vendor/normalize
|
56
|
+
*= require_self
|
57
|
+
*= require_tree .
|
58
|
+
*/
|
59
|
+
```
|
60
|
+
|
61
|
+
```js
|
62
|
+
//= require vendor/normalize
|
63
|
+
//= require_self
|
64
|
+
//= require_tree .
|
65
|
+
```
|
66
|
+
|
67
|
+
By default Sprockets don't serve your file in production so it's up to you compile them, just set-up your `Rakefile` and run the `assets:precompile` task.
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
require 'sinatra/sprockets/task'
|
71
|
+
require 'sintra_app'
|
72
|
+
|
73
|
+
Sinatra::Sprockets.rake_tasks(App)
|
74
|
+
```
|
75
|
+
|
76
|
+
Helpers
|
77
|
+
-------
|
78
|
+
|
79
|
+
This gem come bundled with [sprockets-helpers](https://github.com/petebrowne/sprockets-helpers) to help the path resolution of your assets inside sprockets or your application. All methods available in the gem will be at your disposal has helper once you register the extension.
|
80
|
+
|
81
|
+
```css
|
82
|
+
body {
|
83
|
+
background-image: image-url('cat.png');
|
84
|
+
}
|
85
|
+
```
|
86
|
+
|
87
|
+
```erb
|
88
|
+
<img src="<%= image_path('hello.jpg') %>" />
|
89
|
+
<script src="<%= javascript_path 'application' %>"></script>
|
90
|
+
<link rel="stylesheet" href="<%= stylesheet_path 'application' %>">
|
91
|
+
|
92
|
+
<%= javascript_tag 'application' %>
|
93
|
+
<%= stylesheet_tag 'application' %>
|
94
|
+
|
95
|
+
<!-- Handle the expansion of assets for debugging like Rails -->
|
96
|
+
<%= javascript_tag 'application', expand: true %>
|
97
|
+
```
|
98
|
+
|
99
|
+
Configuration
|
100
|
+
-------------
|
101
|
+
|
102
|
+
You can control Sprockets entirely using Sinatra `set` configuration method. Bellow a list of the configuration:
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
set :assets_prefix, '/assets'
|
106
|
+
set :assets_path, %w[
|
107
|
+
app/assets/vendor
|
108
|
+
app/assets/stylesheets
|
109
|
+
app/assets/javascripts
|
110
|
+
app/assets/images
|
111
|
+
]
|
112
|
+
set :assets_precompile, %w(application.js application.css)
|
113
|
+
set :assets_host, 'cdn.host.com'
|
114
|
+
set :assets_protocol, :https
|
115
|
+
|
116
|
+
# Debug mode automatically sets
|
117
|
+
# expand = true, digest = false, manifest = false
|
118
|
+
set :assets_debug, true
|
119
|
+
|
120
|
+
set :assets_manifest_file, File.join(public_folder, "assets/manifest.json")
|
121
|
+
set :assets_css_compressor, :sass
|
122
|
+
set :assets_js_compressor, :uglifier
|
123
|
+
```
|
124
|
+
|
125
|
+
Minification
|
126
|
+
------------
|
127
|
+
|
128
|
+
As seen on the last example of the configurantion you can configure other libraries to compress your assets, Sinatra::Sprockets handle them transparently and it's up to you to require the gems.
|
129
|
+
|
130
|
+
#### SASS
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
gem 'sass'
|
134
|
+
set :assets_css_compressor, :sass
|
135
|
+
```
|
136
|
+
|
137
|
+
#### Closure
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
gem 'closure-compiler'
|
141
|
+
set :assets_css_compressor, :closure
|
142
|
+
```
|
143
|
+
|
144
|
+
#### Uglifier
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
gem 'uglifier'
|
148
|
+
set :assets_css_compressor, :uglifier
|
149
|
+
```
|
150
|
+
|
151
|
+
#### Uglifier
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
gem 'yui-compressor'
|
155
|
+
set :assets_css_compressor, :yui
|
156
|
+
```
|
157
|
+
|
158
|
+
### Compass and others gems
|
159
|
+
|
160
|
+
The integration is easily done by requiring the [sprockets-sass](https://github.com/petebrowne/sprockets-sass) gem.
|
161
|
+
|
162
|
+
None the less any gem that have integration with the Sprockets will work seamlessly. If you need any other configuration you can call Sprockets configuration directly.
|
163
|
+
|
164
|
+
Copyrights
|
165
|
+
----------
|
166
|
+
|
167
|
+
Copyrights 2012 [**Edson Hilios**](http://edson.hilios.com.br) edson (at) hilios (dot) com (dot) br
|
168
|
+
|
169
|
+
This software is licensed under [MIT-LICENSE](https://github.com/hilios/sinatra-sprockets-wheel/blob/master/MIT-LICENSE)
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'sinatra/sprockets'
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'sprockets'
|
2
|
+
|
3
|
+
Dir[File.join(File.expand_path(File.dirname __FILE__), "sprockets/**/*.rb")].each { |file| require file }
|
4
|
+
|
5
|
+
module Sinatra
|
6
|
+
module Sprockets
|
7
|
+
class << self
|
8
|
+
attr_accessor :sprockets
|
9
|
+
|
10
|
+
def registered(app)
|
11
|
+
return if app.root.nil?
|
12
|
+
# Sprockets configuration
|
13
|
+
app.set_default :assets_prefix, '/assets'
|
14
|
+
app.set_default :assets_path, %w(assets)
|
15
|
+
app.set_default :assets_precompile, %w(application.js application.css
|
16
|
+
*.css *.js *.gif *.jpg *.png *.svg *.ttf *.otf *.eot *.woff)
|
17
|
+
# Compressors
|
18
|
+
app.set_default :assets_css_compressor, :none
|
19
|
+
app.set_default :assets_js_compressor, :none
|
20
|
+
# Helpers options
|
21
|
+
app.set_default :assets_host, ''
|
22
|
+
app.set_default :assets_protocol, :relative
|
23
|
+
app.set_default :assets_digest, true
|
24
|
+
app.set_default :assets_expand, false
|
25
|
+
app.set_default :assets_debug, false
|
26
|
+
# Set the manifest file path
|
27
|
+
app.set_default :assets_manifest_file,
|
28
|
+
File.join(app.public_folder, app.assets_prefix)
|
29
|
+
|
30
|
+
app.configure do
|
31
|
+
# Create a Sprockets environment
|
32
|
+
sprockets ||= ::Sprockets::Environment.new(app.root)
|
33
|
+
app.set :sprockets, sprockets
|
34
|
+
# Append all paths to Sprockets
|
35
|
+
app.assets_path.each do |path|
|
36
|
+
path = File.join(app.root, path) unless path =~ /^\//
|
37
|
+
sprockets.append_path path
|
38
|
+
end
|
39
|
+
# Configure Sprockets::Helpers
|
40
|
+
::Sprockets::Helpers.configure do |config|
|
41
|
+
config.environment = app.sprockets
|
42
|
+
config.prefix = app.assets_prefix
|
43
|
+
config.public_path = app.public_folder
|
44
|
+
config.manifest = ::Sprockets::Manifest.new(app.sprockets,
|
45
|
+
app.assets_manifest_file)
|
46
|
+
# Optionals
|
47
|
+
config.asset_host = app.assets_host
|
48
|
+
config.protocol = app.assets_protocol
|
49
|
+
config.digest = app.assets_digest
|
50
|
+
config.expand = app.assets_expand
|
51
|
+
# Debug mode automatically sets
|
52
|
+
# expand = true, digest = false, manifest = false
|
53
|
+
config.debug = app.assets_debug
|
54
|
+
end
|
55
|
+
# Add my helpers
|
56
|
+
app.helpers Helpers
|
57
|
+
end
|
58
|
+
|
59
|
+
app.configure :development do
|
60
|
+
# Register asset pipeline middleware so we don't need to route on .ru
|
61
|
+
app.use Server, app.sprockets, %r(#{app.assets_prefix})
|
62
|
+
end
|
63
|
+
|
64
|
+
# Configure compression on production
|
65
|
+
app.configure :production do
|
66
|
+
# Set the CSS compressor
|
67
|
+
unless app.assets_css_compressor == :none
|
68
|
+
app.sprockets.css_compressor = app.assets_css_compressor
|
69
|
+
end
|
70
|
+
# Set the JS compressor
|
71
|
+
unless app.assets_js_compressor == :none
|
72
|
+
app.sprockets.js_compressor = app.assets_js_compressor
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def set_default(key, default_value)
|
79
|
+
self.set(key, default_value) unless self.respond_to? key
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
register Sprockets
|
84
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'sprockets-helpers'
|
2
|
+
|
3
|
+
module Sinatra
|
4
|
+
module Sprockets
|
5
|
+
module Helpers
|
6
|
+
include ::Sprockets::Helpers
|
7
|
+
|
8
|
+
def stylesheets(*args)
|
9
|
+
args.map! do |asset|
|
10
|
+
asset = "#{asset}.css" if asset.is_a? Symbol
|
11
|
+
stylesheet_tag(asset)
|
12
|
+
end
|
13
|
+
args.join("")
|
14
|
+
end
|
15
|
+
alias_method :stylesheet, :stylesheets
|
16
|
+
|
17
|
+
def javascripts(*args)
|
18
|
+
args.map! do |asset|
|
19
|
+
asset = "#{asset}.js" if asset.is_a? Symbol
|
20
|
+
javascript_tag(asset)
|
21
|
+
end
|
22
|
+
args.join("")
|
23
|
+
end
|
24
|
+
alias_method :javascript, :javascripts
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Sinatra
|
2
|
+
module Sprockets
|
3
|
+
# http://stackoverflow.com/a/10679994
|
4
|
+
class Server
|
5
|
+
attr_reader :app, :engine, :path_prefix
|
6
|
+
|
7
|
+
def initialize(app, engine, path_prefix, &block)
|
8
|
+
@app = app
|
9
|
+
@engine = engine
|
10
|
+
@path_prefix = path_prefix
|
11
|
+
yield engine if block_given?
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
path = env["PATH_INFO"]
|
16
|
+
if path =~ path_prefix and not engine.nil?
|
17
|
+
env["PATH_INFO"].sub!(path_prefix, '')
|
18
|
+
engine.call(env)
|
19
|
+
else
|
20
|
+
app.call(env)
|
21
|
+
end
|
22
|
+
ensure
|
23
|
+
env["PATH_INFO"] = path
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
require 'rake/sprocketstask'
|
4
|
+
|
5
|
+
module Sinatra
|
6
|
+
module Sprockets
|
7
|
+
class Task < Rake::SprocketsTask
|
8
|
+
# Just create a wrapper for the Sprockets Task
|
9
|
+
def initialize(app)
|
10
|
+
super(:precompile)
|
11
|
+
@output = File.join(app.public_folder, app.assets_prefix)
|
12
|
+
@assets = app.assets_precompile
|
13
|
+
@environment = app.sprockets
|
14
|
+
|
15
|
+
yield self if block_given?
|
16
|
+
end
|
17
|
+
|
18
|
+
def define
|
19
|
+
namespace :assets do
|
20
|
+
super
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class << self
|
25
|
+
def define(app)
|
26
|
+
Task.new(app)
|
27
|
+
end
|
28
|
+
alias_method :define!, :define
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
.other{}
|
@@ -0,0 +1 @@
|
|
1
|
+
var other = {};
|
data/test/app/mock.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Sinatra::Sprockets::HelpersTest < MiniTest::Test
|
4
|
+
|
5
|
+
def app
|
6
|
+
mock_app do
|
7
|
+
get('/javascript') { javascript_tag('application') }
|
8
|
+
|
9
|
+
get('/stylesheet') { stylesheet_tag('application') }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_javascript_helper
|
14
|
+
get('/javascript')
|
15
|
+
assert last_response.ok?
|
16
|
+
assert_match %r(application-(.+?).js), last_response.body
|
17
|
+
assert_match %r(<script (.+?)><\/script>), last_response.body
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_stylesheet_helper
|
21
|
+
get('/stylesheet')
|
22
|
+
assert last_response.ok?
|
23
|
+
assert_match %r(application-(.+?).css), last_response.body
|
24
|
+
assert_match %r(<link (.+?)>), last_response.body
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Sinatra::Sprockets::DevelopmentServerTest < MiniTest::Test
|
4
|
+
def app
|
5
|
+
mock_base_app do
|
6
|
+
# Set the app root manually
|
7
|
+
set :root, File.expand_path('test/app')
|
8
|
+
# Set enviroment before register the extension
|
9
|
+
set :environment, :development
|
10
|
+
register ::Sinatra::Sprockets
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_assets_request_on_development
|
15
|
+
get('/assets/application.js')
|
16
|
+
assert last_response.ok?
|
17
|
+
assert_match /var app = {}/, last_response.body, "Javascript did not required self"
|
18
|
+
assert_match /var other = {}/, last_response.body, "Javascript did not required tree"
|
19
|
+
|
20
|
+
get('/assets/application.css')
|
21
|
+
assert last_response.ok?
|
22
|
+
assert_match /body{}/, last_response.body, "Stylesheet did not required self"
|
23
|
+
assert_match /.other{}/, last_response.body, "Stylesheet did not required tree"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class Sinatra::Sprockets::ProductionServerTest < MiniTest::Test
|
28
|
+
def app
|
29
|
+
mock_app do
|
30
|
+
set :environment, :production
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_assets_request_on_development
|
35
|
+
get('/assets/application.js')
|
36
|
+
assert_equal 404, last_response.status
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
class Sprockets::Manifest
|
5
|
+
# Remove output from Sprockets tasks
|
6
|
+
def logger
|
7
|
+
@logger ||= Logger.new($stdout)
|
8
|
+
@logger.level = Logger::FATAL
|
9
|
+
@logger
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Sinatra::Sprockets::TasksHelper < MiniTest::Test
|
14
|
+
def test_order
|
15
|
+
:alpha
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_task_definition
|
19
|
+
assert_includes rake.tasks.map!(&:name), "assets:precompile"
|
20
|
+
assert_includes rake.tasks.map!(&:name), "assets:clobber"
|
21
|
+
assert_includes rake.tasks.map!(&:name), "assets:clean"
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_0_precompile_task
|
25
|
+
rake["assets:precompile"].invoke
|
26
|
+
assert File.directory?(File.join(app.public_folder, app.assets_prefix))
|
27
|
+
# Ensure every file was precompiled
|
28
|
+
Dir['test/app/assets/**/*'].each do |file|
|
29
|
+
file = file[16...file.length]
|
30
|
+
path = app.sprockets[file].digest_path
|
31
|
+
path = File.join(app.public_folder, app.assets_prefix, path)
|
32
|
+
assert File.exists?(path)
|
33
|
+
end
|
34
|
+
# Ensure manifest file was created
|
35
|
+
manifest_file = ::Sprockets::Manifest.new(app.sprockets,
|
36
|
+
File.join(app.public_folder, app.assets_prefix))
|
37
|
+
File.exists?(manifest_file.path)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_1_clobber_task
|
41
|
+
# Remove the compile directory
|
42
|
+
rake["assets:clobber"].invoke
|
43
|
+
refute File.directory?(File.join(app.public_folder, app.assets_prefix))
|
44
|
+
end
|
45
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
ENV['RACK_ENV'] = 'test'
|
2
|
+
require 'app/mock'
|
3
|
+
require 'rack/test'
|
4
|
+
require 'minitest/autorun'
|
5
|
+
|
6
|
+
class MiniTest::Test
|
7
|
+
include Rack::Test::Methods
|
8
|
+
|
9
|
+
def app
|
10
|
+
Mock
|
11
|
+
end
|
12
|
+
|
13
|
+
def mock_app(&block)
|
14
|
+
Class.new(Mock, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def mock_base_app(&block)
|
18
|
+
Class.new(Sinatra::Base, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def rake
|
22
|
+
require 'rake'
|
23
|
+
@rake ||= lambda {
|
24
|
+
rake = Rake::Application.new
|
25
|
+
Rake.application = rake
|
26
|
+
Rake::Task.define_task(:environment)
|
27
|
+
# Define the task
|
28
|
+
::Sinatra::Sprockets::Task.define(app)
|
29
|
+
return rake
|
30
|
+
}.call
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sinatra-sprockets-chain
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Edson Hilios
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sprockets
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.10.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.10.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sprockets-helpers
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sinatra
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: minitest
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: minitest-colorize
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Plug and play extension for sinatra that mimic rails assets pipeline
|
112
|
+
through sprockets
|
113
|
+
email:
|
114
|
+
- edson.hilios@gmail.com
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- MIT-LICENSE
|
120
|
+
- README.md
|
121
|
+
- lib/sinatra/sprockets/helpers.rb
|
122
|
+
- lib/sinatra/sprockets/server.rb
|
123
|
+
- lib/sinatra/sprockets/task.rb
|
124
|
+
- lib/sinatra/sprockets/version.rb
|
125
|
+
- lib/sinatra/sprockets.rb
|
126
|
+
- lib/sinatra-sprockets-chain.rb
|
127
|
+
- test/app/assets/application.css
|
128
|
+
- test/app/assets/application.js
|
129
|
+
- test/app/assets/image.gif
|
130
|
+
- test/app/assets/other.css
|
131
|
+
- test/app/assets/other.js
|
132
|
+
- test/app/mock.rb
|
133
|
+
- test/sinatra/sprockets/helpers_test.rb
|
134
|
+
- test/sinatra/sprockets/server_test.rb
|
135
|
+
- test/sinatra/sprockets/task_test.rb
|
136
|
+
- test/sinatra/sprockets_test.rb
|
137
|
+
- test/test_helper.rb
|
138
|
+
homepage: https://github.com/hilios/sinatra-sprockets
|
139
|
+
licenses: []
|
140
|
+
metadata: {}
|
141
|
+
post_install_message:
|
142
|
+
rdoc_options: []
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - '>='
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
requirements: []
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 2.0.3
|
158
|
+
signing_key:
|
159
|
+
specification_version: 4
|
160
|
+
summary: Plug and play extension for sinatra that mimic rails assets pipeline through
|
161
|
+
sprockets
|
162
|
+
test_files:
|
163
|
+
- test/app/assets/application.css
|
164
|
+
- test/app/assets/application.js
|
165
|
+
- test/app/assets/image.gif
|
166
|
+
- test/app/assets/other.css
|
167
|
+
- test/app/assets/other.js
|
168
|
+
- test/app/mock.rb
|
169
|
+
- test/sinatra/sprockets/helpers_test.rb
|
170
|
+
- test/sinatra/sprockets/server_test.rb
|
171
|
+
- test/sinatra/sprockets/task_test.rb
|
172
|
+
- test/sinatra/sprockets_test.rb
|
173
|
+
- test/test_helper.rb
|