smart_asana 0.0.1
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.
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +72 -0
- data/Rakefile +2 -0
- data/bin/asana +21 -0
- data/lib/smart_asana.rb +69 -0
- data/lib/smart_asana/version.rb +3 -0
- data/smart_asana.gemspec +20 -0
- metadata +88 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Ryan Bright
|
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,72 @@
|
|
1
|
+
# Smart Asana
|
2
|
+
|
3
|
+
This gem allows you to add tasks to Asana using the [Smart Add][]
|
4
|
+
syntax from [Remember the Milk][].
|
5
|
+
|
6
|
+
I used RTM for four years before switching to Asana, and I missed the
|
7
|
+
seamless task entry. No more!
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'smart_asana'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install smart_asana
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
To run the `asana` executable, define the `ASANA_API_KEY` environmental
|
26
|
+
variable. This will be used to construct a new connection to Asana.
|
27
|
+
|
28
|
+
Once the environmental variable is configured, you can add your tasks
|
29
|
+
from the command-line.
|
30
|
+
|
31
|
+
$ asana 'This is a new task #TheWorkspace !1'
|
32
|
+
|
33
|
+
**Note:** You must include single-quotes around the task entry. Shells
|
34
|
+
like zsh try to parse the indicator characters without them.
|
35
|
+
|
36
|
+
### Specifying Indicators
|
37
|
+
|
38
|
+
The parser will use all text preceding the first indicator as your task
|
39
|
+
name, and the task attributes will be set based on the indicators you
|
40
|
+
have specified.
|
41
|
+
|
42
|
+
You can assign a task to today, upcoming, or later. All other tasks are
|
43
|
+
dropped into your inbox. For more information about these status types,
|
44
|
+
check out the [Tasks documentation][].
|
45
|
+
|
46
|
+
$ asana 'This task is for today !1'
|
47
|
+
|
48
|
+
```text
|
49
|
+
1 - today
|
50
|
+
2 - upcoming
|
51
|
+
3 - later
|
52
|
+
```
|
53
|
+
|
54
|
+
You can also assign a task to a specific workspace.
|
55
|
+
|
56
|
+
$ asana 'This task is in #MyWorkspace'
|
57
|
+
|
58
|
+
Since workspace names can contain multiple words, you'll want to use
|
59
|
+
`MixedCase` indicators. Also, workspace indicators are not case-sensitive.
|
60
|
+
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
1. Fork it
|
65
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
66
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
67
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
68
|
+
5. Create new Pull Request
|
69
|
+
|
70
|
+
[Smart Add]: http://www.rememberthemilk.com/services/smartadd/
|
71
|
+
[Remember The Milk]: http://www.rememberthemilk.com/
|
72
|
+
[Tasks documentation]: http://developer.asana.com/documentation/#tasks
|
data/Rakefile
ADDED
data/bin/asana
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'asana'
|
3
|
+
require 'smart_asana'
|
4
|
+
|
5
|
+
attrs = SmartAsana.parse(ARGV[0])
|
6
|
+
|
7
|
+
Asana.configure do |client|
|
8
|
+
client.api_key = ENV['ASANA_API_KEY']
|
9
|
+
end
|
10
|
+
|
11
|
+
workspaces = Asana::Workspace.all
|
12
|
+
|
13
|
+
workspace = workspaces.select{ |w|
|
14
|
+
w.name.downcase == attrs[:workspace].downcase
|
15
|
+
}.first
|
16
|
+
|
17
|
+
attrs.delete(:workspace)
|
18
|
+
|
19
|
+
workspace ||= workspaces.first
|
20
|
+
|
21
|
+
workspace.create_task(attrs)
|
data/lib/smart_asana.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'active_support/core_ext/string/inflections'
|
2
|
+
|
3
|
+
require "smart_asana/version"
|
4
|
+
|
5
|
+
module SmartAsana
|
6
|
+
|
7
|
+
INDICATOR_CHARACTERS = %w{! #}
|
8
|
+
|
9
|
+
class << self
|
10
|
+
|
11
|
+
def parse(args)
|
12
|
+
words = args.split(' ')
|
13
|
+
indicators = indicators(words)
|
14
|
+
name = name(words, indicators)
|
15
|
+
attributes(indicators).tap do |hash|
|
16
|
+
hash[:name] = name
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def assignee_status(attr)
|
23
|
+
case attr
|
24
|
+
when '1'
|
25
|
+
'today'
|
26
|
+
when '2'
|
27
|
+
'upcoming'
|
28
|
+
when '3'
|
29
|
+
'later'
|
30
|
+
else
|
31
|
+
'inbox'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def attributes(indicators)
|
36
|
+
attrs = {}.tap do |array|
|
37
|
+
indicators.each do |ind|
|
38
|
+
attr = ind[1..ind.length]
|
39
|
+
case ind[0]
|
40
|
+
when '!'
|
41
|
+
array[:assignee_status] = assignee_status(attr)
|
42
|
+
when '#'
|
43
|
+
array[:workspace] = attr.titleize
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def indicators(words)
|
50
|
+
indicators = words.select { |word|
|
51
|
+
INDICATOR_CHARACTERS.include?(word[0])
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
def name(words, indicators)
|
56
|
+
[].tap { |array|
|
57
|
+
words.each do |word|
|
58
|
+
unless indicators.include?(word)
|
59
|
+
array << word
|
60
|
+
else
|
61
|
+
break
|
62
|
+
end
|
63
|
+
end
|
64
|
+
}.join(' ')
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
data/smart_asana.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/smart_asana/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Ryan Bright"]
|
6
|
+
gem.email = ["ryan@rbright.net"]
|
7
|
+
gem.description = %q{Add Asana using tasks using Remember the Milk's Smart Add syntax}
|
8
|
+
gem.summary = %q{Add Asana using tasks using Remember the Milk's Smart Add syntax}
|
9
|
+
gem.homepage = "http://github.com/rbright/smart_asana"
|
10
|
+
|
11
|
+
gem.add_dependency 'activesupport', '~> 3.2.3'
|
12
|
+
gem.add_dependency 'asana', '~> 0.0.3'
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split($\)
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.name = "smart_asana"
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
gem.version = SmartAsana::VERSION
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: smart_asana
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ryan Bright
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.3
|
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: 3.2.3
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: asana
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.0.3
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.0.3
|
46
|
+
description: Add Asana using tasks using Remember the Milk's Smart Add syntax
|
47
|
+
email:
|
48
|
+
- ryan@rbright.net
|
49
|
+
executables:
|
50
|
+
- asana
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- Gemfile
|
56
|
+
- LICENSE
|
57
|
+
- README.md
|
58
|
+
- Rakefile
|
59
|
+
- bin/asana
|
60
|
+
- lib/smart_asana.rb
|
61
|
+
- lib/smart_asana/version.rb
|
62
|
+
- smart_asana.gemspec
|
63
|
+
homepage: http://github.com/rbright/smart_asana
|
64
|
+
licenses: []
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 1.8.21
|
84
|
+
signing_key:
|
85
|
+
specification_version: 3
|
86
|
+
summary: Add Asana using tasks using Remember the Milk's Smart Add syntax
|
87
|
+
test_files: []
|
88
|
+
has_rdoc:
|