nutrella 1.5.4 → 1.7.0

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: 24e66cfc7e3e0b2cf58e7ecb47d16d2689c417e60f4c499bf7ecf777a6e08015
4
- data.tar.gz: 53d417160b545b06988e41c1d6b434d0d61822e04cb54dd7482d725e11e450a7
3
+ metadata.gz: 3c60899382e6e79688404c049df88f7976ec1f1acf77a37e3f1cc7ad939cb152
4
+ data.tar.gz: c1227cbc48e26c2fafe4fd1d4bca4950f037ffcb82fa2f79168e29203d280158
5
5
  SHA512:
6
- metadata.gz: 44e1e12f2f85e870b7d48324450e6d42fa109d606760b31b8a5f0ff70b22b4109a4b304bd00eb765f69b0dc8f40db1ee2571e60014346ea509cf0573cfa4beea
7
- data.tar.gz: 874d0d22d8fc5a51fc27712226927363a3e1c0883b029d0dd449f2b245c4a47073c64f98ad25a45a08ec150fb36bea16b473d43c08ac146d4c063adb5ac903fd
6
+ metadata.gz: 124ce5c5115109501ca6bbf2789acbae393ea1583c285faf4a5a98a635ab56c58937696db6dbf2abd930988640f542b123c5ac43b22862010148408717d41f6f
7
+ data.tar.gz: 536177377379d391139bd47aa4838013e8b41b5ee28da5e686f347bcd5c0e7941ac66a14fcafcb7ee2ac3259ecdbffc339b3d6167e2a6c170a506266911f6630
data/.codeclimate.yml CHANGED
@@ -7,11 +7,6 @@ engines:
7
7
  - ruby
8
8
  fixme:
9
9
  enabled: true
10
- rubocop:
11
- enabled: true
12
- checks:
13
- Rubocop/Rails/Output:
14
- enabled: false
15
10
  reek:
16
11
  enabled: true
17
12
  ratings:
data/.rubocop.yml CHANGED
@@ -4,11 +4,15 @@ require:
4
4
 
5
5
  AllCops:
6
6
  NewCops: enable
7
- TargetRubyVersion: 2.6
7
+ TargetRubyVersion: 3.0
8
8
 
9
9
  Exclude:
10
10
  - 'bin/**/*'
11
11
 
12
+
13
+ Layout/LineLength:
14
+ Max: 120
15
+
12
16
  # Rubocop and I cannot agree.
13
17
  Layout/MultilineMethodCallBraceLayout:
14
18
  Enabled: false
@@ -28,9 +32,6 @@ RSpec/AnyInstance:
28
32
  RSpec/ExampleLength:
29
33
  Max: 15
30
34
 
31
- Metrics/LineLength:
32
- Max: 120
33
-
34
35
  RSpec/DescribeClass:
35
36
  Enabled: false
36
37
 
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.4
1
+ 3.0.5
data/CHANGELOG.md CHANGED
@@ -6,6 +6,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.7.0] - 2023-03-25
10
+
11
+ - Update ruby-trello
12
+ - Update development dependencies
13
+
14
+ #### Breaking Changes
15
+
16
+ - Drop support for all Ruby 2.x versions
17
+
18
+ ## [1.6.0] - 2021-07-30
19
+
20
+ #### New Features
21
+
22
+ - Allow opening a previously created Trello board based on a JIRA ticket
23
+ - Added a configuration option to specify exactly how to search in the cache first
24
+
9
25
  ## [1.5.4] - 2021-07-29
10
26
 
11
27
  #### New Features
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![Gem Version](http://img.shields.io/gem/v/nutrella.svg?style=flat)](https://rubygems.org/gems/nutrella)
4
4
  [![Code Climate](https://codeclimate.com/github/amckinnell/nutrella/badges/gpa.svg)](https://codeclimate.com/github/amckinnell/nutrella)
5
- [![Build Status](https://travis-ci.org/amckinnell/nutrella.svg?branch=master)](https://travis-ci.org/amckinnell/nutrella)
6
5
 
7
6
  A command line tool for associating a Trello board with the current git branch.
8
7
 
@@ -45,7 +44,7 @@ Insert your `token` into your `~/.nutrella.yml` file.
45
44
 
46
45
  If your haven't already done so, insert your `key`, `secret`, and `token` into your `~/.nutrella.yml` file.
47
46
 
48
- The configuration file should look like the following (don't use the keys below, they won't work):
47
+ The configuration file should look like the following (don't use the keys below as they won't work for you):
49
48
 
50
49
  ```yaml
51
50
  # Trello Developer API Keys
@@ -59,6 +58,7 @@ The configuration file should look like the following (don't use the keys below,
59
58
  enable_trello_app: false
60
59
  enable_logging: true
61
60
  cache_capacity: 5
61
+ cache_first: '^PM-\d+'
62
62
  ```
63
63
 
64
64
  **Step 6**: Adjust configuration file (Optional)
@@ -89,22 +89,43 @@ Adjust the `cache_capacity` configuration to increase the capacity of the cache
89
89
  cache_capacity: 15
90
90
  ```
91
91
 
92
+ Adjust the `cache_first` configuration to allow searching the cache first before creating or opening a Trello board:
93
+
94
+ ```yaml
95
+ cache_first: '^(PM|QC)-\d+'
96
+ ```
97
+
98
+ The string that you specify will be treated as a regular expression.
99
+
100
+
92
101
 
93
102
  ## Usage
94
103
 
95
- Create or open a Trello board based on the name of the current git branch:
104
+ There are three ways to invoke the nutrella command:
105
+
106
+ 1. Create or open a Trello board based on the name of the current git branch:
96
107
 
97
- ```sh
108
+ ```sh
98
109
  $ nutrella
99
- ```
110
+ ```
111
+
112
+ This is the command invocation that should meet your needs 90% of the time.
100
113
 
101
- Create or open a named Trello board:
102
114
 
103
- ```sh
115
+ 1. Create or open a named Trello board using the full git branch name:
116
+
117
+ ```sh
104
118
  $ nutrella <git-branch-name>
105
- ```
119
+ ```
120
+
121
+
122
+ 2. Create or open a previously created Trello board using a JIRA ticket like `PM-9423`:
123
+
124
+ ```sh
125
+ $ nutrella <JIRA Ticket>
126
+ ```
106
127
 
107
- Note: you can invoke `nutrella` from your project directory or from any subdirectory.
128
+ This behaviour relies on the `cache_first` configuration setting. Invoking `nutrella` with a JIRA ticket number is for those situations where you make multiple git branches for the same JIRA ticket with a different suffix.
108
129
 
109
130
 
110
131
  ## Troubleshooting
data/exe/nutrella CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  require "nutrella"
4
4
 
5
- board_name = Nutrella::TaskBoardName.board_name(ARGV)
5
+ board_name = Nutrella::TaskBoardName.board_name_from_git_branch(ARGV)
6
6
 
7
7
  Nutrella::Command.new(Dir.home, board_name).run
@@ -0,0 +1,29 @@
1
+ module Nutrella
2
+ #
3
+ # Knows how to take the supplied board name and resolve it to a Trello board url.
4
+ #
5
+ class BoardNameResolver
6
+ def initialize(url_cache, search_specification)
7
+ @url_cache = url_cache
8
+ @search_specification = search_specification
9
+ end
10
+
11
+ def resolve(board_name, &block)
12
+ matching_url(board_name) || cached_url(board_name, &block)
13
+ end
14
+
15
+ private
16
+
17
+ def matching_url(board_name)
18
+ return nil unless @search_specification.match?(board_name)
19
+
20
+ search_reg_exp = Regexp.new(board_name, Regexp::IGNORECASE)
21
+
22
+ @url_cache.search(search_reg_exp)
23
+ end
24
+
25
+ def cached_url(board_name, &block)
26
+ @url_cache.fetch(board_name, &block)
27
+ end
28
+ end
29
+ end
@@ -20,6 +20,12 @@ module Nutrella
20
20
  value
21
21
  end
22
22
 
23
+ def search(search_reg_exp)
24
+ cache_contents.find { |k, _v| search_reg_exp.match?(k) }.last
25
+ rescue
26
+ nil
27
+ end
28
+
23
29
  private
24
30
 
25
31
  def lookup(key)
@@ -41,7 +47,11 @@ module Nutrella
41
47
  end
42
48
 
43
49
  def cache_contents
44
- @_cache_contents ||= YAML.load_file(path)
50
+ @_cache_contents ||= begin
51
+ YAML.load_file(path)
52
+ rescue
53
+ nil
54
+ end
45
55
  end
46
56
  end
47
57
  end
@@ -42,7 +42,7 @@ module Nutrella
42
42
  end
43
43
 
44
44
  def cached_url
45
- @_cached_url ||= url_cache.fetch(@board_name) { task_board.lookup_or_create(@board_name).url }
45
+ @_cached_url ||= board_name_resolver.resolve(@board_name) { task_board.lookup_or_create(@board_name).url }
46
46
  end
47
47
 
48
48
  def configuration_values
@@ -65,6 +65,10 @@ module Nutrella
65
65
  http_url.gsub(/^http.?:/, "trello:")
66
66
  end
67
67
 
68
+ def board_name_resolver
69
+ Nutrella::BoardNameResolver.new(url_cache, configuration_values.fetch(:cache_first, ""))
70
+ end
71
+
68
72
  def task_board
69
73
  Nutrella::TaskBoard.new(configuration_values)
70
74
  end
@@ -21,6 +21,7 @@ module Nutrella
21
21
  enable_trello_app: false
22
22
  enable_logging: false
23
23
  cache_capacity: 5
24
+ cache_first: '^PM-\d+'
24
25
  YAML
25
26
 
26
27
  attr_reader :path, :values
@@ -46,7 +47,8 @@ module Nutrella
46
47
  launch_command: configuration.fetch("launch_command", "open $url$"),
47
48
  enable_trello_app: configuration.fetch("enable_trello_app", "false"),
48
49
  enable_logging: configuration.fetch("enable_logging", "false"),
49
- cache_capacity: configuration.fetch("cache_capacity", 5)
50
+ cache_capacity: configuration.fetch("cache_capacity", 5),
51
+ cache_first: to_reg_exp("cache_first")
50
52
  }
51
53
  rescue => e
52
54
  abort "#{path} #{e}"
@@ -77,5 +79,9 @@ module Nutrella
77
79
  See https://github.com/amckinnell/nutrella for instructions.
78
80
  TEXT
79
81
  end
82
+
83
+ def to_reg_exp(key)
84
+ Regexp.new(configuration.fetch(key, '^PM-\d+'), Regexp::IGNORECASE)
85
+ end
80
86
  end
81
87
  end
@@ -9,7 +9,7 @@ module Nutrella
9
9
  # Note: will also accept the name of a branch as an argument.
10
10
  #
11
11
  class TaskBoardName
12
- def self.board_name(args)
12
+ def self.board_name_from_git_branch(args)
13
13
  git_branch_name = args[0]
14
14
  return git_branch_name if git_branch_name.present?
15
15
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nutrella
4
- VERSION = "1.5.4"
4
+ VERSION = "1.7.0"
5
5
  end
data/lib/nutrella.rb CHANGED
@@ -1,5 +1,4 @@
1
- require "nutrella/string_ext"
2
-
1
+ require "nutrella/board_name_resolver"
3
2
  require "nutrella/cache"
4
3
  require "nutrella/command"
5
4
  require "nutrella/configuration"
data/nutrella.gemspec CHANGED
@@ -16,7 +16,8 @@ Gem::Specification.new do |spec|
16
16
  "homepage_uri" => "https://github.com/amckinnell/nutrella",
17
17
  "changelog_uri" => "https://github.com/amckinnell/nutrella/blob/master/CHANGELOG.md",
18
18
  "source_code_uri" => "https://github.com/amckinnell/nutrella",
19
- "bug_tracker_uri" => "https://github.com/amckinnell/nutrella/issues"
19
+ "bug_tracker_uri" => "https://github.com/amckinnell/nutrella/issues",
20
+ "rubygems_mfa_required" => "true"
20
21
  }
21
22
 
22
23
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features)/}) }
@@ -24,14 +25,14 @@ Gem::Specification.new do |spec|
24
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
26
  spec.require_paths = ["lib"]
26
27
 
27
- spec.required_ruby_version = ">= 2.6"
28
+ spec.required_ruby_version = ">= 3.0"
28
29
 
29
- spec.add_runtime_dependency "ruby-trello", "~> 3.0"
30
+ spec.add_runtime_dependency "ruby-trello", "~> 4.0"
30
31
 
31
32
  spec.add_development_dependency "rake", "~> 13.0"
32
- spec.add_development_dependency "rspec", "~> 3.10"
33
- spec.add_development_dependency "rubocop", "~> 1.18"
33
+ spec.add_development_dependency "rspec", "~> 3.12"
34
+ spec.add_development_dependency "rubocop", "~> 1.48"
34
35
  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
+ spec.add_development_dependency "rubocop-rspec", "~> 2.19"
37
+ spec.add_development_dependency "simplecov", "~> 0.22"
37
38
  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.4
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alistair McKinnell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-29 00:00:00.000000000 Z
11
+ date: 2023-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-trello
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '4.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: '3.0'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.10'
47
+ version: '3.12'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.10'
54
+ version: '3.12'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.18'
61
+ version: '1.48'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.18'
68
+ version: '1.48'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,28 +86,28 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2.4'
89
+ version: '2.19'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '2.4'
96
+ version: '2.19'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.21'
103
+ version: '0.22'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0.21'
110
+ version: '0.22'
111
111
  description:
112
112
  email:
113
113
  - alistair.mckinnell@gmail.com
@@ -123,7 +123,6 @@ files:
123
123
  - ".rspec"
124
124
  - ".rubocop.yml"
125
125
  - ".ruby-version"
126
- - ".travis.yml"
127
126
  - CHANGELOG.md
128
127
  - CODE_OF_CONDUCT.md
129
128
  - Gemfile
@@ -138,11 +137,11 @@ files:
138
137
  - bin/setup
139
138
  - exe/nutrella
140
139
  - lib/nutrella.rb
140
+ - lib/nutrella/board_name_resolver.rb
141
141
  - lib/nutrella/cache.rb
142
142
  - lib/nutrella/command.rb
143
143
  - lib/nutrella/configuration.rb
144
144
  - lib/nutrella/developer_keys.rb
145
- - lib/nutrella/string_ext.rb
146
145
  - lib/nutrella/task_board.rb
147
146
  - lib/nutrella/task_board_name.rb
148
147
  - lib/nutrella/version.rb
@@ -155,6 +154,7 @@ metadata:
155
154
  changelog_uri: https://github.com/amckinnell/nutrella/blob/master/CHANGELOG.md
156
155
  source_code_uri: https://github.com/amckinnell/nutrella
157
156
  bug_tracker_uri: https://github.com/amckinnell/nutrella/issues
157
+ rubygems_mfa_required: 'true'
158
158
  post_install_message:
159
159
  rdoc_options: []
160
160
  require_paths:
@@ -163,14 +163,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: '2.6'
166
+ version: '3.0'
167
167
  required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  requirements:
169
169
  - - ">="
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  requirements: []
173
- rubygems_version: 3.2.24
173
+ rubygems_version: 3.4.8
174
174
  signing_key:
175
175
  specification_version: 4
176
176
  summary: A command line tool for creating a Trello Board based on the current git
data/.travis.yml DELETED
@@ -1 +0,0 @@
1
- language: ruby
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Simpler versions of an extension from ActiveSupport.
4
- #
5
- class String
6
- def titleize
7
- tr("_-", " ").split.map(&:capitalize).join(" ")
8
- end
9
- end