capistrano-af83 0.1.3 → 0.1.4

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/README.md CHANGED
@@ -37,8 +37,6 @@ Capistrano extensions
37
37
 
38
38
  We use some capistrano extensions (capistrano-af83 depends on them):
39
39
 
40
- - [**multistage**](https://github.com/TechnoGate/capistrano-exts):
41
- have a configuration per environment
42
40
  - [**capistrano_colors**](https://github.com/stjernstrom/capistrano_colors/):
43
41
  colorize your capistrano output for better overview
44
42
  - [**capistrano-notification**](https://github.com/ursm/capistrano-notification):
@@ -5,6 +5,6 @@ require "capistrano"
5
5
  if Capistrano::Configuration.instance
6
6
  Capistrano::Configuration.instance.load_paths << File.dirname(__FILE__)
7
7
  Capistrano::Configuration.instance.load "af83/default"
8
- Capistrano::Configuration.instance.load "af83/environments"
8
+ Capistrano::Configuration.instance.load "af83/stages"
9
9
  require "capistrano/af83/extensions"
10
10
  end
@@ -1,6 +1,5 @@
1
1
  # Use a custom maintenance page
2
-
3
- # TODO explain how to use it
2
+ # See http://ariejan.net/2011/09/19/capistrano-and-the-custom-maintenance-page
4
3
 
5
4
  namespace :deploy do
6
5
  namespace :web do
@@ -4,24 +4,22 @@ default_run_options[:pty] = true
4
4
 
5
5
  # Obviously, we are git lovers
6
6
  depend :remote, :command, "git"
7
- set :scm, :git
8
- set :scm_username, :af83
9
- set :repository, "#{scm_username}@git.af83.com:#{appname}.git"
7
+ set :scm, :git
8
+ set :scm_username, :af83
9
+ set :repository, "#{scm_username}@git.af83.com:#{appname}.git"
10
10
 
11
- set :use_sudo, false
12
- set :deploy_via, :remote_cache
13
- set (:application) { "#{rails_env}.#{appname}.af83.com" }
14
- set (:deploy_to) { "/var/www/#{user}/#{rails_env}" }
11
+ set :use_sudo, false
12
+ set :deploy_via, :remote_cache
13
+ set (:application) { "#{rails_env}.#{appname}.af83.com" }
14
+ set (:deploy_to) { "/var/www/#{user}/#{rails_env}" }
15
15
 
16
16
  # I don't know why capistrano don't do the cleanup by default,
17
17
  # but it should be the case.
18
- set :keep_releases, 5
18
+ set :keep_releases, 5
19
19
  after "deploy:update", "deploy:cleanup"
20
20
 
21
- # TODO move this somewhere else
22
- depend :remote, :command, "bundle"
23
- set :bundle_cmd, "bundle"
24
-
25
21
  # It's not a good idea to keep capistrano's default value for this when using
26
22
  # the assets pipeline of Rails3.
27
23
  set :public_children, %w(images)
24
+
25
+ set :bundle_cmd, "bundle"
@@ -0,0 +1,29 @@
1
+ # This code was taken from http://www.bencurtis.com/2011/12/skipping-asset-compilation-with-capistrano/
2
+
3
+ set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
4
+
5
+ namespace :deploy do
6
+ namespace :assets do
7
+
8
+ desc <<-DESC
9
+ Run the asset precompilation rake task. You can specify the full path \
10
+ to the rake executable by setting the rake variable. You can also \
11
+ specify additional environment variables to pass to rake via the \
12
+ asset_env variable. The defaults are:
13
+
14
+ set :rake, "rake"
15
+ set :rails_env, "production"
16
+ set :asset_env, "RAILS_GROUPS=assets"
17
+ set :assets_dependencies, fetch(:assets_dependencies) + %w(config/locales/js)
18
+ DESC
19
+ task :precompile, :roles => :web, :except => { :no_release => true } do
20
+ from = source.next_revision(current_revision)
21
+ if capture("cd #{latest_release} && #{source.local.log(from)} #{assets_dependencies.join ' '} | wc -l").to_i > 0
22
+ run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
23
+ else
24
+ logger.info "Skipping asset pre-compilation because there were no asset changes"
25
+ end
26
+ end
27
+
28
+ end
29
+ end
@@ -1,6 +1,5 @@
1
1
  # Load the capistrano extensions
2
2
  require "capistrano_colors"
3
3
  require "capistrano-notification"
4
- require "capistrano/ext/multistage"
5
4
  require "sushi/ssh"
6
5
  require "bundler/capistrano"
@@ -0,0 +1,56 @@
1
+ # This file was taken from https://github.com/TechnoGate/capistrano-exts
2
+
3
+ # By default, we have 3 stages (dev, staging and production)
4
+ # and we detect other stages if they have a file in confif/deploy.
5
+ default_stages = [:dev, :staging, :prod]
6
+ location = fetch(:stage_dir, "config/deploy")
7
+ unless exists?(:stages)
8
+ set :stages, Dir["#{location}/*.rb"].map { |f| File.basename(f, ".rb") }
9
+ end
10
+
11
+ desc "Set the target stage to `dev'."
12
+ task :dev do
13
+ set :stage, :dev
14
+ set :branch, :master
15
+ set :rails_env, :dev
16
+ set(:default_environment) { { "RAILS_ENV" => rails_env } }
17
+ load "#{location}/#{stage}" if File.exists?("#{location}/#{stage}.rb")
18
+ end
19
+
20
+ desc "Set the target stage to `staging'."
21
+ task :staging do
22
+ set :stage, :staging
23
+ set :branch, :master
24
+ set :rails_env, :staging
25
+ set(:default_environment) { { "RAILS_ENV" => rails_env } }
26
+ load "#{location}/#{stage}" if File.exists?("#{location}/#{stage}.rb")
27
+ end
28
+
29
+ desc "Set the target stage to `prod'."
30
+ task :prod do
31
+ set :stage, :prod
32
+ set :branch, :production
33
+ set :rails_env, :production
34
+ set(:default_environment) { { "RAILS_ENV" => rails_env } }
35
+ load "#{location}/#{stage}" if File.exists?("#{location}/#{stage}.rb")
36
+ end
37
+
38
+ stages.each do |name|
39
+ desc "Set the target stage to `#{name}'."
40
+ task(name) do
41
+ set :stage, name.to_sym
42
+ load "#{location}/#{stage}"
43
+ end
44
+ end
45
+
46
+ namespace :multistage do
47
+ desc "[internal] Ensure that a stage has been selected."
48
+ task :ensure do
49
+ if !exists?(:stage)
50
+ logger.important "Defaulting to `dev'"
51
+ find_and_execute_task(:dev)
52
+ end
53
+ end
54
+ end
55
+
56
+ on :start, "multistage:ensure"
@@ -1,5 +1,7 @@
1
1
  # Use thin for deployment
2
2
 
3
+ depend :remote, :command, "bundle"
4
+
3
5
  namespace :deploy do
4
6
  task :start, :roles => :app do
5
7
  run "cd #{current_path} && #{bundle_cmd} exec thin start -C #{shared_path}/thin.yml"
@@ -1,5 +1,7 @@
1
1
  # Use unicorn for deployment
2
2
 
3
+ depend :remote, :command, "bundle"
4
+
3
5
  namespace :deploy do
4
6
  task :start, :roles => :app do
5
7
  run "cd #{current_path} && #{bundle_cmd} exec unicorn -c config/unicorn.rb -E #{rails_env} -D"
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module AF83
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-af83
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-16 00:00:00.000000000 Z
12
+ date: 2011-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &70837700 !ruby/object:Gem::Requirement
16
+ requirement: &79633480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,21 +21,10 @@ dependencies:
21
21
  version: '2.9'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70837700
25
- - !ruby/object:Gem::Dependency
26
- name: capistrano-ext
27
- requirement: &70837040 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ~>
31
- - !ruby/object:Gem::Version
32
- version: '1.2'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *70837040
24
+ version_requirements: *79633480
36
25
  - !ruby/object:Gem::Dependency
37
26
  name: capistrano_colors
38
- requirement: &70836320 !ruby/object:Gem::Requirement
27
+ requirement: &79631790 !ruby/object:Gem::Requirement
39
28
  none: false
40
29
  requirements:
41
30
  - - ~>
@@ -43,10 +32,10 @@ dependencies:
43
32
  version: '0.5'
44
33
  type: :runtime
45
34
  prerelease: false
46
- version_requirements: *70836320
35
+ version_requirements: *79631790
47
36
  - !ruby/object:Gem::Dependency
48
37
  name: capistrano-notification
49
- requirement: &70835800 !ruby/object:Gem::Requirement
38
+ requirement: &79647200 !ruby/object:Gem::Requirement
50
39
  none: false
51
40
  requirements:
52
41
  - - ~>
@@ -54,10 +43,10 @@ dependencies:
54
43
  version: '0.1'
55
44
  type: :runtime
56
45
  prerelease: false
57
- version_requirements: *70835800
46
+ version_requirements: *79647200
58
47
  - !ruby/object:Gem::Dependency
59
48
  name: sushi
60
- requirement: &70835400 !ruby/object:Gem::Requirement
49
+ requirement: &79646320 !ruby/object:Gem::Requirement
61
50
  none: false
62
51
  requirements:
63
52
  - - ~>
@@ -65,7 +54,7 @@ dependencies:
65
54
  version: 0.0.2
66
55
  type: :runtime
67
56
  prerelease: false
68
- version_requirements: *70835400
57
+ version_requirements: *79646320
69
58
  description: Capistrano recipes for af83
70
59
  email: bruno.michel@af83.com
71
60
  executables: []
@@ -77,7 +66,7 @@ files:
77
66
  - lib/capistrano/af83.rb
78
67
  - lib/capistrano/af83/custom_maintenance_page.rb
79
68
  - lib/capistrano/af83/default.rb
80
- - lib/capistrano/af83/environments.rb
69
+ - lib/capistrano/af83/deploy/assets.rb
81
70
  - lib/capistrano/af83/es.rb
82
71
  - lib/capistrano/af83/extensions.rb
83
72
  - lib/capistrano/af83/info.rb
@@ -85,6 +74,7 @@ files:
85
74
  - lib/capistrano/af83/js_routes.rb
86
75
  - lib/capistrano/af83/mongoid.rb
87
76
  - lib/capistrano/af83/resque.rb
77
+ - lib/capistrano/af83/stages.rb
88
78
  - lib/capistrano/af83/thin.rb
89
79
  - lib/capistrano/af83/unicorn.rb
90
80
  - lib/capistrano/af83/version.rb
@@ -1,6 +0,0 @@
1
- # Configure the 3 stages: dev, staging and production
2
-
3
- set :stages, %w(dev staging production)
4
- set :default_stage, "dev"
5
-
6
- # TODO find how to provide default values for branch, rails_env per stage