Skip to content

Commit

Permalink
Migrate more macros and test_config.h
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed May 20, 2022
1 parent b1fd67a commit 3a8c645
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interacting with Ignition Fuel servers.

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

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

## Examples
Expand Down Expand Up @@ -169,10 +169,10 @@ In the event that the installation is a mix of Debian and from source, command
line tools from `ign-tools` may not work correctly.

A workaround for a single package is to define the environment variable
`IGN_CONFIG_PATH` to point to the location of the Ignition library installation,
`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 IGN_CONFIG_PATH=/usr/local/share/ignition
export GZ_CONFIG_PATH=/usr/local/share/ignition
```

However, that environment variable only takes a single path, which means if the
Expand All @@ -187,7 +187,7 @@ ln -s /usr/local/share/ignition/fuel4.yaml .
ln -s /usr/local/share/ignition/transport7.yaml .
ln -s /usr/local/share/ignition/transportlog7.yaml .
...
export IGN_CONFIG_PATH=$HOME/.ignition/tools/configs
export GZ_CONFIG_PATH=$HOME/.ignition/tools/configs
```

This issue is tracked [here](https://github.com/ignitionrobotics/ign-tools/issues/8).
2 changes: 1 addition & 1 deletion example/configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@set IGN_FUEL-TOOLS_PATH=%cd%\..\..\build\install\%build_type%

cmake -G "NMake Makefiles"^
-DCMAKE_PREFIX_PATH="%IGN_PATH_PATH%\lib\cmake\ignition-fuel-tools0;"^
-DCMAKE_PREFIX_PATH="%GZ_PATH%\lib\cmake\ignition-fuel-tools0;"^
-DCMAKE_INSTALL_PREFIX="install"^
-DCMAKE_BUILD_TYPE=%build_type%^
..
Expand Down
4 changes: 2 additions & 2 deletions src/ClientConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class gz::fuel_tools::ClientConfigPrivate
this->cacheLocation = "";
this->configPath = "";
this->userAgent =
"IgnitionFuelTools-" IGNITION_FUEL_TOOLS_VERSION_FULL;
"IgnitionFuelTools-" GZ_FUEL_TOOLS_VERSION_FULL;
}

/// \brief A list of servers.
Expand All @@ -67,7 +67,7 @@ class gz::fuel_tools::ClientConfigPrivate

/// \brief Name of the user agent.
public: std::string userAgent =
"IgnitionFuelTools-" IGNITION_FUEL_TOOLS_VERSION_FULL;
"IgnitionFuelTools-" GZ_FUEL_TOOLS_VERSION_FULL;
};

//////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/ClientConfig_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ TEST(ClientConfig, EmptyCachePathConfiguration)
TEST(ClientConfig, UserAgent)
{
ClientConfig config;
EXPECT_EQ("IgnitionFuelTools-" IGNITION_FUEL_TOOLS_VERSION_FULL,
EXPECT_EQ("IgnitionFuelTools-" GZ_FUEL_TOOLS_VERSION_FULL,
config.UserAgent());

config.SetUserAgent("my_user_agent");
Expand Down
16 changes: 8 additions & 8 deletions src/ign.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ extern "C" bool getOwnerWorlds(
//////////////////////////////////////////////////
extern "C" GZ_FUEL_TOOLS_VISIBLE char *ignitionVersion()
{
return strdup(IGNITION_FUEL_TOOLS_VERSION_FULL);
return strdup(GZ_FUEL_TOOLS_VERSION_FULL);
}

//////////////////////////////////////////////////
Expand Down Expand Up @@ -324,7 +324,7 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int listModels(const char *_url,
conf.AddServer(serverConf);
}

conf.SetUserAgent("FuelTools " IGNITION_FUEL_TOOLS_VERSION_FULL);
conf.SetUserAgent("FuelTools " GZ_FUEL_TOOLS_VERSION_FULL);

// Filter
gz::fuel_tools::ModelIdentifier modelId;
Expand Down Expand Up @@ -414,7 +414,7 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int listWorlds(const char *_url,
conf.AddServer(serverConf);
}

conf.SetUserAgent("FuelTools " IGNITION_FUEL_TOOLS_VERSION_FULL);
conf.SetUserAgent("FuelTools " GZ_FUEL_TOOLS_VERSION_FULL);

// Filter
gz::fuel_tools::WorldIdentifier worldId;
Expand Down Expand Up @@ -499,7 +499,7 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int downloadUrl(const char *_url,
conf.LoadConfig(_configFile);
}

conf.SetUserAgent("FuelTools " IGNITION_FUEL_TOOLS_VERSION_FULL);
conf.SetUserAgent("FuelTools " GZ_FUEL_TOOLS_VERSION_FULL);

gz::fuel_tools::FuelClient client(conf);
gz::fuel_tools::ModelIdentifier model;
Expand Down Expand Up @@ -673,7 +673,7 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int upload(const char *_path,
});

gz::fuel_tools::ClientConfig conf;
conf.SetUserAgent("FuelTools " IGNITION_FUEL_TOOLS_VERSION_FULL);
conf.SetUserAgent("FuelTools " GZ_FUEL_TOOLS_VERSION_FULL);
gz::fuel_tools::FuelClient client(conf);
gz::fuel_tools::ModelIdentifier model;

Expand Down Expand Up @@ -741,7 +741,7 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int deleteUrl(
const char *_url, const char *_header)
{
gz::fuel_tools::ClientConfig conf;
conf.SetUserAgent("FuelTools " IGNITION_FUEL_TOOLS_VERSION_FULL);
conf.SetUserAgent("FuelTools " GZ_FUEL_TOOLS_VERSION_FULL);
gz::fuel_tools::FuelClient client(conf);

// Store header information
Expand Down Expand Up @@ -828,7 +828,7 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int editUrl(
const char *_path)
{
gz::fuel_tools::ClientConfig conf;
conf.SetUserAgent("FuelTools " IGNITION_FUEL_TOOLS_VERSION_FULL);
conf.SetUserAgent("FuelTools " GZ_FUEL_TOOLS_VERSION_FULL);
gz::fuel_tools::FuelClient client(conf);

// Store header information
Expand Down Expand Up @@ -928,7 +928,7 @@ extern "C" GZ_FUEL_TOOLS_VISIBLE int update(
// Client
gz::fuel_tools::ClientConfig conf;

conf.SetUserAgent("FuelTools " IGNITION_FUEL_TOOLS_VERSION_FULL);
conf.SetUserAgent("FuelTools " GZ_FUEL_TOOLS_VERSION_FULL);

gz::fuel_tools::FuelClient client(conf);

Expand Down
2 changes: 1 addition & 1 deletion src/ign_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ std::string custom_exec_str(std::string _cmd)
return result;
}

auto g_version = std::string(strdup(IGNITION_FUEL_TOOLS_VERSION_FULL));
auto g_version = std::string(strdup(GZ_FUEL_TOOLS_VERSION_FULL));

auto g_listCmd = "ign fuel list -v 4 --force-version " + g_version;

Expand Down
4 changes: 2 additions & 2 deletions test/test_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#define PROJECT_SOURCE_PATH "${PROJECT_SOURCE_DIR}"
#define PROJECT_BINARY_PATH "${PROJECT_BINARY_DIR}"
#define IGNITION_FUEL_TOOLS_LIBRARY_PATH "${PROJECT_BINARY_DIR}/src"
#define IGNITION_FUEL_TOOLS_VERSION_FULL "@PROJECT_VERSION_FULL@"
#define GZ_FUEL_TOOLS_LIBRARY_PATH "${PROJECT_BINARY_DIR}/src"
#define GZ_FUEL_TOOLS_VERSION_FULL "@PROJECT_VERSION_FULL@"
#define TEST_PATH "${PROJECT_SOURCE_DIR}/test"

#include <climits>
Expand Down

0 comments on commit 3a8c645

Please sign in to comment.