git-runner-deploy 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,5 +16,5 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.require_paths = ["lib"]
18
18
 
19
- gem.add_dependency 'git-runner'
19
+ gem.add_dependency 'git-runner', '>= 0.1.0'
20
20
  end
@@ -7,7 +7,7 @@ module GitRunner
7
7
 
8
8
  # Performs deployments using capistrano (cap deploy)
9
9
  class Deploy < Base
10
- VERSION = '0.0.2'
10
+ VERSION = '0.1.0'
11
11
 
12
12
  attr_accessor :clone_directory
13
13
 
@@ -22,12 +22,7 @@ module GitRunner
22
22
  Text.out(Text.green("Performing Deploy (#{environment_from_branch(branch)})"), :heading)
23
23
 
24
24
  checkout_branch
25
-
26
- if missing_capfile?
27
- Text.out(Text.red("Missing Capfile, unable to complete deploy."))
28
- fail!
29
- end
30
-
25
+ ensure_presence_of_capfile
31
26
  prepare_deploy_environment
32
27
  perform_deploy
33
28
  cleanup_deploy_environment
@@ -37,12 +32,17 @@ module GitRunner
37
32
  Text.out(Text.green("\u2714 Deploy successful, completed in #{(end_time - start_time).ceil} seconds"))
38
33
  end
39
34
 
35
+
36
+ private
40
37
  def branches
41
38
  args.split(/\s+/)
42
39
  end
43
40
 
44
- def missing_capfile?
45
- !File.exists?("#{clone_directory}/Capfile")
41
+ def ensure_presence_of_capfile
42
+ unless File.exists?("#{clone_directory}/Capfile")
43
+ Text.out(Text.red("Missing Capfile, unable to complete deploy."))
44
+ fail!
45
+ end
46
46
  end
47
47
 
48
48
  def uses_bundler?
@@ -86,10 +86,25 @@ module GitRunner
86
86
  "cap deploy"
87
87
  end
88
88
 
89
- execute(
90
- "cd #{clone_directory}",
91
- cap_deploy_command
92
- )
89
+ Text.indent do
90
+ execute(
91
+ "cd #{clone_directory}",
92
+ cap_deploy_command,
93
+ :errproc => method(:cap_deploy_outproc)
94
+ )
95
+ end
96
+ end
97
+
98
+ def cap_deploy_outproc(out)
99
+ if out =~ /executing `(.*)'/
100
+ case $1
101
+ when 'bundle:install'
102
+ Text.out('* Installing gems')
103
+
104
+ when 'deploy:restart'
105
+ Text.out('* Restarting application')
106
+ end
107
+ end
93
108
  end
94
109
 
95
110
  def cleanup_deploy_environment
@@ -100,8 +115,6 @@ module GitRunner
100
115
  )
101
116
  end
102
117
 
103
-
104
- private
105
118
  def environment_from_branch(branch)
106
119
  if branch.name == 'master'
107
120
  'production'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-runner-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-09 00:00:00.000000000 Z
12
+ date: 2012-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: git-runner
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 0.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 0.1.0
30
30
  description: Capistrano deploy module for git-runner
31
31
  email:
32
32
  - james@jamesbrooks.net