mingle4r 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +10 -0
- data/README +29 -15
- data/TODO.txt +4 -2
- data/lib/mingle4r/api/card.rb +39 -8
- data/lib/mingle4r/api/project.rb +5 -0
- data/lib/mingle4r/api/wiki.rb +5 -0
- data/lib/mingle4r/card_format.rb +60 -1
- data/lib/mingle4r/common_class_methods.rb +4 -3
- data/lib/mingle4r/version.rb +1 -1
- metadata +5 -5
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
0.4.5
|
2
|
+
-----
|
3
|
+
* fixed card updation
|
4
|
+
* user type properties of a card can be set directly either by using the user name or the user id
|
5
|
+
* properties of type 'tree relationship' and 'Card' can be updated by giving a number
|
6
|
+
|
7
|
+
0.4.4
|
8
|
+
-----
|
9
|
+
* more bug fixes
|
10
|
+
|
1
11
|
0.4.3
|
2
12
|
-----
|
3
13
|
* Lots of bug fixes
|
data/README
CHANGED
@@ -108,6 +108,34 @@ m_c.proj_id = 'great_mingle_project'
|
|
108
108
|
card = m_c.project.cards[0]
|
109
109
|
card.property_value('Status')
|
110
110
|
|
111
|
+
Setting a particular property
|
112
|
+
-----------------------------
|
113
|
+
|
114
|
+
sets the value of the property. The property name given should be the same as in Mingle.
|
115
|
+
Type, name and description should be set directly when creating or updating a card.
|
116
|
+
In case of a custom property use the following method. The value given should be one of
|
117
|
+
the values that Mingle accepts in case of a managed list
|
118
|
+
|
119
|
+
m_c = Mingle4r::MingleClient.new('http://localhost:8080', 'testuser', 'password')
|
120
|
+
m_c.proj_id = 'great_mingle_project'
|
121
|
+
defect_card = m_c.project.cards.first
|
122
|
+
defect_card.property_value('Status', 'Closed')
|
123
|
+
defect_card.save
|
124
|
+
|
125
|
+
In case of properties of type 'Tree Relatioship property' or 'Card'(properties which link
|
126
|
+
to another card) you can should set the property by giving the number of the card. For e.g.
|
127
|
+
|
128
|
+
story_card = m_c.projects.cards.find {|c| c.type == 'Story'}.first
|
129
|
+
story_card.property_value('Feature', 12)
|
130
|
+
story_card.save
|
131
|
+
|
132
|
+
In case of properties of type 'Team member' you can either use the user id (not the name or
|
133
|
+
the login id, you would have to look at the xml to get the id) or more simply the user name.
|
134
|
+
For e.g.
|
135
|
+
|
136
|
+
story_card.property_value('Assignee', 'James Bond')
|
137
|
+
story_card.save
|
138
|
+
|
111
139
|
Creating a card
|
112
140
|
---------------
|
113
141
|
|
@@ -124,20 +152,6 @@ task = Mingle4r::API::new :name => 'set up Cruise build', :type => 'task',
|
|
124
152
|
:description => 'a basic cruise build needs to be set up so that we can start working'
|
125
153
|
task.save => It simply won't work, there is a workaround but rather use as described above.
|
126
154
|
|
127
|
-
Setting a particular property
|
128
|
-
-----------------------------
|
129
|
-
|
130
|
-
sets the value of the property. The property name given should be the same as in Mingle.
|
131
|
-
Type, name and description should be set directly when creating or updating a card.
|
132
|
-
In case of a custom property use the following method. The value given should be one of
|
133
|
-
the values that Mingle accepts in case of a managed list
|
134
|
-
|
135
|
-
m_c = Mingle4r::MingleClient.new('http://localhost:8080', 'testuser', 'password')
|
136
|
-
m_c.proj_id = 'great_mingle_project'
|
137
|
-
defect_card = m_c.project.cards.first
|
138
|
-
defect_card.property_value('Status', 'Closed')
|
139
|
-
defect_card.save
|
140
|
-
|
141
155
|
Adding comment to a particular card
|
142
156
|
-----------------------------------
|
143
157
|
|
@@ -274,7 +288,7 @@ gem install mingle4r
|
|
274
288
|
|
275
289
|
(The MIT License)
|
276
290
|
|
277
|
-
Copyright (c)
|
291
|
+
Copyright (c) 2010 Arusarka Haldar
|
278
292
|
|
279
293
|
Permission is hereby granted, free of charge, to any person obtaining
|
280
294
|
a copy of this software and associated documentation files (the
|
data/TODO.txt
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
will be fixed/implemented very soon
|
2
2
|
-----------------------------------
|
3
3
|
|
4
|
-
*
|
4
|
+
* write documentation about updating card properties of type 'Card', 'Tree Relationship property'
|
5
|
+
and 'Team member'
|
6
|
+
* complete manual QA to ensure/prioritize what needs to be done for card object
|
7
|
+
* performance fixes
|
5
8
|
|
6
9
|
will be implemented, but not very important for now
|
7
10
|
----------------------------------------------------
|
8
11
|
|
9
12
|
* update documentation - write about executing transitions directly on the transition
|
10
|
-
* provide a helper method to link to a card
|
11
13
|
* write tests for project class
|
12
14
|
* implement card_types for a project
|
13
15
|
* mingle client should have cards method
|
data/lib/mingle4r/api/card.rb
CHANGED
@@ -21,13 +21,8 @@ module Mingle4r
|
|
21
21
|
end
|
22
22
|
|
23
23
|
module InstanceMethods
|
24
|
-
# so that active resource tries to find by number
|
25
|
-
def id
|
26
|
-
number()
|
27
|
-
end
|
28
|
-
|
29
24
|
def type
|
30
|
-
|
25
|
+
attributes['card_type_name']
|
31
26
|
end
|
32
27
|
|
33
28
|
def type=(type)
|
@@ -112,7 +107,8 @@ EOS
|
|
112
107
|
# as the mingle property name. the value is optional
|
113
108
|
def property_value(name, val = nil)
|
114
109
|
property = properties.detect { |p| p.name == name }
|
115
|
-
val ? property
|
110
|
+
val ? set_prop_val(property, val) : property.value
|
111
|
+
# val ? property.value = val : property.value
|
116
112
|
end
|
117
113
|
|
118
114
|
# Gets the custom properties in the form of an array of hashes with the property names as keys and
|
@@ -121,9 +117,31 @@ EOS
|
|
121
117
|
properties.map { |p| {p.name => p.value} }
|
122
118
|
end
|
123
119
|
|
120
|
+
def encode(options = {})
|
121
|
+
options.merge! :root => 'card'
|
122
|
+
self.class.format.encode(attributes, options)
|
123
|
+
end
|
124
|
+
|
124
125
|
private
|
126
|
+
def set_prop_val(prop, val)
|
127
|
+
val = find_user_id_with_name(val) if(prop.type_description == 'Automatically generated from the team list' && is_not_a_num?(val))
|
128
|
+
prop.value = val
|
129
|
+
end
|
130
|
+
|
131
|
+
def is_not_a_num?(val)
|
132
|
+
!(val.is_a?(Fixnum))
|
133
|
+
end
|
134
|
+
|
135
|
+
def find_user_id_with_name(name)
|
136
|
+
set_attributes_for(User)
|
137
|
+
users = User.find(:all)
|
138
|
+
user = users.detect { |mingle_user| mingle_user.user.name == name }
|
139
|
+
user.user.id
|
140
|
+
end
|
141
|
+
|
125
142
|
def set_attributes_for(klass)
|
126
|
-
|
143
|
+
nested_resource_site = File.join(self.class.site.to_s, "cards/#{self.number()}").to_s
|
144
|
+
resource_site = (klass == User) ? self.class.site.to_s : nested_resource_site
|
127
145
|
klass.site = resource_site
|
128
146
|
klass.user = self.class.user
|
129
147
|
klass.password = self.class.password
|
@@ -146,6 +164,19 @@ EOS
|
|
146
164
|
return @transition_class_set unless val
|
147
165
|
@transition_class_set = val
|
148
166
|
end
|
167
|
+
|
168
|
+
def user_class_set(val = nil)
|
169
|
+
return @user_class_set unless val
|
170
|
+
@user_class_set = val
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
private
|
175
|
+
# post setup hook
|
176
|
+
def self.on_setup(klass)
|
177
|
+
klass.format = Mingle4r::CardFormat.new
|
178
|
+
klass.primary_key = 'number'
|
179
|
+
klass
|
149
180
|
end
|
150
181
|
end
|
151
182
|
end
|
data/lib/mingle4r/api/project.rb
CHANGED
data/lib/mingle4r/api/wiki.rb
CHANGED
data/lib/mingle4r/card_format.rb
CHANGED
@@ -9,10 +9,13 @@ module Mingle4r
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def decode(xml)
|
12
|
-
from_xml_data(Hash.from_xml(xml))
|
12
|
+
data = from_xml_data(Hash.from_xml(xml))
|
13
|
+
convert_properties(data)
|
14
|
+
data
|
13
15
|
end
|
14
16
|
|
15
17
|
def encode(hash, options={})
|
18
|
+
options.merge! :dasherize => false
|
16
19
|
hash.to_xml(options)
|
17
20
|
end
|
18
21
|
|
@@ -24,5 +27,61 @@ module Mingle4r
|
|
24
27
|
data
|
25
28
|
end
|
26
29
|
end
|
30
|
+
|
31
|
+
def convert_properties(data)
|
32
|
+
types_to_convert = ['Any card used in tree', 'Card',
|
33
|
+
'Automatically generated from the team list']
|
34
|
+
types_to_convert.each { |type| convert_prop_tags_of_type(type, data)}
|
35
|
+
convert_card_type_tag(data)
|
36
|
+
end
|
37
|
+
|
38
|
+
def for_every_card_in(data, &block)
|
39
|
+
if data.is_a?(Hash)
|
40
|
+
block.call(data)
|
41
|
+
else
|
42
|
+
data.collect! { |card| block.call(card) }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def convert_prop_tags_of_type(type, data)
|
47
|
+
for_every_card_in(data) { |card| convert_card_for_prop_tags_of_type(card, type) }
|
48
|
+
end
|
49
|
+
|
50
|
+
def convert_card_for_prop_tags_of_type(card, type)
|
51
|
+
return card unless card['properties']
|
52
|
+
card['properties'].collect! do |prop|
|
53
|
+
convert_prop(prop) if (prop_is_of_type?(prop, type))
|
54
|
+
prop
|
55
|
+
end
|
56
|
+
card
|
57
|
+
end
|
58
|
+
|
59
|
+
def convert_prop(prop)
|
60
|
+
if prop_is_of_type?(prop, 'Automatically generated from the team list')
|
61
|
+
prop = convert_team_member_prop(prop)
|
62
|
+
else
|
63
|
+
prop['value'] = prop['value']['number'] if prop['value']
|
64
|
+
end
|
65
|
+
prop
|
66
|
+
end
|
67
|
+
|
68
|
+
def convert_team_member_prop(prop)
|
69
|
+
return prop unless prop['value']
|
70
|
+
url = prop['value']['url']
|
71
|
+
prop['value'] = File.basename(url).gsub('.xml', '').to_i
|
72
|
+
prop
|
73
|
+
end
|
74
|
+
|
75
|
+
def prop_is_of_type?(prop, type)
|
76
|
+
prop['type_description'] == type
|
77
|
+
end
|
78
|
+
|
79
|
+
def convert_card_type_tag(data)
|
80
|
+
for_every_card_in(data) do |card|
|
81
|
+
card_type = card.delete('card_type')
|
82
|
+
card['card_type_name'] = card_type['name']
|
83
|
+
card
|
84
|
+
end
|
85
|
+
end
|
27
86
|
end
|
28
87
|
end
|
@@ -88,10 +88,11 @@ module Mingle4r
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def setup_class(klass)
|
91
|
-
|
91
|
+
set_resource_attributes(klass)
|
92
92
|
set_class_name(klass)
|
93
93
|
include_instance_methods(klass)
|
94
94
|
include_singleton_methods(klass)
|
95
|
+
on_setup(klass) if(respond_to?('on_setup'))
|
95
96
|
end
|
96
97
|
|
97
98
|
def include_singleton_methods(klass)
|
@@ -108,7 +109,7 @@ module Mingle4r
|
|
108
109
|
klass
|
109
110
|
end
|
110
111
|
|
111
|
-
def
|
112
|
+
def set_resource_attributes(klass)
|
112
113
|
klass.site = self.site
|
113
114
|
klass.user = self.user
|
114
115
|
klass.password = self.password
|
@@ -130,7 +131,7 @@ module Mingle4r
|
|
130
131
|
end
|
131
132
|
|
132
133
|
def method_missing(meth_id, *args, &block)
|
133
|
-
raise ResourceNotSetup.new("Site
|
134
|
+
raise ResourceNotSetup.new("Site not set for #{name}.") unless @resource_class
|
134
135
|
@resource_class.send(meth_id.to_sym, *args, &block)
|
135
136
|
end
|
136
137
|
end
|
data/lib/mingle4r/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mingle4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 5
|
10
|
+
version: 0.4.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- asur
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-06-02 00:00:00 +05:30
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: "0"
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
|
-
description: " A connector
|
35
|
+
description: " A wrapper connector for connecting to Mingle(http://studios.thoughtworks.com/mingle-agile-project-management).\n It uses active resource to handle the restful connections to Mingle. Makes the job of connecting to Mingle a \n lot easier.\n"
|
36
36
|
email: arusarka@gmail.com
|
37
37
|
executables: []
|
38
38
|
|