checkoff 0.3.1 → 0.5.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7de05bff57b8bc1ccd37b878944a994b3bad1d08ddfc5bddbd3b95fcbcfef219
4
- data.tar.gz: 1368a91a4848ef821ec1ea5d55c689d6a9a5e5d31854cd23b573f5034050b7f2
3
+ metadata.gz: cf801216d45c8e3b9c09e80e8d5f05d097dec4361f076f3d70efafd10a628ec5
4
+ data.tar.gz: 19e168d38d597f1ca0962f22d14d2e4326975b847334672337c879edf19d74bb
5
5
  SHA512:
6
- metadata.gz: a75ed4380070000a5c1a598871f41d34e9fc5bf1e45d6964fd739a8f907e759770caebbfe84a59c01e98d50798eff93c01fc3b664f0c24e014098a2b928cd0b9
7
- data.tar.gz: f23238f6b1aa52b41b3567b9246c9982a447f3300a881d15837d9691ea7942425da85b065ee898406b0a0c18a303d221cbe89b0568e7281f3bf10a792d0b9d82
6
+ metadata.gz: 11b63053e7902dad783ccc000990f211a0184a90a016f938fa354871bec3c101ff8fff4743e798998844405710b34e686cc18def737fd44b7956f179bdeb83df
7
+ data.tar.gz: 80577a035c94855fbdcb2ee0abbca795c41a426d8d1737c33f7c9250a86dc52e7699dc64b39c895930bd581fcebe8b90fafc50fb2671c3cfb1729c4074ba8487
@@ -6,6 +6,12 @@ jobs:
6
6
  - image: apiology/circleci-ruby:latest
7
7
  steps:
8
8
  - checkout
9
- - run: bundle install
10
- - run: bundle exec rake --jobs=4 test
11
- - run: bundle exec rake --jobs=4 quality
9
+ - type: cache-restore
10
+ key: checkoff-{{ checksum "checkoff.gemspec" }}-{{ checksum "Gemfile" }}
11
+ - run: gem install --no-document bundler
12
+ - run: bundle install --path vendor/bundle --jobs=4
13
+ - type: cache-save
14
+ key: checkoff-{{ checksum "checkoff.gemspec" }}-{{ checksum "Gemfile" }}
15
+ paths:
16
+ - "vendor/bundle"
17
+ - run: bundle exec rake --jobs=4 ci
@@ -1,30 +1,27 @@
1
- # I like trailing commas in maps. They let me insert new elements and
1
+ # I like trailing commas in hashes. They let me insert new elements and
2
2
  # see them as one line in a diff, not two.
3
- Style/TrailingCommaInArrayLiteral:
3
+ Style/TrailingCommaInHashLiteral:
4
4
  EnforcedStyleForMultiline: comma
5
5
 
6
- Style/TrailingCommaInHashLiteral:
6
+ Style/TrailingCommaInArrayLiteral:
7
7
  EnforcedStyleForMultiline: comma
8
8
 
9
9
  # I use keyword arguments for a poor man's dependency injection to cut
10
10
  # down on the magic in my tests.
11
- ParameterLists:
11
+ Metrics/ParameterLists:
12
12
  CountKeywordArgs: false
13
13
 
14
- # If i'm using one function name and returning the contents of an
14
+ # If I'm using one function name and returning the contents of an
15
15
  # attribute, that's OK. The alternative would be this, which I find
16
16
  # confusing and often not really what I mean:
17
17
  #
18
18
  # attr_reader :something_else
19
19
  # alias_method :something, :something_else
20
- TrivialAccessors:
20
+ Style/TrivialAccessors:
21
21
  ExactNameMatch: true
22
22
 
23
- Layout/MultilineMethodCallIndentation:
24
- EnforcedStyle: indented
25
-
26
23
  #
27
- # Add 'XXX' to the standard list
24
+ # Add 'XX X' to the standard list
28
25
  #
29
26
  Style/CommentAnnotation:
30
27
  Keywords:
@@ -40,3 +37,41 @@ Style/CommentAnnotation:
40
37
  W"
41
38
  - "XX\
42
39
  X"
40
+
41
+ # https://stackoverflow.com/questions/40934345/rubocop-25-line-block-size-and-rspec-tests
42
+ Metrics/BlockLength:
43
+ # Exclude DSLs
44
+ Exclude:
45
+ - 'Rakefile'
46
+ - '*.gemspec'
47
+ - '**/*.rake'
48
+ - 'spec/**/*.rb'
49
+ - 'feature/**/*.rb'
50
+
51
+ # http://www.betterspecs.org/#single
52
+ #
53
+ # > in tests that are not isolated (e.g. ones that integrate with a
54
+ # > DB, an external webservice, or end-to-end-tests), you take a
55
+ # > massive performance hit to do the same setup over and over again,
56
+ # > just to set a different expectation in each test. In these sorts
57
+ # > of slower tests, I think it's fine to specify more than one
58
+ # > isolated behavior.
59
+ RSpec/MultipleExpectations:
60
+ Exclude:
61
+ - 'feature/**/*.rb'
62
+
63
+ Style/StringLiterals:
64
+ EnforcedStyle: single_quotes
65
+ SupportedStyles:
66
+ - single_quotes
67
+ - double_quotes
68
+ ConsistentQuotesInMultiline: true
69
+
70
+ AllCops:
71
+ TargetRubyVersion: 2.4
72
+
73
+
74
+ require:
75
+ - rubocop-rspec
76
+ - rubocop-minitest
77
+ - rubocop-rake
@@ -1 +1 @@
1
- 2.6.3
1
+ 2.6.6
@@ -1,15 +1,17 @@
1
+ language: ruby
2
+ cache: bundler
1
3
  before_install:
4
+ # https://bundler.io/blog/2019/05/14/
5
+ # solutions-for-cant-find-gem-bundler-with-executable-bundle.html
6
+ - gem update --system
2
7
  - gem install bundler
3
- language: ruby
4
8
  rvm:
5
- - ruby-2.5.1
6
- - ruby-2.4.4
7
- - ruby-2.3.7
8
- # - ruby-2.2.10 # no longer supported
9
- #
10
- # - jruby-head # JRuby not supported by dependencies
11
- # - jruby-9.0 # see:
12
- # https://github.com/apiology/quality/issues/59
13
- # https://github.com/brianmario/charlock_holmes/issues/124
14
- #
15
- - ruby-head # Upstream bug - see https://travis-ci.org/apiology/checkoff/jobs/138626934
9
+ # JRuby error with native code build - possibly can be overcome?
10
+ # checking for main() in -lstdc++... RuntimeError: The compiler failed to generate
11
+ # https://travis-ci.com/apiology/pronto-punchlist/jobs/264907931
12
+ # - jruby-head
13
+ - ruby-head
14
+ - ruby-2.7
15
+ - ruby-2.6
16
+ - ruby-2.5
17
+ - ruby-2.4
@@ -0,0 +1,27 @@
1
+ .PHONY: spec feature
2
+
3
+ all: localtest
4
+
5
+ localtest:
6
+ @bundle exec rake localtest
7
+
8
+ feature:
9
+ @bundle exec rake feature
10
+
11
+ spec:
12
+ @bundle exec rake spec
13
+
14
+ rubocop:
15
+ @bundle exec rake rubocop
16
+
17
+ punchlist:
18
+ @bundle exec rake punchlist
19
+
20
+ pronto:
21
+ @bundle exec rake pronto
22
+
23
+ bigfiles:
24
+ @bundle exec rake bigfiles
25
+
26
+ quality:
27
+ @bundle exec rake quality
@@ -1,7 +1,7 @@
1
- # frozen_string_literal: true
2
1
  # coding: ascii
2
+ # frozen_string_literal: true
3
3
 
4
- lib = File.expand_path('../lib', __FILE__)
4
+ lib = File.expand_path('lib', __dir__)
5
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
  require 'checkoff/version'
7
7
 
@@ -27,11 +27,11 @@ Gem::Specification.new do |spec|
27
27
  spec.add_runtime_dependency 'cache_method'
28
28
  spec.add_runtime_dependency 'dalli'
29
29
 
30
- spec.add_development_dependency 'bundler', '~> 1.12'
30
+ spec.add_development_dependency 'bundler'
31
31
  spec.add_development_dependency 'minitest-profile'
32
32
  spec.add_development_dependency 'mocha'
33
- spec.add_development_dependency 'quality'
34
- spec.add_development_dependency 'rake', '~> 10.0'
33
+ spec.add_development_dependency 'quality', '~> 37'
34
+ spec.add_development_dependency 'rake', '~> 13.0'
35
35
  spec.add_development_dependency 'rspec', '>=3.4'
36
36
  spec.add_development_dependency 'simplecov'
37
37
  end
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "result": {
3
- "covered_percent": 98.65
3
+ "covered_percent": 83.74
4
4
  }
5
5
  }
@@ -4,4 +4,5 @@ require 'checkoff/version'
4
4
  require 'checkoff/workspaces'
5
5
  require 'checkoff/projects'
6
6
  require 'checkoff/sections'
7
+ require 'checkoff/subtasks'
7
8
  require 'checkoff/tasks'
@@ -103,7 +103,7 @@ module Checkoff
103
103
  stderr.puts " #{$PROGRAM_NAME} quickadd workspace task_name"
104
104
  stderr.puts
105
105
  stderr.puts "'project' can be set to a project name, or :my_tasks, " \
106
- ':my_tasks_upcoming, :my_tasks_new, or :my_tasks_today'
106
+ ":my_tasks_upcoming, :my_tasks_new, or :my_tasks_today"
107
107
  end
108
108
 
109
109
  def view(workspace_name, project_name, section_name)
@@ -10,7 +10,7 @@ module Checkoff
10
10
  def self.load(sym)
11
11
  file = "#{sym}.yml"
12
12
  YAML.load_file(File.expand_path("~/.#{file}"))
13
- .with_indifferent_access
13
+ .with_indifferent_access
14
14
  end
15
15
  end
16
16
  end
@@ -43,6 +43,7 @@ module Checkoff
43
43
  def projects_by_workspace_name(workspace_name)
44
44
  workspace = @workspaces.workspace_by_name(workspace_name)
45
45
  raise "Could not find workspace named #{workspace_name}" unless workspace
46
+
46
47
  projects.find_by_workspace(workspace: workspace.gid)
47
48
  end
48
49
 
@@ -52,6 +53,7 @@ module Checkoff
52
53
  if my_tasks.nil? || gid.nil?
53
54
  raise "Please define [:my_tasks][#{workspace_name}] in config file"
54
55
  end
56
+
55
57
  projects.find_by_id(gid)
56
58
  end
57
59
 
@@ -75,7 +77,8 @@ module Checkoff
75
77
  {
76
78
  per_page: 100,
77
79
  options: {
78
- fields: %w[name completed_at due_at due_on assignee_status tags],
80
+ fields: %w[name completed_at due_at due_on assignee_status tags
81
+ memberships.project.gid memberships.section.name],
79
82
  },
80
83
  }
81
84
  end
@@ -85,8 +88,8 @@ module Checkoff
85
88
  options[:completed_since] = '9999-12-01' if only_uncompleted
86
89
  options[:project] = project.gid
87
90
  options[:options][:fields] += extra_fields
88
- client.tasks.find_all(options).to_a
91
+ client.tasks.find_all(**options).to_a
89
92
  end
90
- cache_method :tasks_from_project, LONG_CACHE_TIME
93
+ cache_method :tasks_from_project, SHORT_CACHE_TIME
91
94
  end
92
95
  end
@@ -21,7 +21,34 @@ module Checkoff
21
21
 
22
22
  def_delegators :@projects, :client
23
23
 
24
- def file_task_by_section(current_section, by_section, task)
24
+ def file_task_by_section(by_section, task, project_gid)
25
+ membership = task.memberships.find { |m| m.project.gid == project_gid }
26
+ if membership.nil?
27
+ raise "Could not find task in project_gid #{project_gid}: #{task}"
28
+ end
29
+
30
+ current_section = membership.section.name
31
+ current_section = nil if current_section == '(no section)'
32
+ by_section[current_section] ||= []
33
+ by_section[current_section] << task
34
+ end
35
+
36
+ def by_section(tasks, project_gid)
37
+ by_section = {}
38
+ tasks.each do |task|
39
+ file_task_by_section(by_section, task, project_gid)
40
+ end
41
+ by_section
42
+ end
43
+ cache_method :by_section, LONG_CACHE_TIME
44
+
45
+ def tasks_by_section_for_project(project)
46
+ raw_tasks = projects.tasks_from_project(project)
47
+ active_tasks = projects.active_tasks(raw_tasks)
48
+ by_section(active_tasks, project.gid)
49
+ end
50
+
51
+ def legacy_file_task_by_section(current_section, by_section, task)
25
52
  if task.name =~ /:$/
26
53
  current_section = task.name
27
54
  by_section[current_section] = []
@@ -32,31 +59,24 @@ module Checkoff
32
59
  [current_section, by_section]
33
60
  end
34
61
 
35
- def by_section(tasks)
62
+ def legacy_by_section(tasks)
36
63
  current_section = nil
37
64
  by_section = {}
38
65
  tasks.each do |task|
39
- current_section, by_section = file_task_by_section(current_section,
40
- by_section, task)
66
+ current_section, by_section =
67
+ legacy_file_task_by_section(current_section, by_section, task)
41
68
  end
42
69
  by_section
43
70
  end
44
- cache_method :by_section, LONG_CACHE_TIME
45
-
46
- def tasks_by_section_for_project(project)
47
- raw_tasks = projects.tasks_from_project(project)
48
- active_tasks = projects.active_tasks(raw_tasks)
49
- by_section(active_tasks)
50
- end
51
71
 
52
72
  def tasks_by_section_for_project_and_assignee_status(project,
53
73
  assignee_status)
54
74
  raw_tasks = projects.tasks_from_project(project)
55
75
  by_assignee_status =
56
76
  projects.active_tasks(raw_tasks)
57
- .group_by(&:assignee_status)
77
+ .group_by(&:assignee_status)
58
78
  active_tasks = by_assignee_status[assignee_status]
59
- by_section(active_tasks)
79
+ legacy_by_section(active_tasks)
60
80
  end
61
81
 
62
82
  def project_or_raise(workspace_name, project_name)
@@ -100,12 +120,6 @@ module Checkoff
100
120
  end
101
121
  cache_method :section_task_names, SHORT_CACHE_TIME
102
122
 
103
- # Returns all subtasks, including section headers
104
- def raw_subtasks(task)
105
- task.subtasks(projects.task_options)
106
- end
107
- cache_method :raw_subtasks, LONG_CACHE_TIME
108
-
109
123
  def task_due?(task)
110
124
  if task.due_at
111
125
  Time.parse(task.due_at) <= time.now
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'forwardable'
4
+
5
+ module Checkoff
6
+ # Query different subtasks of Asana tasks
7
+ class Subtasks
8
+ MINUTE = 60
9
+ LONG_CACHE_TIME = MINUTE * 15
10
+ SHORT_CACHE_TIME = MINUTE * 5
11
+
12
+ extend Forwardable
13
+
14
+ def file_task_by_section(current_section, by_section, task)
15
+ if task.name =~ /:$/
16
+ current_section = task.name
17
+ by_section[current_section] = []
18
+ else
19
+ by_section[current_section] ||= []
20
+ by_section[current_section] << task
21
+ end
22
+ [current_section, by_section]
23
+ end
24
+
25
+ def by_section(tasks)
26
+ current_section = nil
27
+ by_section = {}
28
+ tasks.each do |task|
29
+ current_section, by_section = file_task_by_section(current_section,
30
+ by_section, task)
31
+ end
32
+ by_section
33
+ end
34
+
35
+ # Returns all subtasks, including section headers
36
+ def raw_subtasks(task)
37
+ task.subtasks(projects.task_options)
38
+ end
39
+ cache_method :raw_subtasks, LONG_CACHE_TIME
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Checkoff
4
- VERSION = '0.3.1'
4
+ VERSION = '0.5.2'
5
5
  end
@@ -12,7 +12,7 @@ module Checkoff
12
12
  def client
13
13
  @client ||= @asana_client.new do |c|
14
14
  c.authentication :access_token, @config[:personal_access_token]
15
- c.default_headers "asana-enable" => "string_ids,new_sections"
15
+ c.default_headers 'asana-enable' => 'string_ids,new_sections'
16
16
  end
17
17
  end
18
18
 
@@ -1,3 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ desc 'Run tasks to be done during a continuous integration (CI) build'
3
4
  task ci: :localtest
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ desc 'Rebaseline quality thresholds to last commit'
3
4
  task :clear_metrics do |_t|
4
5
  ret =
5
6
  system('git checkout coverage/.last_run.json metrics/*_high_water_mark')
@@ -1,3 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ desc 'Standard build when running on a workstation'
3
4
  task localtest: %i[clear_metrics test quality]
@@ -1 +1 @@
1
- 459
1
+ 410
@@ -1,2 +1 @@
1
- 11
2
-
1
+ 3
@@ -1 +1 @@
1
- 2
1
+ 1
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.3.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-28 00:00:00.000000000 Z
11
+ date: 2020-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '1.12'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '1.12'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest-profile
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -112,30 +112,30 @@ dependencies:
112
112
  name: quality
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: '37'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: '37'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rake
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '10.0'
131
+ version: '13.0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '10.0'
138
+ version: '13.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -164,7 +164,7 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
- description:
167
+ description:
168
168
  email:
169
169
  - vince@broz.cc
170
170
  executables:
@@ -180,6 +180,7 @@ files:
180
180
  - CODE_OF_CONDUCT.md
181
181
  - Gemfile
182
182
  - LICENSE.txt
183
+ - Makefile
183
184
  - README.md
184
185
  - Rakefile
185
186
  - bin/console
@@ -193,6 +194,7 @@ files:
193
194
  - lib/checkoff/config_loader.rb
194
195
  - lib/checkoff/projects.rb
195
196
  - lib/checkoff/sections.rb
197
+ - lib/checkoff/subtasks.rb
196
198
  - lib/checkoff/tasks.rb
197
199
  - lib/checkoff/version.rb
198
200
  - lib/checkoff/workspaces.rb
@@ -225,7 +227,7 @@ homepage: http://github.com/apiology/checkoff
225
227
  licenses:
226
228
  - MIT
227
229
  metadata: {}
228
- post_install_message:
230
+ post_install_message:
229
231
  rdoc_options: []
230
232
  require_paths:
231
233
  - lib
@@ -241,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
243
  version: '0'
242
244
  requirements: []
243
245
  rubygems_version: 3.0.3
244
- signing_key:
246
+ signing_key:
245
247
  specification_version: 4
246
248
  summary: Command-line and gem client for Asana (unofficial)
247
249
  test_files: []