Codebase list capistrano / 274d0bd
New upstream version 3.14.0 Samuel Henrique 3 years ago
6 changed file(s) with 38 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
2525 gem "public_suffix", "< 3.0.0"
2626 end
2727
28 # Latest versions of i18n don't support Ruby < 2.1
29 if Gem::Requirement.new("< 2.1").satisfied_by?(Gem::Version.new(RUBY_VERSION))
28 # Latest versions of i18n don't support Ruby < 2.4
29 if Gem::Requirement.new("< 2.4").satisfied_by?(Gem::Version.new(RUBY_VERSION))
3030 gem "i18n", "< 1.3.0"
31 end
32
33 # Latest versions of rake don't support Ruby < 2.2
34 if Gem::Requirement.new("< 2.2").satisfied_by?(Gem::Version.new(RUBY_VERSION))
35 gem "rake", "< 13.0.0"
3136 end
3237
3338 # We only run danger once on a new-ish ruby; no need to install it otherwise
106106
107107 ``` ruby
108108 group :development do
109 gem "capistrano", "~> 3.13", require: false
109 gem "capistrano", "~> 3.14", require: false
110110 end
111111 ```
112112
4848 end
4949
5050 def question
51 if default.nil?
51 if prompt && default.nil?
52 I18n.t(:question_prompt, key: prompt, scope: :capistrano)
53 elsif prompt
54 I18n.t(:question_prompt_default, key: prompt, default_value: default, scope: :capistrano)
55 elsif default.nil?
5256 I18n.t(:question, key: key, scope: :capistrano)
5357 else
5458 I18n.t(:question_default, key: key, default_value: default, scope: :capistrano)
6266 def stdin
6367 (options || {}).fetch(:stdin, $stdin)
6468 end
69
70 def prompt
71 (options || {}).fetch(:prompt, nil)
72 end
6573 end
6674 end
6775 end
1111 written_file: "create %{file}",
1212 question: "Please enter %{key}: ",
1313 question_default: "Please enter %{key} (%{default_value}): ",
14 question_prompt: "%{key}: ",
15 question_prompt_default: "%{key} (%{default_value}): ",
1416 keeping_releases: "Keeping %{keep_releases} of %{releases} deployed releases on %{host}",
1517 skip_cleanup: "Skipping cleanup of invalid releases on %{host}; unexpected foldername found (should be timestamp)",
1618 wont_delete_current_release: "Current release was marked for being removed but it's going to be skipped on %{host}",
00 module Capistrano
1 VERSION = "3.13.0".freeze
1 VERSION = "3.14.0".freeze
22 end
55 let(:question) { Question.new(key, default, stdin: stdin) }
66 let(:question_without_echo) { Question.new(key, default, echo: false, stdin: stdin) }
77 let(:question_without_default) { Question.new(key, nil, stdin: stdin) }
8 let(:question_prompt) { Question.new(key, default, stdin: stdin, prompt: "Your favorite branch") }
9 let(:question_prompt_without_default) { Question.new(key, nil, stdin: stdin, prompt: "Your favorite branch") }
810 let(:default) { :default }
911 let(:key) { :branch }
1012 let(:stdin) { stub(tty?: true) }
4244
4345 expect(question_without_default.call).to eq(branch)
4446 end
47
48 it "uses prompt and returns the value" do
49 $stdout.expects(:print).with("Your favorite branch (default): ")
50 stdin.expects(:gets).returns(branch)
51 stdin.expects(:noecho).never
52
53 expect(question_prompt.call).to eq(branch)
54 end
55
56 it "uses prompt and returns the value but has no default between parenthesis" do
57 $stdout.expects(:print).with("Your favorite branch: ")
58 stdin.expects(:gets).returns(branch)
59 stdin.expects(:noecho).never
60
61 expect(question_prompt_without_default.call).to eq(branch)
62 end
4563 end
4664
4765 context "value is not entered" do