omnifocus-extrabrain 1.0.1 → 1.0.2
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 +4 -4
- data/lib/omnifocus/extrabrain.rb +19 -13
- data/lib/omnifocus/extrabrain/version.rb +1 -1
- data/omnifocus-extrabrain.gemspec +2 -0
- metadata +29 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b755d9c4ca2482a56067d1676b8c90cd66e07758
|
4
|
+
data.tar.gz: de8a413cc21b9489b6efece86026f34a04d9e08c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e78f75ec7e85cdc6acc1d890b7eb96787404584c24a91102862725b11adac9f75584061e404312a4a99f7cd60294aa9c55454caa334c334735b6da627c7ffe23
|
7
|
+
data.tar.gz: 393838f32fe188fbc9e2df999f15afca967d1160eeba1d85c1e0d4fea86778227572a1a8b9296510ec6b75dc331597f840ba17ba8e9583a7c24e57ac319e6ad9
|
data/lib/omnifocus/extrabrain.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
require 'keychain'
|
3
|
+
require 'base64'
|
4
|
+
require 'byebug'
|
3
5
|
|
4
6
|
module OmniFocus::Extrabrain
|
5
7
|
PREFIX = 'EB'
|
6
8
|
|
7
9
|
class Task
|
8
|
-
attr_accessor :id, :title, :
|
10
|
+
attr_accessor :id, :title, :project_id, :team
|
11
|
+
attr_writer :project_title
|
9
12
|
|
10
13
|
def initialize(attrs = {})
|
11
14
|
attrs.each do |attribute, value|
|
@@ -16,8 +19,12 @@ module OmniFocus::Extrabrain
|
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
22
|
+
def url
|
23
|
+
"https://#{team['subdomain']}.extrabrain.se/tasks/#{id}"
|
24
|
+
end
|
25
|
+
|
19
26
|
def ticket_id
|
20
|
-
"#{PREFIX}
|
27
|
+
"#{PREFIX}##{id}"
|
21
28
|
end
|
22
29
|
|
23
30
|
def project_title
|
@@ -46,9 +53,8 @@ module OmniFocus::Extrabrain
|
|
46
53
|
def populate_extrabrain_tasks
|
47
54
|
teams.each do |team|
|
48
55
|
page = 1
|
49
|
-
|
50
56
|
while tasks = get_tasks(team, page) do
|
51
|
-
tasks.each { |
|
57
|
+
tasks.each { |task| process_extrabrain_task(task, team) }
|
52
58
|
page = page + 1
|
53
59
|
end
|
54
60
|
end
|
@@ -68,29 +74,29 @@ module OmniFocus::Extrabrain
|
|
68
74
|
|
69
75
|
def user_id
|
70
76
|
@user_id ||= begin
|
71
|
-
|
72
|
-
|
73
|
-
|
77
|
+
current_user = JSON.parse resource['users/current.json'].get
|
78
|
+
current_user['user']['id']
|
79
|
+
end
|
74
80
|
end
|
75
81
|
|
76
82
|
def resource
|
77
83
|
@resource ||= client('https://extrabrain.se')
|
78
84
|
end
|
79
85
|
|
80
|
-
|
81
86
|
def get_tasks(team, page)
|
82
87
|
team_resource = client("https://#{team['subdomain']}.extrabrain.se")
|
83
88
|
json = JSON.parse team_resource["tasks.json?user_id=#{user_id}&page=#{page}"].get
|
84
89
|
return nil if json.nil? || json.empty?
|
85
|
-
json.map { |task_attributes| Task.new(task_attributes) }
|
90
|
+
json.map { |task_attributes| Task.new(task_attributes.merge team: team) }
|
86
91
|
end
|
87
92
|
|
88
93
|
def process_extrabrain_task(task, team)
|
89
|
-
description = "https://#{team['subdomain']}.extrabrain.se/tasks/#{task.id}"
|
90
94
|
if existing[task.ticket_id]
|
91
|
-
bug_db[task.
|
92
|
-
|
95
|
+
bug_db[existing[task.ticket_id]][task.ticket_id] = true
|
96
|
+
else
|
97
|
+
title = "#{task.ticket_id}: #{task.title}"
|
98
|
+
description = task.url
|
99
|
+
bug_db[task.project_title][task.ticket_id] = [title, description]
|
93
100
|
end
|
94
|
-
bug_db[task.project_title][task.ticket_id] = [task.title, description]
|
95
101
|
end
|
96
102
|
end
|
@@ -19,9 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
+
spec.add_dependency 'omnifocus'
|
22
23
|
spec.add_dependency 'rest-client'
|
23
24
|
spec.add_dependency 'ruby-keychain'
|
24
25
|
|
25
26
|
spec.add_development_dependency "bundler", "~> 1.9"
|
26
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency 'byebug'
|
27
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnifocus-extrabrain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Ross
|
@@ -10,6 +10,20 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2015-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omnifocus
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rest-client
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,20 @@ dependencies:
|
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
description: Plugin for omnifocus gem to provide Extrabrain BTS synchronization.
|
70
98
|
email:
|
71
99
|
- alex@aross.se
|