inploy 1.6.7 → 1.6.8

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
5
5
  require 'spec/rake/spectask'
6
6
 
7
7
  GEM = "inploy"
8
- GEM_VERSION = "1.6.7"
8
+ GEM_VERSION = "1.6.8"
9
9
  SUMMARY = "Rails deployment made easy"
10
10
  AUTHOR = "Diego Carrion"
11
11
  EMAIL = "dc.rec1@gmail.com"
data/lib/inploy/deploy.rb CHANGED
@@ -4,7 +4,9 @@ module Inploy
4
4
  include DSL
5
5
 
6
6
  attr_accessor :repository, :user, :application, :hosts, :path, :ssh_opts, :branch, :environment,
7
- :port, :skip_steps, :cache_dirs, :sudo
7
+ :port, :skip_steps, :cache_dirs, :sudo
8
+
9
+ define_callbacks :after_setup, :before_restarting_server
8
10
 
9
11
  def initialize
10
12
  self.server = :passenger
@@ -47,6 +49,7 @@ module Inploy
47
49
  rake "db:create RAILS_ENV=#{environment}"
48
50
  run "./init.sh" if file_exists?("init.sh")
49
51
  after_update_code
52
+ callback :after_setup
50
53
  end
51
54
 
52
55
  def remote_update
@@ -62,10 +65,6 @@ module Inploy
62
65
  after_update_code
63
66
  end
64
67
 
65
- def before_restarting_server(&block)
66
- @before_restarting_server = block
67
- end
68
-
69
68
  def update_code
70
69
  run "git pull origin #{branch}"
71
70
  end
@@ -93,7 +92,7 @@ module Inploy
93
92
  rake_if_included "asset:packager:build_all"
94
93
  rake_if_included "hoptoad:deploy RAILS_ENV=#{environment} TO=#{environment} REPO=#{repository} REVISION=#{`git log | head -1 | cut -d ' ' -f 2`}"
95
94
  ruby_if_exists "vendor/plugins/newrelic_rpm/bin/newrelic_cmd", :params => "deployments"
96
- instance_eval(&@before_restarting_server) unless @before_restarting_server.nil?
95
+ callback :before_restarting_server
97
96
  restart_server
98
97
  end
99
98
  end
data/lib/inploy/dsl.rb CHANGED
@@ -1,5 +1,24 @@
1
1
  module Inploy
2
2
  module DSL
3
+ module ClassMethods
4
+ def define_callbacks(*callbacks)
5
+ callbacks.each do |callback|
6
+ define_method callback do |&block|
7
+ instance_variable_set "@#{callback}", block
8
+ end
9
+ end
10
+ end
11
+ end
12
+
13
+ def self.included(base)
14
+ base.extend ClassMethods
15
+ end
16
+
17
+ def callback(name)
18
+ instance_variable = instance_variable_get("@#{name.to_s}")
19
+ instance_eval(&instance_variable) unless instance_variable.nil?
20
+ end
21
+
3
22
  def create_folder(path)
4
23
  run "mkdir -p #{path}"
5
24
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 6
8
- - 7
9
- version: 1.6.7
8
+ - 8
9
+ version: 1.6.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Diego Carrion
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-15 00:00:00 -03:00
17
+ date: 2010-08-18 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies: []
20
20