autoevernote 0.1.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +170 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +5 -0
- data/autoevernote.gemspec +40 -0
- data/bin/autoevernote +4 -0
- data/config/autoevernote.example.yml +11 -0
- data/lib/autoevernote.rb +20 -0
- data/lib/autoevernote/asana.rb +60 -0
- data/lib/autoevernote/cli.rb +56 -0
- data/lib/autoevernote/evernote.rb +66 -0
- data/lib/autoevernote/klout.rb +28 -0
- data/lib/autoevernote/version.rb +3 -0
- data/spec/autoevernote/asana_spec.rb +25 -0
- data/spec/fixtures/autoevernote.yml +11 -0
- data/spec/fixtures/vcr_cassettes/completed_tasks.yml +3024 -0
- data/spec/spec_helper.rb +24 -0
- metadata +310 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 949f81540709d3972f2cc2334323efa8a154e67d
|
4
|
+
data.tar.gz: 4e1cce6902ed4456a584d6a7662bba81d76f3a8c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 20524a4bfd846e5f26a122e65cd28f1e8351e41b0f2269a54659bce1a023a60d85650ff7cc5400a96caec4de455eb861b3e3ffc2a190b6dec8bac26b9aa9d8dc
|
7
|
+
data.tar.gz: ce4ba0e731e17ad38d695169dd5981f4a3e877d73b116cf3603baac731fb35a2fdde386bc96c5f1203cbf21083a7a937fe270e9dff6435b300fabc6882d1bf07
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p448
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'asana-ruby', github: 'blackxored/asana-ruby', branch: 'master'
|
4
|
+
gem 'configurations', github: 'blackxored/configurations', branch: 'indifferent-hash-for-config'
|
5
|
+
# Specify your gem's dependencies in autoevernote.gemspec
|
6
|
+
gemspec
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/blackxored/asana-ruby.git
|
3
|
+
revision: 825bb8faf45dc96fd9433e526808f350035dee17
|
4
|
+
branch: master
|
5
|
+
specs:
|
6
|
+
asana-ruby (0.0.2)
|
7
|
+
activeresource (>= 3.0)
|
8
|
+
|
9
|
+
GIT
|
10
|
+
remote: git://github.com/blackxored/configurations.git
|
11
|
+
revision: ee194b869f03e418b79f27862d717e923c8a36ce
|
12
|
+
branch: indifferent-hash-for-config
|
13
|
+
specs:
|
14
|
+
configurations (1.4.0)
|
15
|
+
activesupport
|
16
|
+
|
17
|
+
PATH
|
18
|
+
remote: .
|
19
|
+
specs:
|
20
|
+
autoevernote (0.1.0.alpha.1)
|
21
|
+
activesupport (~> 4.0)
|
22
|
+
evernote_oauth
|
23
|
+
httparty
|
24
|
+
mail
|
25
|
+
nokogiri
|
26
|
+
thin
|
27
|
+
thor
|
28
|
+
|
29
|
+
GEM
|
30
|
+
remote: https://rubygems.org/
|
31
|
+
specs:
|
32
|
+
activemodel (4.1.6)
|
33
|
+
activesupport (= 4.1.6)
|
34
|
+
builder (~> 3.1)
|
35
|
+
activeresource (4.0.0)
|
36
|
+
activemodel (~> 4.0)
|
37
|
+
activesupport (~> 4.0)
|
38
|
+
rails-observers (~> 0.1.1)
|
39
|
+
activesupport (4.1.6)
|
40
|
+
i18n (~> 0.6, >= 0.6.9)
|
41
|
+
json (~> 1.7, >= 1.7.7)
|
42
|
+
minitest (~> 5.1)
|
43
|
+
thread_safe (~> 0.1)
|
44
|
+
tzinfo (~> 1.1)
|
45
|
+
addressable (2.3.6)
|
46
|
+
builder (3.2.2)
|
47
|
+
cane (2.6.2)
|
48
|
+
parallel
|
49
|
+
celluloid (0.16.0)
|
50
|
+
timers (~> 4.0.0)
|
51
|
+
coderay (1.1.0)
|
52
|
+
coveralls (0.7.1)
|
53
|
+
multi_json (~> 1.3)
|
54
|
+
rest-client
|
55
|
+
simplecov (>= 0.7)
|
56
|
+
term-ansicolor
|
57
|
+
thor
|
58
|
+
crack (0.4.2)
|
59
|
+
safe_yaml (~> 1.0.0)
|
60
|
+
daemons (1.1.9)
|
61
|
+
diff-lcs (1.2.5)
|
62
|
+
docile (1.1.5)
|
63
|
+
eventmachine (1.0.3)
|
64
|
+
evernote-thrift (1.25.1)
|
65
|
+
evernote_oauth (0.2.3)
|
66
|
+
evernote-thrift
|
67
|
+
oauth (>= 0.4.1)
|
68
|
+
ffi (1.9.3)
|
69
|
+
formatador (0.2.5)
|
70
|
+
guard (2.6.1)
|
71
|
+
formatador (>= 0.2.4)
|
72
|
+
listen (~> 2.7)
|
73
|
+
lumberjack (~> 1.0)
|
74
|
+
pry (>= 0.9.12)
|
75
|
+
thor (>= 0.18.1)
|
76
|
+
guard-rspec (4.3.1)
|
77
|
+
guard (~> 2.1)
|
78
|
+
rspec (>= 2.14, < 4.0)
|
79
|
+
hitimes (1.2.2)
|
80
|
+
httparty (0.13.1)
|
81
|
+
json (~> 1.8)
|
82
|
+
multi_xml (>= 0.5.2)
|
83
|
+
i18n (0.6.11)
|
84
|
+
json (1.8.1)
|
85
|
+
listen (2.7.9)
|
86
|
+
celluloid (>= 0.15.2)
|
87
|
+
rb-fsevent (>= 0.9.3)
|
88
|
+
rb-inotify (>= 0.9)
|
89
|
+
lumberjack (1.0.9)
|
90
|
+
mail (2.6.1)
|
91
|
+
mime-types (>= 1.16, < 3)
|
92
|
+
method_source (0.8.2)
|
93
|
+
mime-types (2.3)
|
94
|
+
mini_portile (0.6.0)
|
95
|
+
minitest (5.4.1)
|
96
|
+
multi_json (1.10.1)
|
97
|
+
multi_xml (0.5.5)
|
98
|
+
netrc (0.7.7)
|
99
|
+
nokogiri (1.6.3.1)
|
100
|
+
mini_portile (= 0.6.0)
|
101
|
+
oauth (0.4.7)
|
102
|
+
parallel (1.3.2)
|
103
|
+
pry (0.10.1)
|
104
|
+
coderay (~> 1.1.0)
|
105
|
+
method_source (~> 0.8.1)
|
106
|
+
slop (~> 3.4)
|
107
|
+
rack (1.5.2)
|
108
|
+
rails-observers (0.1.2)
|
109
|
+
activemodel (~> 4.0)
|
110
|
+
rake (10.3.2)
|
111
|
+
rb-fsevent (0.9.4)
|
112
|
+
rb-inotify (0.9.5)
|
113
|
+
ffi (>= 0.5.0)
|
114
|
+
rest-client (1.7.2)
|
115
|
+
mime-types (>= 1.16, < 3.0)
|
116
|
+
netrc (~> 0.7)
|
117
|
+
rspec (3.1.0)
|
118
|
+
rspec-core (~> 3.1.0)
|
119
|
+
rspec-expectations (~> 3.1.0)
|
120
|
+
rspec-mocks (~> 3.1.0)
|
121
|
+
rspec-core (3.1.4)
|
122
|
+
rspec-support (~> 3.1.0)
|
123
|
+
rspec-expectations (3.1.1)
|
124
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
125
|
+
rspec-support (~> 3.1.0)
|
126
|
+
rspec-mocks (3.1.1)
|
127
|
+
rspec-support (~> 3.1.0)
|
128
|
+
rspec-support (3.1.0)
|
129
|
+
safe_yaml (1.0.3)
|
130
|
+
simplecov (0.9.1)
|
131
|
+
docile (~> 1.1.0)
|
132
|
+
multi_json (~> 1.0)
|
133
|
+
simplecov-html (~> 0.8.0)
|
134
|
+
simplecov-html (0.8.0)
|
135
|
+
slop (3.6.0)
|
136
|
+
term-ansicolor (1.3.0)
|
137
|
+
tins (~> 1.0)
|
138
|
+
thin (1.6.2)
|
139
|
+
daemons (>= 1.0.9)
|
140
|
+
eventmachine (>= 1.0.0)
|
141
|
+
rack (>= 1.0.0)
|
142
|
+
thor (0.19.1)
|
143
|
+
thread_safe (0.3.4)
|
144
|
+
timers (4.0.1)
|
145
|
+
hitimes
|
146
|
+
tins (1.3.3)
|
147
|
+
tzinfo (1.2.2)
|
148
|
+
thread_safe (~> 0.1)
|
149
|
+
vcr (2.9.3)
|
150
|
+
webmock (1.13.0)
|
151
|
+
addressable (>= 2.2.7)
|
152
|
+
crack (>= 0.3.2)
|
153
|
+
|
154
|
+
PLATFORMS
|
155
|
+
ruby
|
156
|
+
|
157
|
+
DEPENDENCIES
|
158
|
+
asana-ruby!
|
159
|
+
autoevernote!
|
160
|
+
bundler (~> 1.3)
|
161
|
+
cane
|
162
|
+
configurations!
|
163
|
+
coveralls
|
164
|
+
guard-rspec
|
165
|
+
pry
|
166
|
+
rake
|
167
|
+
rspec
|
168
|
+
simplecov
|
169
|
+
vcr
|
170
|
+
webmock (~> 1.13.0)
|
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Adrian Perez
|
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,35 @@
|
|
1
|
+
# Autoevernote
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/autoevernote.png)](http://badge.fury.io/rb/autoevernote) [![Build Status](https://travis-ci.org/blackxored/autoevernote.png)](https://travis-ci.org/blackxored/autoevernote) [![Coverage Status](https://coveralls.io/repos/blackxored/autoevernote/badge.png?branch=master)](https://coveralls.io/r/blackxored/autoevernote) [![Dependency Status](https://gemnasium.com/blackxored/autoevernote.png)](https://gemnasium.com/blackxored/autoevernote) [![Code Climate](https://codeclimate.com/github/blackxored/autoevernote.png)](https://codeclimate.com/github/blackxored/autoevernote)
|
4
|
+
|
5
|
+
A set of automated helpers for Evernote, Asana, and a few other tools.
|
6
|
+
Inspired by the Evernote Diary series, and the concept of quantified self.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
$ gem install autoevernote
|
11
|
+
|
12
|
+
Or if you're developing add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
gem 'autoevernote'
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Example usage for the executable:
|
23
|
+
|
24
|
+
__TODO__: screenshots and descriptions
|
25
|
+
|
26
|
+
$ autoevernote log_completed_tasks
|
27
|
+
$ autoevernote compute_stats
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
1. Fork it
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'autoevernote/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "autoevernote"
|
8
|
+
spec.version = AutoEvernote::VERSION
|
9
|
+
spec.authors = ["Adrian Perez"]
|
10
|
+
spec.email = ["adrianperez.deb@gmail.com"]
|
11
|
+
spec.description = %q{A set of recipes for programatically getting stuff into Evernote}
|
12
|
+
spec.summary = spec.description
|
13
|
+
spec.homepage = "https://github.com/blackxored/autoevernote"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "thor"
|
22
|
+
# spec.add_dependency "configurations"
|
23
|
+
spec.add_dependency "httparty"
|
24
|
+
spec.add_dependency "evernote_oauth"
|
25
|
+
spec.add_dependency "activesupport", "~> 4.0"
|
26
|
+
# TODO: evernote requires thin/rack
|
27
|
+
spec.add_dependency "thin"
|
28
|
+
spec.add_dependency "mail"
|
29
|
+
spec.add_dependency "nokogiri"
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
31
|
+
spec.add_development_dependency "rake"
|
32
|
+
spec.add_development_dependency "pry"
|
33
|
+
spec.add_development_dependency "guard-rspec"
|
34
|
+
spec.add_development_dependency "rspec"
|
35
|
+
spec.add_development_dependency "webmock", "~> 1.13.0"
|
36
|
+
spec.add_development_dependency "vcr"
|
37
|
+
spec.add_development_dependency "simplecov"
|
38
|
+
spec.add_development_dependency "coveralls"
|
39
|
+
spec.add_development_dependency "cane"
|
40
|
+
end
|
data/bin/autoevernote
ADDED
data/lib/autoevernote.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'active_support/all'
|
2
|
+
require 'configurations'
|
3
|
+
require "autoevernote/version"
|
4
|
+
|
5
|
+
module AutoEvernote
|
6
|
+
include Configurations
|
7
|
+
|
8
|
+
autoload :Asana, "autoevernote/asana"
|
9
|
+
autoload :Klout, "autoevernote/klout"
|
10
|
+
autoload :Evernote, "autoevernote/evernote"
|
11
|
+
|
12
|
+
default_config = File.expand_path('~/.autoevernote.yml')
|
13
|
+
|
14
|
+
if File.exist?(default_config)
|
15
|
+
require 'yaml'
|
16
|
+
AutoEvernote.configure do |c|
|
17
|
+
c.from_h(YAML.load_file(default_config))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'asana'
|
2
|
+
|
3
|
+
module AutoEvernote
|
4
|
+
class Asana
|
5
|
+
def initialize
|
6
|
+
@include_archived_tasks = true
|
7
|
+
::Asana.configure do |config|
|
8
|
+
config.api_key = AutoEvernote.configuration.asana.token
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def projects
|
13
|
+
@projects ||= ::Asana::Project.all
|
14
|
+
end
|
15
|
+
|
16
|
+
def workspaces
|
17
|
+
@workspaces ||= ::Asana::Workspace.all
|
18
|
+
end
|
19
|
+
|
20
|
+
def tasks
|
21
|
+
@tasks ||= all_tasks.flatten
|
22
|
+
end
|
23
|
+
|
24
|
+
def completed_tasks
|
25
|
+
@completed_tasks ||= filter_completed_tasks
|
26
|
+
end
|
27
|
+
|
28
|
+
def completed_tasks_for_today
|
29
|
+
@completed_tasks_for_today ||= completed_tasks.select do |task|
|
30
|
+
task.completed_at.to_date == Time.now.to_date
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_note
|
35
|
+
{
|
36
|
+
title: "Completed #{completed_tasks_for_today.size} tasks on #{Time.now.to_date}",
|
37
|
+
body: build_note_body(completed_tasks_for_today),
|
38
|
+
tags: ["asana"]
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def all_tasks
|
44
|
+
workspaces.map(&:tasks).reject(&:empty?)
|
45
|
+
end
|
46
|
+
|
47
|
+
def filter_completed_tasks
|
48
|
+
tasks = workspaces.map { |w| w.tasks(include_archived: true) }
|
49
|
+
tasks.reject(&:empty?).flatten.select(&:completed?)
|
50
|
+
end
|
51
|
+
|
52
|
+
def build_note_body(tasks)
|
53
|
+
body = "<ul>"
|
54
|
+
tasks.each do |task|
|
55
|
+
body += "\n<li><a href='https://app.asana.com/0/#{task.workspace.id}/#{task.id}'>#{task.name}</a></li>"
|
56
|
+
end
|
57
|
+
body += "</ul>"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'autoevernote'
|
3
|
+
|
4
|
+
module AutoEvernote
|
5
|
+
class CLI < Thor
|
6
|
+
desc "version", "Return the version of autoevernote"
|
7
|
+
def version
|
8
|
+
puts AutoEvernote::VERSION
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "log_completed_tasks", "Log today's completed tasks in Asana to Evernote"
|
12
|
+
def log_completed_tasks
|
13
|
+
puts "Retrieving completed tasks"
|
14
|
+
AutoEvernote::Evernote.new.create_note_from_hash(AutoEvernote::Asana.new.to_note)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "compute_stats", "Log quantified-self stats (followers, etc) to Evernote"
|
18
|
+
def compute_stats
|
19
|
+
evernote = AutoEvernote::Evernote.new
|
20
|
+
asana = AutoEvernote::Asana.new
|
21
|
+
klout = AutoEvernote::Klout.new.score(
|
22
|
+
AutoEvernote.configuration.twitter.username
|
23
|
+
)
|
24
|
+
twitter_id = AutoEvernote.configuration.twitter.id
|
25
|
+
twitter_counter_api = AutoEvernote.configuration.twitter.counter_token
|
26
|
+
|
27
|
+
twitter_stats = HTTParty.get("http://api.twittercounter.com", query: {
|
28
|
+
apikey: twitter_counter_api,
|
29
|
+
twitter_id: twitter_id
|
30
|
+
})
|
31
|
+
|
32
|
+
written_tasks_in_month = asana.tasks.select(&in_month_by(:created_at))
|
33
|
+
completed_tasks_in_month = asana.completed_tasks.select(&in_month_by(:completed_at))
|
34
|
+
|
35
|
+
note = {
|
36
|
+
title: "Stats for #{Date.today.strftime('%B %Y')}",
|
37
|
+
notebook: "Main",
|
38
|
+
body: "<ul>",
|
39
|
+
tags: ['baseline']
|
40
|
+
}
|
41
|
+
|
42
|
+
note[:body] += "<li><b>Twitter followers:</b> #{twitter_stats['followers_current']}</li>"
|
43
|
+
note[:body] += "<li><b>Klout Score:</b> #{klout[:score]} (#{klout[:monthly_change]})</li>"
|
44
|
+
note[:body] += "<li><b>Written tasks:</b> #{written_tasks_in_month.size}</li>"
|
45
|
+
note[:body] += "<li><b>Completed tasks:</b> #{completed_tasks_in_month.size}</li>"
|
46
|
+
note[:body] += "</ul>"
|
47
|
+
|
48
|
+
evernote.create_note_from_hash(note)
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def in_month_by(field)
|
53
|
+
->(task) { task.public_send(field) ? 1.month.ago <= Time.parse(task.public_send(field)) : false }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|