highline 3.1.0 → 3.1.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: 68bd1dba0eea8f51020e4b42bf027a432313b312efcf1365c20a6d5ca2b13244
4
- data.tar.gz: d1dd90401ba1b29581afe8e89ef5a2ad3b443184e61f73dd7a60252404c30172
3
+ metadata.gz: b9d2b093cb533443369ed3d5c31f6c09f1d5fdfd4d5b9f89a1e48d8da20a377a
4
+ data.tar.gz: 150008ffff933909afcc40ebdee9bba538dc1170331a4a58cd5ebff5fc582738
5
5
  SHA512:
6
- metadata.gz: b7bcd45c71419a9e90c9cdc9f1dba9c42be76618068cadc8e30e41600272413b16df3cd95d95266fc4d24d70c00c53668f6fe7134fb1e5cee4780740eabc2378
7
- data.tar.gz: 20cfca01c3f433766f9d0884b5ea32dcfa690e6b3652fc6aeb9e691f5eb62f1ffc99ec9941fe724603684b660d374af23b8819054a1e5dfffb5655ff8107df1e
6
+ metadata.gz: 016dc7d742577f9cb8fbca44a07e14a9911b314afb9ad4974456ae29fb379705a4161e48eb19c73fb2a7afe6ae602272360141b09cc17ad33346eb00a03f34e8
7
+ data.tar.gz: 41d933367b093d1296535eedcf8ffc147c561dd51f07ef81d20d3c044877c93d1c3eb0c96a783e1c0f4cfd444ceb1bbbda26c21509519515571cab87ac3744ba
@@ -10,6 +10,7 @@ jobs:
10
10
  os: [ubuntu-latest]
11
11
  ruby-version:
12
12
  - head
13
+ - '3.4'
13
14
  - '3.3'
14
15
  - '3.2'
15
16
  - '3.1'
@@ -23,7 +24,7 @@ jobs:
23
24
  - os: windows-latest
24
25
  ruby-version: head
25
26
  - os: windows-latest
26
- ruby-version: '3.3'
27
+ ruby-version: '3.4'
27
28
  - os: windows-latest
28
29
  ruby-version: mingw
29
30
  - os: windows-latest
@@ -33,7 +34,7 @@ jobs:
33
34
  - os: macos-latest
34
35
  ruby-version: 'head'
35
36
  - os: macos-latest
36
- ruby-version: '3.3'
37
+ ruby-version: '3.4'
37
38
  runs-on: ${{ matrix.os }}
38
39
  steps:
39
40
  - uses: actions/checkout@v4
data/.rubocop.yml CHANGED
@@ -4,7 +4,8 @@
4
4
  # https://github.com/bbatsov/rubocop/tree/master/config
5
5
 
6
6
  AllCops:
7
- TargetRubyVersion: 2.1
7
+ TargetRubyVersion: 3.4
8
+ NewCops: enable
8
9
 
9
10
  # General
10
11
 
@@ -58,7 +59,7 @@ Style/OptionalArguments:
58
59
  - 'lib/highline/list_renderer.rb'
59
60
 
60
61
  # TemplateRenderer should never fail on method missing.
61
- Style/MethodMissing:
62
+ Style/MissingRespondToMissing:
62
63
  Exclude:
63
64
  - 'lib/highline/template_renderer.rb'
64
65
 
@@ -73,7 +74,7 @@ Style/SymbolArray:
73
74
  # Cop supports --auto-correct.
74
75
  # Configuration parameters: EnforcedStyle, SupportedStyles.
75
76
  # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
76
- Layout/IndentHeredoc:
77
+ Layout/HeredocIndentation:
77
78
  Exclude:
78
79
  - 'examples/page_and_wrap.rb'
79
80
  - 'highline.gemspec'
data/Changelog.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  Below is a complete listing of changes for each revision of HighLine.
4
4
 
5
+ ### 3.1.2 / 2025-01-05
6
+ * PR #279 - Upgrades and adjustments for Ruby 3.4 release (@abinoam)
7
+ * PR #278 - Prevent ArgumentError for #col_count_calculate when items exceed 80 chars (@davidjkling, @justintsteele)
8
+
9
+ ### 3.1.1 / 2024-08-18
10
+ * PR #276 - Update #say to always flush the output after a #puts (@blipper)
11
+ * PR #274 / I #273 (@costa)
12
+ * Add Highline#add_to_color_scheme
13
+ * Dockerize the test environment. Just run `bin/test` and voilá!
14
+
5
15
  ### 3.1.0 / 2024-07-15
6
16
  * PR #272 / I #271 - Readline is now completed deprecated over Reline (@abinoam, issue by @64kramsystem)
7
17
  * PR #269 - Provide a 'Changelog' link on rubygems.org/gems/highline (@mark-young-atg)
data/Gemfile CHANGED
@@ -13,7 +13,9 @@ group :code_quality do
13
13
  gem "flog", require: false
14
14
  gem "pronto", require: false, platform: :ruby
15
15
  gem "pronto-flay", require: false, platform: :ruby
16
+ gem "path_expander", "1.1.1", require: false # Remove this lock when path_expander > 1.1.2 and flay > 2.13.3 is released.
16
17
  # gem "pronto-poper", require: false, platform: :ruby
17
18
  gem "pronto-reek", require: false, platform: :ruby
18
19
  gem "pronto-rubocop", require: false, platform: :ruby
20
+ gem "base64", require: false
19
21
  end
data/README.md CHANGED
@@ -206,6 +206,9 @@ Contributing
206
206
  - ```rake acceptance```
207
207
  - ```pronto run```
208
208
 
209
+ Alternatively, if you're in a [Docker](https://www.docker.com)ised environment,
210
+ don't care about installing anything locally -- just run `bin/test` instead.
211
+
209
212
  8. Commit your changes
210
213
  - ```git commit -am "Your commit message"```
211
214
 
data/bin/test ADDED
@@ -0,0 +1,11 @@
1
+ #!/bin/bash -e
2
+ test "$#" -ne 0 && echo "Unsupported args: $@" >&2 && exit 145
3
+ cd "$( dirname "${BASH_SOURCE[0]}" )"/..
4
+
5
+ export COMPOSE_FILE=test/docker-compose.yml
6
+ export COMPOSE_PROJECT_NAME=highline_dev
7
+
8
+ docker compose rm -svf
9
+ docker compose build --force-rm
10
+
11
+ docker compose run --rm tester && docker compose rm -svf || ( docker compose logs && exit 1 )
@@ -236,8 +236,8 @@ class HighLine
236
236
  end
237
237
 
238
238
  def col_count_calculate
239
- (line_size_limit + row_join_str_size) /
240
- (items_max_length + row_join_str_size)
239
+ result = (line_size_limit + row_join_str_size) / (items_max_length + row_join_str_size)
240
+ result == 0 ? 1 : result
241
241
  end
242
242
 
243
243
  def col_count
data/lib/highline/menu.rb CHANGED
@@ -374,12 +374,14 @@ class HighLine
374
374
  end
375
375
 
376
376
  def map_items_by_index
377
- if [:letter, :capital_letter].include?(@index)
378
- # @ and ` are the previous ASCII characters to A and a respectively
379
- prev_char = (@index == :capital_letter ? '@' : '`')
380
- all_items.map { prev_char.succ!.dup }
377
+ size = all_items.size
378
+ case @index
379
+ when :letter
380
+ ("a".."z").first(size)
381
+ when :capital_letter
382
+ ("A".."Z").first(size)
381
383
  else
382
- (1..all_items.size).map(&:to_s)
384
+ (1..size).map(&:to_s)
383
385
  end
384
386
  end
385
387
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  class HighLine
4
4
  # The version of the installed library.
5
- VERSION = "3.1.0".freeze
5
+ VERSION = "3.1.2".freeze
6
6
  end
data/lib/highline.rb CHANGED
@@ -61,6 +61,14 @@ class HighLine
61
61
  true if @color_scheme
62
62
  end
63
63
 
64
+ # Pass a +Hash+ to add +new+ colors to the current scheme.
65
+ def add_to_color_scheme(hash)
66
+ old_hash = (color_scheme || {}).to_hash
67
+ fail "Overlapping color schemes: #{old_hash.keys & hash.keys}" unless
68
+ (old_hash.keys & hash.keys).empty?
69
+ self.color_scheme = ColorScheme.new(old_hash.merge hash)
70
+ end
71
+
64
72
  # Reset color scheme to default (+nil+)
65
73
  def reset_color_scheme
66
74
  self.color_scheme = nil
@@ -377,10 +385,10 @@ class HighLine
377
385
  # if statement ends with whitespace before a color escape code.
378
386
  if /[ \t](\e\[\d+(;\d+)*m)?\Z/ =~ statement
379
387
  output.print(statement)
380
- output.flush
381
388
  else
382
389
  output.puts(statement)
383
390
  end
391
+ output.flush # See: https://github.com/JEG2/highline/pull/276
384
392
  end
385
393
 
386
394
  # Renders and indents a statement.
@@ -547,21 +555,26 @@ class HighLine
547
555
  terminal.raw_no_echo_mode_exec do
548
556
  loop do
549
557
  character = terminal.get_character
550
- raise Interrupt if character == "\u0003"
551
- break unless character
552
- break if ["\n", "\r"].include? character
553
-
554
- # honor backspace and delete
555
- if character == "\b" || character == "\u007F"
556
- chopped = line.chop!
557
- output_erase_char if chopped && question.echo
558
- elsif character == "\cU"
558
+
559
+ case character
560
+ when "\u0003" # Ctrl+C (Interrupt)
561
+ raise Interrupt
562
+ when nil # No character received
563
+ break
564
+ when "\n", "\r" # Newline or carriage return
565
+ break
566
+ when "\b", "\u007F" # Backspace and delete
567
+ unless line.empty?
568
+ line = line.chop
569
+ output_erase_char if question.echo
570
+ end
571
+ when "\cU" # Clear line
559
572
  line.size.times { output_erase_char } if question.echo
560
573
  line = ""
561
- elsif character == "\e"
574
+ when "\e" # Escape key
562
575
  ignore_arrow_key
563
- else
564
- line << character
576
+ else # Any other character
577
+ line += character
565
578
  say_last_char_or_echo_char(line, question)
566
579
  end
567
580
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highline
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Edward Gray II
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-07-15 00:00:00.000000000 Z
10
+ date: 2025-01-06 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -106,6 +105,7 @@ files:
106
105
  - README.md
107
106
  - Rakefile
108
107
  - TODO
108
+ - bin/test
109
109
  - doc/.cvsignore
110
110
  - examples/ansi_colors.rb
111
111
  - examples/asking_for_arrays.rb
@@ -158,7 +158,6 @@ licenses:
158
158
  - Ruby
159
159
  metadata:
160
160
  changelog_uri: https://github.com/JEG2/highline/blob/master/Changelog.md
161
- post_install_message:
162
161
  rdoc_options: []
163
162
  require_paths:
164
163
  - lib
@@ -173,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
172
  - !ruby/object:Gem::Version
174
173
  version: '0'
175
174
  requirements: []
176
- rubygems_version: 3.5.9
177
- signing_key:
175
+ rubygems_version: 3.6.2
178
176
  specification_version: 4
179
177
  summary: HighLine is a high-level command-line IO library.
180
178
  test_files: []