pivotal-to-trello 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +48 -54
- data/Dockerfile +2 -10
- data/Gemfile +7 -6
- data/README.markdown +4 -3
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/bin/pivotal-to-trello +1 -0
- data/lib/pivotal-to-trello.rb +3 -1
- data/lib/pivotal_to_trello/core.rb +2 -0
- data/lib/pivotal_to_trello/pivotal_wrapper.rb +7 -9
- data/lib/pivotal_to_trello/runner.rb +5 -3
- data/lib/pivotal_to_trello/trello_wrapper.rb +8 -6
- data/pivotal-to-trello.gemspec +38 -35
- data/spec/pivotal_to_trello/core_spec.rb +2 -0
- data/spec/pivotal_to_trello/pivotal_wrapper_spec.rb +12 -13
- data/spec/pivotal_to_trello/trello_wrapper_spec.rb +8 -7
- data/spec/spec_helper.rb +23 -20
- metadata +30 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c10f77ac27aa86a8d1aaf4c0db0418db55f53869184db93f60537703bfb489ec
|
4
|
+
data.tar.gz: 6dd95a122bbe59e8cade8a581bc99980e2ad6c73f09d6fc7bf50db2afa5dc0b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03010c13de33774874cf4c91659e84d79aa1c7987476c329c638f68c002dafb8c4abaff33d1951203fdbb756bd0666b26ef586663b1de6bdabfc078a33abb4df
|
7
|
+
data.tar.gz: af73c66c3b40afe394846873ebc35bb76bf426991403a91c3423d94aeab234096961db6248f70a126ad91cfe88c923693c928c0f97d6993efc1b9454ded64b5b
|
data/.rubocop.yml
CHANGED
@@ -1,102 +1,96 @@
|
|
1
1
|
# See example at https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
2
|
+
require:
|
3
|
+
- rubocop-performance
|
4
|
+
|
2
5
|
AllCops:
|
3
|
-
TargetRubyVersion: 2.
|
6
|
+
TargetRubyVersion: 2.6
|
4
7
|
Exclude:
|
5
8
|
- 'Gemfile'
|
6
9
|
- 'pivotal-to-trello.gemspec'
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# separator - alignment of hash rockets, keys are right aligned
|
16
|
-
# 'a' => 2
|
17
|
-
# 'bb' => 3
|
18
|
-
# table - left alignment of keys, hash rockets, and values
|
19
|
-
# 'a' => 2
|
20
|
-
# 'bb' => 3
|
11
|
+
Layout/EmptyLines:
|
12
|
+
Enabled: true
|
13
|
+
|
14
|
+
Layout/EmptyLinesAroundBlockBody:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
Layout/HashAlignment:
|
21
18
|
EnforcedHashRocketStyle: table
|
22
|
-
# Alignment of entries using colon as separator. Valid values are:
|
23
|
-
#
|
24
|
-
# key - left alignment of keys
|
25
|
-
# a: 0
|
26
|
-
# bb: 1
|
27
|
-
# separator - alignment of colons, keys are right aligned
|
28
|
-
# a: 0
|
29
|
-
# bb: 1
|
30
|
-
# table - left alignment of keys and values
|
31
|
-
# a: 0
|
32
|
-
# bb: 1
|
33
19
|
EnforcedColonStyle: table
|
34
20
|
|
35
|
-
|
36
|
-
|
21
|
+
Layout/LineLength:
|
22
|
+
Max: 200
|
37
23
|
|
38
|
-
|
39
|
-
Enabled:
|
40
|
-
|
41
|
-
Layout/EmptyLinesAroundBlockBody:
|
42
|
-
Enabled: false
|
24
|
+
Layout/SpaceBeforeFirstArg:
|
25
|
+
Enabled: true
|
43
26
|
|
44
|
-
|
45
|
-
|
27
|
+
Layout/SpaceInsideParens:
|
28
|
+
Enabled: true
|
46
29
|
|
47
30
|
Metrics/AbcSize:
|
48
31
|
Enabled: true
|
49
|
-
Max:
|
32
|
+
Max: 100
|
50
33
|
|
51
|
-
Metrics/
|
34
|
+
Metrics/BlockLength:
|
52
35
|
Enabled: false
|
53
36
|
CountComments: false
|
54
37
|
|
55
|
-
Metrics/
|
38
|
+
Metrics/CyclomaticComplexity:
|
39
|
+
Enabled: true
|
40
|
+
Max: 15
|
41
|
+
|
42
|
+
Metrics/ClassLength:
|
56
43
|
Enabled: false
|
57
44
|
CountComments: false
|
58
45
|
|
59
46
|
Metrics/MethodLength:
|
60
47
|
Enabled: true
|
61
48
|
CountComments: false
|
62
|
-
Max:
|
49
|
+
Max: 60
|
63
50
|
|
64
|
-
|
65
|
-
|
66
|
-
|
51
|
+
Metrics/PerceivedComplexity:
|
52
|
+
Enabled: true
|
53
|
+
Max: 20
|
67
54
|
|
68
|
-
|
69
|
-
|
55
|
+
Naming/BlockParameterName:
|
56
|
+
MinNameLength: 1
|
70
57
|
|
71
|
-
|
58
|
+
Naming/FileName:
|
72
59
|
Enabled: false
|
73
60
|
|
74
|
-
|
75
|
-
|
61
|
+
Naming/MethodParameterName:
|
62
|
+
MinNameLength: 1
|
76
63
|
|
77
|
-
Style/
|
78
|
-
Enabled:
|
64
|
+
Style/AccessModifierDeclarations:
|
65
|
+
Enabled: true
|
66
|
+
|
67
|
+
Style/AndOr:
|
68
|
+
Enabled: true
|
79
69
|
|
80
70
|
Style/BlockDelimiters:
|
81
|
-
Enabled:
|
71
|
+
Enabled: true
|
82
72
|
|
83
73
|
Style/ClassAndModuleChildren:
|
84
74
|
Enabled: true
|
85
75
|
EnforcedStyle: nested
|
86
76
|
|
87
|
-
Style/
|
77
|
+
Style/Documentation:
|
88
78
|
Enabled: false
|
89
79
|
|
80
|
+
Style/FrozenStringLiteralComment:
|
81
|
+
Enabled: true
|
82
|
+
|
90
83
|
Style/RedundantReturn:
|
91
|
-
Enabled:
|
84
|
+
Enabled: true
|
92
85
|
|
93
86
|
Style/TrailingCommaInArguments:
|
94
87
|
Enabled: true
|
95
88
|
EnforcedStyleForMultiline: comma
|
96
89
|
|
97
|
-
Style/
|
90
|
+
Style/TrailingCommaInArrayLiteral:
|
98
91
|
Enabled: true
|
99
92
|
EnforcedStyleForMultiline: comma
|
100
93
|
|
101
|
-
Style/
|
102
|
-
Enabled:
|
94
|
+
Style/TrailingCommaInHashLiteral:
|
95
|
+
Enabled: true
|
96
|
+
EnforcedStyleForMultiline: comma
|
data/Dockerfile
CHANGED
@@ -1,16 +1,8 @@
|
|
1
|
-
FROM
|
1
|
+
FROM ruby:2.6
|
2
2
|
|
3
3
|
MAINTAINER "Dave Perrett" https://github.com/Dockerfile
|
4
4
|
|
5
|
-
|
6
|
-
RUN apt-get -y update &&\
|
7
|
-
apt-get install -y software-properties-common &&\
|
8
|
-
apt-add-repository ppa:brightbox/ruby-ng &&\
|
9
|
-
apt-get update -q
|
10
|
-
|
11
|
-
RUN apt-get install -y build-essential zlib1g-dev libxml2-dev \
|
12
|
-
ruby2.2 ruby2.2-dev &&\
|
13
|
-
gem install bundler --no-rdoc --no-ri
|
5
|
+
RUN gem install bundler
|
14
6
|
|
15
7
|
# Prepare
|
16
8
|
RUN mkdir /app
|
data/Gemfile
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
gem 'highline', '~> 1.7.8'
|
4
|
-
gem 'ruby-trello', '~> 2.
|
5
|
-
gem '
|
4
|
+
gem 'ruby-trello', '~> 2.2.0'
|
5
|
+
gem 'tracker_api', '~> 1.10.0'
|
6
6
|
|
7
7
|
group :development do
|
8
|
-
gem 'rspec'
|
9
|
-
gem 'rdoc'
|
10
|
-
gem 'jeweler'
|
11
|
-
gem 'rubocop'
|
8
|
+
gem 'rspec'
|
9
|
+
gem 'rdoc'
|
10
|
+
gem 'jeweler'
|
11
|
+
gem 'rubocop'
|
12
|
+
gem 'rubocop-performance'
|
12
13
|
end
|
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
pivotal-to-trello [![Build Status](https://travis-ci.org/recurser/pivotal-to-trello.png?branch=master)](https://travis-ci.org/recurser/pivotal-to-trello)
|
1
|
+
pivotal-to-trello [![Build Status](https://travis-ci.org/recurser/pivotal-to-trello.png?branch=master)](https://travis-ci.org/recurser/pivotal-to-trello) [![Gem Version](https://badge.fury.io/rb/pivotal-to-trello.svg)](https://badge.fury.io/rb/pivotal-to-trello)
|
2
2
|
=================
|
3
3
|
|
4
4
|
This repo provides a command for exporting a [Pivotal Tracker](https://www.pivotaltracker.com/) project to [Trello](https://trello.com/). The command is available as a gem or a docker container.
|
@@ -12,9 +12,9 @@ Getting started
|
|
12
12
|
|
13
13
|
Or pull the container down using Docker:
|
14
14
|
|
15
|
-
> docker pull
|
15
|
+
> docker pull ronawilliams/pivotal-to-trello
|
16
16
|
|
17
|
-
When using the docker container, substitute
|
17
|
+
When using the docker container, substitute `pivotal-to-trello` with `docker run -i ronawilliams/pivotal-to-trello`
|
18
18
|
|
19
19
|
2. Run the importer:
|
20
20
|
|
@@ -235,6 +235,7 @@ The Pivotal Tracker token can be found at the bottom of your [Pivotal profile pa
|
|
235
235
|
Change history
|
236
236
|
--------------
|
237
237
|
|
238
|
+
* **Version 0.3.0 (2019-12-04)** : Update to the maintained tracker_api gem (thanks @rwilliams!).
|
238
239
|
* **Version 0.2.0 (2017-08-10)** : Fix label creation, update gem dependencies, add checklist support (thanks @rikthevik!), add docker support (thanks @kennethkalmer!).
|
239
240
|
* **Version 0.1.2 (2014-01-13)** : Update version number in the gemspec.
|
240
241
|
* **Version 0.1.1 (2014-01-13)** : Specify gem dependencies.
|
data/Rakefile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'bundler'
|
5
5
|
begin
|
6
6
|
Bundler.setup(:default, :development)
|
7
7
|
rescue Bundler::BundlerError => e
|
8
|
-
|
9
|
-
|
8
|
+
warn e.message
|
9
|
+
warn 'Run `bundle install` to install missing gems'
|
10
10
|
exit e.status_code
|
11
11
|
end
|
12
12
|
require 'rake'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/bin/pivotal-to-trello
CHANGED
data/lib/pivotal-to-trello.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
unless defined? P2T_ROOT
|
2
|
-
$LOAD_PATH <<
|
4
|
+
$LOAD_PATH << __dir__
|
3
5
|
P2T_ROOT = File.expand_path(File.dirname(__FILE__) + '/../')
|
4
6
|
P2T_LIB = File.join(P2T_ROOT, 'lib', 'pivotal_to_trello')
|
5
7
|
end
|
@@ -1,33 +1,31 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'tracker_api'
|
2
4
|
|
3
5
|
module PivotalToTrello
|
4
6
|
# Interface to the Pivotal Tracker API.
|
5
7
|
class PivotalWrapper
|
6
8
|
# Constructor
|
7
9
|
def initialize(token)
|
8
|
-
::
|
9
|
-
::PivotalTracker::Client.use_ssl = true
|
10
|
+
@client = TrackerApi::Client.new(token: token)
|
10
11
|
end
|
11
12
|
|
12
13
|
# Returns a hash of available projects keyed on project ID.
|
13
14
|
def project_choices
|
14
|
-
|
15
|
+
@client.projects.each_with_object({}) do |project, hash|
|
15
16
|
hash[project.id] = project.name
|
16
|
-
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
# Returns all stories for the given project.
|
21
21
|
def stories(project_id)
|
22
|
-
project(project_id).stories.
|
22
|
+
@client.project(project_id).stories.sort_by(&:created_at)
|
23
23
|
end
|
24
24
|
|
25
|
-
private
|
26
|
-
|
27
25
|
# Returns the Pivotal project that we're exporting.
|
28
26
|
def project(project_id)
|
29
27
|
@projects ||= {}
|
30
|
-
@projects[project_id] ||=
|
28
|
+
@projects[project_id] ||= @client.project(project_id)
|
31
29
|
end
|
32
30
|
end
|
33
31
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'optparse'
|
2
4
|
require 'ostruct'
|
3
5
|
|
@@ -86,7 +88,7 @@ module PivotalToTrello
|
|
86
88
|
|
87
89
|
global.order!
|
88
90
|
command = args.shift
|
89
|
-
commands[command]
|
91
|
+
commands[command]&.order!
|
90
92
|
|
91
93
|
# Output a help message unless a command has been specified.
|
92
94
|
STDOUT.write global unless options.action
|
@@ -104,5 +106,5 @@ module PivotalToTrello
|
|
104
106
|
def show_version
|
105
107
|
STDOUT.write "pivotal-to-trello version #{PivotalToTrello.version}"
|
106
108
|
end
|
107
|
-
end
|
108
|
-
end
|
109
|
+
end
|
110
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'trello'
|
2
4
|
|
3
5
|
module PivotalToTrello
|
@@ -22,7 +24,7 @@ module PivotalToTrello
|
|
22
24
|
list_id: list_id,
|
23
25
|
)
|
24
26
|
|
25
|
-
|
27
|
+
create_comments(card, pivotal_story)
|
26
28
|
create_tasks(card, pivotal_story)
|
27
29
|
card
|
28
30
|
end
|
@@ -48,7 +50,7 @@ module PivotalToTrello
|
|
48
50
|
choices = Trello::Board.find(board_id).lists.each_with_object({}) do |list, hash|
|
49
51
|
hash[list.id] = list.name
|
50
52
|
end
|
51
|
-
choices
|
53
|
+
choices = Hash[choices.sort_by { |_, v| v }]
|
52
54
|
choices[false] = "[don't import these stories]"
|
53
55
|
choices
|
54
56
|
end
|
@@ -92,15 +94,15 @@ module PivotalToTrello
|
|
92
94
|
private
|
93
95
|
|
94
96
|
# Copies notes from the pivotal story to the card.
|
95
|
-
def
|
96
|
-
pivotal_story.
|
97
|
-
card.add_comment(
|
97
|
+
def create_comments(card, pivotal_story)
|
98
|
+
pivotal_story.comments.each do |comment|
|
99
|
+
card.add_comment(comment.text.to_s.strip.to_s) unless comment.text.to_s.strip.empty?
|
98
100
|
end
|
99
101
|
end
|
100
102
|
|
101
103
|
# Copies notes from the pivotal story to the card.
|
102
104
|
def create_tasks(card, pivotal_story)
|
103
|
-
tasks = pivotal_story.tasks
|
105
|
+
tasks = pivotal_story.tasks
|
104
106
|
return if tasks.empty?
|
105
107
|
|
106
108
|
checklist = Trello::Checklist.create(name: 'Tasks', card_id: card.id)
|
data/pivotal-to-trello.gemspec
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: pivotal-to-trello 0.
|
5
|
+
# stub: pivotal-to-trello 0.3.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name = "pivotal-to-trello"
|
9
|
-
s.version = "0.
|
8
|
+
s.name = "pivotal-to-trello".freeze
|
9
|
+
s.version = "0.3.0"
|
10
10
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
|
-
s.authors = ["Dave Perrett", "Erik Frederiksen", "Kenneth Kalmer"]
|
14
|
-
s.date = "
|
15
|
-
s.description = "Pulls stories from Pivotal Tracker and imports them into Trello"
|
16
|
-
s.email = "hello@daveperrett.com"
|
17
|
-
s.executables = ["pivotal-to-trello"]
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["Dave Perrett".freeze, "Erik Frederiksen".freeze, "Kenneth Kalmer".freeze]
|
14
|
+
s.date = "2019-12-20"
|
15
|
+
s.description = "Pulls stories from Pivotal Tracker and imports them into Trello".freeze
|
16
|
+
s.email = "hello@daveperrett.com".freeze
|
17
|
+
s.executables = ["pivotal-to-trello".freeze]
|
18
18
|
s.extra_rdoc_files = [
|
19
19
|
"LICENSE.txt",
|
20
20
|
"README.markdown"
|
@@ -40,39 +40,42 @@ Gem::Specification.new do |s|
|
|
40
40
|
"spec/pivotal_to_trello/trello_wrapper_spec.rb",
|
41
41
|
"spec/spec_helper.rb"
|
42
42
|
]
|
43
|
-
s.homepage = "http://github.com/recurser/pivotal-to-trello"
|
44
|
-
s.licenses = ["MIT"]
|
45
|
-
s.rubygems_version = "
|
46
|
-
s.summary = "Pivotal Tracker to Trello exporter"
|
43
|
+
s.homepage = "http://github.com/recurser/pivotal-to-trello".freeze
|
44
|
+
s.licenses = ["MIT".freeze]
|
45
|
+
s.rubygems_version = "3.0.3".freeze
|
46
|
+
s.summary = "Pivotal Tracker to Trello exporter".freeze
|
47
47
|
|
48
48
|
if s.respond_to? :specification_version then
|
49
49
|
s.specification_version = 4
|
50
50
|
|
51
51
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
|
-
s.add_runtime_dependency(%q<highline
|
53
|
-
s.add_runtime_dependency(%q<ruby-trello
|
54
|
-
s.add_runtime_dependency(%q<
|
55
|
-
s.add_development_dependency(%q<rspec
|
56
|
-
s.add_development_dependency(%q<rdoc
|
57
|
-
s.add_development_dependency(%q<jeweler
|
58
|
-
s.add_development_dependency(%q<rubocop
|
52
|
+
s.add_runtime_dependency(%q<highline>.freeze, ["~> 1.7.8"])
|
53
|
+
s.add_runtime_dependency(%q<ruby-trello>.freeze, ["~> 2.2.0"])
|
54
|
+
s.add_runtime_dependency(%q<tracker_api>.freeze, ["~> 1.10.0"])
|
55
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<rubocop-performance>.freeze, [">= 0"])
|
59
60
|
else
|
60
|
-
s.add_dependency(%q<highline
|
61
|
-
s.add_dependency(%q<ruby-trello
|
62
|
-
s.add_dependency(%q<
|
63
|
-
s.add_dependency(%q<rspec
|
64
|
-
s.add_dependency(%q<rdoc
|
65
|
-
s.add_dependency(%q<jeweler
|
66
|
-
s.add_dependency(%q<rubocop
|
61
|
+
s.add_dependency(%q<highline>.freeze, ["~> 1.7.8"])
|
62
|
+
s.add_dependency(%q<ruby-trello>.freeze, ["~> 2.2.0"])
|
63
|
+
s.add_dependency(%q<tracker_api>.freeze, ["~> 1.10.0"])
|
64
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
65
|
+
s.add_dependency(%q<rdoc>.freeze, [">= 0"])
|
66
|
+
s.add_dependency(%q<jeweler>.freeze, [">= 0"])
|
67
|
+
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
68
|
+
s.add_dependency(%q<rubocop-performance>.freeze, [">= 0"])
|
67
69
|
end
|
68
70
|
else
|
69
|
-
s.add_dependency(%q<highline
|
70
|
-
s.add_dependency(%q<ruby-trello
|
71
|
-
s.add_dependency(%q<
|
72
|
-
s.add_dependency(%q<rspec
|
73
|
-
s.add_dependency(%q<rdoc
|
74
|
-
s.add_dependency(%q<jeweler
|
75
|
-
s.add_dependency(%q<rubocop
|
71
|
+
s.add_dependency(%q<highline>.freeze, ["~> 1.7.8"])
|
72
|
+
s.add_dependency(%q<ruby-trello>.freeze, ["~> 2.2.0"])
|
73
|
+
s.add_dependency(%q<tracker_api>.freeze, ["~> 1.10.0"])
|
74
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
75
|
+
s.add_dependency(%q<rdoc>.freeze, [">= 0"])
|
76
|
+
s.add_dependency(%q<jeweler>.freeze, [">= 0"])
|
77
|
+
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
78
|
+
s.add_dependency(%q<rubocop-performance>.freeze, [">= 0"])
|
76
79
|
end
|
77
80
|
end
|
78
81
|
|
@@ -1,32 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.expand_path(File.dirname(File.dirname(__FILE__)) + '/spec_helper')
|
2
4
|
|
3
5
|
describe 'PivotalWrapper' do
|
4
|
-
|
6
|
+
# API Token is for a user with just one public sample project.
|
7
|
+
let(:token) { 'ab4c5895f57995bb7547986eacf91160' }
|
8
|
+
let(:wrapper) { PivotalToTrello::PivotalWrapper.new(token) }
|
5
9
|
|
6
10
|
context '#initialize' do
|
7
11
|
it 'sets the pivotal token' do
|
8
|
-
expect(::
|
9
|
-
PivotalToTrello::PivotalWrapper.new(
|
12
|
+
expect(TrackerApi::Client).to receive(:new).with(token: token)
|
13
|
+
PivotalToTrello::PivotalWrapper.new(token)
|
10
14
|
end
|
11
15
|
end
|
12
16
|
|
13
17
|
context '#project_choices' do
|
14
18
|
it 'returns a hash of pivotal projects' do
|
15
|
-
|
16
|
-
expect(::PivotalTracker::Project).to receive(:all).and_return([project])
|
17
|
-
expect(wrapper.project_choices).to eq('id' => 'My Project')
|
19
|
+
expect(wrapper.project_choices).to eq(1_027_488 => 'My Sample Project', 1_027_492 => 'My Sample Project')
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
21
23
|
context '#stories' do
|
22
24
|
it 'returns a sorted array of pivotal stories' do
|
23
|
-
|
24
|
-
|
25
|
-
project
|
26
|
-
expect(
|
27
|
-
allow(project).to receive_message_chain(:stories, :all).and_return([last_story, first_story])
|
28
|
-
expect(wrapper.stories('project_id').first).to eq(first_story)
|
29
|
-
expect(wrapper.stories('project_id').last).to eq(last_story)
|
25
|
+
expect(wrapper.project(1_027_488).id).to eq 1_027_488
|
26
|
+
expect(wrapper.project(1_027_488).stories.count).to eq 85
|
27
|
+
expect(wrapper.project(1_027_488).stories.first.id).to eq(66_727_974)
|
28
|
+
expect(wrapper.project(1_027_488).stories.last.id).to eq(66_728_090)
|
30
29
|
end
|
31
30
|
end
|
32
31
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.expand_path(File.dirname(File.dirname(__FILE__)) + '/spec_helper')
|
2
4
|
|
3
5
|
describe 'TrelloWrapper' do
|
@@ -50,12 +52,12 @@ describe 'TrelloWrapper' do
|
|
50
52
|
end
|
51
53
|
|
52
54
|
it 'adds comments' do
|
53
|
-
note = OpenStruct.new(text: 'My Note'
|
55
|
+
note = OpenStruct.new(text: 'My Note')
|
54
56
|
story = mock_pivotal_story
|
55
|
-
allow(story).to
|
57
|
+
allow(story).to receive(:comments).and_return([note])
|
56
58
|
expect(wrapper).to receive(:get_card).and_return(nil)
|
57
59
|
expect(Trello::Card).to receive(:create).and_return(card)
|
58
|
-
expect(card).to receive(:add_comment).with('
|
60
|
+
expect(card).to receive(:add_comment).with('My Note')
|
59
61
|
expect(wrapper.create_card('list_id', story)).to eq(card)
|
60
62
|
end
|
61
63
|
|
@@ -63,7 +65,7 @@ describe 'TrelloWrapper' do
|
|
63
65
|
task = OpenStruct.new(description: 'My Task', complete: false)
|
64
66
|
story = mock_pivotal_story
|
65
67
|
checklist = double(Trello::Checklist)
|
66
|
-
allow(story).to
|
68
|
+
allow(story).to receive(:tasks).and_return([task])
|
67
69
|
expect(wrapper).to receive(:get_card).and_return(nil)
|
68
70
|
expect(Trello::Card).to receive(:create).and_return(card)
|
69
71
|
expect(Trello::Checklist).to receive(:create).with(name: 'Tasks', card_id: card.id).and_return(checklist)
|
@@ -87,8 +89,8 @@ describe 'TrelloWrapper' do
|
|
87
89
|
list = OpenStruct.new(id: 'id', name: 'My List')
|
88
90
|
expect(Trello::Board).to receive(:find).with('board_id').and_return(board)
|
89
91
|
expect(board).to receive(:lists).and_return([list])
|
90
|
-
expect(wrapper.list_choices('board_id')).to eq(
|
91
|
-
|
92
|
+
expect(wrapper.list_choices('board_id')).to eq('id' => 'My List',
|
93
|
+
false => "[don't import these stories]")
|
92
94
|
end
|
93
95
|
end
|
94
96
|
|
@@ -132,5 +134,4 @@ describe 'TrelloWrapper' do
|
|
132
134
|
wrapper.add_label(card, 'bug', 'red')
|
133
135
|
end
|
134
136
|
end
|
135
|
-
|
136
137
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
5
|
require 'rspec'
|
@@ -5,7 +7,7 @@ require 'pivotal-to-trello'
|
|
5
7
|
|
6
8
|
# Requires supporting files with custom matchers and macros, etc,
|
7
9
|
# in ./support/ and its subdirectories.
|
8
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
|
9
11
|
|
10
12
|
RSpec.configure do |config|
|
11
13
|
end
|
@@ -32,9 +34,10 @@ def mock_pivotal_story(options = {})
|
|
32
34
|
current_state: 'unstarted',
|
33
35
|
story_type: 'feature',
|
34
36
|
}.merge(options)
|
35
|
-
|
36
|
-
|
37
|
-
allow(story).to
|
37
|
+
|
38
|
+
story = double(TrackerApi::Resources::Story)
|
39
|
+
allow(story).to receive(:comments).and_return([])
|
40
|
+
allow(story).to receive(:tasks).and_return([])
|
38
41
|
options.each { |k, v| allow(story).to receive_messages(k => v) }
|
39
42
|
story
|
40
43
|
end
|
@@ -52,20 +55,20 @@ def mock_trello_card(options = {})
|
|
52
55
|
end
|
53
56
|
|
54
57
|
def mock_options
|
55
|
-
OpenStruct.new(
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
58
|
+
OpenStruct.new(pivotal_project_id: 'pivotal_project_id',
|
59
|
+
trello_board_id: 'trello_board_id',
|
60
|
+
icebox_list_id: 'icebox_list_id',
|
61
|
+
current_list_id: 'current_list_id',
|
62
|
+
finished_list_id: 'finished_list_id',
|
63
|
+
delivered_list_id: 'delivered_list_id',
|
64
|
+
accepted_list_id: 'accepted_list_id',
|
65
|
+
rejected_list_id: 'rejected_list_id',
|
66
|
+
bug_list_id: 'bug_list_id',
|
67
|
+
chore_list_id: 'chore_list_id',
|
68
|
+
feature_list_id: 'feature_list_id',
|
69
|
+
release_list_id: 'release_list_id',
|
70
|
+
bug_label: 'bug_label',
|
71
|
+
feature_label: 'feature_label',
|
72
|
+
chore_label: 'chore_label',
|
73
|
+
release_label: 'release_label')
|
71
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pivotal-to-trello
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Perrett
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2019-12-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: highline
|
@@ -32,84 +32,98 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 2.
|
35
|
+
version: 2.2.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 2.
|
42
|
+
version: 2.2.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
|
-
name:
|
44
|
+
name: tracker_api
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 1.10.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
56
|
+
version: 1.10.0
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: rspec
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: '0'
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
70
|
+
version: '0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: rdoc
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
84
|
+
version: '0'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: jeweler
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
91
|
+
version: '0'
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
98
|
+
version: '0'
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: rubocop
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
103
|
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0
|
105
|
+
version: '0'
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 0
|
112
|
+
version: '0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rubocop-performance
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
113
127
|
description: Pulls stories from Pivotal Tracker and imports them into Trello
|
114
128
|
email: hello@daveperrett.com
|
115
129
|
executables:
|
@@ -157,8 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
171
|
- !ruby/object:Gem::Version
|
158
172
|
version: '0'
|
159
173
|
requirements: []
|
160
|
-
|
161
|
-
rubygems_version: 2.4.5
|
174
|
+
rubygems_version: 3.0.3
|
162
175
|
signing_key:
|
163
176
|
specification_version: 4
|
164
177
|
summary: Pivotal Tracker to Trello exporter
|