rallytastic 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.4
1
+ 1.2.5
data/lib/project.rb CHANGED
@@ -19,6 +19,7 @@ class Project
19
19
  referenced_in :parent, :class_name => "Project"
20
20
  references_many :children, :class_name => "Project"
21
21
  references_many :iterations
22
+ references_many :stories
22
23
  embeds_one :revision_parser
23
24
 
24
25
  def refresh hash_values=nil
@@ -26,7 +26,6 @@ class RevisionParser
26
26
  end
27
27
 
28
28
  def completed_on(revisions)
29
- #regex = completed_on_regex ? eval(completed_on_regex) : /SCHEDULE STATE changed from \[[^\]]*\] to [Complete]/
30
29
  regex = completed_on_regex ? eval(completed_on_regex) : /SCHEDULE STATE changed from \[[^\]]*\] to \[Complete\]/
31
30
  latest_revision_date_matching regex, revisions
32
31
  end
data/lib/story.rb CHANGED
@@ -34,6 +34,7 @@ class Story
34
34
 
35
35
  embeds_many :revisions, :inverse_of => :story
36
36
  referenced_in :iteration
37
+ referenced_in :project
37
38
  referenced_in :parent, :class_name => "Story", :inverse_of => :children
38
39
  references_many :children, :class_name => "Story", :inverse_of => :parent
39
40
 
@@ -54,8 +55,8 @@ class Story
54
55
  end
55
56
 
56
57
  def revision_parser
57
- if self.iteration && self.iteration.project
58
- self.iteration.project.revision_parser
58
+ if self.project
59
+ self.project.revision_parser
59
60
  end
60
61
  end
61
62
 
@@ -102,18 +103,29 @@ class Story
102
103
  end
103
104
 
104
105
  def associate hash_values=nil
105
- @rally_hash = hash_values if hash_values
106
- if @rally_hash["Iteration"]
107
- iteration = Iteration.find_or_create_by(:rally_uri => @rally_hash["Iteration"]["_ref"])
108
- self.iteration = iteration
109
- end
110
-
111
- if @rally_hash["Parent"]
112
- story = Story.find_or_create_by(:rally_uri => @rally_hash["Parent"]["_ref"])
113
- self.parent = story
114
- end
106
+ @rally_hash = hash_values || RallyAPI.get(self)
107
+ if @rally_hash
108
+ if @rally_hash["Project"]
109
+ project = Project.find_or_create_by(:rally_uri => @rally_hash["Project"]["_ref"])
110
+ self.project = project
111
+ end
115
112
 
116
- self.save
113
+ if @rally_hash["Iteration"]
114
+ iteration = Iteration.find_or_create_by(:rally_uri => @rally_hash["Iteration"]["_ref"])
115
+ self.iteration = iteration
116
+ end
117
+
118
+ if @rally_hash["Parent"]
119
+ story = Story.find_or_create_by(:rally_uri => @rally_hash["Parent"]["_ref"])
120
+ self.parent = story
121
+ story.children << self
122
+ story.save
123
+ end
124
+
125
+ self.save
126
+ end
127
+ rescue JSON::ParserError => e
128
+ p e
117
129
  end
118
130
 
119
131
 
data/rallytastic.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rallytastic}
8
- s.version = "1.2.4"
8
+ s.version = "1.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Clark"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 2
8
- - 4
9
- version: 1.2.4
8
+ - 5
9
+ version: 1.2.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt Clark
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - - ">="
162
162
  - !ruby/object:Gem::Version
163
- hash: 2084999395012609863
163
+ hash: 471269316980138140
164
164
  segments:
165
165
  - 0
166
166
  version: "0"