crossroads_capistrano 1.4.12 → 1.4.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "crossroads_capistrano"
6
- s.version = "1.4.12"
6
+ s.version = "1.4.13"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Steve Kenworthy", "Ben Tillman", "Nathan Broadbent"]
9
9
  s.email = ["it_dept@crossroads.org.hk"]
@@ -3,11 +3,11 @@
3
3
  if defined?(Capistrano::Configuration) && Capistrano::Configuration.instance
4
4
  require 'capistrano_colors' rescue LoadError puts "Capistrano Colors is not installed."
5
5
  Capistrano::Configuration.instance(:must_exist).load do
6
- # Require multistage & bundler unless disabled.
7
- require 'capistrano/ext/multistage' if fetch(:multistage, true)
8
- require 'bundler/capistrano' if fetch(:bundler, true) rescue LoadError
9
-
10
6
  set :rails_root, Dir.pwd # For tasks that need the root directory
7
+
8
+ # Automatically detect whether multistage & bundler need to be required.
9
+ require 'capistrano/ext/multistage' if File.exists?(File.join(fetch(:rails_root), 'config', 'deploy'))
10
+ require 'bundler/capistrano' if File.exists?(File.join(fetch(:rails_root), 'Gemfile'))
11
11
 
12
12
  # Load base defaults unless disabled.
13
13
  if fetch(:base_defaults, true)
@@ -2,6 +2,31 @@
2
2
  # Capistrano Helper Methods
3
3
  #
4
4
 
5
+ # Helper function which prompts for user input.
6
+ # If user enters nothing, variable is set to the default.
7
+ def prompt_with_default(prompt, var, default=nil)
8
+ set(var) do
9
+ # Append default in brackets to prompt if default is not blank.
10
+ if default != "" && !default.nil?
11
+ prompt << " [#{default}]"
12
+ end
13
+ # Keep passwords hidden.
14
+ if prompt.downcase.include?('password')
15
+ Capistrano::CLI.password_prompt(" #{prompt}: ")
16
+ else
17
+ Capistrano::CLI.ui.ask(" #{prompt}: ")
18
+ end
19
+ end
20
+ set var, default if eval("#{var.to_s}.empty?")
21
+ end
22
+
23
+ # Detect presence and version of Rails.
24
+ def rails_version
25
+ return 3 if File.exists?(File.join(fetch(:rails_root), 'script', 'rails'))
26
+ return 2 if File.exists?(File.join(fetch(:rails_root), 'script', 'server'))
27
+ nil
28
+ end
29
+
5
30
  # Returns the first host with the 'db' role. (useful for :pull commands)
6
31
  def first_db_host
7
32
  @db_host ||= find_servers(:roles => :db).map(&:to_s).first
@@ -27,21 +52,3 @@ def sed(file, args, char="@")
27
52
  (exists?(:use_sudo) && !use_sudo) ? run(cmd) : sudo(cmd)
28
53
  end
29
54
 
30
- # Helper function which prompts for user input.
31
- # If user enters nothing, variable is set to the default.
32
- def prompt_with_default(prompt, var, default=nil)
33
- set(var) do
34
- # Append default in brackets to prompt if default is not blank.
35
- if default != "" && !default.nil?
36
- prompt << " [#{default}]"
37
- end
38
- # Keep passwords hidden.
39
- if prompt.downcase.include?('password')
40
- Capistrano::CLI.password_prompt(" #{prompt}: ")
41
- else
42
- Capistrano::CLI.ui.ask(" #{prompt}: ")
43
- end
44
- end
45
- set var, default if eval("#{var.to_s}.empty?")
46
- end
47
-
@@ -7,10 +7,7 @@ namespace :deploy do
7
7
  if ARGV.include?("-n")
8
8
  puts "\n ** Dry run, not notifying Hoptoad.\n\n"
9
9
  else
10
- begin
11
- require 'active_support/core_ext/string'
12
- rescue Exception
13
- end
10
+ require 'active_support/core_ext/string' if rails_version == 3
14
11
  require 'hoptoad_notifier'
15
12
  require File.join(rails_root,'config','initializers','hoptoad')
16
13
  require 'hoptoad_tasks'
metadata CHANGED
@@ -1,26 +1,31 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: crossroads_capistrano
3
- version: !ruby/object:Gem::Version
4
- version: 1.4.12
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 1.4.13
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Steve Kenworthy
9
9
  - Ben Tillman
10
10
  - Nathan Broadbent
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-05-26 00:00:00.000000000 +08:00
14
+
15
+ date: 2011-05-27 00:00:00 +08:00
15
16
  default_executable:
16
17
  dependencies: []
18
+
17
19
  description: A Crossroads Foundation collection of generic capistrano recipes.
18
- email:
20
+ email:
19
21
  - it_dept@crossroads.org.hk
20
22
  executables: []
23
+
21
24
  extensions: []
25
+
22
26
  extra_rdoc_files: []
23
- files:
27
+
28
+ files:
24
29
  - .gitignore
25
30
  - Gemfile
26
31
  - README.textile
@@ -49,26 +54,30 @@ files:
49
54
  has_rdoc: true
50
55
  homepage: http://www.crossroads.org.hk
51
56
  licenses: []
57
+
52
58
  post_install_message:
53
59
  rdoc_options: []
54
- require_paths:
60
+
61
+ require_paths:
55
62
  - lib
56
- required_ruby_version: !ruby/object:Gem::Requirement
63
+ required_ruby_version: !ruby/object:Gem::Requirement
57
64
  none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
70
  none: false
64
- requirements:
65
- - - ! '>='
66
- - !ruby/object:Gem::Version
67
- version: '0'
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: "0"
68
75
  requirements: []
76
+
69
77
  rubyforge_project: crossroads_capistrano
70
- rubygems_version: 1.6.2
78
+ rubygems_version: 1.6.0
71
79
  signing_key:
72
80
  specification_version: 3
73
81
  summary: Crossroads capistrano recipes
74
82
  test_files: []
83
+