<commit_before>require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")

describe PluginGenerator do
  
  context "ivy" do
    before(:each) do
      FileUtils.cp("./default_configs/ivy.xml", "./ivy.xml")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8", "br.com.caelum.vraptor.plugin"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./ivy.xml")
    end

    it "should inject dependency into ivy.xml" do
      source = File.join File.dirname(__FILE__), "expected_configs", "ivy.xml"
      destination = File.join File.dirname(__FILE__), "ivy.xml"
      exists_and_identical?(source, destination)
    end
  end

  context "ivy with default plugin_org" do
    before(:each) do
      FileUtils.cp("./default_configs/ivy.xml", "./ivy.xml")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./ivy.xml")
    end

    it "should inject dependency into ivy.xml" do
      source = File.join File.dirname(__FILE__), "expected_configs", "default_org_ivy.xml"
      destination = File.join File.dirname(__FILE__), "ivy.xml"
      exists_and_identical?(source, destination)
    end
  end

  context "maven" do
    before(:each) do
      FileUtils.cp("./default_configs/pom.xml", "./pom.xml")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8", "br.com.caelum.vraptor.plugin"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./pom.xml")
    end

    it "should inject dependency into pom.xml" do
      source = File.join File.dirname(__FILE__), "expected_configs", "pom.xml"
      destination = File.join File.dirname(__FILE__), "pom.xml"
      exists_and_identical?(source, destination)
    end
  end
  
  context "maven with default plugin_org" do
    before(:each) do
      FileUtils.cp("./default_configs/pom.xml", "./pom.xml")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./pom.xml")
    end

    it "should inject dependency into pom.xml" do
      source = File.join File.dirname(__FILE__), "expected_configs", "default_org_pom.xml"
      destination = File.join File.dirname(__FILE__), "pom.xml"
      exists_and_identical?(source, destination)
    end
  end

  context "gradle" do
    before(:each) do
      FileUtils.cp("./default_configs/build.gradle", "./build.gradle")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8", "br.com.caelum.vraptor.plugin"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./build.gradle")
    end

    it "should inject dependency into build.gradle" do
      source = File.join File.dirname(__FILE__), "expected_configs", "build.gradle"
      destination = File.join File.dirname(__FILE__), "build.gradle"
      exists_and_identical?(source, destination)
    end
  end

  context "gradle with default plugin_org" do
    before(:each) do
      FileUtils.cp("./default_configs/build.gradle", "./build.gradle")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./build.gradle")
    end

    it "should inject dependency into pom.xml" do
      source = File.join File.dirname(__FILE__), "expected_configs", "default_org_build.gradle"
      destination = File.join File.dirname(__FILE__), "build.gradle"
      exists_and_identical?(source, destination)
    end
  end

end
<commit_msg>Fixing plugin_generator_spec<commit_after>require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")

def copy_file(src, dest)
  full_path_src = File.expand_path(File.dirname(__FILE__) + src)
  FileUtils.cp(full_path_src, dest)
end

describe PluginGenerator do

  context "ivy" do
    before(:each) do
      copy_file("/default_configs/ivy.xml", "./ivy.xml")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8", "br.com.caelum.vraptor.plugin"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./ivy.xml")
    end

    it "should inject dependency into ivy.xml" do
      source = File.join File.dirname(__FILE__), "expected_configs", "ivy.xml"
      destination = "./ivy.xml"
      exists_and_identical?(source, destination)
    end
  end

  context "ivy with default plugin_org" do
    before(:each) do
      copy_file("/default_configs/ivy.xml", "./ivy.xml")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./ivy.xml")
    end

    it "should inject dependency into ivy.xml" do
      source = File.join File.dirname(__FILE__), "expected_configs", "default_org_ivy.xml"
      destination = "./ivy.xml"
      exists_and_identical?(source, destination)
    end
  end

  context "maven" do
    before(:each) do
      copy_file("/default_configs/pom.xml", "./pom.xml")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8", "br.com.caelum.vraptor.plugin"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./pom.xml")
    end

    it "should inject dependency into pom.xml" do
      source = File.join File.dirname(__FILE__), "expected_configs", "pom.xml"
      destination = "./pom.xml"
      exists_and_identical?(source, destination)
    end
  end
  
  context "maven with default plugin_org" do
    before(:each) do
      copy_file("/default_configs/pom.xml", "./pom.xml")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./pom.xml")
    end

    it "should inject dependency into pom.xml" do
      source = File.join File.dirname(__FILE__), "expected_configs", "default_org_pom.xml"
      destination = "./pom.xml"
      exists_and_identical?(source, destination)
    end
  end

  context "gradle" do
    before(:each) do
      copy_file("/default_configs/build.gradle", "./build.gradle")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8", "br.com.caelum.vraptor.plugin"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./build.gradle")
    end

    it "should inject dependency into build.gradle" do
      source = File.join File.dirname(__FILE__), "expected_configs", "build.gradle"
      destination = "./build.gradle"
      exists_and_identical?(source, destination)
    end
  end

  context "gradle with default plugin_org" do
    before(:each) do
      copy_file("/default_configs/build.gradle", "./build.gradle")
      @generator = PluginGenerator.new(["vraptor-environment", "0.0.8"])
      @generator.build
    end

    after(:each) do
      FileUtils.rm("./build.gradle")
    end

    it "should inject dependency into pom.xml" do
      source = File.join File.dirname(__FILE__), "expected_configs", "default_org_build.gradle"
      destination = "./build.gradle"
      exists_and_identical?(source, destination)
    end
  end

end

{'fraction_non_alphanumeric': 0.13974978675007108, 'fraction_numerical': 0.005117998294000569, 'mean_word_length': 3.073537927041112, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 50}, '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': '2771764', 'n_tokens_mistral': 2345, 'n_tokens_neox': 2295, 'n_words': 468}