pivotal_angel 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.gem
2
2
  *.rbc
3
+ *.swp
3
4
  .bundle
4
5
  .config
5
6
  .yardoc
@@ -2,30 +2,56 @@ module PivotalAngel
2
2
  class Project
3
3
  class << self
4
4
  def deep_clone(source_project, name)
5
- new_project = source_project.clone
6
- new_project.name = name
7
- new_project.create
5
+ new_project = PivotalTracker::Project.new name: name,
6
+ iteration_length: source_project.iteration_length,
7
+ point_scale: source_project.point_scale
8
8
 
9
- new_project = PivotalTracker::Project.all.detect { |document| document.name == new_project.name }
9
+ new_project = new_project.create
10
10
 
11
11
  puts "Copying stories from #{source_project.name} to #{new_project.name}"
12
12
  source_project.stories.all.each do |story|
13
- new_story = story.clone
14
- new_story.project_id = new_project.id
15
- a_new_story = new_story.create
13
+ # new story will get the requested_by/owned_by of the api token owner
14
+ # to preserve users, you would need to clone the project first
15
+ # and add all users that were ever on the project to the
16
+ # new project first through the pivotal tracker website
17
+ description = "#{story.description}\n\nOriginally owned by #{story.owned_by}\nOriginally requested by #{story.requested_by}"
18
+
19
+ new_story = new_project.stories.create name: story.name,
20
+ description: description,
21
+ estimate: story.estimate,
22
+ story_type: story.story_type,
23
+ current_state: story.current_state,
24
+ accepted_at: story.accepted_at,
25
+ created_at: story.created_at,
26
+ labels: story.labels
27
+
28
+ raise "Uh Oh: #{new_story.errors.join("\n")}" if new_story.errors.to_a.size > 0
16
29
 
17
30
  story.tasks.all.each do |task|
18
- new_task = task.clone
19
- new_task.story_id = a_new_story.id
20
- new_task.project_id = new_project.id
21
- new_task.create
31
+ new_task = nil
32
+ begin
33
+ new_task = new_story.tasks.create description: task.description,
34
+ complete: task.complete
35
+ putc "t"
36
+ rescue
37
+ puts "0"*80
38
+ puts "unable to create #{new_task.inspect}"
39
+ puts "0"*80
40
+ end
22
41
  end
23
42
 
24
43
  story.notes.all.each do |note|
25
- new_note = note.clone
26
- new_note.story_id = a_new_story.id
27
- new_note.project_id = new_project.id
28
- new_note.create
44
+ begin
45
+ new_story.notes.create text: "#{note.text}\n\nOriginally by #{note.author}",
46
+ noted_at: note.noted_at.to_s,
47
+ author: note.author
48
+
49
+ putc "n"
50
+ rescue
51
+ puts "%"*80
52
+ puts "unable to create #{note.inspect}"
53
+ puts "%"*80
54
+ end
29
55
  end
30
56
  putc "."
31
57
  end
@@ -1,3 +1,3 @@
1
1
  module PivotalAngel
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal_angel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-03-16 00:00:00.000000000 Z
13
+ date: 2012-04-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
- requirement: !ruby/object:Gem::Requirement
17
+ requirement: &70268966157920 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,15 +22,10 @@ dependencies:
22
22
  version: '2.6'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ~>
29
- - !ruby/object:Gem::Version
30
- version: '2.6'
25
+ version_requirements: *70268966157920
31
26
  - !ruby/object:Gem::Dependency
32
27
  name: pivotal-tracker
33
- requirement: !ruby/object:Gem::Requirement
28
+ requirement: &70268966155060 !ruby/object:Gem::Requirement
34
29
  none: false
35
30
  requirements:
36
31
  - - ! '>='
@@ -38,12 +33,7 @@ dependencies:
38
33
  version: '0'
39
34
  type: :runtime
40
35
  prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: '0'
36
+ version_requirements: *70268966155060
47
37
  description: Pivotal Tracker helpers for project and labels
48
38
  email:
49
39
  - rad@aelogica.com
@@ -85,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
75
  version: '0'
86
76
  requirements: []
87
77
  rubyforge_project:
88
- rubygems_version: 1.8.19
78
+ rubygems_version: 1.8.17
89
79
  signing_key:
90
80
  specification_version: 3
91
81
  summary: Deep clone a project, add, remove and rename labels