capistrano-the-best-compression 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e9ca50b1b94403bd7d8a0aab6b2b72e2becb4a6b
4
+ data.tar.gz: 4f3e10198ac3925d49d36ebb515c1d02dc23d406
5
+ SHA512:
6
+ metadata.gz: 46f8f79abd6d2ef738bbb9b217f50793785ad0c82a00e4c90a5aaf83fa71d96671a3e2f71532984319eb0cad155f65909c3f92543888c0d8d919a705684b8484
7
+ data.tar.gz: 9e18d2e6fee0551e6b018277e1f3628f64dde132e0b5f672bfb46084b0e860942ba663108df122a44e0065f30b3c7b1a6575f2ba7f6bfa5ea4ef3f9f7c7965de
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # CapistranoTheBestCompression
2
+
3
+ Optimized assets compressor for Capistrano.
4
+
5
+ ### Getting Started
6
+
7
+ Add the best compression to your Gemfile and `bundle install`:
8
+
9
+ ```ruby
10
+ gem 'capistrano-the-best-compression', git: 'git@github.com:SumatoSoft/capistrano-the-best-compression.git'
11
+ ```
12
+
13
+ Run on your server:
14
+
15
+ ```bash
16
+ $ sudo apt-get install zopfli
17
+ $ cd /tmp && git clone https://github.com/google/zopfli.git && cd zopfli && make zopflipng && sudo mv zopflipng /usr/bin/
18
+ ```
19
+
20
+ Add to your Capfile:
21
+
22
+ ```ruby
23
+ require 'capistrano/the_best_compression'
24
+ ```
25
+
26
+ And to deploy.rb:
27
+
28
+ ```ruby
29
+ before 'deploy:publishing', 'deploy:compress_assets'
30
+ before 'deploy:publishing', 'deploy:compress_png'
31
+ ```
32
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ import './lib/tasks/compress.rake'
@@ -0,0 +1 @@
1
+ load File.expand_path('../../tasks/compress.rake', __FILE__)
@@ -0,0 +1,19 @@
1
+ namespace :deploy do
2
+ desc 'Compress assets'
3
+ task :compress_assets, :names do |_, args|
4
+ on roles(:app) do
5
+ assets_path = release_path.join('public', 'assets')
6
+ names = args[:names].is_a?(Array) && !(args[:names].empty?) ? args[:names] : %w(*.js *.css *.ico *.svg *.pdf)
7
+ names_args = "#{names.join('" -o -name "')}"
8
+ execute "find -L #{assets_path} \\( -name \"#{names_args}\" \\) -exec bash -c \"[ ! -f '{}.gz' ] && zopfli --gzip --i20 '{}'\" \\; "
9
+ end
10
+ end
11
+
12
+ desc 'Compress pngs'
13
+ task :compress_png do
14
+ on roles(:app) do
15
+ assets_path = release_path.join('public', 'assets')
16
+ execute "find -L #{assets_path} \\( -name *.png \\) -not \\( -name 'zopflied_*.png' \\) -exec bash -c 'FULLPATH='{}'; FILENAME=${FULLPATH##*/}; BASEDIRECTORY=${FULLPATH%$FILENAME}; [ ! -f \"${BASEDIRECTORY}zopflied_${FILENAME}\" ] && zopflipng \"${FULLPATH}\" \"${BASEDIRECTORY}zopflied_${FILENAME}\" ' \\; "
17
+ end
18
+ end
19
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module CapistranoTheBestCompression
2
+ VERSION = '0.0.11'
3
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-the-best-compression
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.11
5
+ platform: ruby
6
+ authors:
7
+ - SumatoSoft
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-12-02 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Capistrano the best compression gem
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - README.md
20
+ - Rakefile
21
+ - lib/capistrano/the_best_compression.rb
22
+ - lib/tasks/compress.rake
23
+ - lib/version.rb
24
+ homepage:
25
+ licenses:
26
+ - MIT
27
+ metadata: {}
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 2.4.6
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: Capistrano the Best Compression
48
+ test_files: []