zensana 1.4.1 → 1.5.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41967b4cda033b6887aa91cbe2b933377bf8b3a4
4
- data.tar.gz: bb8564be7e8e921d8f2b8471420e7a77b8892498
3
+ metadata.gz: e97fa7d7b90bac8416207fa5ac106977a9b9d740
4
+ data.tar.gz: f2e42a59aa59a9c59816e9e019ea300b21949f2c
5
5
  SHA512:
6
- metadata.gz: fbfee470cb30563222598fd28be081515d48b200980dd34c07ab9512dfd25776a0804fdc09b9e3e82f1105ec2684283247369f55f2390ce4cefc9bb3e427c186
7
- data.tar.gz: b1bd9d29593f98a04b50e252c6ca15cf86849c9caa07e699d45e051a762f9c85969a0601ed1b95b9cb83e12b27466564e367d41cf8d7595542f261453c63109e
6
+ metadata.gz: 8b8fe064dbcb2448348314366fec7874144b42f20ee5f4acf123263a813998026ffa60ca2aea628461567c48f3c7544adf274d6ff03cffae509bec7e58f9984e
7
+ data.tar.gz: b0ce73be4a761d0d615ef3aaba765bf60b2a605ab9f4818f989a91c45ea04989779f6aa33ce07b8abb0dd33764cb6656b927a3388614a2cf3841affdf5aa4740
data/README.md CHANGED
@@ -55,9 +55,13 @@ control what gets converted.
55
55
  -a, [--attachments], [--no-attachments] # download and upload any attachments
56
56
  # Default: true
57
57
  -c, [--completed], [--no-completed] # include tasks that are completed
58
- -u, [--default-user=DEFAULT_USER] # set a default user to assign to tickets
58
+ -f, [--followers], [--no-followers] # add task followers to ticket as cc
59
+ -t, [--global-tags=one two three] # array of tag(s) to be applied to every ticket imported
60
+ # Default: ["zensana"]
61
+ -g, [--group-id=N] # ZenDesk group_id to assign tickets to - must not conflict with default_user
59
62
  -s, [--stories], [--no-stories] # import stories as comments
60
63
  # Default: true
64
+ -u, [--default-user=DEFAULT_USER] # set a default user to assign to invalid asana user items
61
65
  -v, [--verified], [--no-verified] # `false` will send email to zendesk users created
62
66
  # Default: true
63
67
 
@@ -31,6 +31,7 @@ module Zensana
31
31
  desc 'convert PROJECT', 'Convert PROJECT tasks to ZenDesk tickets (exact ID or NAME required)'
32
32
  option :attachments, type: 'boolean', aliases: '-a', default: true, desc: 'download and upload any attachments'
33
33
  option :completed, type: 'boolean', aliases: '-c', default: false, desc: 'include tasks that are completed'
34
+ option :followers, type: 'boolean', aliases: '-f', default: false, desc: 'add task followers to ticket as cc'
34
35
  option :global_tags, type: 'array', aliases: '-t', default: ['zensana'], desc: 'array of tag(s) to be applied to every ticket imported'
35
36
  option :group_id, type: 'numeric', aliases: '-g', default: nil, desc: 'ZenDesk group_id to assign tickets to - must not conflict with default_user'
36
37
  option :stories, type: 'boolean', aliases: '-s', default: true, desc: 'import stories as comments'
@@ -174,12 +175,21 @@ using options #{options}
174
175
  end
175
176
  end
176
177
 
178
+ # add followers as collaborators
179
+ if options[:followers]
180
+ collaborators = []
181
+ task.followers.each do |follower|
182
+ unless follower == task.created_by
183
+ if collaborator = asana_to_zendesk_user(follower, true)
184
+ collaborators << collaborator.id
185
+ end
186
+ end
187
+ end
188
+ end
189
+
177
190
  # ready to import the ticket now!
178
191
  ticket = Zensana::Zendesk::Ticket.new(
179
- :requester_id => requester.id,
180
- :external_id => task.id,
181
- :subject => task.name,
182
- :description => <<-EOF,
192
+ :description => <<-EOF,
183
193
  This is an Asana task imported using zensana @ #{Time.now}
184
194
 
185
195
  Project: #{@asana_project.name} (#{@asana_project.id})
@@ -188,11 +198,15 @@ using options #{options}
188
198
 
189
199
  Task attributes: #{task.attributes}
190
200
  EOF
191
- :assignee_id => zendesk_assignee_id(task.attributes['assignee']),
192
- :group_id => options[:group_id],
193
- :created_at => task.created_at,
194
- :tags => flatten_tags(project_tags, section_tags),
195
- :comments => comments
201
+ :requester_id => requester.id,
202
+ :external_id => task.id,
203
+ :subject => task.name,
204
+ :assignee_id => zendesk_assignee_id(task.attributes['assignee']),
205
+ :group_id => options[:group_id],
206
+ :created_at => task.created_at,
207
+ :tags => flatten_tags(project_tags, section_tags),
208
+ :comments => comments,
209
+ :collaborator_ids => collaborators
196
210
  )
197
211
  ticket.import
198
212
  say "\n >>> ticket successfully imported ", :green
@@ -32,13 +32,17 @@ module Zensana
32
32
  :headers => {
33
33
  "Content-Type" => "application/binary"
34
34
  },
35
- :detect_mime_type => true,
35
+ :detect_mime_type => mime_type_known?(file),
36
36
  :body => {
37
37
  "filename" => "#{File.basename(file)}",
38
38
  "uploaded_data" => File.new(file)
39
39
  },
40
40
  )['upload']
41
41
  end
42
+
43
+ def mime_type_known?(file)
44
+ ! [ '.cshtml' ].include? File.extname(file)
45
+ end
42
46
  end
43
47
  end
44
48
  end
@@ -1,3 +1,3 @@
1
1
  module Zensana
2
- VERSION = "1.4.1"
2
+ VERSION = "1.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zensana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Warren Bain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-27 00:00:00.000000000 Z
11
+ date: 2015-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print