-
-
Save quasor/5401505 to your computer and use it in GitHub Desktop.
Revisions
-
djmaze revised this gist
Aug 21, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Gem::Specification.new do |s| s.name = 'parallel_assets_compiler' s.version = '0.2.0' s.platform = Gem::Platform::RUBY s.author = 'Jorgen Orehoj Erichsen' s.email = 'joe@erichsen.net' s.summary = 'Compile assets in parallel' s.description = 'Compile assets in parallel to speed up deployment' -
joerichsen revised this gist
Aug 3, 2012 . 2 changed files with 11 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'parallel_assets_compiler' s.version = '0.2.0' s.platform = Gem::Platform::RUBY s.author = 'Jørgen Orehøj Erichsen' s.email = 'joe@erichsen.net' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,19 +17,23 @@ module Sprockets class StaticCompiler def compile # Collect paths logical_paths = [] env.each_logical_path do |logical_path| if File.basename(logical_path)[/[^\.]+/, 0] == 'index' logical_path.sub!(/\/index\./, '.') end logical_paths << logical_path if compile_path?(logical_path) end # Compute! results = Parallel.map(logical_paths) do |logical_path| if asset = env.find_asset(logical_path) [logical_path, write_asset(asset)] end end write_manifest(Hash[results]) if @manifest end end -
joerichsen revised this gist
Jun 5, 2012 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'parallel_assets_compiler' s.version = '0.1.0' -
joerichsen revised this gist
Jun 5, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,7 @@ # https://github.com/hornairs/sprockets-rails-parallel require 'sprockets/static_compiler' require 'parallel' module Sprockets class StaticCompiler -
joerichsen revised this gist
Jun 5, 2012 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,10 @@ # # Works by monkey patching actionpack from Rails 3.2.5 # # Use it by adding this to your Gemfile and run bundle install # # gem 'parallel_assets_compiler', :git => 'git://gist.github.com/2873091.git' # # Inspired by # https://github.com/steel/sprockets/commit/6327afc3341e34efd1dfdcfad08e3b9d85f7fd4a # https://github.com/hornairs/sprockets-rails-parallel -
joerichsen revised this gist
Jun 5, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ # https://github.com/steel/sprockets/commit/6327afc3341e34efd1dfdcfad08e3b9d85f7fd4a # https://github.com/hornairs/sprockets-rails-parallel require 'sprockets/static_compiler' module Sprockets class StaticCompiler -
joerichsen revised this gist
Jun 5, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ # https://github.com/steel/sprockets/commit/6327afc3341e34efd1dfdcfad08e3b9d85f7fd4a # https://github.com/hornairs/sprockets-rails-parallel require 'sprockets/static_compiler module Sprockets class StaticCompiler -
joerichsen revised this gist
Jun 5, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ # https://github.com/steel/sprockets/commit/6327afc3341e34efd1dfdcfad08e3b9d85f7fd4a # https://github.com/hornairs/sprockets-rails-parallel require 'sprockets/railtie' module Sprockets class StaticCompiler -
joerichsen revised this gist
Jun 5, 2012 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,8 @@ # https://github.com/steel/sprockets/commit/6327afc3341e34efd1dfdcfad08e3b9d85f7fd4a # https://github.com/hornairs/sprockets-rails-parallel require 'action_pack' module Sprockets class StaticCompiler @@ -26,4 +28,4 @@ def compile end end end -
joerichsen revised this gist
Jun 5, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,4 +11,5 @@ Gem::Specification.new do |s| s.require_path = '.' s.add_dependency('parallel') s.add_dependency('actionpack') end -
joerichsen revised this gist
Jun 5, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,5 +10,5 @@ Gem::Specification.new do |s| s.files = ['parallel_assets_compiler.rb'] s.require_path = '.' s.add_dependency('parallel') end -
joerichsen created this gist
Jun 5, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ Gem::Specification.new do |s| s.name = 'parallel_assets_compiler' s.version = '0.1.0' s.platform = Gem::Platform::RUBY s.author = 'Jørgen Orehøj Erichsen' s.email = 'joe@erichsen.net' s.summary = 'Compile assets in parallel' s.description = 'Compile assets in parallel to speed up deployment' s.files = ['parallel_assets_compiler.rb'] s.require_path = '.' s.add_development_dependency('parallel') end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ # Compile assets in parallel to speed up deployment # # Works by monkey patching actionpack from Rails 3.2.5 # # Inspired by # https://github.com/steel/sprockets/commit/6327afc3341e34efd1dfdcfad08e3b9d85f7fd4a # https://github.com/hornairs/sprockets-rails-parallel module Sprockets class StaticCompiler def compile manifest = {} logical_paths = [] env.each_logical_path { |logical_path| logical_paths << logical_path } Parallel.map(logical_paths) do |logical_path| if File.basename(logical_path)[/[^\.]+/, 0] == 'index' logical_path.sub!(/\/index\./, '.') end next unless compile_path?(logical_path) if asset = env.find_asset(logical_path) manifest[logical_path] = write_asset(asset) end end write_manifest(manifest) if @manifest end end end