TicGit-ng 1.0.2.16 → 1.0.2.17
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ticgit-ng/base.rb +1 -1
- data/lib/ticgit-ng/syncable_ticket.rb +63 -0
- data/lib/ticgit-ng/version.rb +1 -1
- metadata +6 -4
data/lib/ticgit-ng/base.rb
CHANGED
@@ -0,0 +1,63 @@
|
|
1
|
+
module TicGitNG
|
2
|
+
module Sync
|
3
|
+
class SyncableTicket
|
4
|
+
|
5
|
+
|
6
|
+
#return value is boolean, true if attr has all of the
|
7
|
+
#standard attributes, as defined in standard_attributes()
|
8
|
+
def has_standard_attributes attrs
|
9
|
+
Sync.standard_attributes.each {|attribute, value|
|
10
|
+
if attribute==:comments
|
11
|
+
if (attrs.has_key?(attribute) or attrs.has_key?(attribute.to_s))
|
12
|
+
attribute=attribute.to_s unless attrs.has_key?(attribute)
|
13
|
+
attrs[attribute].each {|comment|
|
14
|
+
value.each_key {|comment_value|
|
15
|
+
|
16
|
+
#:comment__id is hint that we need to look for an ID tag, but not necessarily one that is named comment__id
|
17
|
+
#or one that uses a name that we can completely predict ahead of time. So, we look for any ticket matching this regex.
|
18
|
+
if comment_value==:comment__id
|
19
|
+
return false unless comment.map {|k_v| !k_v[0].to_s[/^comment_.*_id$/].nil?}.include?(true)
|
20
|
+
next
|
21
|
+
end
|
22
|
+
|
23
|
+
return false unless (comment.has_key?(comment_value) or comment.has_key?(comment_value.to_s))
|
24
|
+
}
|
25
|
+
}
|
26
|
+
end
|
27
|
+
else
|
28
|
+
return false unless (attrs.has_key?(attribute) or attrs.has_key?(attribute.to_s))
|
29
|
+
end
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
#parse the comments in attrs for updates of static fields, denoted
|
36
|
+
#by lines in the form of "#KEY=VALUE" where key is an attribute such
|
37
|
+
#as state, title, or label.
|
38
|
+
def parse_attrs_for_updates attrs, malleable
|
39
|
+
updates=[]
|
40
|
+
comment_regex=/\n#[^=]*="[^"]*"/
|
41
|
+
comment_key='comments'
|
42
|
+
comment_key=comment_key.to_sym unless attrs.has_key?(comment_key)
|
43
|
+
attrs[comment_key].each {|comment|
|
44
|
+
c_b_key='comment_body'
|
45
|
+
c_b_key=c_b_key.to_sym unless comment.has_key?(c_b_key)
|
46
|
+
text=comment[c_b_key]
|
47
|
+
while text[comment_regex]
|
48
|
+
match=text[comment_regex]
|
49
|
+
text.gsub!(match,'')
|
50
|
+
updates << match
|
51
|
+
end
|
52
|
+
}
|
53
|
+
updates.each {|update|
|
54
|
+
attr_key,attr_value = update.strip.gsub(/#/,'')
|
55
|
+
attr_key=attr_key.downcase
|
56
|
+
next unless malleable.include?(attr_key)
|
57
|
+
attrs.set(attr_key, attr_value)
|
58
|
+
}
|
59
|
+
attrs
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/ticgit-ng/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: TicGit-ng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 117
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 2
|
10
|
-
-
|
11
|
-
version: 1.0.2.
|
10
|
+
- 17
|
11
|
+
version: 1.0.2.17
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Scott Chacon
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-
|
20
|
+
date: 2012-10-03 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: git
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- lib/ticgit-ng/command/init.rb
|
80
80
|
- lib/ticgit-ng/command/new.rb
|
81
81
|
- lib/ticgit-ng/comment.rb
|
82
|
+
- lib/ticgit-ng/syncable_ticket.rb
|
82
83
|
- lib/ticgit-ng/version.rb
|
83
84
|
- lib/ticgit-ng/ticket.rb
|
84
85
|
- lib/ticgit-ng/command.rb
|
@@ -121,3 +122,4 @@ specification_version: 3
|
|
121
122
|
summary: Git based distributed ticketing system
|
122
123
|
test_files: []
|
123
124
|
|
125
|
+
has_rdoc:
|