capistrano-faster-assets 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6c029f3933f8e608e67b0e33918f69942106c77b
4
+ data.tar.gz: 8ceeb7e6ed9c3973067974fba7d2a60894ea2109
5
+ SHA512:
6
+ metadata.gz: 6a115fa608107fca63f12f9cedbc2cbbd1af613c04310db3d7026184a1a02a986c135695c454f5b58063348117e642bfb8316b8d1182af17641a7e5c539f2570
7
+ data.tar.gz: 3508d145118aca2c9a6a7bf5ce5a5ff5765ad966c6fb3d61c9ca7722d7c2abef726e90fc385dfa2eebfd18906aa356ef48697c249cf065f742ba9a24841e352f
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ /vendor/ruby
19
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in *.gemspec
4
+ gemspec
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2014 Andrew Thal, Ruben Stranders
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the "Software"),
5
+ to deal in the Software without restriction, including without limitation
6
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
+ and/or sell copies of the Software, and to permit persons to whom the
8
+ Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included
11
+ in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
19
+ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,49 @@
1
+ # Capistrano::FasterAssets
2
+
3
+ This gem speeds up asset compilation by skipping the assets:precompile task if none of the assets were changed
4
+ since last release.
5
+
6
+ Works *only* with Capistrano 3+.
7
+
8
+ ### Installation
9
+
10
+ Add this to `Gemfile`:
11
+
12
+ group :development do
13
+ gem 'capistrano', '~> 3.1'
14
+ gem 'capistrano-faster-assets', '~> 1.0'
15
+ end
16
+
17
+ And then:
18
+
19
+ $ bundle install
20
+
21
+ ### Setup and usage
22
+
23
+ Add this line to `Capfile`
24
+
25
+ require 'capistrano/faster_assets'
26
+
27
+ ### More Capistrano automation?
28
+
29
+ If you'd like to streamline your Capistrano deploys, you might want to check
30
+ these zero-configuration, plug-n-play plugins:
31
+
32
+ - [capistrano-unicorn-nginx](https://github.com/bruno-/capistrano-unicorn-nginx)<br/>
33
+ no-configuration unicorn and nginx setup with sensible defaults
34
+ - [capistrano-postgresql](https://github.com/bruno-/capistrano-postgresql)<br/>
35
+ plugin that automates postgresql configuration and setup
36
+ - [capistrano-rbenv-install](https://github.com/bruno-/capistrano-rbenv-install)<br/>
37
+ would you like Capistrano to install rubies for you?
38
+ - [capistrano-safe-deploy-to](https://github.com/bruno-/capistrano-safe-deploy-to)<br/>
39
+ if you're annoyed that Capistrano does **not** create a deployment path for the
40
+ app on the server (default `/var/www/myapp`), this is what you need!
41
+
42
+ ### Bug reports and pull requests
43
+
44
+ ...are very welcome!
45
+
46
+ ### Thanks
47
+
48
+ [@athal7](https://github.com/athal7) - for the original idea and implementation. See https://coderwall.com/p/aridag
49
+ for more details
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/faster_assets/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "capistrano-faster-assets"
8
+ gem.version = Capistrano::FasterAssets::VERSION
9
+ gem.authors = ["Andrew Thal", "Ruben Stranders"]
10
+ gem.email = ["athal7@me.com", "r.stranders@gmail.com"]
11
+ gem.description = <<-EOF.gsub(/^\s+/, '')
12
+ Speeds up asset compilation by skipping the assets:precompile task if none of the assets were changed since last release.
13
+
14
+ Works *only* with Capistrano 3+.
15
+
16
+ Based on https://coderwall.com/p/aridag
17
+ EOF
18
+ gem.summary = "Speeds up asset compilation if none of the assets were changed since last release."
19
+ gem.homepage = "https://github.com/capistrano-plugins/capistrano-faster-assets"
20
+
21
+ gem.files = `git ls-files`.split($/)
22
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
23
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
24
+ gem.require_paths = ["lib"]
25
+
26
+ gem.add_dependency "capistrano", ">= 3.1"
27
+ gem.add_development_dependency "rake"
28
+ end
File without changes
@@ -0,0 +1 @@
1
+ load File.expand_path("../tasks/faster_assets.rake", __FILE__)
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module FasterAssets
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,48 @@
1
+ # Original source: https://coderwall.com/p/aridag
2
+
3
+
4
+ # set the locations that we will look for changed assets to determine whether to precompile
5
+ set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
6
+
7
+ # clear the previous precompile task
8
+ Rake::Task["deploy:assets:precompile"].clear_actions
9
+ class PrecompileRequired < StandardError;
10
+ end
11
+
12
+ namespace :deploy do
13
+ namespace :assets do
14
+ desc "Precompile assets"
15
+ task :precompile do
16
+ on roles(fetch(:assets_roles)) do
17
+ within release_path do
18
+ with rails_env: fetch(:rails_env) do
19
+ begin
20
+ # find the most recent release
21
+ latest_release = capture(:ls, '-xr', releases_path).split[1]
22
+
23
+ # precompile if this is the first deploy
24
+ raise PrecompileRequired unless latest_release
25
+
26
+ latest_release_path = releases_path.join(latest_release)
27
+
28
+ # precompile if the previous deploy failed to finish precompiling
29
+ execute(:ls, latest_release_path.join('assets_manifest_backup')) rescue raise(PrecompileRequired)
30
+
31
+ fetch(:assets_dependencies).each do |dep|
32
+ # execute raises if there is a diff
33
+ execute(:diff, '-Naur', release_path.join(dep), latest_release_path.join(dep)) rescue raise(PrecompileRequired)
34
+ end
35
+
36
+ info("Skipping asset precompile, no asset diff found")
37
+
38
+ # copy over all of the assets from the last release
39
+ execute(:cp, '-r', latest_release_path.join('public', fetch(:assets_prefix)), release_path.join('public', fetch(:assets_prefix)))
40
+ rescue PrecompileRequired
41
+ execute(:rake, "assets:precompile")
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-faster-assets
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Thal
8
+ - Ruben Stranders
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-10-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '3.1'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '3.1'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ description: |
43
+ Speeds up asset compilation by skipping the assets:precompile task if none of the assets were changed since last release.
44
+ Works *only* with Capistrano 3+.
45
+ Based on https://coderwall.com/p/aridag
46
+ email:
47
+ - athal7@me.com
48
+ - r.stranders@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - ".gitignore"
54
+ - Gemfile
55
+ - LICENSE.md
56
+ - README.md
57
+ - Rakefile
58
+ - capistrano-faster-assets.gemspec
59
+ - lib/capistrano-faster-assets.rb
60
+ - lib/capistrano/faster_assets.rb
61
+ - lib/capistrano/faster_assets/version.rb
62
+ - lib/capistrano/tasks/faster_assets.rake
63
+ homepage: https://github.com/capistrano-plugins/capistrano-faster-assets
64
+ licenses: []
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.2.2
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: Speeds up asset compilation if none of the assets were changed since last
86
+ release.
87
+ test_files: []