yapt 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yapt.rb +47 -0
- data/lib/yapt/config.rb +4 -6
- data/lib/yapt/templates/for_git_display.erb +5 -0
- data/lib/yapt/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c87d64d0ea7777eb448747137bb77d4d30bc8dcb
|
4
|
+
data.tar.gz: 2b087b18bb83f290a284376de2cf9c90804bce04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66c0e55c57689ed2049a1f20d20b9fcd91f9473db64a86d07a4bbfb8166b56e91db8ae3702b1a07ba14b8a80dff58dcfc454fadec0245f82a4023569b90ad648
|
7
|
+
data.tar.gz: bade0f8237011b9e37dd381c957340b5193cd9ceb504e5599b31639fb731783f13c699d1181e93fe5b68f760b1c9452a59524d125b92c08ecb54b10a8955659c
|
data/lib/yapt.rb
CHANGED
@@ -24,6 +24,10 @@ module Yapt
|
|
24
24
|
config.api_token
|
25
25
|
end
|
26
26
|
|
27
|
+
def self.github_url_base
|
28
|
+
config.github_url_base
|
29
|
+
end
|
30
|
+
|
27
31
|
def self.cache_duration
|
28
32
|
3600
|
29
33
|
end
|
@@ -36,6 +40,45 @@ module Yapt
|
|
36
40
|
Member.find(id)
|
37
41
|
end
|
38
42
|
|
43
|
+
class GitLogShiv
|
44
|
+
def self.find(since_until)
|
45
|
+
result = `git log #{since_until}`
|
46
|
+
commits = result.split(/^commit/).reverse.collect {|c| "commit#{c}" }
|
47
|
+
commits.pop if commits.last == 'commit'
|
48
|
+
commits.collect {|c| new(c) }
|
49
|
+
end
|
50
|
+
|
51
|
+
attr_reader :sha, :author, :tracker_ids, :message
|
52
|
+
def initialize(message)
|
53
|
+
lines = message.split("\n")
|
54
|
+
@sha = lines.first[/\w+$/].strip
|
55
|
+
author_line = lines[1]
|
56
|
+
@author = author_line[/:[^<]+/].sub(/\A:/,'').strip
|
57
|
+
just_message = lines[3..-1].join("\n")
|
58
|
+
tracker_directives = just_message.scan(/\[.*\d+\]/)
|
59
|
+
@tracker_ids = []
|
60
|
+
tracker_directives.each do |directive|
|
61
|
+
@tracker_ids << directive[/\d+/]
|
62
|
+
just_message.gsub!(directive,'')
|
63
|
+
end
|
64
|
+
@message = just_message.strip
|
65
|
+
end
|
66
|
+
|
67
|
+
def github_link
|
68
|
+
"#{Yapt.github_url_base}/commit/#{sha}"
|
69
|
+
end
|
70
|
+
|
71
|
+
def display
|
72
|
+
output = ''
|
73
|
+
tracker_ids.each do |id|
|
74
|
+
story = Story.find(id)
|
75
|
+
output << View.new([story]).display("for_git_display").strip + "\n"
|
76
|
+
end
|
77
|
+
output << "Git commit:\n #{message} by #{author}\n #{github_link}\n\n"
|
78
|
+
output
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
39
82
|
class Runner < Boson::Runner
|
40
83
|
attr_reader :start_time
|
41
84
|
def initialize
|
@@ -43,6 +86,10 @@ module Yapt
|
|
43
86
|
super
|
44
87
|
end
|
45
88
|
|
89
|
+
def git(since_until)
|
90
|
+
output GitLogShiv.find(since_until).collect(&:display)
|
91
|
+
end
|
92
|
+
|
46
93
|
def list(*args)
|
47
94
|
display_config = View.extract_display_config(args)
|
48
95
|
@stories = Story.find(args)
|
data/lib/yapt/config.rb
CHANGED
@@ -7,12 +7,10 @@ module Yapt
|
|
7
7
|
@project_path = project_path
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def api_token
|
15
|
-
config.fetch('api_token')
|
10
|
+
%w(project_id api_token github_url_base).each do |attr|
|
11
|
+
define_method attr do
|
12
|
+
config.fetch(attr)
|
13
|
+
end
|
16
14
|
end
|
17
15
|
|
18
16
|
private
|
data/lib/yapt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yapt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Schenkman-Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: boson
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- lib/yapt/request.rb
|
132
132
|
- lib/yapt/story.rb
|
133
133
|
- lib/yapt/templates/detail.erb
|
134
|
+
- lib/yapt/templates/for_git_display.erb
|
134
135
|
- lib/yapt/templates/simple.erb
|
135
136
|
- lib/yapt/version.rb
|
136
137
|
- lib/yapt/view.rb
|