checkoff 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac558deb21242fbafa8896765220574a9b7386ff
4
- data.tar.gz: efe68230c0e4d485942c3bca5a7a21b94cb0acfa
3
+ metadata.gz: 8eda5499a65efce1e6439d1f91558d00e358dde1
4
+ data.tar.gz: 8390ace557f726d0a6a80bb3411de2459a2f5345
5
5
  SHA512:
6
- metadata.gz: 7e67efc0190d8c58993e0657d3681da8266e274f246d7a15f13be90de50f12ead8c90d871289a5265e7e055e67107dfa8a8bdee44bd176f143ec444a97a2d132
7
- data.tar.gz: 7dcffa12ba7ecf02b32d5cf48443214c5e265f76e7eed9324ce49effadbb21c904f25c8ebf3960ad3d1cbc08e80bcf6197727c4a409e75bc4aa229ec46459a39
6
+ metadata.gz: ef603fb6034b3b37d8587225a1fadf0dbd42e508197e22f9a075dd2a0fe7263ee7f75906098e0c4b50f1b7b743b4e1b85b9b21f049281eed0ded528b0e6a4d84
7
+ data.tar.gz: c94b4a269d580b99e6e44614ed070c770dee3ccfb909e8e9772e41a99d3bacbf725e993b8e8f193d5302c3f727bedbc9102c0c954887959a80e8aea9344cff62
data/README.md CHANGED
@@ -3,31 +3,127 @@ Command-line and gem client for Asana (unofficial)
3
3
  [![Circle CI](https://circleci.com/gh/apiology/checkoff.svg?style=svg)](https://circleci.com/gh/apiology/checkoff)
4
4
  [![Travis CI](https://travis-ci.org/apiology/checkoff.svg?branch=master)](https://travis-ci.org/apiology/checkoff)
5
5
 
6
+ ## Using
7
+
8
+ ```
9
+ $ checkoff --help
10
+ View tasks:
11
+ checkoff view workspace project [section]
12
+
13
+ 'project' can be set to a project name, or :my_tasks, :my_tasks_upcoming, :my_tasks_new, or :my_tasks_today
14
+ ```
15
+
16
+ Let's say we have a project like this:
17
+
18
+ ![project screenshot from asana.com](https://github.com/apiology/checkoff/raw/master/docs/example_project.png "Example project")
19
+
20
+ Checkoff outputs things in JSON. 'jq' is a great tool to use in combination:
21
+
22
+ ```
23
+ $ checkoff view 'Personal Projects' 'Create demo'
24
+ {"":[{"name":"This is a task that doesn't belong to any sections."}],"Write it:":[{"name":"Write something"}],"Publish to github:":[{"name":"git push!"}],"Make sure it looks OK!:":[{"name":"Looks it up in your browser..."}]}
25
+ $
26
+ ```
27
+
28
+ ```json
29
+ $ checkoff view 'Personal Projects' 'Create demo' | jq
30
+ {
31
+ "": [
32
+ {
33
+ "name": "This is a task that doesn't belong to any sections."
34
+ }
35
+ ],
36
+ "Write it:": [
37
+ {
38
+ "name": "Write something"
39
+ }
40
+ ],
41
+ "Publish to github:": [
42
+ {
43
+ "name": "git push!"
44
+ }
45
+ ],
46
+ "Make sure it looks OK!:": [
47
+ {
48
+ "name": "Looks it up in your browser..."
49
+ }
50
+ ]
51
+ }
52
+ ```
53
+
54
+ You can drill down into a section on the command line:
55
+
56
+ ```
57
+ $ checkoff view 'Personal Projects' 'Create demo' 'Publish to github:'
58
+ [{"name":"git push!"}]
59
+ ```
60
+
61
+ You can use fun `jq` tricks:
62
+
63
+ ```json
64
+ $ checkoff view 'Personal Projects' 'Create demo' | jq 'to_entries | map(.value) | flatten | map(.name)'
65
+ [
66
+ "This is a task that doesn't belong to any sections.",
67
+ "Write something",
68
+ "git push!",
69
+ "Looks it up in your browser..."
70
+ ]
71
+ ```
72
+
73
+ And even gather counts for project metrics:
74
+
75
+ ```bash
76
+ $ checkoff view 'Personal Projects' 'Create demo' | jq 'to_entries | map(.value) | flatten | map(.name) | length'
77
+ 4
78
+ $
79
+ ```
80
+
6
81
  ## Caching
7
82
 
8
83
  Note that I don't know of a way through the Asana API to target
9
84
  individual sections and pull back only those tasks, which is a real
10
85
  bummer! As a result, sometimes the number of tasks brought back to
11
- answer a query is really large and takes a while. To help make that
12
- less annoying, I do caching using memcached; you'll need to install
13
- it.
86
+ answer a query is really large and takes a while--especially if you're
87
+ querying on something like `:my_tasks_today`. To help make that less
88
+ annoying, I do caching using memcached; you'll need to install it.
89
+
90
+ If you're working in real time with modifications in Asana, you may
91
+ need to occasionally run `echo 'flush_all' | nc localhost 11211` to
92
+ clear the cache.
14
93
 
15
94
  ## Installing
16
95
 
96
+ This will work under OS X:
97
+
17
98
  ```bash
18
99
  brew install memcached
100
+ ln -sfv /usr/local/opt/memcached/*.plist ~/Library/LaunchAgents
101
+ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
19
102
  gem install checkoff
20
-
21
103
  ```
22
104
 
23
- ## Using
105
+ ## Configuring
24
106
 
25
- ```bash
26
- $ checkoff --help
27
- View tasks:
28
- exe/checkoff view workspace project [section]
107
+ You'll need to create a file called `.asana.yml` in your home directory, that looks like this:
29
108
 
30
- 'project' can be set to a project name, or :my_tasks, :my_tasks_upcoming, :my_tasks_new, or :my_tasks_today
109
+ ```yaml
110
+ ---
111
+
112
+ #
113
+ # when you click on 'My Tasks' in Asana, put the number (just the
114
+ # number) from the URL in the mapping below.
115
+ #
116
+ my_tasks:
117
+ 'Your workspace name here': 'some_long_number'
118
+
119
+ #
120
+
121
+ # Click on your profile in the uppper right in Asana, go to 'My
122
+ # Profile Settings', click on 'Apps', got o 'Manage Developer Apps',
123
+ # and select 'Create New Personal Access Token'. Note down the key
124
+ # in this section.
125
+ #
126
+ personal_access_token: 'some_big_long_string_from_asana.com_here'
31
127
  ```
32
128
 
33
129
  ## Developing
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "result": {
3
- "covered_percent": 98.31
3
+ "covered_percent": 98.65
4
4
  }
5
5
  }
Binary file
data/lib/checkoff/cli.rb CHANGED
@@ -21,9 +21,15 @@ module Checkoff
21
21
  end
22
22
 
23
23
  def task_to_hash(task)
24
- {
24
+ task_out = {
25
25
  name: task.name,
26
26
  }
27
+ if task.due_on
28
+ task_out[:due] = task.due_on
29
+ elsif task.due_at
30
+ task_out[:due] = task.due_at
31
+ end
32
+ task_out
27
33
  end
28
34
 
29
35
  def tasks_to_hash(tasks)
@@ -5,7 +5,7 @@ require 'active_support/core_ext/hash'
5
5
  class ConfigLoader
6
6
  def self.load(sym)
7
7
  file = "#{sym}.yml"
8
- YAML.load_file(File.expand_path("~/private/#{file}"))
8
+ YAML.load_file(File.expand_path("~/.#{file}"))
9
9
  .with_indifferent_access
10
10
  end
11
11
  end
@@ -64,7 +64,6 @@ module Checkoff
64
64
  if project_name.is_a?(Symbol) && project_name.to_s.start_with?('my_tasks')
65
65
  my_tasks(workspace_name)
66
66
  else
67
- STDERR.puts "Looking for #{project_name} under #{workspace_name}"
68
67
  projects = projects_by_workspace_name(workspace_name)
69
68
  projects.find do |project|
70
69
  project.name == project_name
@@ -12,8 +12,8 @@ module Checkoff
12
12
  LONG_CACHE_TIME = MINUTE * 15
13
13
  SHORT_CACHE_TIME = MINUTE * 5
14
14
 
15
- def initialize
16
- @sections = Checkoff::Sections.new
15
+ def initialize(sections: Checkoff::Sections.new)
16
+ @sections = sections
17
17
  end
18
18
 
19
19
  def tasks_minus_sections(tasks)
@@ -1,3 +1,3 @@
1
1
  module Checkoff
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-18 00:00:00.000000000 Z
11
+ date: 2016-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dalli
@@ -173,6 +173,7 @@ files:
173
173
  - checkoff.gemspec
174
174
  - circle.yml
175
175
  - coverage/.last_run.json
176
+ - docs/example_project.png
176
177
  - exe/checkoff
177
178
  - lib/checkoff.rb
178
179
  - lib/checkoff/cli.rb