Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pom and jar test files #36

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions lib/tetra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
require "tetra/facades/tar"

# main internal classes
require "tetra/constants"
require "tetra/version"
require "tetra/project_initer"
require "tetra/project"
Expand Down
6 changes: 6 additions & 0 deletions lib/tetra/constants.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# encoding: UTF-8

# base module for tetra
module Tetra
CCOLLECTIONS = "commons-collections4-4.5.0-M2-src".freeze
end
Binary file removed spec/data/commons-collections4-4.4-src.tar.gz
Binary file not shown.
Binary file removed spec/data/commons-collections4-4.4-src.zip
Binary file not shown.
Binary file not shown.
Binary file added spec/data/commons-collections4-4.5.0-M2-src.zip
Binary file not shown.
Binary file removed spec/data/commons-logging/commons-logging-1.1.1.jar
Binary file not shown.
Binary file not shown.
1,965 changes: 1,770 additions & 195 deletions spec/data/commons-logging/parent_pom.xml

Large diffs are not rendered by default.

1,047 changes: 688 additions & 359 deletions spec/data/commons-logging/pom.xml

Large diffs are not rendered by default.

1,211 changes: 1,065 additions & 146 deletions spec/data/struts-apps/pom.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion spec/data/tomcat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>7.0.40</version>
<version>11.0.2</version>
<description>Binary distribution of Apache Tomcat</description>
<url>http://tomcat.apache.org/</url>
<packaging>pom</packaging>
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/coarse/generate_all_subcommand_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

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", "#{Tetra::CCOLLECTIONS}.zip"))
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", Tetra::CCOLLECTIONS))

# first dry-run, all normal
@aruba_timeout_seconds = 240
Expand Down Expand Up @@ -58,7 +58,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", "#{Tetra::CCOLLECTIONS}.zip"))
write_file("commons-collections.zip", archive_contents)

# init project
Expand All @@ -79,7 +79,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", Tetra::CCOLLECTIONS))
@aruba_timeout_seconds = 240
run_interactive("tetra dry-run")
type("mvn package -DskipTests")
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/coarse/generate_spec_subcommand_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

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", "#{Tetra::CCOLLECTIONS}.zip"))
write_file("commons-collections.zip", archive_contents)

run_simple("tetra init --no-archive commons-collections")
cd("commons-collections")

cd("src")
run_simple("unzip ../../commons-collections.zip")
cd("commons-collections4-4.4-src")
cd(Tetra::CCOLLECTIONS)

run_simple("tetra change-sources --no-archive")
expect(output_from("tetra change-sources --no-archive")).to include("New sources committed")
Expand Down
12 changes: 6 additions & 6 deletions spec/lib/coarse/init_subcommand_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,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", "#{Tetra::CCOLLECTIONS}.zip"))
write_file("commons-collections.zip", archive_contents)

run_simple("tetra init commons-collections commons-collections.zip")
Expand All @@ -48,8 +48,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", Tetra::CCOLLECTIONS)], true)
check_file_presence([File.join("src", Tetra::CCOLLECTIONS, "pom.xml")], true)

check_file_presence([File.join("packages", "commons-collections", "commons-collections.zip")], true)

Expand All @@ -58,7 +58,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", "#{Tetra::CCOLLECTIONS}.tar.gz"))
write_file("commons-collections.tar.gz", archive_contents)

run_simple("tetra init commons-collections commons-collections.tar.gz")
Expand All @@ -74,8 +74,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", Tetra::CCOLLECTIONS)], true)
check_file_presence([File.join("src", Tetra::CCOLLECTIONS, "pom.xml")], true)

check_file_presence([File.join("packages", "commons-collections", "commons-collections.tar.gz")], true)

Expand Down
2 changes: 1 addition & 1 deletion spec/lib/fine/pom_getter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
describe "#get_pom" do
it "gets the pom from a jar" do
dir_path = File.join("spec", "data", "commons-logging")
jar_path = File.join(dir_path, "commons-logging-1.1.1.jar")
jar_path = File.join(dir_path, "commons-logging-1.3.4.jar")
path, status = pom_getter.get_pom(jar_path)
expect(status).to eq :found_in_jar
expect(File.exist?(path)).to be_truthy
Expand Down
36 changes: 16 additions & 20 deletions spec/lib/fine/pom_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,38 @@
it "reads the group id" do
expect(commons_pom.group_id).to eq "commons-logging"
expect(nailgun_pom.group_id).to eq "com.martiansoftware"
expect(struts_apps_pom.group_id).to eq "org.apache.struts"
expect(struts_apps_pom.group_id).to eq ""
end
end

describe "#artifact_id" do
it "reads the artifact id" do
expect(commons_pom.artifact_id).to eq "commons-logging"
expect(nailgun_pom.artifact_id).to eq "nailgun-all"
expect(struts_apps_pom.artifact_id).to eq "struts2-apps"
expect(struts_apps_pom.artifact_id).to eq "struts2-parent"
end
end

describe "#name" do
it "reads artifact name" do
expect(commons_pom.name).to eq "Commons Logging"
expect(commons_pom.name).to eq "Apache Commons Logging"
expect(nailgun_pom.name).to eq "nailgun-all"
expect(struts_apps_pom.name).to eq "Webapps"
expect(struts_apps_pom.name).to eq "Struts 2"
end
end

describe "#version" do
it "reads the version" do
expect(commons_pom.version).to eq "1.1.1"
expect(commons_pom.version).to eq "1.3.4"
expect(nailgun_pom.version).to eq "0.9.1"
expect(struts_apps_pom.version).to eq ""
expect(struts_apps_pom.version).to eq "6.7.0"
end
end

# rubocop:disable Layout/LineLength, Layout/TrailingWhitespace
describe "#description" do
it "reads the description" do
expect(commons_pom.description).to eq "Commons Logging is a thin adapter allowing configurable bridging to other,
well known logging systems."
expect(commons_pom.description).to eq "Apache Commons Logging is a thin adapter allowing configurable bridging to other,\n well-known logging systems."
expect(nailgun_pom.description).to eq "
Nailgun is a client, protocol, and server for running Java programs
from the command line without incurring the JVM startup overhead.
Expand All @@ -52,51 +51,48 @@

This project contains the server and examples.
"
expect(struts_apps_pom.description).to eq ""
expect(struts_apps_pom.description).to eq "Apache Struts 2"
end
end
# rubocop:enable Layout/LineLength, Layout/TrailingWhitespace

describe "#url" do
it "reads the url" do
expect(commons_pom.url).to eq "http://commons.apache.org/logging"
expect(commons_pom.url).to eq "https://commons.apache.org/proper/commons-logging/"
expect(nailgun_pom.url).to eq "http://martiansoftware.com/nailgun"
expect(struts_apps_pom.url).to eq ""
expect(struts_apps_pom.url).to eq "https://struts.apache.org/"
end
end

describe "#license_name" do
it "reads the license name" do
expect(commons_pom.license_name).to eq ""
expect(nailgun_pom.license_name).to eq "The Apache Software License, Version 2.0"
expect(struts_apps_pom.license_name).to eq ""
expect(struts_apps_pom.license_name).to eq "The Apache Software License, Version 2.0"
end
end

describe "#runtime_dependency_ids" do
it "reads the dependency maven ids" do
expect(commons_pom.runtime_dependency_ids).to eq []
expect(nailgun_pom.runtime_dependency_ids).to eq []
expect(struts_apps_pom.runtime_dependency_ids).to eq [["org.apache.struts", "struts2-core", "${project.version}"]]
expect(struts_apps_pom.runtime_dependency_ids).to eq []
end
end

describe "#scm_connection" do
it "reads the SCM connection address" do
expect(commons_pom.scm_connection).to eq "scm:svn:http://svn.apache.org/repos/asf/commons/proper/" \
"logging/tags/commons-logging-1.1.1"
expect(commons_pom.scm_connection).to eq "scm:git:https://gitbox.apache.org/repos/asf/commons-logging"
expect(nailgun_pom.scm_connection).to eq "scm:git:[email protected]:martylamb/nailgun.git"
expect(struts_apps_pom.scm_connection).to eq "scm:svn:http://svn.apache.org/repos/asf/struts/struts2/" \
"tags/STRUTS_2_3_14/apps"
expect(struts_apps_pom.scm_connection).to eq "scm:git:https://gitbox.apache.org/repos/asf/struts.git"
end
end

describe "#scm_url" do
it "reads the SCM connection url" do
expect(commons_pom.scm_url).to eq "http://svn.apache.org/repos/asf/commons/proper/logging/tags/" \
"commons-logging-1.1.1"
expect(commons_pom.scm_url).to eq "https://gitbox.apache.org/repos/asf/commons-logging"
expect(nailgun_pom.scm_url).to eq "scm:git:[email protected]:martylamb/nailgun.git"
expect(struts_apps_pom.scm_url).to eq "http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_14/apps"
expect(struts_apps_pom.scm_url).to eq "https://github.com/apache/struts/"
end
end
end
4 changes: 2 additions & 2 deletions spec/lib/fine/tar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
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", "#{Tetra::CCOLLECTIONS}.tar.gz") }
let(:tar) { Tetra::Tar.new }

describe "#decompress" do
Expand All @@ -15,7 +15,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}/#{Tetra::CCOLLECTIONS}/DEVELOPERS-GUIDE.html")
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/fine/unzip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
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", "#{Tetra::CCOLLECTIONS}.zip") }
let(:unzip) { Tetra::Unzip.new }

describe "#decompress" do
Expand All @@ -15,7 +15,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}/#{Tetra::CCOLLECTIONS}/DEVELOPERS-GUIDE.html")
end
end
end
Expand Down
Loading