capistrano-precompile-on-local 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3dd8411aa83d67b3510981642e3bf79f01e26931
4
- data.tar.gz: 693bbeccf937e6ac33af98e97d4ab5fdad9631db
3
+ metadata.gz: 04251469c29c1267ab0b1e9ced87a6bcdf201311
4
+ data.tar.gz: 946318c267dd8cb4a97f92bf70a83044eb0c450a
5
5
  SHA512:
6
- metadata.gz: 8b571799509225ce901df57001eb4cb86cd99b9c84eb3805d03650a66304818a7afa67d5d9b9b80ee683d8fbead33f7351404e945b4e274a751fdd12e98c4340
7
- data.tar.gz: 102f84c63f8850f685d11b96eb7da6d92dfe9b2d46495865b3c3fb520d26ae56f785d6730fb124851438cf57b974c19f13ce8db7917b3dc399a35f55a0b32f41
6
+ metadata.gz: e320e943c06bb32c7846cc873f0abaa98f68902b8664caed1f02adc8b7effc95084b585af672709969f0a7a4da2e19b3779d83f087bdefbedff5f3fd533236a1
7
+ data.tar.gz: d27be6be73e4feabb654d083ad95bb9ba15abacb48a5ab0610dafdeed6488fbb1f779dc0a883a0f836b3ddc0801e8ab17fad9a393cd9d4a869310555da3bfb5b
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module PrecompileOnLocal
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
@@ -2,24 +2,40 @@ namespace :deploy do
2
2
  namespace :assets do
3
3
  Rake::Task['deploy:assets:precompile'].clear_actions
4
4
 
5
- desc "Precompile assets on local machine and upload them to the server."
6
- task :precompile do
5
+ set :asset_full_path, -> { "#{release_path}/public/#{fetch(:assets_prefix)}" }
6
+
7
+ task :precompile_on_local do
7
8
  run_locally do
8
9
  execute 'RAILS_ENV=production bundle exec rake assets:precompile'
10
+ execute "cd ./public/#{fetch(:assets_prefix)} && tar zcf assets.tar.gz *"
9
11
  end
12
+ end
10
13
 
14
+ task :upload_and_extract do
11
15
  on roles(:app) do
12
16
  within release_path do
13
- asset_full_path = "#{release_path}/public/#{fetch(:assets_prefix)}"
14
- asset_parent_path = File.dirname(asset_full_path)
15
- execute "mkdir -p #{asset_full_path}"
16
- upload! "./public/#{fetch(:assets_prefix)}", asset_parent_path, recursive: true
17
+ execute "mkdir -p #{fetch(:asset_full_path)}"
18
+ upload! "./public/#{fetch(:assets_prefix)}/assets.tar.gz", fetch(:asset_full_path)
19
+ execute "cd #{fetch(:asset_full_path)} && tar zxf assets.tar.gz"
20
+ execute "cd #{fetch(:asset_full_path)} && rm assets.tar.gz"
17
21
  end
18
22
  end
23
+ end
19
24
 
25
+ task :clean do
20
26
  run_locally do
21
27
  execute "rm -r ./public/#{fetch(:assets_prefix)}"
22
28
  end
23
29
  end
30
+
31
+ desc "Precompile assets on local machine and upload them to the server."
32
+ task :precompile do
33
+ begin
34
+ invoke 'deploy:assets:precompile_on_local'
35
+ invoke 'deploy:assets:upload_and_extract'
36
+ ensure
37
+ invoke 'deploy:assets:clean'
38
+ end
39
+ end
24
40
  end
25
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-precompile-on-local
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ayaya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-18 00:00:00.000000000 Z
11
+ date: 2014-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano