dead_end 2.0.1 → 2.0.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: 7d7d236a8a3634efc153e2a20f511072c2b10f97553595ddb3309b88f74dbbb8
4
- data.tar.gz: 5cb84a34d16f9c7714791f01864cfb1b05095b8eb9587be5cfbc86aed1c31a20
3
+ metadata.gz: ec9e05716b47eb5d96ac063126a59977d98b8cf3e6f09ba0a0065d425a3c15e5
4
+ data.tar.gz: c78047c6dd36c1c716e1970e9bec5887bbcaf1fcc0341cbb5c11405043a07105
5
5
  SHA512:
6
- metadata.gz: 41f2022c9faba2cd907b91f9dbd2200172af5ddaa6117f80c7dc7229665026e89d06284cfd43d439dfe879f541ee77b57cb09334c49d1f7732ba1ab484197852
7
- data.tar.gz: 667597674b31cda70837d9e11c46ccf3f4d7374445f56d8fc1f1f4fda3bd4cad0fdf2c2517620224aea683be21b7142101787aac0cb40e7a296ac039be2af0d3
6
+ metadata.gz: 2eca38b35ef1371cae5fd104fa88dad33d44b17cb6bf29b01b5dea0c650d3d21c0dfbf2b1ac96f0a6f307e7d541cf2a2f7be062d59f1626b16c82f1a2f7d3a3e
7
+ data.tar.gz: 1a09171cb208465cf48ff5ac0346240d5bf155aebb886c27b6259742f325bc58a0b73ec9998fcbb1544440e6df7363fa7ab57a04dba9e7887207f30916e8c3a9
@@ -1,13 +1,20 @@
1
1
  name: Check Changelog
2
2
 
3
3
  on:
4
- pull_request:
5
- types: [opened, reopened, edited, synchronize]
4
+ pull_request:
5
+ types: [opened, reopened, edited, labeled, unlabeled, synchronize]
6
+
6
7
  jobs:
7
- build:
8
+ check-changelog:
8
9
  runs-on: ubuntu-latest
10
+ if: |
11
+ !contains(github.event.pull_request.body, '[skip changelog]') &&
12
+ !contains(github.event.pull_request.body, '[changelog skip]') &&
13
+ !contains(github.event.pull_request.body, '[skip ci]') &&
14
+ !contains(github.event.pull_request.labels.*.name, 'skip changelog')
9
15
  steps:
10
- - uses: actions/checkout@v1
11
- - name: Check that CHANGELOG is touched
12
- run: |
13
- cat $GITHUB_EVENT_PATH | jq .pull_request.title | grep -i '\[\(\(changelog skip\)\|\(ci skip\)\)\]' || git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
16
+ - uses: actions/checkout@v2.3.5
17
+ - name: Check that CHANGELOG is touched
18
+ run: |
19
+ git fetch origin ${{ github.base_ref }} --depth 1 && \
20
+ git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## HEAD (unreleased)
2
2
 
3
+ ## 2.0.2
4
+
5
+ - Don't print terminal color codes when output is not tty (https://github.com/zombocom/dead_end/pull/91)
6
+
3
7
  ## 2.0.1
4
8
 
5
9
  - Reintroduce Ruby 2.5 support (https://github.com/zombocom/dead_end/pull/90)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dead_end (2.0.1)
4
+ dead_end (2.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/exe/dead_end CHANGED
@@ -5,7 +5,6 @@ require "optparse"
5
5
  require_relative "../lib/dead_end"
6
6
 
7
7
  options = {}
8
- options[:terminal] = true
9
8
  options[:record_dir] = ENV["DEAD_END_RECORD_DIR"]
10
9
 
11
10
  parser = OptionParser.new do |opts|
@@ -46,6 +45,10 @@ parser = OptionParser.new do |opts|
46
45
  options[:record_dir] = v
47
46
  end
48
47
 
48
+ opts.on("--terminal", "Enable terminal highlighting") do |v|
49
+ options[:terminal] = true
50
+ end
51
+
49
52
  opts.on("--no-terminal", "Disable terminal highlighting") do |v|
50
53
  options[:terminal] = false
51
54
  end
@@ -67,7 +70,7 @@ warn "Record dir: #{options[:record_dir]}" if options[:record_dir]
67
70
  display = DeadEnd.call(
68
71
  source: file.read,
69
72
  filename: file.expand_path,
70
- terminal: options[:terminal],
73
+ terminal: options.fetch(:terminal, DeadEnd::DEFAULT_VALUE),
71
74
  record_dir: options[:record_dir]
72
75
  )
73
76
 
@@ -9,8 +9,9 @@ module DeadEnd
9
9
  class DisplayInvalidBlocks
10
10
  attr_reader :filename
11
11
 
12
- def initialize(code_lines:, blocks:, io: $stderr, filename: nil, terminal: false, invalid_obj: WhoDisSyntaxError::Null.new)
13
- @terminal = terminal
12
+ def initialize(code_lines:, blocks:, io: $stderr, filename: nil, terminal: DEFAULT_VALUE, invalid_obj: WhoDisSyntaxError::Null.new)
13
+ @terminal = terminal == DEFAULT_VALUE ? io.isatty : terminal
14
+
14
15
  @filename = filename
15
16
  @io = io
16
17
 
@@ -12,6 +12,10 @@ require "ripper"
12
12
  require "timeout"
13
13
 
14
14
  module DeadEnd
15
+ # Used to indicate a default value that cannot
16
+ # be confused with another input
17
+ DEFAULT_VALUE = Object.new.freeze
18
+
15
19
  class Error < StandardError; end
16
20
  SEARCH_SOURCE_ON_ERROR_DEFAULT = true
17
21
  TIMEOUT_DEFAULT = ENV.fetch("DEAD_END_TIMEOUT", 1).to_i
@@ -27,15 +31,14 @@ module DeadEnd
27
31
  if search_source_on_error
28
32
  call(
29
33
  source: Pathname(filename).read,
30
- filename: filename,
31
- terminal: true
34
+ filename: filename
32
35
  )
33
36
  end
34
37
 
35
38
  raise e
36
39
  end
37
40
 
38
- def self.call(source:, filename:, terminal: false, record_dir: nil, timeout: TIMEOUT_DEFAULT, io: $stderr)
41
+ def self.call(source:, filename:, terminal: DEFAULT_VALUE, record_dir: nil, timeout: TIMEOUT_DEFAULT, io: $stderr)
39
42
  search = nil
40
43
  Timeout.timeout(timeout) do
41
44
  record_dir ||= ENV["DEBUG"] ? "tmp" : nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeadEnd
4
- VERSION = "2.0.1"
4
+ VERSION = "2.0.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dead_end
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - schneems
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-19 00:00:00.000000000 Z
11
+ date: 2021-10-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: When you get an "unexpected end" in your syntax this gem helps you find
14
14
  it