<commit_before>require File.expand_path('../../spec_helper', __FILE__)

module Pod
  describe Command::Package do
    after do
      Dir.glob("Pods").each { |dir| Pathname.new(dir).rmtree }
    end

    it "uses additional spec repos passed on the command line" do
      SourcesManager.stubs(:search).returns(nil)
      nil::NilClass.any_instance.stubs(:install!)
      Installer.expects(:new).with {
        |sandbox, podfile| podfile.sources == ['foo', 'bar']
      }

      command = Command.parse(%w{ package spec/fixtures/KFData.podspec --spec-sources=foo,bar})
      command.send(:install_pod, :osx, nil)

    end

    it "uses only the master repo if no spec repos were passed" do
      SourcesManager.stubs(:search).returns(nil)
      nil::NilClass.any_instance.stubs(:install!)
      Installer.expects(:new).with {
          |sandbox, podfile| podfile.sources == ['https://github.com/CocoaPods/Specs.git']
        }

      command = Command.parse(%w{ package spec/fixtures/KFData.podspec })
      command.send(:install_pod, :osx, nil)
    end

    it "creates seperate static and dynamic target if dynamic is passed" do
      source_dir = Dir.pwd

      SourcesManager.stubs(:search).returns(nil)

      command = Command.parse(%w{ package spec/fixtures/NikeKit.podspec -dynamic})
      command. create_working_directory

      command.config.sandbox_root       = 'Pods'
      command.config.integrate_targets  = false
      command.config.skip_repo_update   = true

      static_sandbox = command.build_static_sandbox(true)
      static_installer = command.install_pod(:ios, static_sandbox)

      dynamic_sandbox = command.build_dynamic_sandbox(static_sandbox, static_installer)
      command.install_dynamic_pod(dynamic_sandbox, static_sandbox, static_installer)

      static_sandbox_dir = Dir.new(Dir.pwd << "/Pods/Static")
      dynamic_sandbox_dir = Dir.new(Dir.pwd << "/Pods/Dynamic")

      static_sandbox_dir.to_s.should.not.be.empty
      dynamic_sandbox_dir.to_s.should.not.be.empty

      Dir.chdir(source_dir)
    end
  end
end<commit_msg>Adopt changes necessary for CocoaPods/CocoaPods#5017<commit_after>require File.expand_path('../../spec_helper', __FILE__)

module Pod
  describe Command::Package do
    after do
      Dir.glob("Pods").each { |dir| Pathname.new(dir).rmtree }
    end

    it "uses additional spec repos passed on the command line" do
      SourcesManager.stubs(:search).returns(nil)
      nil::NilClass.any_instance.stubs(:install!)
      Installer.expects(:new).with {
        |sandbox, podfile| podfile.sources == ['foo', 'bar']
      }

      command = Command.parse(%w{ package spec/fixtures/KFData.podspec --spec-sources=foo,bar})
      command.send(:install_pod, :osx, nil)

    end

    it "uses only the master repo if no spec repos were passed" do
      SourcesManager.stubs(:search).returns(nil)
      nil::NilClass.any_instance.stubs(:install!)
      Installer.expects(:new).with {
          |sandbox, podfile| podfile.sources == ['https://github.com/CocoaPods/Specs.git']
        }

      command = Command.parse(%w{ package spec/fixtures/KFData.podspec })
      command.send(:install_pod, :osx, nil)
    end

    it "creates seperate static and dynamic target if dynamic is passed" do
      source_dir = Dir.pwd

      SourcesManager.stubs(:search).returns(nil)

      command = Command.parse(%w{ package spec/fixtures/NikeKit.podspec -dynamic})
      command. create_working_directory

      command.config.sandbox_root       = 'Pods'
      command.config.integrate_targets  = false

      static_sandbox = command.build_static_sandbox(true)
      static_installer = command.install_pod(:ios, static_sandbox)

      dynamic_sandbox = command.build_dynamic_sandbox(static_sandbox, static_installer)
      command.install_dynamic_pod(dynamic_sandbox, static_sandbox, static_installer)

      static_sandbox_dir = Dir.new(Dir.pwd << "/Pods/Static")
      dynamic_sandbox_dir = Dir.new(Dir.pwd << "/Pods/Dynamic")

      static_sandbox_dir.to_s.should.not.be.empty
      dynamic_sandbox_dir.to_s.should.not.be.empty

      Dir.chdir(source_dir)
    end
  end
end
{'fraction_non_alphanumeric': 0.11491739552964043, 'fraction_numerical': 0.0009718172983479105, 'mean_word_length': 3.3291272344900107, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5750979', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1295, 'n_words': 243}