diff --git a/README.md b/README.md index 15405b77..fa534de8 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ networkless build. First, grab the sources: ```bash -wget https://archive.apache.org/dist/commons/collections/source/commons-collections4-4.4-src.tar.gz +wget https://archive.apache.org/dist/commons/collections/source/commons-collections4-4.5.0-M2-src.tar.gz ``` Second, create a new `tetra` project named `commons-collections` based on those sources: diff --git a/lib/tetra.rb b/lib/tetra.rb index da304f70..a858a382 100644 --- a/lib/tetra.rb +++ b/lib/tetra.rb @@ -35,6 +35,7 @@ require "tetra/facades/tar" # main internal classes +require "tetra/constants" require "tetra/version" require "tetra/project_initer" require "tetra/project" diff --git a/lib/tetra/constants.rb b/lib/tetra/constants.rb new file mode 100644 index 00000000..fc022ab8 --- /dev/null +++ b/lib/tetra/constants.rb @@ -0,0 +1,6 @@ +# encoding: UTF-8 + +# base module for tetra +module Tetra + CCOLLECTIONS = "commons-collections4-4.5.0-M2-src".freeze +end diff --git a/spec/data/commons-collections4-4.4-src.tar.gz b/spec/data/commons-collections4-4.4-src.tar.gz deleted file mode 100644 index 39108e10..00000000 Binary files a/spec/data/commons-collections4-4.4-src.tar.gz and /dev/null differ diff --git a/spec/data/commons-collections4-4.4-src.zip b/spec/data/commons-collections4-4.4-src.zip deleted file mode 100644 index ae7e8539..00000000 Binary files a/spec/data/commons-collections4-4.4-src.zip and /dev/null differ diff --git a/spec/data/commons-collections4-4.5.0-M2-src.tar.gz b/spec/data/commons-collections4-4.5.0-M2-src.tar.gz new file mode 100644 index 00000000..dba8cf29 Binary files /dev/null and b/spec/data/commons-collections4-4.5.0-M2-src.tar.gz differ diff --git a/spec/data/commons-collections4-4.5.0-M2-src.zip b/spec/data/commons-collections4-4.5.0-M2-src.zip new file mode 100644 index 00000000..1c0df1a1 Binary files /dev/null and b/spec/data/commons-collections4-4.5.0-M2-src.zip differ diff --git a/spec/lib/coarse/generate_all_subcommand_spec.rb b/spec/lib/coarse/generate_all_subcommand_spec.rb index 19bb4719..e49558dd 100644 --- a/spec/lib/coarse/generate_all_subcommand_spec.rb +++ b/spec/lib/coarse/generate_all_subcommand_spec.rb @@ -1,13 +1,14 @@ require "spec_helper" +require "tetra/constants" describe "`tetra generate-all`", type: :aruba do it "generates specs and tarballs for a sample package, source archive workflow" do - archive_contents = File.read(File.join("spec", "data", "commons-collections4-4.4-src.zip")) + archive_contents = File.read(File.join("spec", "data", CCOLLECTIONS)) write_file("commons-collections.zip", archive_contents) # init project run_simple("tetra init commons-collections commons-collections.zip") - cd(File.join("commons-collections", "src", "commons-collections4-4.4-src")) + cd(File.join("commons-collections", "src", CCOLLECTIONS)) # first dry-run, all normal @aruba_timeout_seconds = 240 @@ -58,7 +59,7 @@ end it "generates specs and tarballs for a sample package, manual source workflow" do - archive_contents = File.read(File.join("spec", "data", "commons-collections4-4.4-src.zip")) + archive_contents = File.read(File.join("spec", "data", "#{CCOLLECTIONS}.zip")) write_file("commons-collections.zip", archive_contents) # init project @@ -79,7 +80,7 @@ expect(output_from("tetra change-sources ../commons-collections.zip")).to include("New sources committed") # second dry-run, all normal - cd(File.join("src", "commons-collections4-4.4-src")) + cd(File.join("src", CCOLLECTIONS)) @aruba_timeout_seconds = 240 run_interactive("tetra dry-run") type("mvn package -DskipTests") diff --git a/spec/lib/coarse/generate_spec_subcommand_spec.rb b/spec/lib/coarse/generate_spec_subcommand_spec.rb index cd3b0884..b22db43a 100644 --- a/spec/lib/coarse/generate_spec_subcommand_spec.rb +++ b/spec/lib/coarse/generate_spec_subcommand_spec.rb @@ -1,8 +1,9 @@ require "spec_helper" +require "tetra/constants" describe "`tetra generate-spec`", type: :aruba do it "outputs a warning if source files are not found" do - archive_contents = File.read(File.join("spec", "data", "commons-collections4-4.4-src.zip")) + archive_contents = File.read(File.join("spec", "data", "#{CCOLLECTIONS}.zip")) write_file("commons-collections.zip", archive_contents) run_simple("tetra init --no-archive commons-collections") @@ -10,7 +11,7 @@ cd("src") run_simple("unzip ../../commons-collections.zip") - cd("commons-collections4-4.4-src") + cd(CCOLLECTIONS) run_simple("tetra change-sources --no-archive") expect(output_from("tetra change-sources --no-archive")).to include("New sources committed") diff --git a/spec/lib/coarse/init_subcommand_spec.rb b/spec/lib/coarse/init_subcommand_spec.rb index 95117efb..6da1b5d0 100644 --- a/spec/lib/coarse/init_subcommand_spec.rb +++ b/spec/lib/coarse/init_subcommand_spec.rb @@ -1,4 +1,5 @@ require "spec_helper" +require "tetra/constants" describe "`tetra`", type: :aruba do it "shows an error if required parameters are not set" do @@ -32,7 +33,7 @@ end it "inits a new project with a zip source file" do - archive_contents = File.read(File.join("spec", "data", "commons-collections4-4.4-src.zip")) + archive_contents = File.read(File.join("spec", "data", "#{CCOLLECTIONS}.zip")) write_file("commons-collections.zip", archive_contents) run_simple("tetra init commons-collections commons-collections.zip") @@ -48,8 +49,8 @@ cd("commons-collections") check_directory_presence([".git", "kit", "src", "packages"], true) - check_directory_presence([File.join("src", "commons-collections4-4.4-src")], true) - check_file_presence([File.join("src", "commons-collections4-4.4-src", "pom.xml")], true) + check_directory_presence([File.join("src", CCOLLECTIONS)], true) + check_file_presence([File.join("src", CCOLLECTIONS, "pom.xml")], true) check_file_presence([File.join("packages", "commons-collections", "commons-collections.zip")], true) @@ -58,7 +59,7 @@ end it "inits a new project with a tar source file" do - archive_contents = File.read(File.join("spec", "data", "commons-collections4-4.4-src.tar.gz")) + archive_contents = File.read(File.join("spec", "data", "#{CCOLLECTIONS}.tar.gz")) write_file("commons-collections.tar.gz", archive_contents) run_simple("tetra init commons-collections commons-collections.tar.gz") @@ -74,8 +75,8 @@ cd("commons-collections") check_directory_presence([".git", "kit", "src", "packages"], true) - check_directory_presence([File.join("src", "commons-collections4-4.4-src")], true) - check_file_presence([File.join("src", "commons-collections4-4.4-src", "pom.xml")], true) + check_directory_presence([File.join("src", CCOLLECTIONS)], true) + check_file_presence([File.join("src", CCOLLECTIONS, "pom.xml")], true) check_file_presence([File.join("packages", "commons-collections", "commons-collections.tar.gz")], true) diff --git a/spec/lib/fine/tar_spec.rb b/spec/lib/fine/tar_spec.rb index cef9a54d..a001dd08 100644 --- a/spec/lib/fine/tar_spec.rb +++ b/spec/lib/fine/tar_spec.rb @@ -1,11 +1,12 @@ # encoding: UTF-8 require "spec_helper" +require "tetra/constants" describe Tetra::Tar do include Tetra::Mockers - let(:zipfile) { File.join("spec", "data", "commons-collections4-4.4-src.tar.gz") } + let(:zipfile) { File.join("spec", "data", "#{CCOLLECTIONS}.tar.gz") } let(:tar) { Tetra::Tar.new } describe "#decompress" do @@ -15,7 +16,7 @@ files = Find.find(dir).to_a - expect(files).to include("#{dir}/commons-collections4-4.4-src/DEVELOPERS-GUIDE.html") + expect(files).to include("#{dir}/#{CCOLLECTIONS}/DEVELOPERS-GUIDE.html") end end end diff --git a/spec/lib/fine/unzip_spec.rb b/spec/lib/fine/unzip_spec.rb index aa0f3804..aff81a5e 100644 --- a/spec/lib/fine/unzip_spec.rb +++ b/spec/lib/fine/unzip_spec.rb @@ -1,11 +1,12 @@ # encoding: UTF-8 require "spec_helper" +require "tetra/constants" describe Tetra::Unzip do include Tetra::Mockers - let(:zipfile) { File.join("spec", "data", "commons-collections4-4.4-src.zip") } + let(:zipfile) { File.join("spec", "data", "#{CCOLLECTIONS}.zip") } let(:unzip) { Tetra::Unzip.new } describe "#decompress" do @@ -15,7 +16,7 @@ files = Find.find(dir).to_a - expect(files).to include("#{dir}/commons-collections4-4.4-src/DEVELOPERS-GUIDE.html") + expect(files).to include("#{dir}/#{CCOLLECTIONS}/DEVELOPERS-GUIDE.html") end end end