capistrano-lazy-assets 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/capistrano-lazy-assets/version.rb +1 -1
- data/lib/capistrano-lazy-assets.rb +11 -12
- metadata +1 -1
@@ -1,21 +1,20 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
module Capistrano
|
4
|
-
module Lazy
|
5
|
-
module Assets
|
6
|
-
# Your code goes here...
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
require 'capistrano-lazy-assets/version'
|
10
2
|
|
11
3
|
configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
12
4
|
Capistrano::Configuration.instance(:must_exist) :
|
13
5
|
Capistrano.configuration(:must_exist)
|
14
6
|
|
15
7
|
configuration.load do
|
16
|
-
namespace :
|
17
|
-
|
18
|
-
|
8
|
+
namespace :deploy do
|
9
|
+
namespace :assets do
|
10
|
+
task :precompile, :roles => :web, :except => { :no_release => true } do
|
11
|
+
from = source.next_revision(current_revision)
|
12
|
+
if capture("cd #{latest_release} && #{source.local.log(from)} app/assets/ | wc -l").to_i > 0
|
13
|
+
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
|
14
|
+
else
|
15
|
+
logger.info 'Skipping asset pre-compilation because there were no asset changes'
|
16
|
+
end
|
17
|
+
end
|
19
18
|
end
|
20
19
|
end
|
21
20
|
end
|