HeSYINUvSBZfxqA-capistrano_log 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ examples/campfire.rb
data/Capfile ADDED
@@ -0,0 +1,14 @@
1
+ # Only needed in development
2
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
3
+ require 'capistrano/log_with_awesome'
4
+
5
+ # Load the example
6
+ Dir['examples/*.rb'].each { |plugin| load(plugin) }
7
+
8
+ # Stub deploy tasks to demonstrate the awesome
9
+ server 'localhost', :local
10
+ set :application, 'test'
11
+ set :deploy_to, '/tmp'
12
+ task :deploy do
13
+ run "uname -a"
14
+ end
@@ -0,0 +1,56 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{HeSYINUvSBZfxqA-capistrano_log}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jesse Newland"]
12
+ s.date = %q{2010-05-26}
13
+ s.description = %q{logging callbacks for capistrano}
14
+ s.email = %q{jnewland@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "Capfile",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "HeSYINUvSBZfxqA-capistrano_log.gemspec",
26
+ "examples/campfire.rb.example",
27
+ "examples/raise.rb",
28
+ "examples/upload.rb",
29
+ "lib/capistrano-log_with_awesome.rb",
30
+ "lib/capistrano/log_with_awesome.rb",
31
+ "lib/capistrano/log_with_awesome/version.rb"
32
+ ]
33
+ s.homepage = %q{http://github.com/jnewland/capistrano-log_with_awesome}
34
+ s.rdoc_options = ["--charset=UTF-8"]
35
+ s.require_paths = ["lib"]
36
+ s.rubygems_version = %q{1.3.6}
37
+ s.summary = %q{logging callbacks for capistrano}
38
+ s.test_files = [
39
+ "examples/raise.rb",
40
+ "examples/upload.rb"
41
+ ]
42
+
43
+ if s.respond_to? :specification_version then
44
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
48
+ s.add_runtime_dependency(%q<HeSYINUvSBZfxqA-capistrano>, [">= 2.5.14"])
49
+ else
50
+ s.add_dependency(%q<HeSYINUvSBZfxqA-capistrano>, [">= 2.5.14"])
51
+ end
52
+ else
53
+ s.add_dependency(%q<HeSYINUvSBZfxqA-capistrano>, [">= 2.5.14"])
54
+ end
55
+ end
56
+
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Jesse Newland
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,55 @@
1
+ = capistrano-log_with_awesome
2
+
3
+ Awesome callbacks for capistrano logging.
4
+
5
+ Install the gem:
6
+
7
+ gem install capistrano-log_with_awesome
8
+
9
+ Require the gem in your <tt>config/deploy.rb</tt> or <tt>Capfile</tt>:
10
+
11
+ require 'capistrano/log_with_awesome'
12
+
13
+ Want to upload the full log to a directory after a deploy?
14
+
15
+ on :exit do
16
+ put full_log, "#{deploy_to}/shared/log/last_deploy.log"
17
+ end
18
+
19
+ Want to halt deploy if a command you're running generates output you don't
20
+ like but returns a status code of 0?
21
+
22
+ on :log_message do
23
+ raise Exception if message =~ /oh snap/
24
+ end
25
+
26
+ Want to pipe your capistrano log to Campfire?
27
+
28
+ require 'tinder'
29
+ campfire = Tinder::Campfire.new 'yourdomain', :ssl => true
30
+ campfire.login 'APIKEY', 'X'
31
+ set :room, campfire.find_room_by_name('Log')
32
+
33
+ # Paste the full log to Campfire after a deploy
34
+ on :exit do
35
+ room.paste full_log
36
+ end
37
+
38
+ # Log every single cap log line to Campfire, as it happens. Insane.
39
+ on :log_message do
40
+ room.speak message
41
+ end
42
+
43
+ == Note on Patches/Pull Requests
44
+
45
+ * Fork the project.
46
+ * Make your feature addition or bug fix.
47
+ * Add tests for it. This is important so I don't break it in a
48
+ future version unintentionally.
49
+ * Commit, do not mess with rakefile, version, or history.
50
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
51
+ * Send me a pull request. Bonus points for topic branches.
52
+
53
+ == Copyright
54
+
55
+ Copyright (c) 2010 Jesse Newland. See LICENSE for details.
@@ -0,0 +1,21 @@
1
+ $LOAD_PATH.unshift 'lib'
2
+ require 'capistrano/log_with_awesome/version'
3
+ require 'rake'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.version = Capistrano::LogWithAwesome::VERSION
9
+ gem.name = "capistrano-log_with_awesome"
10
+ gem.summary = %Q{logging callbacks for capistrano}
11
+ gem.description = %Q{logging callbacks for capistrano}
12
+ gem.email = "jnewland@gmail.com"
13
+ gem.homepage = "http://github.com/jnewland/capistrano-log_with_awesome"
14
+ gem.authors = ["Jesse Newland"]
15
+ gem.add_dependency "capistrano", ">= 2.5.14"
16
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
+ end
18
+ Jeweler::GemcutterTasks.new
19
+ rescue LoadError
20
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
+ end
@@ -0,0 +1,15 @@
1
+ require 'json'
2
+ require 'tinder'
3
+ campfire = Tinder::Campfire.new 'yourdomain', :ssl => true
4
+ campfire.login 'APIKEY', 'X'
5
+ set :room, campfire.find_room_by_name('Log')
6
+
7
+ # Paste the full log to Campfire after a deploy
8
+ on :exit do
9
+ room.paste full_log
10
+ end
11
+
12
+ # Log every single cap log line to Campfire, as it happens. Insane.
13
+ on :log_message do
14
+ room.speak message
15
+ end
@@ -0,0 +1,4 @@
1
+ on :log_message do
2
+ # Raise an exception and halt the deploy if you're on an ATT 3G card
3
+ raise Exception if message =~ /mycingular/
4
+ end
@@ -0,0 +1,3 @@
1
+ on :exit do
2
+ put full_log, "#{deploy_to}/deploy.log"
3
+ end
@@ -0,0 +1 @@
1
+ require 'capistrano/log_with_awesome'
@@ -0,0 +1,60 @@
1
+ require 'capistrano'
2
+
3
+ module Capistrano
4
+ class LogWithAwesome < Capistrano::Logger
5
+ #replaces the built in Capistrano logger with awesome
6
+ def self.init(config)
7
+ @config = config
8
+ level = @config.logger.level
9
+ @config.logger = new
10
+ @config.logger.level = level
11
+ end
12
+
13
+ def self.log_with_awesome(message)
14
+ @buffer ||= []
15
+ @buffer << message
16
+ @config.set :message, message
17
+ @config.set :full_log, @buffer.join("\n")
18
+ @config.silently_trigger(:log_message)
19
+ end
20
+
21
+ # Log and do awesome things
22
+ # I wish there was a nicer way to do this. Hax on device.puts, maybe?
23
+ def log(level, message, line_prefix=nil)
24
+ if level <= self.level
25
+ indent = "%*s" % [Capistrano::Logger::MAX_LEVEL, "*" * (Capistrano::Logger::MAX_LEVEL - level)]
26
+ (RUBY_VERSION >= "1.9" ? message.lines : message).each do |line|
27
+ if line_prefix
28
+ self.class.log_with_awesome "#{indent} [#{line_prefix}] #{line.strip}"
29
+ else
30
+ self.class.log_with_awesome "#{indent} #{line.strip}"
31
+ end
32
+ end
33
+ end
34
+ super(level, message, line_prefix)
35
+ end
36
+ end
37
+ end
38
+
39
+ module Capistrano
40
+ class Configuration
41
+ module Callbacks
42
+ # Trigger the named event without logging.it
43
+ def silently_trigger(event, task=nil)
44
+ pending = Array(callbacks[event]).select { |c| c.applies_to?(task) }
45
+ if pending.any?
46
+ pending.each { |callback| callback.call }
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ # load last in order to repoen rather than define
54
+ require 'capistrano/log_with_awesome/version'
55
+
56
+ if Capistrano::Configuration.instance
57
+ Capistrano::Configuration.instance.load do
58
+ Capistrano::LogWithAwesome.init(self)
59
+ end
60
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ class LogWithAwesome
3
+ VERSION = '0.0.2'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: HeSYINUvSBZfxqA-capistrano_log
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: ruby
12
+ authors:
13
+ - Jesse Newland
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-05-26 00:00:00 +00:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 7
28
+ segments:
29
+ - 2
30
+ - 5
31
+ - 14
32
+ version: 2.5.14
33
+ prerelease: false
34
+ type: :runtime
35
+ requirement: *id001
36
+ name: HeSYINUvSBZfxqA-capistrano
37
+ description: logging callbacks for capistrano
38
+ email: jnewland@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE
45
+ - README.rdoc
46
+ files:
47
+ - .gitignore
48
+ - Capfile
49
+ - LICENSE
50
+ - README.rdoc
51
+ - Rakefile
52
+ - HeSYINUvSBZfxqA-capistrano_log.gemspec
53
+ - examples/campfire.rb.example
54
+ - examples/raise.rb
55
+ - examples/upload.rb
56
+ - lib/capistrano-log_with_awesome.rb
57
+ - lib/capistrano/log_with_awesome.rb
58
+ - lib/capistrano/log_with_awesome/version.rb
59
+ has_rdoc: true
60
+ homepage: http://github.com/jnewland/capistrano-log_with_awesome
61
+ licenses: []
62
+
63
+ post_install_message:
64
+ rdoc_options:
65
+ - --charset=UTF-8
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ hash: 3
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ requirements: []
87
+
88
+ rubyforge_project:
89
+ rubygems_version: 1.6.2
90
+ signing_key:
91
+ specification_version: 3
92
+ summary: logging callbacks for capistrano
93
+ test_files:
94
+ - examples/raise.rb
95
+ - examples/upload.rb