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

ign -> gz CLI Migration : gz-fuel-tools #262

Merged
merged 6 commits into from
Jun 23, 2022
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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ set(IGN_MSGS_MAJOR_VER ${ignition-msgs9_VERSION_MAJOR})

#--------------------------------------
# Find ignition-tools
find_program(HAVE_IGN_TOOLS ign)
find_program(HAVE_GZ_TOOLS gz)

#============================================================================
# Configure the build
#============================================================================
gz_configure_build(QUIT_IF_BUILD_ERRORS)

#============================================================================
# ign command line support
# gz command line support
#============================================================================
add_subdirectory(conf)

Expand Down
12 changes: 6 additions & 6 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

### Gazebo Fuel Tools 6.1.0 (2021-10-15)

1. Detect ign instead of using cmake module to check for ignition-tools
1. Detect gz instead of using cmake module to check for ignition-tools
* [Pull request #191](https://github.com/gazebosim/gz-fuel-tools/pull/191)

1. Added fuel update command
Expand Down Expand Up @@ -83,10 +83,10 @@
1. APIs for retrieving models in parallel
* [Pull request #199](https://github.com/gazebosim/gz-fuel-tools/pull/199)

1. Detect `ign` instead of using cmake module to check for ignition-tools
1. Detect `gz` instead of using cmake module to check for ignition-tools
* [Pull request #191](https://github.com/gazebosim/gz-fuel-tools/pull/191)

1. Added `ign fuel update` command
1. Added `gz fuel update` command
* [Pull request #185](https://github.com/gazebosim/gz-fuel-tools/pull/185)

1. Fixed Windows download and CI
Expand Down Expand Up @@ -204,7 +204,7 @@

### Gazebo Fuel Tools 4.2.1 (2020-08-26)

1. Fix `ign fuel download`, which was missing the `-j` option.
1. Fix `gz fuel download`, which was missing the `-j` option.
* [Pull request 116](https://github.com/gazebosim/gz-fuel-tools/pull/116)

### Gazebo Fuel Tools 4.2.0 (2020-08-26)
Expand All @@ -213,7 +213,7 @@
and `legal` information in a `metadata.pbtxt` file.
* [Pull request 69](https://github.com/gazebosim/gz-fuel-tools/pull/69)

1. Added `edit` subcommand to the `ign fuel`. The edit command currently
1. Added `edit` subcommand to the `gz fuel`. The edit command currently
supports editing a model's privacy.
* [Pull request 67](https://github.com/gazebosim/gz-fuel-tools/pull/67)

Expand Down Expand Up @@ -316,7 +316,7 @@

### Gazebo Fuel Tools 3.2.0 (2019-06-14)

1. FuelClient::DownloadModel accepts HTTP headers, and the `ign fuel
1. FuelClient::DownloadModel accepts HTTP headers, and the `gz fuel
download` command can accept a single HTTP header.
* [BitBucket pull request 100](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-fuel-tools/pull-requests/100)

Expand Down
6 changes: 3 additions & 3 deletions INSTALL_WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ need to [disable the Windows firewall](http://windows.microsoft.com/en-us/window

1. Make a directory to work in, e.g.:

mkdir ign-ws
cd ign-ws
mkdir gz-ws
cd gz-ws

1. In a Windows Command Prompt, load your compiler setup, e.g.:

Expand All @@ -38,7 +38,7 @@ need to [disable the Windows firewall](http://windows.microsoft.com/en-us/window
nmake install


You should now have an installation of Gazebo Fuel-Tools in ign-ws/ign-fuel-tools/build/install.
You should now have an installation of Gazebo Fuel-Tools in gz-ws/ign-fuel-tools/build/install.

## Run tests

Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ interacting with Gazebo Fuel servers.

See the [installation tutorial](https://gazebosim.org/api/fuel_tools/5.0/install.html).

Make sure `GZ_CONFIG_PATH` is set to the right install location so that `ign fuel` will work.
Default is `/usr/local/share/ignition`.
Make sure `GZ_CONFIG_PATH` is set to the right install location so that `gz fuel` will work.
Default is `/usr/local/share/gz`.

## Examples

For a complete list of commands run `ign fuel -h` on the command line.
For a complete list of commands run `gz fuel -h` on the command line.

**List all models**
```
$ ign fuel list -t model -r | head
$ gz fuel list -t model -r | head
https://fuel.ignitionrobotics.org/anonymous/test_model_595389531
https://fuel.ignitionrobotics.org/anonymous/test_model_122023392
https://fuel.ignitionrobotics.org/anonymous/test_model_429486665
Expand All @@ -47,7 +47,7 @@ https://fuel.ignitionrobotics.org/anonymous/test_model_380348669

**Download a model**
```
$ ign fuel download -u https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Ambulance -v 4
$ gz fuel download -u https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Ambulance -v 4
Downloading model:
Name: Ambulance
Owner: OpenRobotics
Expand Down Expand Up @@ -94,7 +94,7 @@ Its Value can be copied.

The JWT token can then used to upload the model:
```
ign fuel upload -m ~/path_to_model --header 'authorization: Bearer <JWT TOKEN>'
gz fuel upload -m ~/path_to_model --header 'authorization: Bearer <JWT TOKEN>'
```

Note that the `upload` command only works for models currently, not worlds.
Expand All @@ -106,7 +106,7 @@ See issues beginning with [Fuel backend] in the title. Here are two examples.

**TODO: Find a model on disk**
```
$ ign fuel locate --name am1
$ gz fuel locate --name am1
/home/developer/.ignition/fuel/fuel.ignitionrobotics.org/alice/am1
```

Expand Down Expand Up @@ -172,7 +172,7 @@ A workaround for a single package is to define the environment variable
`GZ_CONFIG_PATH` to point to the location of the Ignition library installation,
where the YAML file for the package is found, such as
```
export GZ_CONFIG_PATH=/usr/local/share/ignition
export GZ_CONFIG_PATH=/usr/local/share/gz
```

However, that environment variable only takes a single path, which means if the
Expand All @@ -183,9 +183,9 @@ line is using symbolic links to each library's YAML file.
```
mkdir ~/.ignition/tools/configs -p
cd ~/.ignition/tools/configs/
ln -s /usr/local/share/ignition/fuel4.yaml .
ln -s /usr/local/share/ignition/transport7.yaml .
ln -s /usr/local/share/ignition/transportlog7.yaml .
ln -s /usr/local/share/gz/fuel4.yaml .
ln -s /usr/local/share/gz/transport7.yaml .
ln -s /usr/local/share/gz/transportlog7.yaml .
...
export GZ_CONFIG_PATH=$HOME/.ignition/tools/configs
```
Expand Down
2 changes: 1 addition & 1 deletion conf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ configure_file(
"fuel.yaml.in"
"${CMAKE_BINARY_DIR}/test/conf/fuel${PROJECT_VERSION_MAJOR}.yaml" @ONLY)

set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/ignition/cmdfuel${PROJECT_VERSION_MAJOR}")
set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/gz/cmdfuel${PROJECT_VERSION_MAJOR}")

# Generate a configuration file.
# Note that the major version of the library is included in the name.
Expand Down
16 changes: 12 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set (sources
CollectionIdentifier.cc
FuelClient.cc
Helpers.cc
ign.cc
gz.cc
Interface.cc
JSONParser.cc
LocalCache.cc
Expand All @@ -21,7 +21,7 @@ set (gtest_sources
ClientConfig_TEST.cc
CollectionIdentifier_TEST.cc
FuelClient_TEST.cc
ign_src_TEST.cc
gz_src_TEST.cc
Interface_TEST.cc
Helpers_TEST.cc
JSONParser_TEST.cc
Expand All @@ -36,9 +36,9 @@ set (gtest_sources
Zip_TEST.cc
)

if (HAVE_IGN_TOOLS)
if (HAVE_GZ_TOOLS)
set (gtest_sources ${gtest_sources}
ign_TEST.cc
gz_TEST.cc
)
endif()

Expand Down Expand Up @@ -67,10 +67,18 @@ gz_target_interface_include_directories(${PROJECT_LIBRARY_TARGET_NAME}
# Build the unit tests.
gz_build_tests(TYPE UNIT
SOURCES ${gtest_sources}
TEST_LIST test_targets
LIB_DEPS
ignition-common${IGN_COMMON_MAJOR_VER}::ignition-common${IGN_COMMON_MAJOR_VER}
TINYXML2::TINYXML2
)

foreach(test ${test_targets})

target_compile_definitions(${test} PRIVATE
"GZ_PATH=\"${HAVE_GZ_TOOLS}\"")

endforeach()

# Command line support.
add_subdirectory(cmd)
2 changes: 1 addition & 1 deletion src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ configure_file(


# Install the ruby command line library in an unversioned location.
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmdfuel${PROJECT_VERSION_MAJOR}.rb DESTINATION lib/ruby/ignition)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmdfuel${PROJECT_VERSION_MAJOR}.rb DESTINATION lib/ruby/gz)
16 changes: 8 additions & 8 deletions src/cmd/cmdfuel.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ COMMON_OPTIONS =
COMMANDS = { 'fuel' =>
"Manage simulation resources. \n"\
" \n"\
" ign fuel [action] [options] \n"\
" gz fuel [action] [options] \n"\
" \n"\
"Available Actions: \n"\
" delete Delete resources \n"\
Expand All @@ -83,7 +83,7 @@ SUBCOMMANDS = {
'delete' =>
"Delete simulation resources \n"\
" \n"\
" ign fuel delete [options] \n"\
" gz fuel delete [options] \n"\
" \n"\
"Available Options: \n"\
" -u [--url] arg URL of the server that should receive \n"\
Expand All @@ -96,7 +96,7 @@ SUBCOMMANDS = {
'download' =>
"Download simulation resources \n"\
" \n"\
" ign fuel download [options] \n"\
" gz fuel download [options] \n"\
" \n"\
"Available Options: \n"\
" -u [--url] arg Full resource URL, such as: \n"\
Expand All @@ -114,7 +114,7 @@ SUBCOMMANDS = {
'edit' =>
"Edit a simulation resource \n"\
" \n"\
" ign fuel edit [options] \n"\
" gz fuel edit [options] \n"\
" \n"\
"Available Options: \n"\
" -m [--model] arg Path to directory containing the model. \n"\
Expand All @@ -130,7 +130,7 @@ SUBCOMMANDS = {
'list' =>
"List simulation resources \n"\
" \n"\
" ign fuel list [options] \n"\
" gz fuel list [options] \n"\
" \n"\
"Available Options: \n"\
" -t [--type] arg Resource type (i.e. model, world). Required. \n"\
Expand All @@ -144,7 +144,7 @@ SUBCOMMANDS = {
'meta' =>
"Read and write resource metadata \n"\
" \n"\
" ign fuel meta [options] \n"\
" gz fuel meta [options] \n"\
" \n"\
"Available Options: \n"\
" --config2pbtxt arg Convert a model.config file to a \n"\
Expand All @@ -156,7 +156,7 @@ SUBCOMMANDS = {
'upload' =>
"Upload simulation resources \n"\
" \n"\
" ign fuel upload [options] \n"\
" gz fuel upload [options] \n"\
" \n"\
"Available Options: \n"\
" -m [--model] arg Path to directory containing a model, or \n"\
Expand All @@ -177,7 +177,7 @@ SUBCOMMANDS = {
'update' =>
"Update all models and worlds in local cache \n"\
" \n"\
" ign fuel update [options] \n"\
" gz fuel update [options] \n"\
" \n"\
"Available Options: \n"\
" --onlymodels Use this argument to only update models. \n"\
Expand Down
2 changes: 1 addition & 1 deletion src/ign.cc → src/gz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
#include "gz/fuel_tools/FuelClient.hh"
#include "gz/fuel_tools/Helpers.hh"
#include "gz/fuel_tools/Result.hh"
#include "ign.hh"
#include "gz.hh"
#include "gz/fuel_tools/WorldIdentifier.hh"

//////////////////////////////////////////////////
Expand Down
24 changes: 12 additions & 12 deletions src/ign.hh → src/gz.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE char *gzVersion();
extern "C" GZ_FUEL_TOOLS_VISIBLE void cmdVerbosity(
const char *_verbosity);

/// \brief External hook to execute 'ign fuel list -t model' from the command
/// \brief External hook to execute 'gz fuel list -t model' from the command
/// line.
/// \param[in] _url Optional server URL.
/// \param[in] _owner Optional owner name
Expand All @@ -40,7 +40,7 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int listModels(
const char *_url = nullptr, const char *_owner = "",
const char *_raw = "false", const char *_configFile = nullptr);

/// \brief External hook to execute 'ign fuel list -t world' from the command
/// \brief External hook to execute 'gz fuel list -t world' from the command
/// line.
/// \param[in] _url Optional server URL.
/// \param[in] _owner Optional owner name
Expand All @@ -51,7 +51,7 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int listWorlds(
const char *_url = nullptr, const char *_owner = "",
const char *_raw = "false", const char *_configFile = nullptr);

/// \brief External hook to execute 'ign fuel download -u URL' from the command
/// \brief External hook to execute 'gz fuel download -u URL' from the command
/// line.
/// \param[in] _url Resource URL.
/// \param[in] _configFile Path to a YAML configuration file.
Expand All @@ -63,12 +63,12 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int downloadUrl(
const char *_url = nullptr, const char *_configFile = nullptr,
const char *_header = nullptr, const char *_type = nullptr, int _jobs = 1);

/// \brief External hook to execute 'ign fuel upload -m path' from the command
/// \brief External hook to execute 'gz fuel upload -m path' from the command
/// line.
///
/// Example usage, including a private access token which is required:
///
/// `ign fuel upload -m ~/my_model --header "Private-Token: <access_token>"`
/// `gz fuel upload -m ~/my_model --header "Private-Token: <access_token>"`
///
/// \param[in] _path Resource path.
/// \param[in] _url Server URL.
Expand All @@ -82,39 +82,39 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int upload(const char *_path,
const char *_url, const char *_header = nullptr,
const char *_private = nullptr, const char *_owner = nullptr);

/// \brief External hook to execute 'ign fuel delete [options]' from the command
/// \brief External hook to execute 'gz fuel delete [options]' from the command
/// line.
///
/// Example usage, including a private access token which is required:
///
/// `ign fuel delete -u https://fuel.ignitionrobotics.org/1.0/openrobotics/models/Ambulance --header "Private-Token: <access_token>"` // NOLINT
/// `gz fuel delete -u https://fuel.ignitionrobotics.org/1.0/openrobotics/models/Ambulance --header "Private-Token: <access_token>"` // NOLINT
///
/// \param[in] _url Resource URL.
/// \param[in] _header An HTTP header.
/// \return 1 if successful, 0 if not.
extern "C" GZ_FUEL_TOOLS_VISIBLE int deleteUrl(
const char *_url, const char *_header = nullptr);

/// \brief External hook to execute 'ign fuel meta --config2pbtxt path'
/// \brief External hook to execute 'gz fuel meta --config2pbtxt path'
/// from the command line.
/// \param[in] _path Resource path.
/// \return 1 if successful, 0 if not.
extern "C" GZ_FUEL_TOOLS_VISIBLE int config2Pbtxt(
const char *_path = nullptr);


/// \brief External hook to execute 'ign fuel meta --pbtxt2config path'
/// \brief External hook to execute 'gz fuel meta --pbtxt2config path'
/// from the command line.
/// \param[in] _path Resource path.
/// \return 1 if successful, 0 if not.
extern "C" GZ_FUEL_TOOLS_VISIBLE int pbtxt2Config(const char *_path);

/// \brief External hook to execute 'ign fuel edit [options]' from the command
/// \brief External hook to execute 'gz fuel edit [options]' from the command
/// line.
///
/// Example usage, including a private access token which is required:
///
/// `ign fuel edit -u https://fuel.ignitionrobotics.org/1.0/openrobotics/models/Ambulance --header "Private-Token: <access_token>"` --public // NOLINT
/// `gz fuel edit -u https://fuel.ignitionrobotics.org/1.0/openrobotics/models/Ambulance --header "Private-Token: <access_token>"` --public // NOLINT
///
/// \param[in] _url Resource URL.
/// \param[in] _header An HTTP header.
Expand All @@ -127,7 +127,7 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int editUrl(
const char *_private = nullptr,
const char *_path = nullptr);

/// \brief External hook to execute 'ign fuel update [options] from the command'
/// \brief External hook to execute 'gz fuel update [options] from the command'
/// line
/// \param[in] _onlyModels "1" to only update models.
/// \param[in] _onlyWorlds "1" to only update worlds.
Expand Down
Loading