padrino-sprockets 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,5 @@
1
+ module Padrino
2
+ module Sprockets
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+ require "sprockets/environment"
3
+ module Padrino
4
+ module Sprockets
5
+ class << self
6
+ def registered(app)
7
+ app.helpers Helpers
8
+ end
9
+ end
10
+ module Helpers
11
+ module ClassMethods
12
+ def sprockets(options={})
13
+ url = options[:url] || 'assets'
14
+ _root = options[:root] || root
15
+ set :sprockets_url, url
16
+ use Padrino::Sprockets::App,:root => _root,:url => url
17
+ end
18
+ end
19
+ def self.included(base)
20
+ base.extend ClassMethods
21
+ end
22
+ end #Helpers
23
+ class App
24
+ def initialize(app, options={})
25
+ @app = app
26
+ @root = options[:root]
27
+ url = options[:url] || 'assets'
28
+ @matcher = /^\/#{url}\/*/
29
+ @environment = ::Sprockets::Environment.new(@root) do |env|
30
+ end
31
+ @environment.append_path 'assets/javascripts'
32
+ @environment.append_path 'assets/stylesheets'
33
+ @environment.append_path 'assets/images'
34
+ end
35
+ def call(env)
36
+ path = env["PATH_INFO"]
37
+ logger.debug { "path:#{path} url:#{@url}" }
38
+ return @app.call(env) unless @matcher =~ path
39
+ env['PATH_INFO'].sub!(@matcher,'')
40
+ @environment.call(env)
41
+ end
42
+ end
43
+ end #Sprockets
44
+ end #Padrino
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: padrino-sprockets
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Night Sailer
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-18 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sprockets
16
+ requirement: &70097789555480 !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: *70097789555480
25
+ description: Padrino with Sprockets
26
+ email:
27
+ - nightsailer@gmail.com
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - lib/padrino/sprockets-version.rb
33
+ - lib/padrino/sprockets.rb
34
+ homepage: https://github.com/nightsailer/padrino-sprockets
35
+ licenses: []
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 1.8.6
55
+ signing_key:
56
+ specification_version: 3
57
+ summary: Padrino with Sprockets
58
+ test_files: []