rails-slow-assets-workaround 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/.document +5 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +93 -0
- data/LICENSE.txt +20 -0
- data/README.md +65 -0
- data/Rakefile +26 -0
- data/VERSION +1 -0
- data/lib/rails_slow_assets_workaround.rb +7 -0
- data/lib/tasks/assets.rake +58 -0
- data/rails-slow-assets-workaround.gemspec +55 -0
- metadata +108 -0
data/.document
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (3.2.7)
|
5
|
+
actionpack (= 3.2.7)
|
6
|
+
mail (~> 2.4.4)
|
7
|
+
actionpack (3.2.7)
|
8
|
+
activemodel (= 3.2.7)
|
9
|
+
activesupport (= 3.2.7)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
journey (~> 1.0.4)
|
13
|
+
rack (~> 1.4.0)
|
14
|
+
rack-cache (~> 1.2)
|
15
|
+
rack-test (~> 0.6.1)
|
16
|
+
sprockets (~> 2.1.3)
|
17
|
+
activemodel (3.2.7)
|
18
|
+
activesupport (= 3.2.7)
|
19
|
+
builder (~> 3.0.0)
|
20
|
+
activerecord (3.2.7)
|
21
|
+
activemodel (= 3.2.7)
|
22
|
+
activesupport (= 3.2.7)
|
23
|
+
arel (~> 3.0.2)
|
24
|
+
tzinfo (~> 0.3.29)
|
25
|
+
activeresource (3.2.7)
|
26
|
+
activemodel (= 3.2.7)
|
27
|
+
activesupport (= 3.2.7)
|
28
|
+
activesupport (3.2.7)
|
29
|
+
i18n (~> 0.6)
|
30
|
+
multi_json (~> 1.0)
|
31
|
+
arel (3.0.2)
|
32
|
+
builder (3.0.0)
|
33
|
+
erubis (2.7.0)
|
34
|
+
git (1.2.5)
|
35
|
+
hike (1.2.1)
|
36
|
+
i18n (0.6.0)
|
37
|
+
jeweler (1.8.4)
|
38
|
+
bundler (~> 1.0)
|
39
|
+
git (>= 1.2.5)
|
40
|
+
rake
|
41
|
+
rdoc
|
42
|
+
journey (1.0.4)
|
43
|
+
json (1.7.4)
|
44
|
+
mail (2.4.4)
|
45
|
+
i18n (>= 0.4.0)
|
46
|
+
mime-types (~> 1.16)
|
47
|
+
treetop (~> 1.4.8)
|
48
|
+
mime-types (1.19)
|
49
|
+
multi_json (1.3.6)
|
50
|
+
polyglot (0.3.3)
|
51
|
+
rack (1.4.1)
|
52
|
+
rack-cache (1.2)
|
53
|
+
rack (>= 0.4)
|
54
|
+
rack-ssl (1.3.2)
|
55
|
+
rack
|
56
|
+
rack-test (0.6.1)
|
57
|
+
rack (>= 1.0)
|
58
|
+
rails (3.2.7)
|
59
|
+
actionmailer (= 3.2.7)
|
60
|
+
actionpack (= 3.2.7)
|
61
|
+
activerecord (= 3.2.7)
|
62
|
+
activeresource (= 3.2.7)
|
63
|
+
activesupport (= 3.2.7)
|
64
|
+
bundler (~> 1.0)
|
65
|
+
railties (= 3.2.7)
|
66
|
+
railties (3.2.7)
|
67
|
+
actionpack (= 3.2.7)
|
68
|
+
activesupport (= 3.2.7)
|
69
|
+
rack-ssl (~> 1.3.2)
|
70
|
+
rake (>= 0.8.7)
|
71
|
+
rdoc (~> 3.4)
|
72
|
+
thor (>= 0.14.6, < 2.0)
|
73
|
+
rake (0.9.2.2)
|
74
|
+
rdoc (3.12)
|
75
|
+
json (~> 1.4)
|
76
|
+
sprockets (2.1.3)
|
77
|
+
hike (~> 1.2)
|
78
|
+
rack (~> 1.0)
|
79
|
+
tilt (~> 1.1, != 1.3.0)
|
80
|
+
thor (0.15.4)
|
81
|
+
tilt (1.3.3)
|
82
|
+
treetop (1.4.10)
|
83
|
+
polyglot
|
84
|
+
polyglot (>= 0.3.1)
|
85
|
+
tzinfo (0.3.33)
|
86
|
+
|
87
|
+
PLATFORMS
|
88
|
+
ruby
|
89
|
+
|
90
|
+
DEPENDENCIES
|
91
|
+
bundler
|
92
|
+
jeweler (~> 1.8.4)
|
93
|
+
rails
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 mcasimir
|
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,65 @@
|
|
1
|
+
# rails-slow-assets-workaround
|
2
|
+
## Speed up rails assets compilation splitting it in 2 phases.
|
3
|
+
|
4
|
+
`Rails ~> 3.0` `assets:precompile` can be really slow, `rails-slow-assets-workaround` overcomes to this issue speeding up the assets compilation in a very simple way.
|
5
|
+
|
6
|
+
### How it works
|
7
|
+
|
8
|
+
This gem only provides a new task: `assets:compile` that is responsible of compiling only those assets that are listed into `config/assets.yml`
|
9
|
+
|
10
|
+
Using it combined with `assets:precompile` can greatly reduce the deploy time of Rails apps with assets pipleline.
|
11
|
+
|
12
|
+
To avoid wait minutes at any deploy you can split the depoyment process it in 2 phases, add any assets you wish to recompile often to `config/assets.yml`, it's really fast if they are few, and compile them with `assets:compile` and leave the other to `assets:precompile`, so:
|
13
|
+
|
14
|
+
* run `assets:precompile` (slow) once and for each time you add a new asset not listed in `config/assets.yml`.
|
15
|
+
* run `assets:compile` (fast) on each deploy.
|
16
|
+
|
17
|
+
### Install
|
18
|
+
|
19
|
+
``` rb
|
20
|
+
gem 'rails-slow-assets-workaround'
|
21
|
+
```
|
22
|
+
|
23
|
+
Create `config/assets.yml`
|
24
|
+
|
25
|
+
And edit it eg.:
|
26
|
+
|
27
|
+
``` yml
|
28
|
+
---
|
29
|
+
- admin/admin.css
|
30
|
+
- admin/admin.js
|
31
|
+
- site/site.css
|
32
|
+
- site/site.js
|
33
|
+
|
34
|
+
```
|
35
|
+
|
36
|
+
### Usage
|
37
|
+
|
38
|
+
Run once
|
39
|
+
|
40
|
+
``` sh
|
41
|
+
$ rake assets:compile
|
42
|
+
```
|
43
|
+
|
44
|
+
---
|
45
|
+
|
46
|
+
Copyright (c) 2012 mcasimir
|
47
|
+
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
49
|
+
a copy of this software and associated documentation files (the
|
50
|
+
"Software"), to deal in the Software without restriction, including
|
51
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
52
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
53
|
+
permit persons to whom the Software is furnished to do so, subject to
|
54
|
+
the following conditions:
|
55
|
+
|
56
|
+
The above copyright notice and this permission notice shall be
|
57
|
+
included in all copies or substantial portions of the Software.
|
58
|
+
|
59
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
60
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
61
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
62
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
63
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
64
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
65
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "rails-slow-assets-workaround"
|
18
|
+
gem.homepage = "http://github.com/mcasimir/rails-slow-assets-workaround"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Speed up rails assets compilation splitting it in 2 phases}
|
21
|
+
gem.description = %Q{Speed up rails assets compilation splitting it in 2 phases}
|
22
|
+
gem.email = "maurizio.cas@gmail.com"
|
23
|
+
gem.authors = ["mcasimir"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,58 @@
|
|
1
|
+
namespace :assets do
|
2
|
+
task :compile => :environment do
|
3
|
+
require 'sprockets'
|
4
|
+
|
5
|
+
# workaround used also by native assets:precompile:all to load sprockets hooks
|
6
|
+
_ = ActionView::Base
|
7
|
+
|
8
|
+
if !File.exist?(Rails.root.join('config', 'assets.yml'))
|
9
|
+
puts "Nothing to do: #{Rails.root.join('config', 'assets.yml')} does not exists"
|
10
|
+
exit
|
11
|
+
end
|
12
|
+
|
13
|
+
# ==============================================
|
14
|
+
# = Read configuration from Rails / assets.yml =
|
15
|
+
# ==============================================
|
16
|
+
|
17
|
+
env = Rails.application.assets
|
18
|
+
target = File.join(::Rails.public_path, Rails.application.config.assets.prefix)
|
19
|
+
assets = YAML.load_file(Rails.root.join('config', 'assets.yml'))
|
20
|
+
manifest_path = Rails.root.join(target, 'manifest.yml')
|
21
|
+
digest = !!Rails.application.config.assets.digest
|
22
|
+
manifest = digest
|
23
|
+
|
24
|
+
|
25
|
+
# =======================
|
26
|
+
# = Old manifest backup =
|
27
|
+
# =======================
|
28
|
+
|
29
|
+
manifest_old = File.exists?(manifest_path) ? YAML.load_file(manifest_path) : {}
|
30
|
+
|
31
|
+
# ==================
|
32
|
+
# = Compile assets =
|
33
|
+
# ==================
|
34
|
+
|
35
|
+
compiler = Sprockets::StaticCompiler.new(env,
|
36
|
+
target,
|
37
|
+
assets,
|
38
|
+
:digest => digest,
|
39
|
+
:manifest => manifest)
|
40
|
+
compiler.compile
|
41
|
+
|
42
|
+
# ===================================
|
43
|
+
# = Merge new manifest into old one =
|
44
|
+
# ===================================
|
45
|
+
|
46
|
+
manifest_new = File.exists?(manifest_path) ? YAML.load_file(manifest_path) : {}
|
47
|
+
|
48
|
+
File.open(manifest_path, 'w') do |out|
|
49
|
+
YAML.dump(manifest_old.merge(manifest_new), out)
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
# ===============================
|
54
|
+
# = Compress assets if required =
|
55
|
+
# ===============================
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "rails-slow-assets-workaround"
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["mcasimir"]
|
12
|
+
s.date = "2012-08-05"
|
13
|
+
s.description = "Speed up rails assets compilation splitting it in 2 phases"
|
14
|
+
s.email = "maurizio.cas@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.md",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"lib/rails_slow_assets_workaround.rb",
|
28
|
+
"lib/tasks/assets.rake",
|
29
|
+
"rails-slow-assets-workaround.gemspec"
|
30
|
+
]
|
31
|
+
s.homepage = "http://github.com/mcasimir/rails-slow-assets-workaround"
|
32
|
+
s.licenses = ["MIT"]
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
s.rubygems_version = "1.8.24"
|
35
|
+
s.summary = "Speed up rails assets compilation splitting it in 2 phases"
|
36
|
+
|
37
|
+
if s.respond_to? :specification_version then
|
38
|
+
s.specification_version = 3
|
39
|
+
|
40
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
41
|
+
s.add_runtime_dependency(%q<rails>, [">= 0"])
|
42
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
43
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
44
|
+
else
|
45
|
+
s.add_dependency(%q<rails>, [">= 0"])
|
46
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
47
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
48
|
+
end
|
49
|
+
else
|
50
|
+
s.add_dependency(%q<rails>, [">= 0"])
|
51
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
52
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-slow-assets-workaround
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- mcasimir
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !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: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: jeweler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.8.4
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.8.4
|
62
|
+
description: Speed up rails assets compilation splitting it in 2 phases
|
63
|
+
email: maurizio.cas@gmail.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files:
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
files:
|
70
|
+
- .document
|
71
|
+
- Gemfile
|
72
|
+
- Gemfile.lock
|
73
|
+
- LICENSE.txt
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- VERSION
|
77
|
+
- lib/rails_slow_assets_workaround.rb
|
78
|
+
- lib/tasks/assets.rake
|
79
|
+
- rails-slow-assets-workaround.gemspec
|
80
|
+
homepage: http://github.com/mcasimir/rails-slow-assets-workaround
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
hash: -2330918489266723910
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 1.8.24
|
105
|
+
signing_key:
|
106
|
+
specification_version: 3
|
107
|
+
summary: Speed up rails assets compilation splitting it in 2 phases
|
108
|
+
test_files: []
|