snitch 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,8 @@
1
- 0.1.2 - 10/10/2007
1
+ 0.1.4 - 12/12/2007
2
+ * added email service (patch from Nolan Eakins)
3
+ 0.1.3 & 0.1.2 - 10/10/2007
2
4
  * corrected dependencies
3
- * TODO: make generator for config and post-commit files, allow optional passing of project name to snitch
4
-
5
5
  0.1.1 - 3/25/2007
6
6
  * added documentation; the first release didn't have hardly any
7
-
8
7
  0.1.0 - 3/25/2007
9
8
  * initial release of snitch
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2007 John Nunemaker
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ CHANGELOG.txt
2
+ MIT-LICENSE
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ TODO.txt
7
+ bin/snitch
8
+ lib/snitch.rb
9
+ lib/snitch/base.rb
10
+ lib/snitch/config.rb
11
+ lib/snitch/exceptions.rb
12
+ lib/snitch/patches/hash.rb
13
+ lib/snitch/patches/tinder.rb
14
+ lib/snitch/service.rb
15
+ lib/snitch/services/campfire.rb
16
+ lib/snitch/services/email.rb
17
+ lib/snitch/services/twitter.rb
18
+ lib/snitch/svnlook.rb
19
+ lib/snitch/version.rb
20
+ setup.rb
21
+ test/test_helper.rb
22
+ test/unit/base_test.rb
23
+ test/unit/service_test.rb
24
+ test/unit/services/campfire_test.rb
25
+ test/unit/services/email_test.rb
26
+ test/unit/services/twitter_test.rb
27
+ test/unit/svnlook_test.rb
28
+ website/css/common.css
29
+ website/images/campfire.gif
30
+ website/images/twitter.gif
31
+ website/index.html
data/Rakefile CHANGED
@@ -49,7 +49,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
49
49
 
50
50
  # == Optional
51
51
  #p.changes - A description of the release's latest changes.
52
- p.extra_deps = [['twitter', '0.2.0'], ['tinder', '0.1.4'], ['activesupport', '1.4.2']]
52
+ p.extra_deps = ['twitter', 'tinder', 'activesupport', 'tmail']
53
53
  #p.spec_extras - A hash of extra values to set in the gemspec.
54
54
  end
55
55
 
@@ -75,4 +75,4 @@ task :check_version do
75
75
  puts "Please update your version.rb to match the release version, currently #{VERS}"
76
76
  exit
77
77
  end
78
- end
78
+ end
@@ -0,0 +1 @@
1
+ * make generator for config and post-commit files, allow optional passing of project name to snitch
@@ -9,6 +9,7 @@ require 'snitch/patches/hash'
9
9
  require 'snitch/patches/tinder'
10
10
  require 'snitch/service'
11
11
  require 'snitch/services/campfire'
12
+ require 'snitch/services/email'
12
13
  require 'snitch/services/twitter'
13
14
  require 'snitch/svnlook'
14
- require 'snitch/version'
15
+ require 'snitch/version'
@@ -39,9 +39,21 @@ services:
39
39
  :twitter:
40
40
  :login:
41
41
  :password:
42
+ :email:
43
+ # You mail server settings:
44
+ :host:
45
+ :server: localhost
46
+ :port: 25
47
+ # Your login creds:
48
+ :login:
49
+ :password:
50
+ :method: :login
51
+ # Our email addresses:
52
+ :from: Snitch <root@localhost>
53
+ :to:
42
54
  EOF
43
55
  File.open(config_file_path, 'w') { |f| f.write snitch_config_tpl } unless File.exists?(config_file_path)
44
56
  end
45
57
  end
46
58
  end
47
- end
59
+ end
@@ -0,0 +1,48 @@
1
+ require 'snitch/service'
2
+ require 'tmail'
3
+ require 'net/smtp'
4
+
5
+ module Snitch
6
+ module Services
7
+ class Email < Service
8
+
9
+ # Sets the prefferred commit message length to <tt>:long</tt>
10
+ self.message_length = :long
11
+
12
+ def initialize(*args)
13
+ super(*args)
14
+ end
15
+
16
+ # Sends the email
17
+ def tattle(message)
18
+ send_email(create_email(message))
19
+ end
20
+
21
+ def send_email(email)
22
+ email_opts = %W(server port host login password auth_method).collect { |attr| lookup(attr) }
23
+
24
+ Net::SMTP.start(*email_opts) do |smtp|
25
+ smtp.send_message(email.to_s, from, to)
26
+ end
27
+ end
28
+
29
+ def create_email(message)
30
+ mail = TMail::Mail.new
31
+ mail.to = to
32
+ mail.from = from
33
+ mail.subject = message[0, message.index("\n") || message.length]
34
+ mail.date = Time.now
35
+ mail.set_content_type 'text', 'plain'
36
+ mail.body = message
37
+ mail
38
+ end
39
+
40
+ def lookup(var)
41
+ self.send(var)
42
+ rescue NameError
43
+ nil
44
+ end
45
+
46
+ end
47
+ end
48
+ end
@@ -26,10 +26,12 @@ module Snitch
26
26
  look(:author).chop
27
27
  end
28
28
 
29
- # Returns a best guess of the projects name. Assumes that most will be /some/path/to/cabin/repos/.
30
- # Using the aforementioned path, this would return cabin as the project name.
29
+ # Returns a best guess of the projects name. Assumes that most will be
30
+ # /some/path/to/cabin/repos/ or /some/path/to/cabin. Will grab the last
31
+ # two folders in the path and remove any that are equal to "repos".
31
32
  def project
32
- @project ||= repository.split('/')[-2]
33
+ # @project ||= repository.split('/')[-2]
34
+ @project ||= repository.split('/')[-2, 2].detect { |a| a != 'repos' }
33
35
  end
34
36
 
35
37
  # Returns the message entered with the committed revision
@@ -2,7 +2,7 @@ module Snitch #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -0,0 +1,31 @@
1
+ require File.dirname(__FILE__) + '/../../test_helper'
2
+
3
+ class EmailTest < Test::Unit::TestCase
4
+ def setup
5
+ @config = CONFIG[:services][:email]
6
+ @service = Snitch::Services::Email.new(@config)
7
+ end
8
+
9
+ test 'should have attributes' do
10
+ assert_equal @config, @service.attributes
11
+ end
12
+
13
+ test "should make the email's body the commit message"
14
+
15
+ test "should set the To field to what's in the config"
16
+
17
+ test "should set the From field with what's in the config"
18
+
19
+ test "should connect to the server in the config"
20
+
21
+ test "should connect on the port in the config"
22
+
23
+ test "should login using the login and password config options"
24
+
25
+ test "should use the authentication method from the config"
26
+
27
+ test "should use the host from the config as the mail server's name"
28
+
29
+ test "should tattle by sending the email"
30
+
31
+ end
@@ -0,0 +1,47 @@
1
+ @media screen, projection {
2
+ /*
3
+ Copyright (c) 2007, Yahoo! Inc. All rights reserved.
4
+ Code licensed under the BSD License:
5
+ http://developer.yahoo.net/yui/license.txt
6
+ version: 2.2.0
7
+ */
8
+ body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;}
9
+ body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}/*ol,ul {list-style:none;}*/caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;}
10
+ /* end of yahoo reset and fonts */
11
+
12
+ body {color:#333; background:#4b1a1a; line-height:1.3;}
13
+ p {margin:0 0 20px;}
14
+ a {color:#4b1a1a;}
15
+ a:hover {text-decoration:none;}
16
+ strong {font-weight:bold;}
17
+ em {font-style:italics;}
18
+ h1,h2,h3,h4,h5,h6 {font-weight:bold;}
19
+ h1 {font-size:197%; margin:30px 0; color:#4b1a1a;}
20
+ h2 {font-size:174%; margin:20px 0; color:#b8111a;}
21
+ h3 {font-size:152%; margin:10px 0;}
22
+ h4 {font-size:129%; margin:10px 0;}
23
+ pre {background:#eee; padding:20px; border:1px solid #ccc; font-size:100%; overflow:auto;}
24
+ code {font-size:100%; margin:0; padding:0;}
25
+ ul, ol {margin:10px 0 10px 25px;}
26
+ ol li {margin:0 0 10px;}
27
+
28
+
29
+
30
+
31
+
32
+ div#wrapper {background:#fff; width:560px; margin:0 auto; padding:20px; border:10px solid #bc8c46; border-width:0 10px;}
33
+ div#header {position:relative; border-bottom:1px dotted; margin:0 0 10px; padding:0 0 10px;}
34
+ div#header p {margin:0; padding:0;}
35
+ div#header h1 {margin:0; padding:0;}
36
+ ul#nav {position:absolute; top:0; right:0; list-style:none; margin:0; padding:0;}
37
+ ul#nav li {display:inline; padding:0 0 0 5px;}
38
+ ul#nav li a {}
39
+ div#content {}
40
+ div#footer {margin:40px 0 0; border-top:1px dotted; padding:10px 0 0;}
41
+
42
+
43
+
44
+
45
+
46
+
47
+ }
@@ -0,0 +1,87 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5
+ <title>Snitch by John Nunemaker</title>
6
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
7
+ </head>
8
+ <body>
9
+
10
+ <div id="wrapper">
11
+ <div id="header">
12
+ <h1>Snitch</h1>
13
+ <p>Drop dead easy subversion commit notifications.</p>
14
+
15
+ <ul id="nav">
16
+ <li><a href="snitch/">Docs</a></li>
17
+ <li><a href="http://rubyforge.org/projects/snitch/">Rubyforge Page</a></li>
18
+ </ul>
19
+ </div>
20
+
21
+ <div id="content">
22
+ <p>Snitch is an subversion post-commit service integration helper. I just made that up. Subversion has a post-commit hook which is executed each time you commit a change to a repository. Snitch makes it really easy to hook into the post-commit and send the commit message along with the files changed to various services on the web. </p>
23
+
24
+ <p>Currently, snitch works with <a href="http://campfirenow.com">campfire</a> and <a href="http://twitter.com">twitter</a>. I'll be adding in SMS, email, some day but feel free to do it yourself and send me a patch.</p>
25
+
26
+ <h2>Screenshots</h2>
27
+ <h3>Campfire</h3>
28
+ <p><img src="images/campfire.gif" alt="Campfire Snitch Screenshot" /></p>
29
+ <h3>Twitter</h3>
30
+ <p><img src="images/twitter.gif" alt="Twitter Snitch Screenshot" /></p>
31
+
32
+ <h2>Installation</h2>
33
+
34
+ <ol>
35
+ <li>sudo gem install hpricot</li>
36
+ <li>sudo gem install twitter tinder snitch</li>
37
+ <li>
38
+ <p>Create a configuration file (default is /home/deploy/.snitch) that looks like the following (be sure to fill in all the values). Be sure that none of the tabs from below get stay in the config file. It gets parse by yaml so formatting is important.</p>
39
+
40
+ <pre><code># what is the location of svnlook
41
+ # you can find this on *nix boxes by typing: which svnlook
42
+ svnlook: /usr/bin/svnlook
43
+
44
+ # what services would you like to send commit messages to?
45
+ services:
46
+ :campfire:
47
+ :subdomain:
48
+ :login:
49
+ :password:
50
+ :room: Development
51
+ :twitter:
52
+ :login:
53
+ :password: </code></pre>
54
+ </li>
55
+ <li>
56
+ <p>Create or edit the post-commit file inside your repository to look like the following. Be sure to edit the CONFIG_FILE variable to wherever you created your config file in step 3.</p>
57
+
58
+ <pre><code>#!/bin/sh
59
+ REPOS="$1"
60
+ REV="$2"
61
+ CONFIG_FILE="/home/deploy/.snitch"
62
+
63
+ snitch $REPOS $REV $CONFIG_FILE 2> /tmp/snitch</code></pre>
64
+ </li>
65
+ </ol>
66
+
67
+ <h2>Support</h2>
68
+ <p>Please leave all support requests and suggestions at the <a href="http://groups.google.com/group/ruby-snitch-gem">google group</a>.</p>
69
+ </div>
70
+
71
+ <div id="footer">
72
+ <p>Created by <a href="http://addictedtonew.com/about/">John Nunemaker</a> (with ideas from <a href="http://90percentgravity.com">Bill Harle</a> and <a href="http://grundyhome.com">Chas Grundy</a>)</a></p>
73
+ </div>
74
+
75
+ </div>
76
+
77
+ <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
78
+ <script type="text/javascript">
79
+ _uacct = "UA-85301-8";
80
+ urchinTracker();
81
+ </script>
82
+
83
+ <!-- 103bees.com 'bee' code v1.11 - please do not make any changes! -->
84
+ <script type="text/javascript" src="http://103bees.com/bees/?bee=3672&amp;fid=5537"></script>
85
+ <!-- 103bees.com 'bee' code -->
86
+ </body>
87
+ </html>
metadata CHANGED
@@ -1,38 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: snitch
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.1.3
7
- date: 2007-10-23 00:00:00 -04:00
8
- summary: Makes tattling on your svn commits to other services simple
9
- require_paths:
10
- - lib
11
- email: nunemaker@gmail.com
12
- homepage: http://snitch.rubyforge.org
13
- rubyforge_project: snitch
14
- description: Makes tattling on your svn commits to other services simple
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
25
- platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
4
+ version: 0.1.4
5
+ platform: ""
29
6
  authors:
30
7
  - John Nunemaker
31
- files:
32
- - Rakefile
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2007-12-12 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: twitter
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: tinder
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: "0"
32
+ version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: activesupport
35
+ version_requirement:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: "0"
41
+ version:
42
+ - !ruby/object:Gem::Dependency
43
+ name: tmail
44
+ version_requirement:
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ description: Makes tattling on your svn commits to other services simple
52
+ email: nunemaker@gmail.com
53
+ executables:
54
+ - snitch
55
+ extensions: []
56
+
57
+ extra_rdoc_files:
58
+ - CHANGELOG.txt
59
+ - Manifest.txt
33
60
  - README.txt
61
+ - TODO.txt
62
+ files:
34
63
  - CHANGELOG.txt
35
- - setup.rb
64
+ - MIT-LICENSE
65
+ - Manifest.txt
66
+ - README.txt
67
+ - Rakefile
68
+ - TODO.txt
69
+ - bin/snitch
36
70
  - lib/snitch.rb
37
71
  - lib/snitch/base.rb
38
72
  - lib/snitch/config.rb
@@ -41,59 +75,53 @@ files:
41
75
  - lib/snitch/patches/tinder.rb
42
76
  - lib/snitch/service.rb
43
77
  - lib/snitch/services/campfire.rb
78
+ - lib/snitch/services/email.rb
44
79
  - lib/snitch/services/twitter.rb
45
80
  - lib/snitch/svnlook.rb
46
81
  - lib/snitch/version.rb
82
+ - setup.rb
47
83
  - test/test_helper.rb
48
84
  - test/unit/base_test.rb
49
85
  - test/unit/service_test.rb
50
86
  - test/unit/services/campfire_test.rb
87
+ - test/unit/services/email_test.rb
51
88
  - test/unit/services/twitter_test.rb
52
89
  - test/unit/svnlook_test.rb
53
- - bin/snitch
90
+ - website/css/common.css
91
+ - website/images/campfire.gif
92
+ - website/images/twitter.gif
93
+ - website/index.html
94
+ has_rdoc: true
95
+ homepage: http://snitch.rubyforge.org
96
+ post_install_message:
97
+ rdoc_options:
98
+ - --main
99
+ - README.txt
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: "0"
107
+ version:
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: "0"
113
+ version:
114
+ requirements: []
115
+
116
+ rubyforge_project: snitch
117
+ rubygems_version: 0.9.5
118
+ signing_key:
119
+ specification_version: 2
120
+ summary: Makes tattling on your svn commits to other services simple
54
121
  test_files:
55
122
  - test/unit/base_test.rb
56
123
  - test/unit/service_test.rb
57
124
  - test/unit/services/campfire_test.rb
125
+ - test/unit/services/email_test.rb
58
126
  - test/unit/services/twitter_test.rb
59
127
  - test/unit/svnlook_test.rb
60
- rdoc_options:
61
- - --main
62
- - README.txt
63
- extra_rdoc_files:
64
- - README.txt
65
- - CHANGELOG.txt
66
- executables:
67
- - snitch
68
- extensions: []
69
-
70
- requirements: []
71
-
72
- dependencies:
73
- - !ruby/object:Gem::Dependency
74
- name: twitter
75
- version_requirement:
76
- version_requirements: !ruby/object:Gem::Version::Requirement
77
- requirements:
78
- - - "="
79
- - !ruby/object:Gem::Version
80
- version: 0.2.0
81
- version:
82
- - !ruby/object:Gem::Dependency
83
- name: tinder
84
- version_requirement:
85
- version_requirements: !ruby/object:Gem::Version::Requirement
86
- requirements:
87
- - - "="
88
- - !ruby/object:Gem::Version
89
- version: 0.1.4
90
- version:
91
- - !ruby/object:Gem::Dependency
92
- name: activesupport
93
- version_requirement:
94
- version_requirements: !ruby/object:Gem::Version::Requirement
95
- requirements:
96
- - - "="
97
- - !ruby/object:Gem::Version
98
- version: 1.4.2
99
- version: