nutrella 1.5.0 → 1.5.4

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
  SHA256:
3
- metadata.gz: 3ada2f552730cbf6221835584e054c6e11e97772d0a31ea615b82216555d4b09
4
- data.tar.gz: 199bdf1116434ed92d25c718fa8aee98e96c998427176508a55b81acf59bee01
3
+ metadata.gz: 24e66cfc7e3e0b2cf58e7ecb47d16d2689c417e60f4c499bf7ecf777a6e08015
4
+ data.tar.gz: 53d417160b545b06988e41c1d6b434d0d61822e04cb54dd7482d725e11e450a7
5
5
  SHA512:
6
- metadata.gz: 9d4bf1688c192e4a6b0f669d610931ec99c1ff95c9147b09e8a88e66933e8f53957cca69040cbd9462f867d6084bea00beb787e27f22fec8da227a18186ee8db
7
- data.tar.gz: f57b83dfb937e477a8f56d71bda8a6b3414252bab313d6c1f1c501b3d504ce691a99f5f4b0db3f2c4b7708bf96a87127ab6d53a6462c386f13cfea763f889731
6
+ metadata.gz: 44e1e12f2f85e870b7d48324450e6d42fa109d606760b31b8a5f0ff70b22b4109a4b304bd00eb765f69b0dc8f40db1ee2571e60014346ea509cf0573cfa4beea
7
+ data.tar.gz: 874d0d22d8fc5a51fc27712226927363a3e1c0883b029d0dd449f2b245c4a47073c64f98ad25a45a08ec150fb36bea16b473d43c08ac146d4c063adb5ac903fd
data/.gitignore CHANGED
@@ -5,3 +5,4 @@
5
5
  /pkg
6
6
  /tmp
7
7
  /.bundle
8
+ /*.log
data/.rubocop.yml CHANGED
@@ -1,8 +1,10 @@
1
1
  require:
2
+ - rubocop-rake
2
3
  - rubocop-rspec
3
4
 
4
5
  AllCops:
5
- TargetRubyVersion: 2.5
6
+ NewCops: enable
7
+ TargetRubyVersion: 2.6
6
8
 
7
9
  Exclude:
8
10
  - 'bin/**/*'
@@ -11,21 +13,15 @@ AllCops:
11
13
  Layout/MultilineMethodCallBraceLayout:
12
14
  Enabled: false
13
15
 
14
- Layout/SpaceAroundMethodCallOperator:
15
- Enabled: true
16
-
17
- Lint/RaiseException:
18
- Enabled: true
19
-
20
- Lint/StructNewOverride:
21
- Enabled: true
22
-
23
16
  Metrics/BlockLength:
24
17
  Enabled: false
25
18
 
26
19
  Naming/MemoizedInstanceVariableName:
27
20
  EnforcedStyleForLeadingUnderscores: required
28
21
 
22
+ Rake/Desc:
23
+ Enabled: false
24
+
29
25
  RSpec/AnyInstance:
30
26
  Enabled: false
31
27
 
@@ -62,22 +58,10 @@ Style/BlockDelimiters:
62
58
  BracesRequiredMethods:
63
59
  - 'let'
64
60
 
65
- Style/ExponentialNotation:
66
- Enabled: true
67
-
68
61
  # We can ignore this small performance improvement.
69
62
  Style/FrozenStringLiteralComment:
70
63
  Enabled: false
71
64
 
72
- Style/HashEachMethods:
73
- Enabled: true
74
-
75
- Style/HashTransformKeys:
76
- Enabled: true
77
-
78
- Style/HashTransformValues:
79
- Enabled: true
80
-
81
65
  # We like to use the hash rocket in rake files.
82
66
  Style/HashSyntax:
83
67
  Exclude:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.6
1
+ 2.7.4
data/CHANGELOG.md CHANGED
@@ -6,6 +6,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.5.4] - 2021-07-29
10
+
11
+ #### New Features
12
+
13
+ - Added a configuration option to adjust the cache capacity
14
+
15
+ ## [1.5.3] - 2021-02-18
16
+
17
+ - Update ruby-trello
18
+ - Update development dependencies
19
+
20
+ #### Breaking Changes
21
+
22
+ - Drop support for Ruby 2.5
23
+
24
+ ## [1.5.2] - 2020-04-27
25
+
26
+ #### New Features
27
+
28
+ - Added a configuration option to enable logging for easier troubleshooting
29
+
30
+ ## [1.5.1] - 2020-04-27
31
+
32
+ #### Bug Fix
33
+
34
+ - Honour the specified named Trello board argument over the Trello board derived from the current git branch
35
+
9
36
  ## [1.5.0] - 2020-04-26
10
37
 
11
38
  #### New Features
@@ -26,7 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
53
 
27
54
  ## [1.3.0] - 2019-05-20
28
55
 
29
- #### Yanked
56
+ - Yanked
30
57
 
31
58
  ## [1.2.2] - 2019-04-27
32
59
 
data/README.md CHANGED
@@ -57,25 +57,39 @@ The configuration file should look like the following (don't use the keys below,
57
57
  organization: 542d76ac2fad4697c3e80448
58
58
  launch_command: open $url$
59
59
  enable_trello_app: false
60
+ enable_logging: true
61
+ cache_capacity: 5
60
62
  ```
61
63
 
62
- Finally, you can tweak your configuration:
64
+ **Step 6**: Adjust configuration file (Optional)
63
65
 
64
- 1. Adjust the launch_command configuration to fit your needs. For example, on macOS to open
65
- your Trello board in Firefox change your configuration to:
66
+ Adjust the `launch_command` configuration to fit your needs.
67
+ For example, to open your Trello board in Firefox change your configuration to:
66
68
 
67
69
  ```yaml
68
70
  launch_command: open -a firefox $url$
69
71
  ```
70
72
 
71
- 1. Adjust the enable_trello_app configuration to open boards in the Trello app. For example,
72
- if you have installed the Trello app on macOS to open your Trello board in the Trello app
73
- change your configuration to:
73
+ Adjust the `enable_trello_app` configuration to open boards in the Trello app.
74
+ To open your Trello board in the Trello app change your configuration to:
74
75
 
75
76
  ```yaml
76
77
  enable_trello_app: true
77
78
  ```
78
79
 
80
+ Adjust the `enable_logging` configuration to start logging diagnostics:
81
+
82
+ ```yaml
83
+ enable_logging: true
84
+ ```
85
+
86
+ Adjust the `cache_capacity` configuration to increase the capacity of the cache (see `~/.nutrella.cache.yml`):
87
+
88
+ ```yaml
89
+ cache_capacity: 15
90
+ ```
91
+
92
+
79
93
  ## Usage
80
94
 
81
95
  Create or open a Trello board based on the name of the current git branch:
@@ -95,7 +109,13 @@ Note: you can invoke `nutrella` from your project directory or from any subdirec
95
109
 
96
110
  ## Troubleshooting
97
111
 
98
- 1. For `method_missing: undefined method 'this'`
112
+ 1. If an unexpected Trello board is opening try clearing your cache:
113
+
114
+ ```sh
115
+ rm ~/.nutrella.cache.yml
116
+ ```
117
+
118
+ 1. If you see `method_missing: undefined method 'this'`
99
119
 
100
120
  Try updating `RubyGems`
101
121
 
@@ -103,7 +123,7 @@ Note: you can invoke `nutrella` from your project directory or from any subdirec
103
123
  gem update --system
104
124
  ```
105
125
 
106
- 1. For `uninitialized constant Gem::Source (NameError)`
126
+ 1. If you see `uninitialized constant Gem::Source (NameError)`
107
127
 
108
128
  Try updating `bundler`
109
129
 
@@ -111,7 +131,7 @@ Note: you can invoke `nutrella` from your project directory or from any subdirec
111
131
  gem install bundler
112
132
  ```
113
133
 
114
- 1. For `cannot load such file -- nutrella`
134
+ 1. If you see `cannot load such file -- nutrella`
115
135
 
116
136
  This error may appear after running `irb -rubygems` and you are unable to `require 'nutrella'`.
117
137
  Try running `irb -rubygems` from your home directory:
@@ -15,6 +15,8 @@ module Nutrella
15
15
 
16
16
  def run
17
17
  launch(board_url)
18
+ ensure
19
+ logger.close
18
20
  end
19
21
 
20
22
  private
@@ -22,11 +24,21 @@ module Nutrella
22
24
  def launch(url)
23
25
  launch_command = configuration_values.fetch(:launch_command).gsub("$url$", url)
24
26
 
27
+ logger.info { "Launch command: '#{launch_command}'" }
28
+
25
29
  system(launch_command)
26
30
  end
27
31
 
28
32
  def board_url
29
- enable_trello_app? ? trello_url(cached_url) : cached_url
33
+ url = enable_trello_app? ? trello_url(cached_url) : cached_url
34
+
35
+ logger.info { "Board URL: '#{url}'" }
36
+
37
+ url
38
+ end
39
+
40
+ def cache_capacity
41
+ @_cache_capacity ||= configuration_values.fetch(:cache_capacity)
30
42
  end
31
43
 
32
44
  def cached_url
@@ -41,6 +53,14 @@ module Nutrella
41
53
  configuration_values.fetch(:enable_trello_app)
42
54
  end
43
55
 
56
+ def logger
57
+ @_logger ||= Logger.new(log_filename)
58
+ end
59
+
60
+ def log_filename
61
+ configuration_values.fetch(:enable_logging) ? "nutrella.log" : "/dev/null"
62
+ end
63
+
44
64
  def trello_url(http_url)
45
65
  http_url.gsub(/^http.?:/, "trello:")
46
66
  end
@@ -50,7 +70,7 @@ module Nutrella
50
70
  end
51
71
 
52
72
  def url_cache
53
- Nutrella::Cache.new(cache_filename, 5)
73
+ Nutrella::Cache.new(cache_filename, cache_capacity)
54
74
  end
55
75
  end
56
76
  end
@@ -9,7 +9,7 @@ module Nutrella
9
9
  class Configuration
10
10
  NULOGY_ORGANIZATION_ID = "542d76ac2fad4697c3e80448"
11
11
 
12
- INITIAL_CONFIGURATION = <<-YAML.strip_heredoc
12
+ INITIAL_CONFIGURATION = <<~YAML
13
13
  # Trello Developer API Keys
14
14
  key: <your developer key>
15
15
  secret: <your developer secret>
@@ -18,7 +18,9 @@ module Nutrella
18
18
  # Optional Configuration
19
19
  organization: #{NULOGY_ORGANIZATION_ID}
20
20
  launch_command: open $url$
21
- enable_trello_app: False
21
+ enable_trello_app: false
22
+ enable_logging: false
23
+ cache_capacity: 5
22
24
  YAML
23
25
 
24
26
  attr_reader :path, :values
@@ -35,14 +37,16 @@ module Nutrella
35
37
 
36
38
  private
37
39
 
38
- def load_configuration
40
+ def load_configuration # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
39
41
  @values = {
40
42
  key: configuration.fetch("key"),
41
43
  secret: configuration.fetch("secret"),
42
44
  token: configuration.fetch("token"),
43
45
  organization: configuration.fetch("organization", NULOGY_ORGANIZATION_ID),
44
46
  launch_command: configuration.fetch("launch_command", "open $url$"),
45
- enable_trello_app: configuration.fetch("enable_trello_app", "False")
47
+ enable_trello_app: configuration.fetch("enable_trello_app", "false"),
48
+ enable_logging: configuration.fetch("enable_logging", "false"),
49
+ cache_capacity: configuration.fetch("cache_capacity", 5)
46
50
  }
47
51
  rescue => e
48
52
  abort "#{path} #{e}"
@@ -64,7 +68,7 @@ module Nutrella
64
68
  end
65
69
 
66
70
  def configuration_missing_message
67
- <<-TEXT.strip_heredoc
71
+ <<~TEXT
68
72
  I see that you don't have a config file '#{path}'.
69
73
  So, I created one for you.
70
74
 
@@ -1,13 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Simpler versions of extensions from ActiveSupport.
3
+ # Simpler versions of an extension from ActiveSupport.
4
4
  #
5
5
  class String
6
- def strip_heredoc
7
- gsub(/^ +/, "")
8
- end
9
-
10
6
  def titleize
11
- tr("_-", " ").split(" ").map(&:capitalize).join(" ")
7
+ tr("_-", " ").split.map(&:capitalize).join(" ")
12
8
  end
13
9
  end
@@ -10,12 +10,12 @@ module Nutrella
10
10
  #
11
11
  class TaskBoardName
12
12
  def self.board_name(args)
13
- git_branch_name, status = Open3.capture2("git rev-parse --abbrev-ref HEAD")
14
- return git_branch_name.chomp if status.success?
15
-
16
13
  git_branch_name = args[0]
17
14
  return git_branch_name if git_branch_name.present?
18
15
 
16
+ git_branch_name, status = Open3.capture2("git rev-parse --abbrev-ref HEAD")
17
+ return git_branch_name.chomp if status.success?
18
+
19
19
  abort "Sorry. Can't figure out a name for the board."
20
20
  end
21
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nutrella
4
- VERSION = "1.5.0"
4
+ VERSION = "1.5.4"
5
5
  end
data/nutrella.gemspec CHANGED
@@ -24,13 +24,14 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.required_ruby_version = ">= 2.5"
27
+ spec.required_ruby_version = ">= 2.6"
28
28
 
29
- spec.add_runtime_dependency "ruby-trello", "~> 2.1"
29
+ spec.add_runtime_dependency "ruby-trello", "~> 3.0"
30
30
 
31
- spec.add_development_dependency "rake", ">= 12.1", "< 13.1"
32
- spec.add_development_dependency "rspec", ">= 3.9", "< 4.0"
33
- spec.add_development_dependency "rubocop", "~> 0.82"
34
- spec.add_development_dependency "rubocop-rspec", "~> 1.38"
35
- spec.add_development_dependency "simplecov", "~> 0.17"
31
+ spec.add_development_dependency "rake", "~> 13.0"
32
+ spec.add_development_dependency "rspec", "~> 3.10"
33
+ spec.add_development_dependency "rubocop", "~> 1.18"
34
+ spec.add_development_dependency "rubocop-rake", "~> 0.6"
35
+ spec.add_development_dependency "rubocop-rspec", "~> 2.4"
36
+ spec.add_development_dependency "simplecov", "~> 0.21"
36
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutrella
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alistair McKinnell
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-26 00:00:00.000000000 Z
11
+ date: 2021-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-trello
@@ -16,97 +16,99 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.1'
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.1'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '12.1'
34
- - - "<"
31
+ - - "~>"
35
32
  - !ruby/object:Gem::Version
36
- version: '13.1'
33
+ version: '13.0'
37
34
  type: :development
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '12.1'
44
- - - "<"
38
+ - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: '13.1'
40
+ version: '13.0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: rspec
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '3.9'
54
- - - "<"
45
+ - - "~>"
55
46
  - !ruby/object:Gem::Version
56
- version: '4.0'
47
+ version: '3.10'
57
48
  type: :development
58
49
  prerelease: false
59
50
  version_requirements: !ruby/object:Gem::Requirement
60
51
  requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: '3.9'
64
- - - "<"
52
+ - - "~>"
65
53
  - !ruby/object:Gem::Version
66
- version: '4.0'
54
+ version: '3.10'
67
55
  - !ruby/object:Gem::Dependency
68
56
  name: rubocop
69
57
  requirement: !ruby/object:Gem::Requirement
70
58
  requirements:
71
59
  - - "~>"
72
60
  - !ruby/object:Gem::Version
73
- version: '0.82'
61
+ version: '1.18'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.18'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.6'
74
76
  type: :development
75
77
  prerelease: false
76
78
  version_requirements: !ruby/object:Gem::Requirement
77
79
  requirements:
78
80
  - - "~>"
79
81
  - !ruby/object:Gem::Version
80
- version: '0.82'
82
+ version: '0.6'
81
83
  - !ruby/object:Gem::Dependency
82
84
  name: rubocop-rspec
83
85
  requirement: !ruby/object:Gem::Requirement
84
86
  requirements:
85
87
  - - "~>"
86
88
  - !ruby/object:Gem::Version
87
- version: '1.38'
89
+ version: '2.4'
88
90
  type: :development
89
91
  prerelease: false
90
92
  version_requirements: !ruby/object:Gem::Requirement
91
93
  requirements:
92
94
  - - "~>"
93
95
  - !ruby/object:Gem::Version
94
- version: '1.38'
96
+ version: '2.4'
95
97
  - !ruby/object:Gem::Dependency
96
98
  name: simplecov
97
99
  requirement: !ruby/object:Gem::Requirement
98
100
  requirements:
99
101
  - - "~>"
100
102
  - !ruby/object:Gem::Version
101
- version: '0.17'
103
+ version: '0.21'
102
104
  type: :development
103
105
  prerelease: false
104
106
  version_requirements: !ruby/object:Gem::Requirement
105
107
  requirements:
106
108
  - - "~>"
107
109
  - !ruby/object:Gem::Version
108
- version: '0.17'
109
- description:
110
+ version: '0.21'
111
+ description:
110
112
  email:
111
113
  - alistair.mckinnell@gmail.com
112
114
  executables:
@@ -153,7 +155,7 @@ metadata:
153
155
  changelog_uri: https://github.com/amckinnell/nutrella/blob/master/CHANGELOG.md
154
156
  source_code_uri: https://github.com/amckinnell/nutrella
155
157
  bug_tracker_uri: https://github.com/amckinnell/nutrella/issues
156
- post_install_message:
158
+ post_install_message:
157
159
  rdoc_options: []
158
160
  require_paths:
159
161
  - lib
@@ -161,15 +163,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
163
  requirements:
162
164
  - - ">="
163
165
  - !ruby/object:Gem::Version
164
- version: '2.5'
166
+ version: '2.6'
165
167
  required_rubygems_version: !ruby/object:Gem::Requirement
166
168
  requirements:
167
169
  - - ">="
168
170
  - !ruby/object:Gem::Version
169
171
  version: '0'
170
172
  requirements: []
171
- rubygems_version: 3.0.3
172
- signing_key:
173
+ rubygems_version: 3.2.24
174
+ signing_key:
173
175
  specification_version: 4
174
176
  summary: A command line tool for creating a Trello Board based on the current git
175
177
  branch.