omnifocus-trello 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omnifocus-trello.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Vesa Vänskä
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # omnifocus-trello
2
+
3
+ code: https://github.com/vesan/omnifocus-trello
4
+
5
+ Plugin for omnifocus gem to provide Trello BTS synchronization.
6
+
7
+ Pulls all cards assigned to a user and creates corresponding tasks to OmniFocus.
8
+ Cards in lists having completed cards are marked as done. The user whose tasks
9
+ are synced and the lists that are considered as having completed cards are
10
+ configurable using the config file.
11
+
12
+ ## Usage
13
+
14
+ 1. Install
15
+
16
+ $ gem install omnifocus-trello
17
+
18
+ 2. Sync
19
+
20
+ $ of sync
21
+
22
+ 3. (On the first run, configuration file will be generated at
23
+ ~/.omnifocus-trello.yml. Follow to instructions to get a token.)
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ require "omnifocus"
2
+
3
+ module OmniFocus::Trello
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,69 @@
1
+ require "open-uri"
2
+ require "json"
3
+ require "yaml"
4
+
5
+ module OmniFocus::Trello
6
+ PREFIX = "TR"
7
+ KEY = "3ad9e72a2e2d41a98450ca775a0bafe4"
8
+
9
+ def load_or_create_config
10
+ path = File.expand_path "~/.omnifocus-trello.yml"
11
+ config = YAML.load(File.read(path)) rescue nil
12
+
13
+ unless config then
14
+ config = { :token => "Open URL https://trello.com/1/authorize?key=#{KEY}&name=OmniFocus+Trello+integration&expiration=never&response_type=token and copy the token from the web page here.", :done_boards => ["Done", "Deployed", "Finished", "Cards in these boards are considered done, you add and remove names to fit your workflow."] }
15
+
16
+ File.open(path, "w") { |f|
17
+ YAML.dump(config, f)
18
+ }
19
+
20
+ abort "Created default config in #{path}. Go fill it out."
21
+ end
22
+
23
+ config
24
+ end
25
+
26
+ def populate_trello_tasks
27
+ config = load_or_create_config
28
+ token = config[:token]
29
+ done_lists = config[:done_lists]
30
+
31
+ boards = fetch_boards(token)
32
+ fetch_cards(token).each do |card|
33
+ process_card(boards, done_lists, card)
34
+ end
35
+ end
36
+
37
+ def fetch_cards(token)
38
+ url = "https://api.trello.com/1/members/my/cards?key=#{KEY}&token=#{token}"
39
+
40
+ JSON.parse(open(url).read)
41
+ end
42
+
43
+ def process_card(boards, done_lists, card)
44
+ number = card["idShort"]
45
+ url = card["shortUrl"]
46
+ board = boards.find {|board| board["id"] == card["idBoard"] }
47
+ project_name = board["name"]
48
+ ticket_id = "#{PREFIX}-#{project_name}##{number}"
49
+ title = "#{ticket_id}: #{card["name"]}"
50
+ list = board["lists"].find {|list| list["id"] == card["idList"] }
51
+
52
+ # If card is in a "done" list, mark it as completed.
53
+ if done_lists.include?(list["name"])
54
+ return
55
+ end
56
+
57
+ if existing[ticket_id]
58
+ bug_db[existing[ticket_id]][ticket_id] = true
59
+ return
60
+ end
61
+
62
+ bug_db[project_name][ticket_id] = [title, url]
63
+ end
64
+
65
+ def fetch_boards(token)
66
+ url = "https://api.trello.com/1/members/my/boards?key=#{KEY}&token=#{token}&lists=open"
67
+ JSON.parse(open(url).read)
68
+ end
69
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omnifocus/trello/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Vesa Vänskä"]
6
+ gem.email = ["vesa@vesavanska.com"]
7
+ gem.description = %q{Plugin for omnifocus gem to provide Trello BTS synchronization.}
8
+ gem.summary = %q{Plugin for omnifocus gem to provide Trello BTS synchronization.}
9
+ gem.homepage = "https://github.com/vesan/omnifocus-trello"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "omnifocus-trello"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = OmniFocus::Trello::VERSION
17
+
18
+ gem.add_dependency "omnifocus", "~> 2.1"
19
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omnifocus-trello
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Vesa Vänskä
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omnifocus
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.1'
30
+ description: Plugin for omnifocus gem to provide Trello BTS synchronization.
31
+ email:
32
+ - vesa@vesavanska.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE
40
+ - README.md
41
+ - Rakefile
42
+ - lib/omnifocus/trello.rb
43
+ - lib/omnifocus/trello/version.rb
44
+ - omnifocus-trello.gemspec
45
+ homepage: https://github.com/vesan/omnifocus-trello
46
+ licenses: []
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubyforge_project:
65
+ rubygems_version: 1.8.24
66
+ signing_key:
67
+ specification_version: 3
68
+ summary: Plugin for omnifocus gem to provide Trello BTS synchronization.
69
+ test_files: []