asset_precompilation_finder 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in asset_precompilation_finder.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "asset_precompilation_finder/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "asset_precompilation_finder"
7
+ s.version = AssetPrecompilationFinder::VERSION
8
+ s.authors = ["Micah Geisel"]
9
+ s.email = ["micah@botandrose.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Railtie to set asset precompilation paths to a better default}
12
+ s.description = %q{Sets the Rails asset precompilation path to compile everything except partials, and compile css last.}
13
+
14
+ s.rubyforge_project = "asset_precompilation_finder"
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
+ # specify any dependencies here; for example:
22
+ s.add_runtime_dependency "rails", "~>3.1"
23
+ end
@@ -0,0 +1,30 @@
1
+ require "asset_precompilation_finder/version"
2
+
3
+ module AssetPrecompilationFinder
4
+ class Finder
5
+ def initialize app
6
+ @app = app
7
+ end
8
+
9
+ def each(&blk)
10
+ # don't compile list until last possible moment, as the asset engine might not be initialized yet.
11
+ list.each { |v| blk.call(v) }
12
+ end
13
+
14
+ private
15
+
16
+ def list
17
+ @list ||= begin
18
+ paths = @app.assets.each_logical_path
19
+ paths = paths.reject { |p| File.basename(p).starts_with?("_") } # don't compile partials
20
+ paths = paths.sort { |a,b| a.ends_with?(".css") ? 1 : -1 } # compile css last, as it may depend on other assets, like images
21
+ end
22
+ end
23
+ end
24
+
25
+ class Railtie < ::Rails::Railtie
26
+ initializer :set_assets_precompile_list do |app|
27
+ app.config.assets.precompile = Finder.new app
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ module AssetPrecompilationFinder
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: asset_precompilation_finder
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Micah Geisel
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-11-22 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rails
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 5
29
+ segments:
30
+ - 3
31
+ - 1
32
+ version: "3.1"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: Sets the Rails asset precompilation path to compile everything except partials, and compile css last.
36
+ email:
37
+ - micah@botandrose.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - Rakefile
48
+ - asset_precompilation_finder.gemspec
49
+ - lib/asset_precompilation_finder.rb
50
+ - lib/asset_precompilation_finder/version.rb
51
+ homepage: ""
52
+ licenses: []
53
+
54
+ post_install_message:
55
+ rdoc_options: []
56
+
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ requirements: []
78
+
79
+ rubyforge_project: asset_precompilation_finder
80
+ rubygems_version: 1.8.11
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: Railtie to set asset precompilation paths to a better default
84
+ test_files: []
85
+