Skip to content

Commit

Permalink
Update dependencies ruby to v3.3.0 and highline to 3.0.0 (#29)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Emma Sax <[email protected]>
  • Loading branch information
renovate[bot] and emmahsax authored Feb 4, 2024
1 parent f7998b6 commit 871b729
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.2
3.3.0
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,51 @@ four

> HighlineWrapper.new.ask('What is your favorite number?', {required: true})
What is your favorite number?

--- This question is required ---

What is your favorite number?

--- This question is required ---

What is your favorite number?

--- This question is required ---

What is your favorite number?
2
=> "2"

> HighlineWrapper.new.ask('What is your favorite number?', {required: true, indicate_default_message: false})
What is your favorite number?

--- This question is required ---

What is your favorite number?

--- This question is required ---

What is your favorite number?
5
=> "5"

> HighlineWrapper.new.ask('What is your favorite number?', {indicate_default_message: false})
What is your favorite number?

=> ""

> HighlineWrapper.new.ask('What is your favorite color?')
What is your favorite color?

--- Default selected: EMPTY ---

=> ""

> HighlineWrapper.new.ask('What is your favorite color?', {default: 'orange'})
What is your favorite color?

--- Default selected: orange ---

=> "orange"

> HighlineWrapper.new.ask('Please type your private token:', {secret: true})
Expand All @@ -115,9 +130,11 @@ Please type your private token:
Please type your private token:

--- This question is required ---

Please type your private token:

--- This question is required ---

Please type your private token:
****************
=> "MY-PRIVATE-TOKEN"
Expand Down Expand Up @@ -150,7 +167,9 @@ Notes:
```ruby
> HighlineWrapper.new.ask_yes_no('Do you like Ruby?')
Do you like Ruby?

--- Default selected: YES ---

=> true

> HighlineWrapper.new.ask_yes_no('Do you like Ruby?', {indicate_default_message: false})
Expand All @@ -164,16 +183,24 @@ no

> HighlineWrapper.new.ask_yes_no('Do you like Ruby?', {default: false})
Do you like Ruby?

--- Default selected: NO ---

=> false

> HighlineWrapper.new.ask_yes_no('Do you like Ruby?', {required: true})
Do you like Ruby?

--- This question is required ---

Do you like Ruby?

--- This question is required ---

Do you like Ruby?

--- This question is required ---

Do you like Ruby?
N
=> false
Expand All @@ -182,6 +209,7 @@ N
Do you like Ruby?
uh-huh
--- This question is required ---

Do you like Ruby?
YES
=> true
Expand All @@ -190,6 +218,7 @@ YES
Do you like Ruby?
yep
--- This question is required ---

Do you like Ruby?
yes
=> true
Expand Down Expand Up @@ -239,12 +268,16 @@ What is your favorite number of these?
1. one
2. two
3. three

--- This question is required ---

What is your favorite number of these?
1. one
2. two
3. three

--- This question is required ---

What is your favorite number of these?
1. one
2. two
Expand All @@ -257,7 +290,9 @@ What is your favorite number of these?
1. one
2. two
3. three

--- Default selected: 1. one ---

=> {:value=>"one", :index=>0}

> HighlineWrapper.new.ask_multiple_choice('What is your favorite number of these?', ['one', 'two', 'three'], {with_index: true, default: 'one', indicate_default_message: false})
Expand All @@ -272,12 +307,16 @@ What is your favorite number of these?
1. one
2. two
3. three

--- This question is required ---

What is your favorite number of these?
1. one
2. two
3. three

--- This question is required ---

What is your favorite number of these?
1. one
2. two
Expand All @@ -290,22 +329,27 @@ What is your favorite number of these?
1. one
2. two
3. three

--- Default selected: EMPTY ---

=> nil

> HighlineWrapper.new.ask_multiple_choice('What is your favorite number of these?', ['one', 'two', 'three'], {default: nil, with_index: true})
What is your favorite number of these?
1. one
2. two
3. three

--- Default selected: EMPTY ---

=> nil

> HighlineWrapper.new.ask_multiple_choice('What is your favorite number of these?', ['one', 'two', 'three'], {default: nil, with_index: true, indicate_default_message: false})
What is your favorite number of these?
1. one
2. two
3. three

=> nil
```

Expand Down Expand Up @@ -353,35 +397,44 @@ What are your favorite numbers of these?
1. one
2. two
3. three

=> []

> HighlineWrapper.new.ask_checkbox("What are your favorite numbers of these?", ['one', 'two','three'], {with_indexes: true})
What are your favorite numbers of these?
1. one
2. two
3. three

--- Defaults selected: EMPTY ---

=> []

> HighlineWrapper.new.ask_checkbox("What are your favorite numbers of these?", ['one', 'two','three'], {defaults: ['two', 'three']})
What are your favorite numbers of these?
1. one
2. two
3. three

--- Defaults selected: 2. two, 3. three ---

=> [{:value=>"two"}, {:value=>"three"}]

> HighlineWrapper.new.ask_checkbox("What are your favorite numbers of these?", ['one', 'two','three'], {required: true, with_indexes: true})
What are your favorite numbers of these?
1. one
2. two
3. three

--- This question is required ---

What are your favorite numbers of these?
1. one
2. two
3. three

--- This question is required ---

What are your favorite numbers of these?
1. one
2. two
Expand All @@ -394,7 +447,9 @@ What are your favorite numbers of these?
1. one
2. two
3. three

--- This question is required ---

What are your favorite numbers of these?
1. one
2. two
Expand All @@ -407,6 +462,7 @@ What are your favorite numbers of these?
1. one
2. two
3. three

=> [{:value=>"two", :index=>1}, {:value=>"three", :index=>2}]
```

Expand Down
3 changes: 2 additions & 1 deletion highline_wrapper.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Gem::Specification.new do |gem|
gem.summary = 'A little HighLine wrapper'
gem.version = HighlineWrapper::VERSION

gem.add_dependency 'highline', '~> 2.0'
gem.add_dependency 'abbrev', '~> 0.1'
gem.add_dependency 'highline', '~> 3.0'

gem.add_development_dependency 'bundler', '~> 2.2'
gem.add_development_dependency 'faker', '~> 3.0'
Expand Down
2 changes: 1 addition & 1 deletion lib/highline_wrapper/checkbox_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def ask(prompt, choices, options)

private def print_default_message(options, choices)
defaults = options[:default_indexes].map { |i| "#{i + 1}. #{choices[i]}".strip }.join(', ')
puts "--- Defaults selected: #{defaults} ---"
puts "--- Defaults selected: #{defaults} ---\n\n"
end

private def format_multiple_selections(choices, indices, with_indexes)
Expand Down
2 changes: 1 addition & 1 deletion lib/highline_wrapper/multiple_choice_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def ask(prompt, choices, options)
end

private def print_default_message(options)
puts "--- Default selected: #{options[:default_index] + 1}. #{options[:default]} ---"
puts "--- Default selected: #{options[:default_index] + 1}. #{options[:default]} ---\n\n"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/highline_wrapper/open_ended_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def ask(prompt, options)

private def print_default_message(options)
if !options[:secret]
puts "--- Default selected: #{options[:default].empty? ? 'EMPTY' : options[:default]} ---"
puts "--- Default selected: #{options[:default].empty? ? 'EMPTY' : options[:default]} ---\n\n"
elsif options[:secret]
puts '--- Default selected: HIDDEN ---'
puts "--- Default selected: HIDDEN ---\n\n"
end
end
end
Expand Down
5 changes: 2 additions & 3 deletions lib/highline_wrapper/question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ class Question
class << self
def ask_highline(prompt, secret: false)
highline.ask(prompt) do |conf|
conf.readline = true
conf.echo = '*' if secret
end
end
Expand All @@ -23,12 +22,12 @@ def format_selection(choices, index, with_index)
end

def recurse(prompt, choices, options)
puts '--- This question is required ---'
puts "--- This question is required ---\n\n"
choices.nil? ? ask(prompt, options) : ask(prompt, choices, options)
end

def return_empty_defaults(options)
puts '--- Default selected: EMPTY ---' if options[:indicate_default_message]
puts "--- Default selected: EMPTY ---\n\n" if options[:indicate_default_message]
options[:defaults] || options[:default]
end

Expand Down
2 changes: 1 addition & 1 deletion lib/highline_wrapper/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class HighlineWrapper
VERSION = '1.3.1'
VERSION = '2.0.0'
end
2 changes: 1 addition & 1 deletion lib/highline_wrapper/yes_no_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def ask(prompt, options)
end

private def print_default_message(options)
puts "--- Default selected: #{options[:default] ? 'YES' : 'NO'} ---"
puts "--- Default selected: #{options[:default] ? 'YES' : 'NO'} ---\n\n"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/highline_wrapper/checkbox_question_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

describe HighlineWrapper::CheckboxQuestion do
let(:choices) { %w[one two three] }
let(:response) { double(:response, readline: true, to_i: 3) }
let(:response) { double(:response, to_i: 3) }
let(:highline) { double(:highline_cli, ask: response) }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/highline_wrapper/multiple_choice_question_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

describe HighlineWrapper::MultipleChoiceQuestion do
let(:choices) { %w[one two three] }
let(:response) { double(:response, readline: true, to_i: 3) }
let(:response) { double(:response, to_i: 3) }
let(:highline) { double(:highline_cli, ask: response) }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/highline_wrapper/open_ended_question_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'highline_wrapper'

describe HighlineWrapper::OpenEndedQuestion do
let(:response) { double(:response, readline: true, to_i: 3) }
let(:response) { double(:response, to_i: 3) }
let(:highline) { double(:highline_cli, ask: response) }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/highline_wrapper/question_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'highline_wrapper'

describe HighlineWrapper::Question do
let(:response) { double(:response, readline: true, to_i: 3) }
let(:response) { double(:response, to_i: 3) }
let(:highline) { double(:highline_cli, ask: response) }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/highline_wrapper/yes_no_question_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'highline_wrapper'

describe HighlineWrapper::YesNoQuestion do
let(:response) { double(:response, readline: true, to_i: 3) }
let(:response) { double(:response, to_i: 3) }
let(:highline) { double(:highline_cli, ask: response) }

before do
Expand Down

0 comments on commit 871b729

Please sign in to comment.