checkoff 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -2
- data/Rakefile +1 -0
- data/checkoff.gemspec +1 -0
- data/coverage/.last_run.json +1 -1
- data/lib/checkoff.rb +1 -0
- data/lib/checkoff/cli.rb +33 -9
- data/lib/checkoff/config_loader.rb +2 -0
- data/lib/checkoff/projects.rb +24 -0
- data/lib/checkoff/sections.rb +1 -0
- data/lib/checkoff/tasks.rb +2 -0
- data/lib/checkoff/version.rb +2 -1
- data/lib/tasks/ci.rake +1 -0
- data/lib/tasks/clear_metrics.rake +1 -0
- data/lib/tasks/default.rake +1 -0
- data/lib/tasks/feature.rake +1 -0
- data/lib/tasks/localtest.rake +1 -0
- data/lib/tasks/quality.rake +1 -0
- data/lib/tasks/spec.rake +1 -0
- data/lib/tasks/test.rake +1 -0
- data/metrics/bigfiles_high_water_mark +1 -1
- data/metrics/bundle-audit_high_water_mark +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2072628c4164da14449f985dc2e455b04a2a9973
|
4
|
+
data.tar.gz: 3a8cdae4f8678cfc2295f79a9477a11bc996715b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d30eed934598931ef970ebe69a19196ac8fb027186da42e447f8f1a03a73366621164148e46d143a5317bc5a66e3ca392f25bf98398a7aba69a66bcacd2bec1
|
7
|
+
data.tar.gz: de6b37ce6683cc2f1ee58276d2594b6ff16ddf1b3694d33c3bc328922958eba3a82072fe6291dcda3cfbc5d3feb8388a764acf9766d2b5adce27f48bcd0c2990
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.1
|
1
|
+
ruby-2.3.1
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
data/checkoff.gemspec
CHANGED
data/coverage/.last_run.json
CHANGED
data/lib/checkoff.rb
CHANGED
data/lib/checkoff/cli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require 'ostruct'
|
4
5
|
require 'dalli'
|
5
6
|
require 'cache_method'
|
@@ -12,9 +13,11 @@ module Checkoff
|
|
12
13
|
class CLI
|
13
14
|
attr_reader :sections, :stderr
|
14
15
|
|
15
|
-
def initialize(
|
16
|
+
def initialize(projects: Checkoff::Projects.new,
|
17
|
+
sections: Checkoff::Sections.new(projects: projects),
|
16
18
|
stderr: STDERR,
|
17
19
|
kernel: Kernel)
|
20
|
+
@projects = projects
|
18
21
|
@sections = sections
|
19
22
|
@kernel = kernel
|
20
23
|
@stderr = stderr
|
@@ -51,9 +54,12 @@ module Checkoff
|
|
51
54
|
tasks_to_hash(tasks).to_json
|
52
55
|
end
|
53
56
|
|
57
|
+
def quickadd(task_name)
|
58
|
+
@projects.add_task(task_name)
|
59
|
+
end
|
60
|
+
|
54
61
|
def validate_args!(args)
|
55
|
-
|
56
|
-
return unless project.nil? || mode != 'view'
|
62
|
+
return unless args.length < 2 || !%w(view quickadd).include?(args[0])
|
57
63
|
|
58
64
|
output_help
|
59
65
|
exit(1)
|
@@ -61,24 +67,42 @@ module Checkoff
|
|
61
67
|
|
62
68
|
def parse_args(args)
|
63
69
|
validate_args!(args)
|
64
|
-
args[
|
70
|
+
mode = args[0]
|
71
|
+
subargs = OpenStruct.new
|
72
|
+
if mode == 'view'
|
73
|
+
subargs.workspace = args[1]
|
74
|
+
subargs.project = args[2]
|
75
|
+
elsif mode == 'quickadd'
|
76
|
+
subargs.task_name = args[1]
|
77
|
+
else
|
78
|
+
raise
|
79
|
+
end
|
80
|
+
[mode, subargs]
|
65
81
|
end
|
66
82
|
|
67
83
|
def output_help
|
68
84
|
stderr.puts 'View tasks:'
|
69
85
|
stderr.puts " #{$PROGRAM_NAME} view workspace project [section]"
|
86
|
+
stderr.puts " #{$PROGRAM_NAME} quickadd task_name"
|
70
87
|
stderr.puts
|
71
88
|
stderr.puts "'project' can be set to a project name, or :my_tasks, " \
|
72
89
|
':my_tasks_upcoming, :my_tasks_new, or :my_tasks_today'
|
73
90
|
end
|
74
91
|
|
75
92
|
def run(args)
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
93
|
+
command, subargs = parse_args(args)
|
94
|
+
if command == 'view'
|
95
|
+
project = subargs.project
|
96
|
+
project = project[1..-1].to_sym if project.start_with? ':'
|
97
|
+
if section.nil?
|
98
|
+
run_on_project(subargs.workspace, project)
|
99
|
+
else
|
100
|
+
run_on_section(subargs.workspace, project, subargs.section)
|
101
|
+
end
|
102
|
+
elsif command == 'quickadd'
|
103
|
+
quickadd(subargs.task_name)
|
80
104
|
else
|
81
|
-
|
105
|
+
raise
|
82
106
|
end
|
83
107
|
end
|
84
108
|
end
|
data/lib/checkoff/projects.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative 'config_loader'
|
2
2
|
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require 'cache_method'
|
4
5
|
require 'asana'
|
5
6
|
|
@@ -39,6 +40,29 @@ module Checkoff
|
|
39
40
|
end
|
40
41
|
cache_method :projects, LONG_CACHE_TIME
|
41
42
|
|
43
|
+
def add_task(name,
|
44
|
+
workspace_id: default_workspace_id,
|
45
|
+
assignee_id: default_assignee_id)
|
46
|
+
Asana::Resources::Task.create(client,
|
47
|
+
assignee: assignee_id,
|
48
|
+
workspace: workspace_id, name: name)
|
49
|
+
end
|
50
|
+
|
51
|
+
def default_workspace_id
|
52
|
+
@config[:default_workspace_id]
|
53
|
+
end
|
54
|
+
|
55
|
+
def default_assignee_id
|
56
|
+
@config[:default_assignee_id]
|
57
|
+
end
|
58
|
+
|
59
|
+
def user_by_name(name, workspace_id: raise)
|
60
|
+
client.users.find_all(workspace: workspace_id).find do |user|
|
61
|
+
print(user)
|
62
|
+
user.name == name
|
63
|
+
end || raise("Could not find user #{email}")
|
64
|
+
end
|
65
|
+
|
42
66
|
def workspace_by_name(workspace_name)
|
43
67
|
client.workspaces.find_all.find do |workspace|
|
44
68
|
workspace.name == workspace_name
|
data/lib/checkoff/sections.rb
CHANGED
data/lib/checkoff/tasks.rb
CHANGED
data/lib/checkoff/version.rb
CHANGED
data/lib/tasks/ci.rake
CHANGED
data/lib/tasks/default.rake
CHANGED
data/lib/tasks/feature.rake
CHANGED
data/lib/tasks/localtest.rake
CHANGED
data/lib/tasks/quality.rake
CHANGED
data/lib/tasks/spec.rake
CHANGED
data/lib/tasks/test.rake
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
487
|
@@ -0,0 +1 @@
|
|
1
|
+
0
|
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.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vince Broz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dalli
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/tasks/test.rake
|
193
193
|
- metrics/bigfiles_high_water_mark
|
194
194
|
- metrics/brakeman_high_water_mark
|
195
|
+
- metrics/bundle-audit_high_water_mark
|
195
196
|
- metrics/cane_high_water_mark
|
196
197
|
- metrics/eslint_high_water_mark
|
197
198
|
- metrics/flay_high_water_mark
|
@@ -221,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
222
|
version: '0'
|
222
223
|
requirements: []
|
223
224
|
rubyforge_project:
|
224
|
-
rubygems_version: 2.
|
225
|
+
rubygems_version: 2.5.1
|
225
226
|
signing_key:
|
226
227
|
specification_version: 4
|
227
228
|
summary: Command-line and gem client for Asana (unofficial)
|