Module: Capistrano::Blaze
- Extended by:
- Blaze
- Included in:
- Blaze
- Defined in:
- lib/capistrano/blaze.rb,
lib/capistrano/blaze/version.rb
Constant Summary collapse
- VERSION =
'0.0.1'
Instance Method Summary collapse
- #command ⇒ Object
- #configure(opts = {}) {|@config| ... } ⇒ Object
- #failure(context, exception) ⇒ Object
- #speak(message) ⇒ Object
- #success(context) ⇒ Object
- #test(context) ⇒ Object
- #user ⇒ Object
Instance Method Details
#command ⇒ Object
45 46 47 |
# File 'lib/capistrano/blaze.rb', line 45 def command [ 'cap', *$* ] * ' ' end |
#configure(opts = {}) {|@config| ... } ⇒ Object
11 12 13 14 |
# File 'lib/capistrano/blaze.rb', line 11 def configure(opts = {}) @config = OpenStruct.new(opts) yield @config if block_given? end |
#failure(context, exception) ⇒ Object
29 30 31 |
# File 'lib/capistrano/blaze.rb', line 29 def failure(context, exception) speak ":warning: #{user} failed to deploy to the #{context.stage} stage of #{context.application}, via `#{command}`: #{exception.to_s} (#{exception.class.inspect})" end |
#speak(message) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/capistrano/blaze.rb', line 16 def speak() port = @config.ssl ? 443 : 80 req = Net::HTTP::Post.new("/room/#{@config.room_id}/speak.json") req.basic_auth @config.token, 'X' req.body = { :message => { :body => } }.to_json req.content_type = "application/json" res = Net::HTTP.start("#{@config.account}.campfirenow.com", port, :use_ssl => @config.ssl) do |http| http.request(req) end end |
#success(context) ⇒ Object
33 34 35 |
# File 'lib/capistrano/blaze.rb', line 33 def success(context) speak "#{user} succesfully deployed to the #{context.stage} stage of #{context.application}, via `#{command}`" end |
#test(context) ⇒ Object
41 42 43 |
# File 'lib/capistrano/blaze.rb', line 41 def test(context) speak ":heart: #{context.application}!" end |
#user ⇒ Object
37 38 39 |
# File 'lib/capistrano/blaze.rb', line 37 def user `whoami`.strip end |