Module: Capistrano::ReleaseParty
- Includes:
- Announce
- Defined in:
- lib/release_party/release_party.rb
Class Method Summary collapse
- .extended(configuration) ⇒ Object
-
.instance(party = nil, cap_config = nil) {|@env| ... } ⇒ Object
Singleton instance of the release party environment.
Methods included from Announce
Class Method Details
.extended(configuration) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/release_party/release_party.rb', line 26 def self.extended(configuration) configuration.load do before 'deploy', 'release_party:starting' after 'deploy', 'release_party:finished' namespace :release_party do task :starting do env = Capistrano::ReleaseParty.instance(Capistrano::ReleaseParty, configuration) do |environment| begin environment.load_release_file rescue ReleaseFile::FileNotFoundError => error announce error. end end announce "Beginning deployment, project details obtained." # Record when the release began env.release_started = Time.now # Load all the celebrations env.celebrations = \ Celebration.celebrations.collect do |celebration_class| begin celebration_class.new(env).tap(&:before_deploy) rescue LoadError => error announce "Unable to load #{celebration_class}, message: #{error.} you may have to install a gem" rescue ArgumentError => error announce error. end end.compact self end task :finished do env = Capistrano::ReleaseParty.instance announce "Performing post deploy celebrations!" # Record when the release finished env.release_finished = Time.now # Do after deploy env.celebrations.each(&:after_deploy) self end end end end |
.instance(party = nil, cap_config = nil) {|@env| ... } ⇒ Object
Singleton instance of the release party environment
16 17 18 19 20 21 22 23 24 |
# File 'lib/release_party/release_party.rb', line 16 def self.instance(party = nil, cap_config = nil, &block) return @env unless @env.nil? raise ArgumentError, "Release finished without being started" if party.nil? || cap_config.nil? @env = Environment.new party, cap_config yield(@env) if block_given? @env end |