crossroads_capistrano 1.2.9 → 1.3.0

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.
@@ -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.2.9"
6
+ s.version = "1.3.0"
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"]
@@ -1,23 +1,20 @@
1
- module CrossroadsCapistrano
2
- begin
3
- @@cap_config = Capistrano::Configuration.instance(:must_exist)
4
- class << self
5
- def load_recipes(recipes)
6
- @@cap_config.load do
7
- if recipes == :all
8
- # Load all available recipes.
9
- recipes = Dir.glob(File.join(File.dirname(__FILE__), 'crossroads_capistrano', '*.rb'))
10
- recipes.each{|f| load f}
11
- else
12
- # Load each specified recipe.
13
- recipes.each{|r| load File.join(File.dirname(__FILE__),'crossroads_capistrano',"#{r}.rb")}
14
- end
15
- end
16
- end
1
+ # crossroads_recipes for using RVM on a server with capistrano.
2
+ unless Capistrano::Configuration.respond_to?(:instance)
3
+ abort "rvm/capistrano requires Capistrano >= 2."
4
+ end
5
+
6
+ Capistrano::Configuration.instance(:must_exist).load do
7
+ def load_crossroads_recipes(recipes)
8
+ if recipes == :all
9
+ # Load all available crossroads_recipes.
10
+ recipes = Dir.glob(File.join(File.dirname(__FILE__),
11
+ 'crossroads_capistrano', 'recipes', '*.rb'))
12
+ recipes.each{|f| load f}
13
+ else
14
+ # Load each specified recipe.
15
+ recipes.each{|r| load File.join(File.dirname(__FILE__),
16
+ "crossroads_capistrano/recipes/#{r}.rb")}
17
17
  end
18
- rescue LoadError => ex
19
- # Ignore this gem if Capistrano is not loaded.
20
- raise ex unless ex.message == "Please require this file from within a Capistrano recipe"
21
18
  end
22
19
  end
23
20
 
@@ -0,0 +1,30 @@
1
+ namespace :deploy do
2
+ desc "Show currently deployed revision on server."
3
+ task :revisions, :roles => :app do
4
+ current, previous, latest = current_revision[0,7], previous_revision[0,7], real_revision[0,7]
5
+ puts "\n" << "-"*63
6
+ puts "===== Master Revision: \033[1;33m#{latest}\033[0m\n\n"
7
+ puts "===== [ \033[1;36m#{application} - #{stage}\033[0m ]"
8
+ puts "=== Deployed Revision: \033[1;32m#{current}\033[0m"
9
+ puts "=== Previous Revision: \033[1;32m#{previous}\033[0m\n\n"
10
+
11
+ # If deployed and master are the same, show the difference between the last 2 deployments.
12
+ base_label, new_label, base_rev, new_rev = latest != current ? \
13
+ ["deployed", "master", current, latest] : \
14
+ ["previous", "deployed", previous, current]
15
+
16
+ # Show difference between master and deployed revisions.
17
+ if (diff = `git log #{base_rev}..#{new_rev} --oneline`) != ""
18
+ # Colorize refs
19
+ diff.gsub!(/^([a-f0-9]+) /, "\033[1;32m\\1\033[0m - ")
20
+ diff = " " << diff.gsub("\n", "\n ") << "\n"
21
+ # Indent commit messages nicely, max 80 chars per line, line has to end with space.
22
+ diff = diff.split("\n").map{|l|l.scan(/.{1,120}/).join("\n"<<" "*14).gsub(/([^ ]*)\n {14}/m,"\n"<<" "*14<<"\\1")}.join("\n")
23
+ puts "=== Difference between #{base_label} revision and #{new_label} revision:\n\n"
24
+ puts diff
25
+ end
26
+ end
27
+ end
28
+
29
+ after "deploy", "deploy:revisions"
30
+
metadata CHANGED
@@ -1,66 +1,86 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: crossroads_capistrano
3
- version: !ruby/object:Gem::Version
4
- version: 1.2.9
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 3
9
+ - 0
10
+ version: 1.3.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Steve Kenworthy
9
14
  - Ben Tillman
10
15
  - Nathan Broadbent
11
16
  autorequire:
12
17
  bindir: bin
13
18
  cert_chain: []
14
- date: 2011-05-14 00:00:00.000000000 +08:00
19
+
20
+ date: 2011-05-19 00:00:00 +08:00
15
21
  default_executable:
16
22
  dependencies: []
23
+
17
24
  description: A Crossroads Foundation collection of generic capistrano recipes.
18
- email:
25
+ email:
19
26
  - it_dept@crossroads.org.hk
20
27
  executables: []
28
+
21
29
  extensions: []
30
+
22
31
  extra_rdoc_files: []
23
- files:
32
+
33
+ files:
24
34
  - .gitignore
25
35
  - Gemfile
26
36
  - README.textile
27
37
  - Rakefile
28
38
  - crossroads_capistrano.gemspec
29
39
  - lib/crossroads_capistrano.rb
30
- - lib/crossroads_capistrano/delayed_job.rb
31
- - lib/crossroads_capistrano/log.rb
32
- - lib/crossroads_capistrano/newrelic.rb
33
- - lib/crossroads_capistrano/passenger.rb
34
- - lib/crossroads_capistrano/postgresql.rb
35
- - lib/crossroads_capistrano/prompt.rb
36
- - lib/crossroads_capistrano/revisions.rb
37
- - lib/crossroads_capistrano/rvm.rb
38
- - lib/crossroads_capistrano/stack.rb
39
- - lib/crossroads_capistrano/whenever.rb
40
- - lib/crossroads_capistrano/yum.rb
40
+ - lib/crossroads_capistrano/recipes/delayed_job.rb
41
+ - lib/crossroads_capistrano/recipes/log.rb
42
+ - lib/crossroads_capistrano/recipes/newrelic.rb
43
+ - lib/crossroads_capistrano/recipes/passenger.rb
44
+ - lib/crossroads_capistrano/recipes/postgresql.rb
45
+ - lib/crossroads_capistrano/recipes/prompt.rb
46
+ - lib/crossroads_capistrano/recipes/revisions.rb
47
+ - lib/crossroads_capistrano/recipes/rvm.rb
48
+ - lib/crossroads_capistrano/recipes/stack.rb
49
+ - lib/crossroads_capistrano/recipes/whenever.rb
50
+ - lib/crossroads_capistrano/recipes/yum.rb
41
51
  has_rdoc: true
42
52
  homepage: http://www.crossroads.org.hk
43
53
  licenses: []
54
+
44
55
  post_install_message:
45
56
  rdoc_options: []
46
- require_paths:
57
+
58
+ require_paths:
47
59
  - lib
48
- required_ruby_version: !ruby/object:Gem::Requirement
60
+ required_ruby_version: !ruby/object:Gem::Requirement
49
61
  none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
70
  none: false
56
- requirements:
57
- - - ! '>='
58
- - !ruby/object:Gem::Version
59
- version: '0'
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
60
78
  requirements: []
79
+
61
80
  rubyforge_project: crossroads_capistrano
62
- rubygems_version: 1.6.2
81
+ rubygems_version: 1.3.7
63
82
  signing_key:
64
83
  specification_version: 3
65
84
  summary: Crossroads capistrano recipes
66
85
  test_files: []
86
+
@@ -1,28 +0,0 @@
1
- desc "Show currently deployed revision on server."
2
- task :revisions, :roles => :app do
3
- current, previous, latest = current_revision[0,7], previous_revision[0,7], real_revision[0,7]
4
- puts "\n" << "-"*63
5
- puts "===== Master Revision: \033[1;33m#{latest}\033[0m\n\n"
6
- puts "===== [ \033[1;36m#{application.capitalize} - #{stage.capitalize}\033[0m ]"
7
- puts "=== Deployed Revision: \033[1;32m#{current}\033[0m"
8
- puts "=== Previous Revision: \033[1;32m#{previous}\033[0m\n\n"
9
-
10
- # If deployed and master are the same, show the difference between the last 2 deployments.
11
- base_label, new_label, base_rev, new_rev = latest != current ? \
12
- ["deployed", "master", current, latest] : \
13
- ["previous", "deployed", previous, current]
14
-
15
- # Show difference between master and deployed revisions.
16
- if (diff = `git log #{base_rev}..#{new_rev} --oneline`) != ""
17
- # Colorize refs
18
- diff.gsub!(/^([a-f0-9]+) /, "\033[1;32m\\1\033[0m - ")
19
- diff = " " << diff.gsub("\n", "\n ") << "\n"
20
- # Indent commit messages nicely, max 80 chars per line, line has to end with space.
21
- diff = diff.split("\n").map{|l|l.scan(/.{1,120}/).join("\n"<<" "*14).gsub(/([^ ]*)\n {14}/m,"\n"<<" "*14<<"\\1")}.join("\n")
22
- puts "=== Difference between #{base_label} revision and #{new_label} revision:\n\n"
23
- puts diff
24
- end
25
- end
26
-
27
- after "deploy", "revisions"
28
-