racing-sprockets 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,19 @@
1
+ *.rbc
2
+ *.sassc
3
+ .sass-cache
4
+ capybara-*.html
5
+ .rspec
6
+ .rvmrc
7
+ /.bundle
8
+ /vendor/bundle
9
+ /log/*
10
+ /tmp/*
11
+ /db/*.sqlite3
12
+ /public/system/*
13
+ /coverage/
14
+ /spec/tmp/*
15
+ **.orig
16
+ rerun.txt
17
+ pickle-email-*.html
18
+ .project
19
+ config/initializers/secret_token.rb
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in racing-sprockets.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Craig McNamara
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ racing-sprockets
2
+ ================
3
+
4
+ Speed up asset compilation and configuration.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ require "racing/sprockets/version"
2
+ require "racing/sprockets/fast_manifest"
3
+
4
+ module Racing
5
+ module Sprockets
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ module Racing
2
+ module Sprockets
3
+ class Engine < Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,50 @@
1
+ require 'thread_safe'
2
+ require 'sprockets/manifest'
3
+ require 'thread/pool'
4
+
5
+ Sprockets::Manifest.class_eval do
6
+ def assets
7
+ @data['assets'] = ThreadSafe::Hash.new(@data['assets'] || {})
8
+ end
9
+
10
+ def files
11
+ @data['files'] = ThreadSafe::Hash.new(@data['files'] || {})
12
+ end
13
+
14
+ def compile(*args)
15
+ pool = Thread.pool(10)
16
+ unless environment
17
+ raise Error, "manifest requires environment for compilation"
18
+ end
19
+
20
+ paths = environment.each_logical_path(*args).to_a +
21
+ args.flatten.select { |fn| Pathname.new(fn).absolute? if fn.is_a?(String)}
22
+
23
+ paths.each do |path|
24
+ pool.process do
25
+ if asset = find_asset(path)
26
+ files[asset.digest_path] = {
27
+ 'logical_path' => asset.logical_path,
28
+ 'mtime' => asset.mtime.iso8601,
29
+ 'size' => asset.bytesize,
30
+ 'digest' => asset.digest
31
+ }
32
+ assets[asset.logical_path] = asset.digest_path
33
+
34
+ target = File.join(dir, asset.digest_path)
35
+
36
+ if File.exist?(target)
37
+ logger.debug "Skipping #{target}, already exists"
38
+ else
39
+ logger.info "Writing #{target}"
40
+ asset.write_to target
41
+ asset.write_to "#{target}.gz" if asset.is_a?(Sprockets::BundledAsset)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ pool.shutdown
47
+ save
48
+ paths
49
+ end
50
+ end
@@ -0,0 +1,5 @@
1
+ module Racing
2
+ module Sprockets
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'racing/sprockets/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "racing-sprockets"
8
+ spec.version = Racing::Sprockets::VERSION
9
+ spec.authors = ["Craig McNamara"]
10
+ spec.email = ["craig@caring.com"]
11
+ spec.description = %q{Try to speed up configuration and deployment of Sprockets}
12
+ spec.summary = %q{Compiles assets in parallel with a thread pool. Provides Jammit like precompile config as assets.yml}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'thread'
22
+ spec.add_dependency 'thread_safe'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: racing-sprockets
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Craig McNamara
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-11-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ none: false
21
+ name: thread
22
+ type: :runtime
23
+ prerelease: false
24
+ requirement: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ! '>='
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
29
+ none: false
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ none: false
37
+ name: thread_safe
38
+ type: :runtime
39
+ prerelease: false
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ none: false
46
+ - !ruby/object:Gem::Dependency
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ~>
50
+ - !ruby/object:Gem::Version
51
+ version: '1.3'
52
+ none: false
53
+ name: bundler
54
+ type: :development
55
+ prerelease: false
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: '1.3'
61
+ none: false
62
+ - !ruby/object:Gem::Dependency
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ none: false
69
+ name: rake
70
+ type: :development
71
+ prerelease: false
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ none: false
78
+ description: Try to speed up configuration and deployment of Sprockets
79
+ email:
80
+ - craig@caring.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - .gitignore
86
+ - Gemfile
87
+ - LICENSE
88
+ - README.md
89
+ - Rakefile
90
+ - lib/racing/sprockets.rb
91
+ - lib/racing/sprockets/engine.rb
92
+ - lib/racing/sprockets/fast_manifest.rb
93
+ - lib/racing/sprockets/version.rb
94
+ - racing-sprockets.gemspec
95
+ homepage: ''
96
+ licenses:
97
+ - MIT
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ none: false
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ none: false
114
+ requirements: []
115
+ rubyforge_project:
116
+ rubygems_version: 1.8.23
117
+ signing_key:
118
+ specification_version: 3
119
+ summary: Compiles assets in parallel with a thread pool. Provides Jammit like precompile
120
+ config as assets.yml
121
+ test_files: []
122
+ has_rdoc: