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

5 ➡️ 6 #197

Merged
merged 9 commits into from
Aug 13, 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
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ project(ignition-fuel_tools6 VERSION 6.0.0)
# 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 Expand Up @@ -62,10 +62,7 @@ set(IGN_MSGS_MAJOR_VER ${ignition-msgs7_VERSION_MAJOR})

#--------------------------------------
# Find ignition-tools
ign_find_package(ignition-tools QUIET)
if (ignition-tools_FOUND)
set (HAVE_IGN_TOOLS TRUE)
endif()
find_program(HAVE_IGN_TOOLS ign)

#============================================================================
# Configure the build
Expand Down
31 changes: 31 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,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
42 changes: 42 additions & 0 deletions include/ignition/fuel_tools/FuelClient.hh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ namespace ignition
/// \param[in] _id a partially filled out identifier used to fetch models
/// \remarks Fulfills Get-One requirement
/// \param[out] _model The requested model
/// \param[in] _headers Headers to set on the HTTP request.
/// \return Result of the fetch operation.
public: Result ModelDetails(const ModelIdentifier &_id,
ModelIdentifier &_model,
Expand Down Expand Up @@ -126,6 +127,15 @@ namespace ignition
public: Result WorldDetails(const WorldIdentifier &_id,
WorldIdentifier &_world) const;

/// \brief Fetch the details of a world.
/// \param[in] _id a partially filled out identifier used to fetch worlds
/// \param[out] _world The requested world
/// \param[in] _headers Headers to set on the HTTP request.
/// \return Result of the fetch operation.
public: Result WorldDetails(const WorldIdentifier &_id,
WorldIdentifier &_world,
const std::vector<std::string> &_headers) const;

/// \brief Returns an iterator that can return information of worlds
/// \remarks An iterator instead of a list of names, to be able to
/// handle pagination. The iterator may fetch more names if
Expand Down Expand Up @@ -180,6 +190,20 @@ namespace ignition
const std::vector<std::string> &_headers,
bool _private = false);

/// \brief Upload a directory as a new model
/// \param[in] _pathToModelDir a path to a directory containing a model
/// \param[in] _id An identifier to assign to this new model
/// \param[in] _headers Headers to set on the HTTP request.
/// \param[in] _private True to make the model private.
/// \param[in] _owner Name of the owner. Empty string indicates that
/// the owner is specified by the private token in the headers.
/// \return Result of the upload operation
public: Result UploadModel(const std::string &_pathToModelDir,
const ModelIdentifier &_id,
const std::vector<std::string> &_headers,
bool _private,
const std::string &_owner);

/// \brief Remove a model from ignition fuel
/// \param[in] _id The model identifier.
/// \return Result of the delete operation
Expand Down Expand Up @@ -213,6 +237,14 @@ namespace ignition
/// \return Result of the download operation
public: Result DownloadWorld(WorldIdentifier &_id);

/// \brief Download a world from Ignition Fuel. This will override an
/// existing local copy of the world.
/// \param[out] _id The world identifier, with local path updated.
/// \param[in] _headers Headers to set on the HTTP request.
/// \return Result of the download operation
public: Result DownloadWorld(WorldIdentifier &_id,
const std::vector<std::string> &_headers);

/// \brief Download a model from ignition fuel. This will override an
/// existing local copy of the model.
/// \param[in] _modelUrl The unique URL of the model to download.
Expand Down Expand Up @@ -381,6 +413,16 @@ namespace ignition
public: bool ParseCollectionUrl(const common::URI &_url,
CollectionIdentifier &_id);

/// \brief Update all models in local cache.
/// \param[in] _headers Headers to set on the HTTP request.
/// \return True if everything updated successfully.
public: bool UpdateModels(const std::vector<std::string> &_headers);

/// \brief Update all worlds in local cache.
/// \param[in] _headers Headers to set on the HTTP request.
/// \return True if everything updated successfully.
public: bool UpdateWorlds(const std::vector<std::string> &_headers);

/// \brief Checked if there is any header already specify
/// \param[in] _serverConfig Server configuration
/// \param[inout] _headers Vector with headers to check
Expand Down
4 changes: 4 additions & 0 deletions include/ignition/fuel_tools/WorldIter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ namespace ignition
/// \return Internal world identifier
public: WorldIdentifier *operator->();

/// \brief Derefence operator
/// \return Internal world identifier
public: WorldIdentifier &operator*();

/// \brief Private data pointer.
private: std::unique_ptr<WorldIterPrivate> dataPtr;
};
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 @@ -422,4 +441,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();
}

19 changes: 3 additions & 16 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,11 +118,12 @@ TEST(CollectionIdentifier, AsString)
common::Console::SetVerbosity(4);
{
CollectionIdentifier id;

#ifndef _WIN32
std::string str =
"Name: \n"\
"Owner: \n"\
"Unique name: https://fuel.ignitionrobotics.org//collections/\n"
"Unique name: https://fuel.ignitionrobotics.org/collections/\n"
"Server:\n"
" URL: https://fuel.ignitionrobotics.org\n"
" Version: 1.0\n"
Expand All @@ -145,7 +132,7 @@ TEST(CollectionIdentifier, AsString)
std::string str =
"Name: \n"\
"Owner: \n"\
"Unique name: https://fuel.ignitionrobotics.org\\collections\n"
"Unique name: https://fuel.ignitionrobotics.org/collections\n"
"Server:\n"
" URL: https://fuel.ignitionrobotics.org\n"
" Version: 1.0\n"
Expand Down
Loading