asset_tasks 0.0.2
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/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +65 -0
- data/MIT-LICENSE +20 -0
- data/README.md +52 -0
- data/Rakefile +2 -0
- data/asset_tasks.gemspec +25 -0
- data/lib/asset_tasks.rb +10 -0
- data/lib/asset_tasks/barista.rb +19 -0
- data/lib/asset_tasks/railtie.rb +10 -0
- data/lib/asset_tasks/tasks/assets.rake +19 -0
- data/lib/asset_tasks/tasks/barista.rake +41 -0
- data/lib/asset_tasks/tasks/compass.rake +33 -0
- data/lib/asset_tasks/tasks/jammit.rake +14 -0
- data/lib/asset_tasks/version.rb +3 -0
- metadata +117 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
asset_tasks (0.0.2)
|
5
|
+
barista
|
6
|
+
compass
|
7
|
+
jammit
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
abstract (1.0.0)
|
13
|
+
actionpack (3.0.3)
|
14
|
+
activemodel (= 3.0.3)
|
15
|
+
activesupport (= 3.0.3)
|
16
|
+
builder (~> 2.1.2)
|
17
|
+
erubis (~> 2.6.6)
|
18
|
+
i18n (~> 0.4)
|
19
|
+
rack (~> 1.2.1)
|
20
|
+
rack-mount (~> 0.6.13)
|
21
|
+
rack-test (~> 0.5.6)
|
22
|
+
tzinfo (~> 0.3.23)
|
23
|
+
activemodel (3.0.3)
|
24
|
+
activesupport (= 3.0.3)
|
25
|
+
builder (~> 2.1.2)
|
26
|
+
i18n (~> 0.4)
|
27
|
+
activesupport (3.0.3)
|
28
|
+
barista (0.6.1)
|
29
|
+
open4
|
30
|
+
railties (~> 3.0)
|
31
|
+
builder (2.1.2)
|
32
|
+
closure-compiler (0.3.3)
|
33
|
+
compass (0.10.6)
|
34
|
+
haml (>= 3.0.4)
|
35
|
+
erubis (2.6.6)
|
36
|
+
abstract (>= 1.0.0)
|
37
|
+
haml (3.0.24)
|
38
|
+
i18n (0.5.0)
|
39
|
+
jammit (0.5.4)
|
40
|
+
closure-compiler (>= 0.1.0)
|
41
|
+
yui-compressor (>= 0.9.1)
|
42
|
+
open4 (1.0.1)
|
43
|
+
rack (1.2.1)
|
44
|
+
rack-mount (0.6.13)
|
45
|
+
rack (>= 1.0.0)
|
46
|
+
rack-test (0.5.6)
|
47
|
+
rack (>= 1.0)
|
48
|
+
railties (3.0.3)
|
49
|
+
actionpack (= 3.0.3)
|
50
|
+
activesupport (= 3.0.3)
|
51
|
+
rake (>= 0.8.7)
|
52
|
+
thor (~> 0.14.4)
|
53
|
+
rake (0.8.7)
|
54
|
+
thor (0.14.6)
|
55
|
+
tzinfo (0.3.23)
|
56
|
+
yui-compressor (0.9.1)
|
57
|
+
|
58
|
+
PLATFORMS
|
59
|
+
ruby
|
60
|
+
|
61
|
+
DEPENDENCIES
|
62
|
+
asset_tasks!
|
63
|
+
barista
|
64
|
+
compass
|
65
|
+
jammit
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2010 Steven Hancock
|
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,52 @@
|
|
1
|
+
# asset_tasks_
|
2
|
+
|
3
|
+
Rake tasks for asset compiling and packaging using [Barista], [Compass] and
|
4
|
+
[Jammit]
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Configure [Barista], [Compass] and [Jammit] according to their instructions and
|
9
|
+
add the following line to your `Gemfile`
|
10
|
+
gem 'asset_tasks'
|
11
|
+
|
12
|
+
Then run `bundle install` and you're good to go.
|
13
|
+
|
14
|
+
## Rake Tasks
|
15
|
+
|
16
|
+
* assets:clear - Clear all assets
|
17
|
+
* assets:compile - Compile all assets
|
18
|
+
* assets:package - Compile and package all assets
|
19
|
+
* barista:clear - Clear Barista assets
|
20
|
+
* barista:compile - Compile Barista assets (alias for barista:brew)
|
21
|
+
* compass:clear - Clear Compass assets
|
22
|
+
* compass:compile - Compile Compass assets
|
23
|
+
* jammit:clear - Clear Jammit assets
|
24
|
+
* jammit:package - Package Jammit assets
|
25
|
+
|
26
|
+
## Optional pre-commit Hook
|
27
|
+
|
28
|
+
The `assets:commit:hook` task is provided as a convenient git pre-commit hook.
|
29
|
+
To use it, add the following to `.git/hooks/pre-commit` and make the file
|
30
|
+
executable.
|
31
|
+
#!/bin/sh
|
32
|
+
rake assets:commit:hook -s
|
33
|
+
|
34
|
+
Note that the commit hook doesn't work for some reason if you have git sources
|
35
|
+
in your `Gemfile`
|
36
|
+
|
37
|
+
## Note on Patches/Pull Requests
|
38
|
+
|
39
|
+
* Fork the project.
|
40
|
+
* Make your feature addition or bug fix.
|
41
|
+
* Commit, do not mess with rakefile, version, or history.
|
42
|
+
(if you want to have your own version, that is fine but bump version in a
|
43
|
+
commit by itself I can ignore when I pull)
|
44
|
+
* Send me a pull request. Bonus points for topic branches.
|
45
|
+
|
46
|
+
## Copyright
|
47
|
+
|
48
|
+
Copyright (c) 2010 Steven Hancock. See MIT-LICENSE for details.
|
49
|
+
|
50
|
+
[Barista]: https://github.com/Sutto/barista
|
51
|
+
[Compass]: https://github.com/chriseppstein/compass
|
52
|
+
[Jammit]: https://github.com/documentcloud/jammit
|
data/Rakefile
ADDED
data/asset_tasks.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "asset_tasks/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "asset_tasks"
|
7
|
+
s.version = AssetTasks::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Steven Hancock"]
|
10
|
+
s.email = ["stevenh512@gmail.com"]
|
11
|
+
s.homepage = "https://github.com/stevenh512/asset_tasks"
|
12
|
+
s.summary = %q{Rake tasks for asset packaging with Barista, Compass and Jammit}
|
13
|
+
s.description = %q{Rake tasks for asset packaging with Barista, Compass and Jammit}
|
14
|
+
|
15
|
+
s.rubyforge_project = "asset_tasks"
|
16
|
+
|
17
|
+
s.add_dependency("barista")
|
18
|
+
s.add_dependency("compass")
|
19
|
+
s.add_dependency("jammit")
|
20
|
+
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
|
+
s.require_paths = ["lib"]
|
25
|
+
end
|
data/lib/asset_tasks.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'barista'
|
2
|
+
require 'barista/framework'
|
3
|
+
require 'barista/version'
|
4
|
+
|
5
|
+
if Barista::Version::MINOR < 7
|
6
|
+
module Barista
|
7
|
+
class Framework
|
8
|
+
def output_root
|
9
|
+
@output_root || Barista.output_root
|
10
|
+
end
|
11
|
+
|
12
|
+
def output_path_for(file, format = 'js')
|
13
|
+
# Strip the leading slashes
|
14
|
+
file = file.to_s.gsub(/^\/+/, '')
|
15
|
+
output_root.join(file).to_s.gsub(/\.[^\.]+$/, ".#{format}")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module AssetTasks
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
rake_tasks do
|
4
|
+
load AssetTasks.library_root.join('asset_tasks/tasks/assets.rake')
|
5
|
+
load AssetTasks.library_root.join('asset_tasks/tasks/barista.rake')
|
6
|
+
load AssetTasks.library_root.join('asset_tasks/tasks/compass.rake')
|
7
|
+
load AssetTasks.library_root.join('asset_tasks/tasks/jammit.rake')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
namespace :assets do
|
2
|
+
task :base do
|
3
|
+
Rake::Task["assets:custom"].invoke if Rake::Task.task_defined?("assets:custom")
|
4
|
+
end
|
5
|
+
|
6
|
+
desc "Clear all assets"
|
7
|
+
task :clear
|
8
|
+
|
9
|
+
desc "Compile all assets"
|
10
|
+
task :compile => "assets:base"
|
11
|
+
|
12
|
+
desc "Generate and package all assets"
|
13
|
+
task :package => [:compile, "jammit:package"]
|
14
|
+
|
15
|
+
namespace :commit do
|
16
|
+
desc "Commit hook, prevents commits if assets are out of date"
|
17
|
+
task :hook
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require Rails.root.to_s + '/config/initializers/barista_config'
|
2
|
+
|
3
|
+
namespace :barista do
|
4
|
+
desc "Clear all Barista assets"
|
5
|
+
task :clear do
|
6
|
+
Barista::Framework.exposed_coffeescripts.each do |file|
|
7
|
+
origin_path, framework = Barista::Framework.full_path_for(file)
|
8
|
+
return if origin_path.nil?
|
9
|
+
destination_path = framework.output_path_for(file)
|
10
|
+
system "rm -Rfv #{destination_path}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Compile Barista assets"
|
15
|
+
task :compile => ["assets:base", "barista:brew"]
|
16
|
+
|
17
|
+
def barista_out_of_date?
|
18
|
+
result = false
|
19
|
+
Barista::Framework.exposed_coffeescripts.each do |file|
|
20
|
+
origin_path, framework = Barista::Framework.full_path_for(file)
|
21
|
+
return if origin_path.nil?
|
22
|
+
destination_path = framework.output_path_for(file)
|
23
|
+
result ||= Barista::Compiler.dirty?(origin_path, destination_path)
|
24
|
+
end
|
25
|
+
result
|
26
|
+
end
|
27
|
+
|
28
|
+
namespace :commit do
|
29
|
+
task :hook do
|
30
|
+
if barista_out_of_date?
|
31
|
+
puts "\e[31m ** Asset files are out-of-date. **\e[0m"
|
32
|
+
Rake::Task["assets:package"].invoke
|
33
|
+
exit(1)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Rake::Task["assets:clear"].enhance(["barista:clear"])
|
39
|
+
Rake::Task["assets:compile"].enhance(["barista:compile"])
|
40
|
+
Rake::Task["assets:commit:hook"].enhance(["barista:commit:hook"])
|
41
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'compass'
|
2
|
+
require 'compass/exec'
|
3
|
+
namespace :compass do
|
4
|
+
desc "Clear Compass assets"
|
5
|
+
task :clear do
|
6
|
+
system "rm -Rfv public/stylesheets/*"
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "Compile Compass assets"
|
10
|
+
task :compile => "assets:base" do
|
11
|
+
project = Compass::Commands::UpdateProject.new(Rails.root.to_s, :quiet => false, :force => true)
|
12
|
+
project.perform
|
13
|
+
end
|
14
|
+
|
15
|
+
def compass_out_of_date?
|
16
|
+
project = Compass::Commands::UpdateProject.new(Rails.root.to_s, :quiet => false, :force => false)
|
17
|
+
project.new_compiler_instance.out_of_date?
|
18
|
+
end
|
19
|
+
|
20
|
+
namespace :commit do
|
21
|
+
task :hook do
|
22
|
+
if compass_out_of_date?
|
23
|
+
puts "\e[31m ** Asset files are out-of-date. **\e[0m"
|
24
|
+
Rake::Task["assets:package"].invoke
|
25
|
+
exit(1)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
Rake::Task["assets:clear"].enhance(["compass:clear"])
|
31
|
+
Rake::Task["assets:compile"].enhance(["compass:compile"])
|
32
|
+
Rake::Task["assets:commit:hook"].enhance(["compass:commit:hook"])
|
33
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
namespace :jammit do
|
2
|
+
desc "Clear Jammit assets"
|
3
|
+
task :clear do
|
4
|
+
system "rm -Rfv public/assets/*"
|
5
|
+
end
|
6
|
+
|
7
|
+
desc "Package Jammit assets"
|
8
|
+
task :package do
|
9
|
+
Jammit.package!
|
10
|
+
end
|
11
|
+
|
12
|
+
Rake::Task["assets:clear"].enhance(["jammit:clear"])
|
13
|
+
# Rake::Task["assets:commit:hook"].enhance(["jammit:commit:hook"])
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: asset_tasks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Steven Hancock
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-12-15 00:00:00 -08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: barista
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: compass
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
version: "0"
|
44
|
+
type: :runtime
|
45
|
+
version_requirements: *id002
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: jammit
|
48
|
+
prerelease: false
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
type: :runtime
|
58
|
+
version_requirements: *id003
|
59
|
+
description: Rake tasks for asset packaging with Barista, Compass and Jammit
|
60
|
+
email:
|
61
|
+
- stevenh512@gmail.com
|
62
|
+
executables: []
|
63
|
+
|
64
|
+
extensions: []
|
65
|
+
|
66
|
+
extra_rdoc_files: []
|
67
|
+
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- Gemfile
|
71
|
+
- Gemfile.lock
|
72
|
+
- MIT-LICENSE
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- asset_tasks.gemspec
|
76
|
+
- lib/asset_tasks.rb
|
77
|
+
- lib/asset_tasks/barista.rb
|
78
|
+
- lib/asset_tasks/railtie.rb
|
79
|
+
- lib/asset_tasks/tasks/assets.rake
|
80
|
+
- lib/asset_tasks/tasks/barista.rake
|
81
|
+
- lib/asset_tasks/tasks/compass.rake
|
82
|
+
- lib/asset_tasks/tasks/jammit.rake
|
83
|
+
- lib/asset_tasks/version.rb
|
84
|
+
has_rdoc: true
|
85
|
+
homepage: https://github.com/stevenh512/asset_tasks
|
86
|
+
licenses: []
|
87
|
+
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
version: "0"
|
109
|
+
requirements: []
|
110
|
+
|
111
|
+
rubyforge_project: asset_tasks
|
112
|
+
rubygems_version: 1.3.7
|
113
|
+
signing_key:
|
114
|
+
specification_version: 3
|
115
|
+
summary: Rake tasks for asset packaging with Barista, Compass and Jammit
|
116
|
+
test_files: []
|
117
|
+
|