2019-04-19 15:38:03 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# frozen_string_literal: true
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-28 08:35:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								require "cmd/shared_examples/args_parse"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-01 16:14:25 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								describe "brew install" do
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-28 08:35:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  it_behaves_like "parseable arguments"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-01 16:14:25 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  it "installs formulae", :integration_test do
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    setup_test_formula "testball1"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    expect { brew "install", "testball1" }
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-16 22:18:56 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .to output(%r{#{HOMEBREW_CELLAR}/testball1/0\.1}o).to_stdout
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-25 09:01:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .and not_to_output.to_stderr
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .and be_a_success
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-07 10:33:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect(HOMEBREW_CELLAR/"testball1/0.1/foo/test").not_to be_a_file
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-01 16:14:25 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  it "installs formulae with options", :integration_test do
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-07 10:33:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    setup_test_formula "testball1"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    expect { brew "install", "testball1", "--with-foo" }
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-16 22:18:56 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .to output(%r{#{HOMEBREW_CELLAR}/testball1/0\.1}o).to_stdout
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-07 10:33:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .and not_to_output.to_stderr
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .and be_a_success
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    expect(HOMEBREW_CELLAR/"testball1/0.1/foo/test").to be_a_file
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-01 16:14:25 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  it "can install keg-only Formulae", :integration_test do
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-28 08:35:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    setup_test_formula "testball1", <<~RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      version "1.0"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      keg_only "test reason"
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-11 15:17:40 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    expect { brew "install", "testball1" }
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-16 22:18:56 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .to output(%r{#{HOMEBREW_CELLAR}/testball1/1\.0}o).to_stdout
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .and not_to_output.to_stderr
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .and be_a_success
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-07 10:33:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect(HOMEBREW_CELLAR/"testball1/1.0/foo/test").not_to be_a_file
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-01 16:14:25 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  it "can install HEAD Formulae", :integration_test do
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    repo_path = HOMEBREW_CACHE.join("repo")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    repo_path.join("bin").mkpath
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    repo_path.cd do
							 | 
						
					
						
							
								
									
										
										
										
											2022-10-07 18:33:58 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      system "git", "-c", "init.defaultBranch=master", "init"
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-29 19:55:05 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      FileUtils.touch "bin/something.bin"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      FileUtils.touch "README"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      system "git", "add", "--all"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      system "git", "commit", "-m", "Initial repo commit"
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-11 15:17:40 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    setup_test_formula "testball1", <<~RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      version "1.0"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      head "file://#{repo_path}", :using => :git
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      def install
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        prefix.install Dir["*"]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      end
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-11 15:17:40 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # Ignore dependencies, because we'll try to resolve requirements in build.rb
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # and there will be the git requirement, but we cannot instantiate git
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # formula since we only have testball1 formula.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    expect { brew "install", "testball1", "--HEAD", "--ignore-dependencies" }
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-16 22:18:56 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .to output(%r{#{HOMEBREW_CELLAR}/testball1/HEAD-d5eb689}o).to_stdout
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-25 09:01:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .and output(/Cloning into/).to_stderr
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .and be_a_success
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-07 10:33:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect(HOMEBREW_CELLAR/"testball1/HEAD-d5eb689/foo/test").not_to be_a_file
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-30 11:23:40 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  it "installs formulae with debug symbols", :integration_test do
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-11 10:54:18 -10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    setup_test_formula "testball1"
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-30 11:23:40 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-01 15:25:34 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect { brew "install", "testball1", "--debug-symbols", "--build-from-source" }
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-30 11:23:40 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .to output(%r{#{HOMEBREW_CELLAR}/testball1/0\.1}o).to_stdout
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .and not_to_output.to_stderr
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .and be_a_success
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-01 16:30:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect(HOMEBREW_CELLAR/"testball1/0.1/bin/test").to be_a_file
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-10 16:55:19 -10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect(HOMEBREW_CELLAR/"testball1/0.1/bin/test.dSYM/Contents/Resources/DWARF/test").to be_a_file if OS.mac?
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-02 08:53:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    expect(HOMEBREW_CACHE/"Sources/testball1").to be_a_directory
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-30 11:23:40 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-23 06:06:02 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								end
							 |