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

4 ➡️ 5 #193

Merged
merged 4 commits into from
Jul 14, 2021
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
id: ci
uses: ignition-tooling/action-ignition-ci@bionic
with:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
codecov-enabled: true
focal-ci:
runs-on: ubuntu-latest
name: Ubuntu Focal CI
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ project(ignition-fuel_tools5 VERSION 5.1.1)
# Find ignition-cmake
#============================================================================
# If you get an error at this line, you need to install ignition-cmake
find_package(ignition-cmake2 2.3 REQUIRED)
find_package(ignition-cmake2 2.8.0 REQUIRED)
set(IGN_CMAKE_VER ${ignition-cmake2_VERSION_MAJOR})

#============================================================================
Expand Down
31 changes: 31 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,37 @@
1. Fixed test - Download world 2
* [Pull request 110](https://github.com/ignitionrobotics/ign-fuel-tools/pull/110)

### Ignition Fuel Tools 4.X.X (202X-XX-XX)

### Ignition Fuel Tools 4.4.0 (2021-06-17)

1. Remove `tools/code_check` and update codecov
* [Pull request #187](https://github.com/ignitionrobotics/ign-fuel-tools/pull/187)

1. Fixed windows download
* [Pull request #178](https://github.com/ignitionrobotics/ign-fuel-tools/pull/178)

1. Master branch updates
* [Pull request #170](https://github.com/ignitionrobotics/ign-fuel-tools/pull/170)

1. Support private-token in `config.yaml`
* [Pull request #156](https://github.com/ignitionrobotics/ign-fuel-tools/pull/156)

1. Add Windows Installation
* [Pull request #162](https://github.com/ignitionrobotics/ign-fuel-tools/pull/162)

1. Use semantic version and prevent crash if version is missing
* [Pull request #151](https://github.com/ignitionrobotics/ign-fuel-tools/pull/151)

1. Document `IGN_FUEL_CACHE_PATH` on command line
* [Pull request #149](https://github.com/ignitionrobotics/ign-fuel-tools/pull/149)

1. Support editing/patching model files
* [Pull request #140](https://github.com/ignitionrobotics/ign-fuel-tools/pull/140)

1. Set keep alive on
* [Pull request #141](https://github.com/ignitionrobotics/ign-fuel-tools/pull/141)

### Ignition Fuel Tools 4.3.0 (2020-12-01)

1. Improve fork experience.
Expand Down
28 changes: 23 additions & 5 deletions src/ClientConfig_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ std::string homePath()
return homePath;
}

/////////////////////////////////////////////////
/// \brief Get cache directory.
/// \return Cache directory
/// \ToDo: Move this function to ignition::common::Filesystem
std::string cachePath()
{
std::string cachePath;
#ifndef _WIN32
return std::string("/tmp/ignition/fuel");
#else
return std::string("C:\\Windows\\Temp");
#endif
}

/////////////////////////////////////////////////
/// \brief Initially only the default server in config
TEST(ClientConfig, InitiallyDefaultServers)
Expand Down Expand Up @@ -115,8 +129,9 @@ TEST(ClientConfig, CustomConfiguration)
<< "" << std::endl
<< "# Where are the assets stored in disk." << std::endl
<< "cache:" << std::endl
<< " path: /tmp/ignition/fuel" << std::endl
<< " path: " + cachePath() << std::endl
<< std::endl;
ofs.close();

EXPECT_TRUE(config.LoadConfig(testPath));

Expand All @@ -128,8 +143,7 @@ TEST(ClientConfig, CustomConfiguration)
EXPECT_EQ("https://myserver",
config.Servers().back().Url().Str());

EXPECT_EQ("/tmp/ignition/fuel", config.CacheLocation());

EXPECT_EQ(cachePath(), config.CacheLocation());
// Remove the configuration file.
removeFileTemp(testPath);
}
Expand All @@ -156,8 +170,9 @@ TEST(ClientConfig, RepeatedServerConfiguration)
<< "" << std::endl
<< "# Where are the assets stored in disk." << std::endl
<< "cache:" << std::endl
<< " path: /tmp/ignition/fuel" << std::endl
<< " path: " + cachePath() << std::endl
<< std::endl;
ofs.close();

EXPECT_TRUE(config.LoadConfig(testPath));

Expand All @@ -182,6 +197,7 @@ TEST(ClientConfig, NoServerUrlConfiguration)
<< " -" << std::endl
<< " banana: coconut" << std::endl
<< std::endl;
ofs.close();

EXPECT_FALSE(config.LoadConfig(testPath));

Expand All @@ -206,6 +222,7 @@ TEST(ClientConfig, EmptyServerUrlConfiguration)
<< " -" << std::endl
<< " url: " << std::endl
<< std::endl;
ofs.close();

EXPECT_FALSE(config.LoadConfig(testPath));

Expand All @@ -227,6 +244,7 @@ TEST(ClientConfig, NoCachePathConfiguration)
ofs << "---" << std::endl
<< "cache:" << std::endl
<< std::endl;
ofs.close();

EXPECT_FALSE(config.LoadConfig(testPath));

Expand All @@ -249,6 +267,7 @@ TEST(ClientConfig, EmptyCachePathConfiguration)
<< "cache:" << std::endl
<< " path:" << std::endl
<< std::endl;
ofs.close();

EXPECT_FALSE(config.LoadConfig(testPath));

Expand Down Expand Up @@ -417,4 +436,3 @@ int main(int argc, char **argv)
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

1 change: 0 additions & 1 deletion src/CollectionIdentifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,3 @@ std::string CollectionIdentifier::AsPrettyString(
<< this->Server().AsPrettyString(_prefix + " ");
return out.str();
}

15 changes: 1 addition & 14 deletions src/CollectionIdentifier_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ TEST(CollectionIdentifier, UniqueName)
CollectionIdentifier id;
id.SetName("hello");
id.SetOwner("alice");
#ifndef _WIN32
id.SetServer(srv1);
EXPECT_EQ("https://localhost:8001/alice/collections/hello", id.UniqueName());

Expand All @@ -66,19 +65,6 @@ TEST(CollectionIdentifier, UniqueName)

id.SetServer(srv3);
EXPECT_EQ("https://localhost:8003/alice/collections/hello", id.UniqueName());
#else
id.SetServer(srv1);
EXPECT_EQ("https://localhost:8001/alice/collections/hello",
id.UniqueName());

id.SetServer(srv2);
EXPECT_EQ("https://localhost:8002/alice/collections/hello",
id.UniqueName());

id.SetServer(srv3);
EXPECT_EQ("https://localhost:8003/alice/collections/hello",
id.UniqueName());
#endif
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -132,6 +118,7 @@ TEST(CollectionIdentifier, AsString)
common::Console::SetVerbosity(4);
{
CollectionIdentifier id;

#ifndef _WIN32
std::string str =
"Name: \n"\
Expand Down
7 changes: 7 additions & 0 deletions src/FuelClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ bool FuelClient::ParseWorldFileUrl(const common::URI &_fileUrl,

return true;
}

//////////////////////////////////////////////////
bool FuelClient::ParseCollectionUrl(const common::URI &_url,
CollectionIdentifier &_id)
Expand Down Expand Up @@ -1289,6 +1290,12 @@ Result FuelClient::CachedModelFile(const common::URI &_fileUrl,
// Check if file exists
filePath = common::joinPaths(modelPath, filePath);

std::vector<std::string> tokens = ignition::common::split(filePath, "/");
std::string sTemp;
for (auto s : tokens)
sTemp = ignition::common::joinPaths(sTemp, s);
filePath = sTemp;

if (common::exists(filePath))
{
_path = filePath;
Expand Down
12 changes: 6 additions & 6 deletions src/FuelClient_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ TEST_F(FuelClientTest, ParseModelFileURL)
/////////////////////////////////////////////////
// Protocol "https" not supported or disabled in libcurl for Windows
// https://github.com/ignitionrobotics/ign-fuel-tools/issues/105
TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(DownloadModel))
TEST_F(FuelClientTest, DownloadModel)
{
// Configure to use binary path as cache
ASSERT_EQ(0, ChangeDirectory(PROJECT_BINARY_PATH));
Expand Down Expand Up @@ -593,7 +593,7 @@ TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(DownloadModel))
/////////////////////////////////////////////////
// Windows doesn't support colons in filenames
// https://github.com/ignitionrobotics/ign-fuel-tools/issues/106
TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(CachedModel))
TEST_F(FuelClientTest, CachedModel)
{
// Configure to use binary path as cache and populate it
ASSERT_EQ(0, ChangeDirectory(PROJECT_BINARY_PATH));
Expand Down Expand Up @@ -983,7 +983,7 @@ TEST_F(FuelClientTest, ParseWorldFileUrl)
//////////////////////////////////////////////////
// Protocol "https" not supported or disabled in libcurl for Windows
// https://github.com/ignitionrobotics/ign-fuel-tools/issues/105
TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(DownloadWorld))
TEST_F(FuelClientTest, DownloadWorld)
{
// Configure to use binary path as cache
ASSERT_EQ(0, ChangeDirectory(PROJECT_BINARY_PATH));
Expand Down Expand Up @@ -1061,7 +1061,7 @@ TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(DownloadWorld))
/////////////////////////////////////////////////
// Windows doesn't support colons in filenames
// https://github.com/ignitionrobotics/ign-fuel-tools/issues/106
TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(CachedWorld))
TEST_F(FuelClientTest, CachedWorld)
{
// Configure to use binary path as cache and populate it
ASSERT_EQ(0, ChangeDirectory(PROJECT_BINARY_PATH));
Expand Down Expand Up @@ -1251,7 +1251,7 @@ TEST_F(FuelClientTest, WorldDetails)
/////////////////////////////////////////////////
// Protocol "https" not supported or disabled in libcurl for Windows
// https://github.com/ignitionrobotics/ign-fuel-tools/issues/105
TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(Models))
TEST_F(FuelClientTest, Models)
{
ClientConfig config;
config.SetCacheLocation(common::joinPaths(common::cwd(), "test_cache"));
Expand Down Expand Up @@ -1285,7 +1285,7 @@ TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(Models))
/////////////////////////////////////////////////
// Protocol "https" not supported or disabled in libcurl for Windows
// https://github.com/ignitionrobotics/ign-fuel-tools/issues/105
TEST_F(FuelClientTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(Worlds))
TEST_F(FuelClientTest, Worlds)
{
ClientConfig config;
config.SetCacheLocation(common::joinPaths(common::cwd(), "test_cache"));
Expand Down
5 changes: 3 additions & 2 deletions src/Interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace ignition
auto modelUri = _uri.substr(0,
_uri.find("files", model.UniqueName().size())-1);
_client.DownloadModel(common::URI(modelUri), result);
result += "/" + fileUrl;
result = common::joinPaths(result, fileUrl);
}
// Download the world, if it is a world URI
else if (_client.ParseWorldUrl(uri, world) &&
Expand All @@ -68,7 +68,8 @@ namespace ignition
auto worldUri = _uri.substr(0,
_uri.find("files", world.UniqueName().size())-1);
_client.DownloadWorld(common::URI(worldUri), result);
result += "/" + fileUrl;
result = common::joinPaths(result, fileUrl);

}

return result;
Expand Down
Loading