nutrella 1.5.1 → 1.5.2

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: 7add4b79f183553908597ee654ab4b6eab29cbda1b429c6ced3d94da2d533ccc
4
- data.tar.gz: b2dbc3a33c1a4c4c65cd377ab9d450a0553b8636d03521d5ef0e8767ec82280c
3
+ metadata.gz: '048802727749f75d0574ca96e6049f9a50e9e07593f0f9be6bb1dd2b3960691e'
4
+ data.tar.gz: c7e3409c81c7eca40460f827a649f18ab8246bd98759eaf57a29ff4ffd1c4f97
5
5
  SHA512:
6
- metadata.gz: 978a5254670d43a7af9abef50a1878842c84c6dbb022998812d5d4450c6752216c28fa37880ac0a6799dc79b571222d6536cb218da78e8e5aeee4558f5f992aa
7
- data.tar.gz: 5b2fc237ef01364c6598715f5889ca4e5dde29978843f8f2f132bbc3c4d2e2cadbf8522aa33bec4c43cc55107b8131a9a38b6fae2e1325c7b88d0850bedc1817
6
+ metadata.gz: 2b1edcfb213175f8360135e326166f235782be1351bed8c7d1b27e4ee45abf2f693ed6fa56554adcec711c3efb1057a022b60e893dac4911ca27c1a1f27ca1d0
7
+ data.tar.gz: c83f869b34a624f5e39b16408e07a6afc7a1c69c575c6f454b37570c1da4bab6892bfef5f09fbab1f83e77295aef07a82aa50edffcd4b23daa36e4472926b9a8
data/.gitignore CHANGED
@@ -5,3 +5,4 @@
5
5
  /pkg
6
6
  /tmp
7
7
  /.bundle
8
+ /*.log
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.5.2] - 2020-04-27
10
+
11
+ #### New Features
12
+
13
+ - Added a configuration option to enable logging for easier troubleshooting
14
+
9
15
  ## [1.5.1] - 2020-04-27
10
16
 
11
17
  #### Bug Fix
data/README.md CHANGED
@@ -75,6 +75,12 @@ To open your Trello board in the Trello app change your configuration to:
75
75
  enable_trello_app: true
76
76
  ```
77
77
 
78
+ Adjust the `enable_logging` configuration to start logging diagnostics:
79
+
80
+ ```yaml
81
+ enable_logging: true
82
+ ```
83
+
78
84
 
79
85
  ## Usage
80
86
 
@@ -95,7 +101,13 @@ Note: you can invoke `nutrella` from your project directory or from any subdirec
95
101
 
96
102
  ## Troubleshooting
97
103
 
98
- 1. For `method_missing: undefined method 'this'`
104
+ 1. If an unexpected Trello board is opening try clearing your cache:
105
+
106
+ ```sh
107
+ rm ~/.nutrella.cache.yml
108
+ ```
109
+
110
+ 1. If you see `method_missing: undefined method 'this'`
99
111
 
100
112
  Try updating `RubyGems`
101
113
 
@@ -103,7 +115,7 @@ Note: you can invoke `nutrella` from your project directory or from any subdirec
103
115
  gem update --system
104
116
  ```
105
117
 
106
- 1. For `uninitialized constant Gem::Source (NameError)`
118
+ 1. If you see `uninitialized constant Gem::Source (NameError)`
107
119
 
108
120
  Try updating `bundler`
109
121
 
@@ -111,7 +123,7 @@ Note: you can invoke `nutrella` from your project directory or from any subdirec
111
123
  gem install bundler
112
124
  ```
113
125
 
114
- 1. For `cannot load such file -- nutrella`
126
+ 1. If you see `cannot load such file -- nutrella`
115
127
 
116
128
  This error may appear after running `irb -rubygems` and you are unable to `require 'nutrella'`.
117
129
  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,17 @@ 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
30
38
  end
31
39
 
32
40
  def cached_url
@@ -41,6 +49,14 @@ module Nutrella
41
49
  configuration_values.fetch(:enable_trello_app)
42
50
  end
43
51
 
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
+
44
60
  def trello_url(http_url)
45
61
  http_url.gsub(/^http.?:/, "trello:")
46
62
  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,8 @@ 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
22
23
  YAML
23
24
 
24
25
  attr_reader :path, :values
@@ -35,14 +36,15 @@ module Nutrella
35
36
 
36
37
  private
37
38
 
38
- def load_configuration
39
+ def load_configuration # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
39
40
  @values = {
40
41
  key: configuration.fetch("key"),
41
42
  secret: configuration.fetch("secret"),
42
43
  token: configuration.fetch("token"),
43
44
  organization: configuration.fetch("organization", NULOGY_ORGANIZATION_ID),
44
45
  launch_command: configuration.fetch("launch_command", "open $url$"),
45
- enable_trello_app: configuration.fetch("enable_trello_app", "False")
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}"
@@ -64,7 +66,7 @@ module Nutrella
64
66
  end
65
67
 
66
68
  def configuration_missing_message
67
- <<-TEXT.strip_heredoc
69
+ <<~TEXT
68
70
  I see that you don't have a config file '#{path}'.
69
71
  So, I created one for you.
70
72
 
@@ -1,12 +1,8 @@
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
7
  tr("_-", " ").split(" ").map(&:capitalize).join(" ")
12
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nutrella
4
- VERSION = "1.5.1"
4
+ VERSION = "1.5.2"
5
5
  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.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alistair McKinnell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-27 00:00:00.000000000 Z
11
+ date: 2020-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-trello