git_manager 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/config/email.yml +7 -0
- data/lib/git_manager.rb +54 -14
- metadata +8 -4
data/config/email.yml
ADDED
data/lib/git_manager.rb
CHANGED
@@ -1,27 +1,67 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
1
|
+
# example usage
|
2
|
+
# Git::Blames::Pending.new(
|
3
|
+
# :root => <root folder where build logs are located>
|
4
|
+
# :rspec => boolean specifying whether or
|
5
|
+
# not you want to run rspec now to get pending specs
|
6
|
+
# ).blame( :email => true )
|
7
|
+
# for emailing create a config/email.yml file as specified
|
8
|
+
# in this gems own config/email.yml file
|
9
|
+
# example usage
|
10
|
+
# Git::Managed::Branch.new.delete_branches
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require 'net/smtp'
|
14
|
+
require 'yaml'
|
9
15
|
|
10
16
|
module Git
|
17
|
+
module Emails
|
18
|
+
def load_configuration
|
19
|
+
config = YAML::load_file('./config/email.yml')
|
20
|
+
@email_from = config['authentication']['from']
|
21
|
+
@email_password = config['authentication']['password']
|
22
|
+
@email_mappings = config['users']
|
23
|
+
end
|
24
|
+
|
25
|
+
def send_gmail options
|
26
|
+
load_configuration
|
27
|
+
recipients = options[:recipients]
|
28
|
+
msg = "Subject: #{options[:subject]}\n\n#{options[:message]}"
|
29
|
+
smtp = Net::SMTP.new 'smtp.gmail.com', 587
|
30
|
+
smtp.enable_starttls
|
31
|
+
smtp.start( '', @email_from, @email_password, :login ) do
|
32
|
+
smtp.send_message(msg, @email_from, recipients.map{ |recipient| @email_mappings[recipient]})
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
11
37
|
module Managed
|
12
38
|
class Branch
|
13
39
|
end
|
14
40
|
end
|
41
|
+
|
15
42
|
module Blames
|
16
|
-
|
43
|
+
include Git::Emails
|
44
|
+
def blame(options = nil)
|
17
45
|
self.tasks.each_pair do |key, attributes|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
46
|
+
if options.nil? || !options[:email]
|
47
|
+
stdout key, attributes
|
48
|
+
else
|
49
|
+
send_gmail :recipients => attributes[:contributors],
|
50
|
+
:subject => "Please collaborate to fix spec: " +
|
51
|
+
"#{attributes[:spec_file]} : " +
|
52
|
+
"#{attributes[:line_number]}",
|
53
|
+
:message => "Spec Details:\n " +
|
54
|
+
"#{attributes[:details].join('\n')}"
|
55
|
+
end
|
23
56
|
end
|
24
57
|
end
|
58
|
+
def stdout
|
59
|
+
puts "\nPending Spec Information:"
|
60
|
+
puts " Description: #{key}"
|
61
|
+
puts " Contributors: #{attributes[:contributors].join(', ')}"
|
62
|
+
puts " File: #{attributes[:spec_file]}"
|
63
|
+
puts " Line: #{attributes[:line_number]}\n"
|
64
|
+
end
|
25
65
|
class Pending
|
26
66
|
end
|
27
67
|
class Blame
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kikuchiyo
|
@@ -18,7 +18,10 @@ cert_chain: []
|
|
18
18
|
date: 2012-08-21 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
|
-
description:
|
21
|
+
description: |-
|
22
|
+
delete old git branches and blame pending specs
|
23
|
+
for e-mailing: requires config/email.yml file in root directory
|
24
|
+
for using build logs make sure you pass path to Git::Blames::Pending.new through :root parameter
|
22
25
|
email: kikuchiyo6@gmail.com
|
23
26
|
executables: []
|
24
27
|
|
@@ -29,6 +32,7 @@ extra_rdoc_files: []
|
|
29
32
|
files:
|
30
33
|
- lib/git_manager.rb
|
31
34
|
- lib/logs/2012-08-21_00-00-01
|
35
|
+
- config/email.yml
|
32
36
|
- spec/git_manager_spec.rb
|
33
37
|
homepage: http://rubygems.org/gems/git_manager
|
34
38
|
licenses: []
|