nutrella 1.3.1 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +15 -2
- data/.ruby-version +1 -1
- data/CHANGELOG.md +39 -3
- data/README.md +50 -18
- data/lib/nutrella/cache.rb +1 -1
- data/lib/nutrella/command.rb +34 -6
- data/lib/nutrella/configuration.rb +12 -6
- data/lib/nutrella/string_ext.rb +2 -6
- data/lib/nutrella/task_board_name.rb +3 -3
- data/lib/nutrella/version.rb +1 -1
- data/nutrella.gemspec +8 -8
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 388bb6fc6a90e7819009bb33d2a05f8341949b135218618628b8caf6bdda0478
|
4
|
+
data.tar.gz: cb8b8713edc5aa263877b6a9924ad49d6b0725be174926a9119a2d9a168bb28e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 065c8d70378e4e202136a857cff0a0e816d6e17b56d8feaacd469d864273f404304b902310d258727b664ec4a25081dfbb4629a8c1e3aa26690c0b9f85879d84
|
7
|
+
data.tar.gz: db0d17e835fe9b3553cfd675018a9b569af6acfb312d2e1a9bd01e9585e8aff8e613d854b51be40d6cb0e4353ed40be9e1e70e219535fc1b28d2ec985f4c13bc
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require:
|
2
|
-
- rubocop-
|
2
|
+
- rubocop-rake
|
3
3
|
- rubocop-rspec
|
4
4
|
|
5
5
|
AllCops:
|
6
|
-
|
6
|
+
NewCops: enable
|
7
|
+
TargetRubyVersion: 2.6
|
7
8
|
|
8
9
|
Exclude:
|
9
10
|
- 'bin/**/*'
|
@@ -15,6 +16,12 @@ Layout/MultilineMethodCallBraceLayout:
|
|
15
16
|
Metrics/BlockLength:
|
16
17
|
Enabled: false
|
17
18
|
|
19
|
+
Naming/MemoizedInstanceVariableName:
|
20
|
+
EnforcedStyleForLeadingUnderscores: required
|
21
|
+
|
22
|
+
Rake/Desc:
|
23
|
+
Enabled: false
|
24
|
+
|
18
25
|
RSpec/AnyInstance:
|
19
26
|
Enabled: false
|
20
27
|
|
@@ -45,6 +52,12 @@ RSpec/MultipleExpectations:
|
|
45
52
|
RSpec/SubjectStub:
|
46
53
|
Enabled: false
|
47
54
|
|
55
|
+
Style/BlockDelimiters:
|
56
|
+
Enabled: true
|
57
|
+
EnforcedStyle: line_count_based
|
58
|
+
BracesRequiredMethods:
|
59
|
+
- 'let'
|
60
|
+
|
48
61
|
# We can ignore this small performance improvement.
|
49
62
|
Style/FrozenStringLiteralComment:
|
50
63
|
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.6
|
data/CHANGELOG.md
CHANGED
@@ -6,13 +6,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.5.3] - 2021-02-18
|
10
|
+
|
11
|
+
- Update ruby-trello
|
12
|
+
- Update development dependencies
|
13
|
+
|
14
|
+
#### Breaking Changes
|
15
|
+
|
16
|
+
- Drop support for Ruby 2.5
|
17
|
+
|
18
|
+
## [1.5.2] - 2020-04-27
|
19
|
+
|
20
|
+
#### New Features
|
21
|
+
|
22
|
+
- Added a configuration option to enable logging for easier troubleshooting
|
23
|
+
|
24
|
+
## [1.5.1] - 2020-04-27
|
25
|
+
|
26
|
+
#### Bug Fix
|
27
|
+
|
28
|
+
- Honour the specified named Trello board argument over the Trello board derived from the current git branch
|
29
|
+
|
30
|
+
## [1.5.0] - 2020-04-26
|
31
|
+
|
32
|
+
#### New Features
|
33
|
+
|
34
|
+
- Added a configuration option to support opening boards in the desktop Trello app
|
35
|
+
|
36
|
+
## [1.4.0] - 2020-03-30
|
37
|
+
|
38
|
+
#### Breaking Changes
|
39
|
+
|
40
|
+
- Drop support for Ruby 2.4
|
41
|
+
|
9
42
|
## [1.3.1] - 2019-05-20
|
10
|
-
|
43
|
+
|
44
|
+
#### New Features
|
45
|
+
|
11
46
|
- Added a configuration option to adjust the command that launches your Trello boards
|
12
47
|
|
13
48
|
## [1.3.0] - 2019-05-20
|
14
|
-
|
49
|
+
|
50
|
+
- Yanked
|
15
51
|
|
16
52
|
## [1.2.2] - 2019-04-27
|
17
|
-
|
53
|
+
|
18
54
|
- Added a changelog
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ A command line tool for associating a Trello board with the current git branch.
|
|
29
29
|
**Step 3**: Get key and secret (best to do this from your home directory)
|
30
30
|
|
31
31
|
$ cd ~
|
32
|
-
$ irb -rubygems
|
32
|
+
$ irb -r rubygems
|
33
33
|
irb> require 'nutrella'
|
34
34
|
irb> Nutrella.open_public_key_url
|
35
35
|
|
@@ -47,6 +47,7 @@ If your haven't already done so, insert your `key`, `secret`, and `token` into y
|
|
47
47
|
|
48
48
|
The configuration file should look like the following (don't use the keys below, they won't work):
|
49
49
|
|
50
|
+
```yaml
|
50
51
|
# Trello Developer API Keys
|
51
52
|
key: c2fc703429da08b6e7dcb0a878e35564
|
52
53
|
secret: 7fd865f372891afa93aabdb6b836254bcda10c8a320def2b3207e2ffb425bc0a
|
@@ -55,50 +56,81 @@ The configuration file should look like the following (don't use the keys below,
|
|
55
56
|
# Optional Configuration
|
56
57
|
organization: 542d76ac2fad4697c3e80448
|
57
58
|
launch_command: open $url$
|
59
|
+
enable_trello_app: false
|
60
|
+
```
|
61
|
+
|
62
|
+
**Step 6**: Adjust configuration file (Optional)
|
58
63
|
|
59
|
-
|
60
|
-
Trello board in Firefox change
|
64
|
+
Adjust the `launch_command` configuration to fit your needs.
|
65
|
+
For example, to open your Trello board in Firefox change your configuration to:
|
61
66
|
|
67
|
+
```yaml
|
62
68
|
launch_command: open -a firefox $url$
|
69
|
+
```
|
70
|
+
|
71
|
+
Adjust the `enable_trello_app` configuration to open boards in the Trello app.
|
72
|
+
To open your Trello board in the Trello app change your configuration to:
|
73
|
+
|
74
|
+
```yaml
|
75
|
+
enable_trello_app: true
|
76
|
+
```
|
77
|
+
|
78
|
+
Adjust the `enable_logging` configuration to start logging diagnostics:
|
79
|
+
|
80
|
+
```yaml
|
81
|
+
enable_logging: true
|
82
|
+
```
|
63
83
|
|
64
84
|
|
65
85
|
## Usage
|
66
86
|
|
67
87
|
Create or open a Trello board based on the name of the current git branch:
|
68
88
|
|
89
|
+
```sh
|
69
90
|
$ nutrella
|
91
|
+
```
|
70
92
|
|
71
93
|
Create or open a named Trello board:
|
72
94
|
|
95
|
+
```sh
|
73
96
|
$ nutrella <git-branch-name>
|
97
|
+
```
|
74
98
|
|
75
99
|
Note: you can invoke `nutrella` from your project directory or from any subdirectory.
|
76
100
|
|
101
|
+
|
77
102
|
## Troubleshooting
|
78
103
|
|
79
|
-
|
104
|
+
1. If an unexpected Trello board is opening try clearing your cache:
|
80
105
|
|
81
|
-
|
106
|
+
```sh
|
107
|
+
rm ~/.nutrella.cache.yml
|
108
|
+
```
|
82
109
|
|
83
|
-
|
84
|
-
gem update --system
|
85
|
-
```
|
110
|
+
1. If you see `method_missing: undefined method 'this'`
|
86
111
|
|
87
|
-
|
112
|
+
Try updating `RubyGems`
|
88
113
|
|
89
|
-
|
114
|
+
```sh
|
115
|
+
gem update --system
|
116
|
+
```
|
90
117
|
|
91
|
-
|
92
|
-
gem install bundler
|
93
|
-
```
|
118
|
+
1. If you see `uninitialized constant Gem::Source (NameError)`
|
94
119
|
|
95
|
-
|
120
|
+
Try updating `bundler`
|
96
121
|
|
97
|
-
|
122
|
+
```sh
|
123
|
+
gem install bundler
|
124
|
+
```
|
98
125
|
|
99
|
-
|
100
|
-
|
101
|
-
|
126
|
+
1. If you see `cannot load such file -- nutrella`
|
127
|
+
|
128
|
+
This error may appear after running `irb -rubygems` and you are unable to `require 'nutrella'`.
|
129
|
+
Try running `irb -rubygems` from your home directory:
|
130
|
+
|
131
|
+
```sh
|
132
|
+
cd ~
|
133
|
+
```
|
102
134
|
|
103
135
|
|
104
136
|
## Origin of Name
|
data/lib/nutrella/cache.rb
CHANGED
data/lib/nutrella/command.rb
CHANGED
@@ -14,23 +14,51 @@ module Nutrella
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def run
|
17
|
-
|
17
|
+
launch(board_url)
|
18
|
+
ensure
|
19
|
+
logger.close
|
18
20
|
end
|
19
21
|
|
20
22
|
private
|
21
23
|
|
24
|
+
def launch(url)
|
25
|
+
launch_command = configuration_values.fetch(:launch_command).gsub("$url$", url)
|
26
|
+
|
27
|
+
logger.info { "Launch command: '#{launch_command}'" }
|
28
|
+
|
29
|
+
system(launch_command)
|
30
|
+
end
|
31
|
+
|
22
32
|
def board_url
|
23
|
-
|
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 cached_url
|
41
|
+
@_cached_url ||= url_cache.fetch(@board_name) { task_board.lookup_or_create(@board_name).url }
|
24
42
|
end
|
25
43
|
|
26
44
|
def configuration_values
|
27
|
-
@
|
45
|
+
@_configuration_values ||= Nutrella::Configuration.values(configuration_filename)
|
28
46
|
end
|
29
47
|
|
30
|
-
def
|
31
|
-
|
48
|
+
def enable_trello_app?
|
49
|
+
configuration_values.fetch(:enable_trello_app)
|
50
|
+
end
|
32
51
|
|
33
|
-
|
52
|
+
def logger
|
53
|
+
@_logger ||= Logger.new(log_filename)
|
54
|
+
end
|
55
|
+
|
56
|
+
def log_filename
|
57
|
+
configuration_values.fetch(:enable_logging) ? "nutrella.log" : "/dev/null"
|
58
|
+
end
|
59
|
+
|
60
|
+
def trello_url(http_url)
|
61
|
+
http_url.gsub(/^http.?:/, "trello:")
|
34
62
|
end
|
35
63
|
|
36
64
|
def task_board
|
@@ -9,7 +9,7 @@ module Nutrella
|
|
9
9
|
class Configuration
|
10
10
|
NULOGY_ORGANIZATION_ID = "542d76ac2fad4697c3e80448"
|
11
11
|
|
12
|
-
INITIAL_CONFIGURATION =
|
12
|
+
INITIAL_CONFIGURATION = <<~YAML
|
13
13
|
# Trello Developer API Keys
|
14
14
|
key: <your developer key>
|
15
15
|
secret: <your developer secret>
|
@@ -18,6 +18,8 @@ module Nutrella
|
|
18
18
|
# Optional Configuration
|
19
19
|
organization: #{NULOGY_ORGANIZATION_ID}
|
20
20
|
launch_command: open $url$
|
21
|
+
enable_trello_app: false
|
22
|
+
enable_logging: false
|
21
23
|
YAML
|
22
24
|
|
23
25
|
attr_reader :path, :values
|
@@ -34,20 +36,24 @@ module Nutrella
|
|
34
36
|
|
35
37
|
private
|
36
38
|
|
37
|
-
def load_configuration
|
38
|
-
configuration = YAML.load_file(path)
|
39
|
-
|
39
|
+
def load_configuration # rubocop:disable Metrics/MethodLength
|
40
40
|
@values = {
|
41
41
|
key: configuration.fetch("key"),
|
42
42
|
secret: configuration.fetch("secret"),
|
43
43
|
token: configuration.fetch("token"),
|
44
44
|
organization: configuration.fetch("organization", NULOGY_ORGANIZATION_ID),
|
45
|
-
launch_command: configuration.fetch("launch_command", "open $url$")
|
45
|
+
launch_command: configuration.fetch("launch_command", "open $url$"),
|
46
|
+
enable_trello_app: configuration.fetch("enable_trello_app", "false"),
|
47
|
+
enable_logging: configuration.fetch("enable_logging", "false")
|
46
48
|
}
|
47
49
|
rescue => e
|
48
50
|
abort "#{path} #{e}"
|
49
51
|
end
|
50
52
|
|
53
|
+
def configuration
|
54
|
+
@_configuration ||= YAML.load_file(path)
|
55
|
+
end
|
56
|
+
|
51
57
|
def configuration_missing?
|
52
58
|
return false if File.exist?(path)
|
53
59
|
|
@@ -60,7 +66,7 @@ module Nutrella
|
|
60
66
|
end
|
61
67
|
|
62
68
|
def configuration_missing_message
|
63
|
-
|
69
|
+
<<~TEXT
|
64
70
|
I see that you don't have a config file '#{path}'.
|
65
71
|
So, I created one for you.
|
66
72
|
|
data/lib/nutrella/string_ext.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Simpler versions of
|
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
|
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
|
data/lib/nutrella/version.rb
CHANGED
data/nutrella.gemspec
CHANGED
@@ -24,14 +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.
|
27
|
+
spec.required_ruby_version = ">= 2.6"
|
28
28
|
|
29
|
-
spec.add_runtime_dependency "ruby-trello", "~>
|
29
|
+
spec.add_runtime_dependency "ruby-trello", "~> 3.0"
|
30
30
|
|
31
|
-
spec.add_development_dependency "rake", "~>
|
32
|
-
spec.add_development_dependency "rspec", "~> 3.
|
33
|
-
spec.add_development_dependency "rubocop", "~>
|
34
|
-
spec.add_development_dependency "rubocop-
|
35
|
-
spec.add_development_dependency "rubocop-rspec", "~>
|
36
|
-
spec.add_development_dependency "simplecov", "~> 0.
|
31
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.10"
|
33
|
+
spec.add_development_dependency "rubocop", "~> 1.10"
|
34
|
+
spec.add_development_dependency "rubocop-rake", "~> 0.5"
|
35
|
+
spec.add_development_dependency "rubocop-rspec", "~> 2.2"
|
36
|
+
spec.add_development_dependency "simplecov", "~> 0.21"
|
37
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.3
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alistair McKinnell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-trello
|
@@ -16,98 +16,98 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
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: '
|
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
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.10'
|
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.
|
54
|
+
version: '3.10'
|
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: '
|
61
|
+
version: '1.10'
|
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: '
|
68
|
+
version: '1.10'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-
|
70
|
+
name: rubocop-rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0.5'
|
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: '
|
82
|
+
version: '0.5'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop-rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '2.2'
|
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: '
|
96
|
+
version: '2.2'
|
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.
|
103
|
+
version: '0.21'
|
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.
|
110
|
+
version: '0.21'
|
111
111
|
description:
|
112
112
|
email:
|
113
113
|
- alistair.mckinnell@gmail.com
|
@@ -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.
|
166
|
+
version: '2.6'
|
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.
|
173
|
+
rubygems_version: 3.2.11
|
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
|