gorilla-capistrano-recipes 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gorilla-capistrano-recipes}
8
- s.version = "0.1.5"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Benny Degezelle"]
12
- s.date = %q{2009-12-15}
12
+ s.date = %q{2010-08-24}
13
13
  s.description = %q{This gem allows for a clean Capfile by setting up common capistrano stuff such as Git preferences, Radiant specifics, db dump helpers, passenger or lighty restart, ...}
14
14
  s.email = %q{benny@gorilla-webdesign.be}
15
15
  s.extra_rdoc_files = [
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "gorilla-capistrano-recipes.gemspec",
27
27
  "lib/gorilla-capistrano-recipes.rb",
28
+ "lib/gorilla-capistrano-recipes/deepmodules.rb",
28
29
  "lib/gorilla-capistrano-recipes/deploy.rb",
29
30
  "lib/gorilla-capistrano-recipes/lighttpd.rb",
30
31
  "lib/gorilla-capistrano-recipes/mysql.rb",
@@ -37,7 +38,7 @@ Gem::Specification.new do |s|
37
38
  s.homepage = %q{http://github.com/jomz/gorilla-capistrano-recipes}
38
39
  s.rdoc_options = ["--charset=UTF-8"]
39
40
  s.require_paths = ["lib"]
40
- s.rubygems_version = %q{1.3.5}
41
+ s.rubygems_version = %q{1.3.7}
41
42
  s.summary = %q{Common capistrano recipes for Gorilla sites}
42
43
  s.test_files = [
43
44
  "test/helper.rb",
@@ -48,7 +49,7 @@ Gem::Specification.new do |s|
48
49
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
49
50
  s.specification_version = 3
50
51
 
51
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
52
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
53
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
53
54
  else
54
55
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
@@ -0,0 +1,68 @@
1
+ require 'capistrano/recipes/deploy/scm/git'
2
+ require 'capistrano/recipes/deploy/strategy/remote_cache'
3
+
4
+ unless Capistrano::Configuration.respond_to?(:instance)
5
+ abort "capistrano/deepmodules requires Capistrano 2"
6
+ end
7
+
8
+ module Capistrano
9
+ module Deploy
10
+
11
+ module SCM
12
+ class Git < Base
13
+
14
+ # Simple interface to submodule commands
15
+ def submodule(subcmd)
16
+ "#{command} submodule #{subcmd}"
17
+ end
18
+
19
+ end
20
+ end
21
+
22
+
23
+ module Strategy
24
+
25
+ class RemoteCache < Remote
26
+ # Executes the SCM command for this strategy and writes the REVISION
27
+ # mark file to each host.
28
+ # We're overriding default deploy! method to inject a call to deep
29
+ # update the nested modules
30
+ def deploy!
31
+ update_repository_cache
32
+ update_submodules(repository_cache)
33
+ copy_repository_cache
34
+ end
35
+
36
+ private
37
+
38
+ # Inits and updates submodules in the repository at the path given
39
+ # via the argument, then recursively descends into all found
40
+ # submodule and updated them and all their down-levels, too
41
+ def update_submodules(dir)
42
+ logger.trace "updating submodule at #{dir}"
43
+
44
+ submodules = Array.new
45
+ run("cd #{dir} && #{source.submodule('status')}") do |state, stream, text|
46
+ # parsing the output of "git submodule status" command
47
+ # and collecting paths of all submodules into an array
48
+ submodules += text.split(/\n/).collect do |submodule|
49
+ $~[1] if submodule.rstrip =~ /.\w{40} ([^()]+)($| \(.*\)$)/
50
+ end
51
+ end
52
+
53
+ if submodules.size > 0 then
54
+ # init and update submodules if they were found
55
+ scm_run("cd #{dir} && "+
56
+ "#{source.submodule('init')} && "+
57
+ "#{source.submodule('update')} "
58
+ )
59
+ # and descend into them to repeat the process recursively
60
+ submodules.each { |submodule| update_submodules("#{dir}/#{submodule}") }
61
+ end
62
+
63
+ end
64
+ end
65
+
66
+ end
67
+ end
68
+ end
@@ -1,8 +1,7 @@
1
1
  configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
2
2
 
3
3
  configuration.load do
4
- require "capistrano/deepmodules"
5
-
4
+ require "gorilla-capistrano-recipes/deepmodules"
6
5
  default_run_options[:pty] = true
7
6
  set :ssh_options, { :forward_agent => true}
8
7
  set(:deploy_to) { "/home/#{user}/apps/#{application}" }
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorilla-capistrano-recipes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Benny Degezelle
@@ -9,19 +15,23 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-12-15 00:00:00 +01:00
18
+ date: 2010-08-24 00:00:00 +02:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: thoughtbot-shoulda
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
23
32
  version: "0"
24
- version:
33
+ type: :development
34
+ version_requirements: *id001
25
35
  description: This gem allows for a clean Capfile by setting up common capistrano stuff such as Git preferences, Radiant specifics, db dump helpers, passenger or lighty restart, ...
26
36
  email: benny@gorilla-webdesign.be
27
37
  executables: []
@@ -40,6 +50,7 @@ files:
40
50
  - VERSION
41
51
  - gorilla-capistrano-recipes.gemspec
42
52
  - lib/gorilla-capistrano-recipes.rb
53
+ - lib/gorilla-capistrano-recipes/deepmodules.rb
43
54
  - lib/gorilla-capistrano-recipes/deploy.rb
44
55
  - lib/gorilla-capistrano-recipes/lighttpd.rb
45
56
  - lib/gorilla-capistrano-recipes/mysql.rb
@@ -58,21 +69,27 @@ rdoc_options:
58
69
  require_paths:
59
70
  - lib
60
71
  required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
61
73
  requirements:
62
74
  - - ">="
63
75
  - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
64
79
  version: "0"
65
- version:
66
80
  required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
67
82
  requirements:
68
83
  - - ">="
69
84
  - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
70
88
  version: "0"
71
- version:
72
89
  requirements: []
73
90
 
74
91
  rubyforge_project:
75
- rubygems_version: 1.3.5
92
+ rubygems_version: 1.3.7
76
93
  signing_key:
77
94
  specification_version: 3
78
95
  summary: Common capistrano recipes for Gorilla sites