assets_on_heroku 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -0
- data/Rakefile +14 -0
- data/VERSION +1 -0
- data/assets_on_heroku.gemspec +41 -0
- data/lib/assets_on_heroku.rb +48 -0
- metadata +67 -0
data/README
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Assets On Heroku - CSS, JavaScript, Sass. Works with Rails, Merb and Rack apps
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
Jeweler::Tasks.new do |gemspec|
|
4
|
+
gemspec.name = "assets_on_heroku"
|
5
|
+
gemspec.summary = "Assets On Heroku - CSS, JavaScript, Sass"
|
6
|
+
gemspec.description = "Assets On Heroku - CSS, JavaScript, Sass. Works with Rails, Merb and Rack apps"
|
7
|
+
gemspec.email = "jacek.becela@gmail.com"
|
8
|
+
gemspec.homepage = "http://github.com/ncr/assets_on_heroku"
|
9
|
+
gemspec.authors = ["Jacek Becela", "Tomasz Mazur"]
|
10
|
+
end
|
11
|
+
Jeweler::GemcutterTasks.new
|
12
|
+
rescue LoadError
|
13
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
14
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{assets_on_heroku}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jacek Becela", "Tomasz Mazur"]
|
12
|
+
s.date = %q{2010-04-19}
|
13
|
+
s.description = %q{Assets On Heroku - CSS, JavaScript, Sass. Works with Rails, Merb and Rack apps}
|
14
|
+
s.email = %q{jacek.becela@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"README",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"assets_on_heroku.gemspec",
|
23
|
+
"lib/assets_on_heroku.rb"
|
24
|
+
]
|
25
|
+
s.homepage = %q{http://github.com/ncr/assets_on_heroku}
|
26
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
s.rubygems_version = %q{1.3.6}
|
29
|
+
s.summary = %q{Assets On Heroku - CSS, JavaScript, Sass}
|
30
|
+
|
31
|
+
if s.respond_to? :specification_version then
|
32
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
33
|
+
s.specification_version = 3
|
34
|
+
|
35
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
36
|
+
else
|
37
|
+
end
|
38
|
+
else
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module AssetsOnHeroku
|
2
|
+
class Rack
|
3
|
+
def initialize(app)
|
4
|
+
@app = app
|
5
|
+
|
6
|
+
setup_sass
|
7
|
+
setup_rails
|
8
|
+
setup_merb
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
root = "tmp/public"
|
13
|
+
path = ::Rack::Request.new(env).path
|
14
|
+
|
15
|
+
is_stylesheet_request = path.start_with?("/stylesheets/") && path.end_with?(".css")
|
16
|
+
is_javascript_request = path.start_with?("/javascripts/") && path.end_with?(".js")
|
17
|
+
|
18
|
+
if is_stylesheet_request || is_javascript_request
|
19
|
+
::Rack::File.new(root).call(env)
|
20
|
+
else
|
21
|
+
@app.call(env)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def setup_sass
|
28
|
+
Sass::Plugin.options = {
|
29
|
+
:css_location => "tmp/public/stylesheets",
|
30
|
+
:template_location => "public/stylesheets/sass"
|
31
|
+
} if defined?(Sass::Plugin)
|
32
|
+
end
|
33
|
+
|
34
|
+
def setup_rails
|
35
|
+
ActionView::Helpers::AssetTagHelper.module_eval do
|
36
|
+
def write_asset_file_contents_with_heroku(broken_joined_asset_path, asset_paths)
|
37
|
+
fixed_joined_asset_path = broken_joined_asset_path.sub("public", "tmp/public")
|
38
|
+
write_asset_file_contents_without_heroku(fixed_joined_asset_path, asset_paths)
|
39
|
+
end
|
40
|
+
alias_method_chain :write_asset_file_contents, :heroku
|
41
|
+
end if defined?(ActionView::Helpers::AssetTagHelper)
|
42
|
+
end
|
43
|
+
|
44
|
+
def setup_merb
|
45
|
+
# Coming soon!
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: assets_on_heroku
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Jacek Becela
|
13
|
+
- Tomasz Mazur
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-04-19 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Assets On Heroku - CSS, JavaScript, Sass. Works with Rails, Merb and Rack apps
|
23
|
+
email: jacek.becela@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README
|
30
|
+
files:
|
31
|
+
- README
|
32
|
+
- Rakefile
|
33
|
+
- VERSION
|
34
|
+
- assets_on_heroku.gemspec
|
35
|
+
- lib/assets_on_heroku.rb
|
36
|
+
has_rdoc: true
|
37
|
+
homepage: http://github.com/ncr/assets_on_heroku
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options:
|
42
|
+
- --charset=UTF-8
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
segments:
|
50
|
+
- 0
|
51
|
+
version: "0"
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
requirements: []
|
60
|
+
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 1.3.6
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: Assets On Heroku - CSS, JavaScript, Sass
|
66
|
+
test_files: []
|
67
|
+
|