Skip to content

Commit

Permalink
Rename martin-mbtiles crate to mbtiles (#976)
Browse files Browse the repository at this point in the history
This simplifies usage as both a crate and as a tool
  • Loading branch information
nyurik authored Oct 28, 2023
1 parent 76a1b7f commit 47b3106
Show file tree
Hide file tree
Showing 56 changed files with 57 additions and 59 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
- run: cargo fmt --all -- --check
- run: cargo clippy --package martin-tile-utils -- -D warnings
- run: cargo clippy --package martin-mbtiles --no-default-features -- -D warnings
- run: cargo clippy --package martin-mbtiles -- -D warnings
- run: cargo clippy --package mbtiles --no-default-features -- -D warnings
- run: cargo clippy --package mbtiles -- -D warnings
- run: cargo clippy --package martin -- -D warnings
- run: cargo clippy --package martin --features bless-tests -- -D warnings
- run: cargo doc --no-deps --workspace
Expand All @@ -72,8 +72,8 @@ jobs:
run: |
set -x
cargo test --package martin-tile-utils
cargo test --package martin-mbtiles --no-default-features
cargo test --package martin-mbtiles
cargo test --package mbtiles --no-default-features
cargo test --package mbtiles
cargo test --package martin
cargo test --doc
env:
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
echo "Building $target"
export "CARGO_TARGET_$(echo $target | tr 'a-z-' 'A-Z_')_RUSTFLAGS"='-C strip=debuginfo'
cross build --release --target $target --package martin-mbtiles
cross build --release --target $target --package mbtiles
cross build --release --target $target --package martin
mkdir -p target_releases/$target
Expand Down Expand Up @@ -274,7 +274,7 @@ jobs:
set -x
rustup target add "${{ matrix.target }}"
export RUSTFLAGS='-C strip=debuginfo'
cargo build --release --target ${{ matrix.target }} --package martin-mbtiles
cargo build --release --target ${{ matrix.target }} --package mbtiles
cargo build --release --target ${{ matrix.target }} --package martin
mkdir -p target_releases
mv target/${{ matrix.target }}/release/mbtiles${{ matrix.ext }} target_releases/
Expand Down
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["martin", "martin-tile-utils", "martin-mbtiles"]
members = ["martin", "martin-tile-utils", "mbtiles"]

[workspace.package]
edition = "2021"
Expand Down Expand Up @@ -33,8 +33,8 @@ insta = "1"
itertools = "0.11"
json-patch = "1.2"
log = "0.4"
martin-mbtiles = { path = "./martin-mbtiles", version = "0.6.0", default-features = false }
martin-tile-utils = { path = "./martin-tile-utils", version = "0.1.0" }
mbtiles = { path = "./mbtiles", version = "0.7.0", default-features = false }
num_cpus = "1"
pbf_font_tools = { version = "2.5.0", features = ["freetype"] }
pmtiles = { version = "0.3", features = ["mmap-async-tokio", "tilejson"] }
Expand Down
2 changes: 1 addition & 1 deletion docs/src/50-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Martin has a few additional tools that can be used to interact with the data.
## MBTiles tool
A small utility that allows users to interact with the `*.mbtiles` files from the command line. Use `mbtiles --help` to see a list of available commands, and `mbtiles <command> --help` to see help for a specific command.

This tool can be installed by compiling the latest released version with `cargo install martin-mbtiles`, or by downloading a pre-built binary from the [releases page](https://github.com/maplibre/martin/releases/latest).
This tool can be installed by compiling the latest released version with `cargo install mbtiles`, or by downloading a pre-built binary from the [releases page](https://github.com/maplibre/martin/releases/latest).

### meta-all
Print all metadata values to stdout, as well as the results of tile detection. The format of the values printed is not stable, and should only be used for visual inspection.
Expand Down
8 changes: 4 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ bless: restart clean-test bless-insta-martin bless-insta-mbtiles

# Run integration tests and save its output as the new expected output
bless-insta-mbtiles *ARGS: (cargo-install "cargo-insta")
#rm -rf martin-mbtiles/tests/snapshots
cargo insta test --accept --unreferenced=auto -p martin-mbtiles {{ ARGS }}
#rm -rf mbtiles/tests/snapshots
cargo insta test --accept --unreferenced=auto -p mbtiles {{ ARGS }}

# Run integration tests and save its output as the new expected output
bless-insta-martin *ARGS: (cargo-install "cargo-insta")
Expand Down Expand Up @@ -256,8 +256,8 @@ git-pre-push: stop start

# Update sqlite database schema.
prepare-sqlite: install-sqlx
mkdir -p martin-mbtiles/.sqlx
cd martin-mbtiles && cargo sqlx prepare --database-url sqlite://$PWD/../tests/fixtures/mbtiles/world_cities.mbtiles -- --lib --tests
mkdir -p mbtiles/.sqlx
cd mbtiles && cargo sqlx prepare --database-url sqlite://$PWD/../tests/fixtures/mbtiles/world_cities.mbtiles -- --lib --tests

# Install SQLX cli if not already installed.
[private]
Expand Down
2 changes: 1 addition & 1 deletion martin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ futures.workspace = true
itertools.workspace = true
json-patch.workspace = true
log.workspace = true
martin-mbtiles.workspace = true
martin-tile-utils.workspace = true
mbtiles.workspace = true
num_cpus.workspace = true
pbf_font_tools.workspace = true
pmtiles.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion martin/src/mbtiles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::sync::Arc;

use async_trait::async_trait;
use log::trace;
use martin_mbtiles::MbtilesPool;
use martin_tile_utils::TileInfo;
use mbtiles::MbtilesPool;
use tilejson::TileJSON;

use crate::file_config::FileError;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions martin-mbtiles/Cargo.toml → mbtiles/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "martin-mbtiles"
version = "0.6.0"
name = "mbtiles"
version = "0.7.0"
authors = ["Yuri Astrakhan <[email protected]>", "MapLibre contributors"]
description = "A simple low-level MbTiles access and processing library, with some tile format detection and other relevant heuristics."
keywords = ["mbtiles", "maps", "tiles", "mvt", "tilejson"]
Expand Down
8 changes: 4 additions & 4 deletions martin-mbtiles/README.md → mbtiles/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# martin-mbtiles
# mbtiles

[![Book](https://img.shields.io/badge/docs-Book-informational)](https://maplibre.org/martin/50-tools.html)
[![docs.rs docs](https://docs.rs/martin-mbtiles/badge.svg)](https://docs.rs/martin-mbtiles)
[![docs.rs docs](https://docs.rs/mbtiles/badge.svg)](https://docs.rs/mbtiles)
[![Slack chat](https://img.shields.io/badge/Chat-on%20Slack-blueviolet)](https://slack.openstreetmap.us/)
[![GitHub](https://img.shields.io/badge/github-maplibre/martin-8da0cb?logo=github)](https://github.com/maplibre/martin)
[![crates.io version](https://img.shields.io/crates/v/martin-mbtiles.svg)](https://crates.io/crates/martin-mbtiles)
[![CI build](https://github.com/maplibre/martin/workflows/CI/badge.svg)](https://github.com/maplibre/martin-mbtiles/actions)
[![crates.io version](https://img.shields.io/crates/v/mbtiles.svg)](https://crates.io/crates/mbtiles)
[![CI build](https://github.com/maplibre/martin/workflows/CI/badge.svg)](https://github.com/maplibre/martin/actions)

A library to help tile servers like [Martin](https://maplibre.org/martin) work with [MBTiles](https://github.com/mapbox/mbtiles-spec) files. When using as a lib, you may want to disable default features (i.e. the unused "cli" feature).

Expand Down
4 changes: 2 additions & 2 deletions martin-mbtiles/src/bin/main.rs → mbtiles/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};

use clap::{Parser, Subcommand};
use log::error;
use martin_mbtiles::{apply_patch, IntegrityCheckType, MbtResult, Mbtiles, MbtilesCopier};
use mbtiles::{apply_patch, IntegrityCheckType, MbtResult, Mbtiles, MbtilesCopier};

#[derive(Parser, PartialEq, Eq, Debug)]
#[command(
Expand Down Expand Up @@ -148,7 +148,7 @@ mod tests {

use clap::error::ErrorKind;
use clap::Parser;
use martin_mbtiles::{CopyDuplicateMode, MbtilesCopier};
use mbtiles::{CopyDuplicateMode, MbtilesCopier};

use crate::Commands::{ApplyPatch, Copy, MetaGetValue, MetaSetValue, Validate};
use crate::{Args, IntegrityCheckType};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 3 additions & 5 deletions martin-mbtiles/tests/mbtiles.rs → mbtiles/tests/mbtiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ use std::str::from_utf8;
use ctor::ctor;
use insta::{allow_duplicates, assert_display_snapshot};
use log::info;
use martin_mbtiles::IntegrityCheckType::Off;
use martin_mbtiles::MbtTypeCli::{Flat, FlatWithHash, Normalized};
use martin_mbtiles::{
apply_patch, create_flat_tables, MbtResult, MbtTypeCli, Mbtiles, MbtilesCopier,
};
use mbtiles::IntegrityCheckType::Off;
use mbtiles::MbtTypeCli::{Flat, FlatWithHash, Normalized};
use mbtiles::{apply_patch, create_flat_tables, MbtResult, MbtTypeCli, Mbtiles, MbtilesCopier};
use pretty_assertions::assert_eq as pretty_assert_eq;
use rstest::{fixture, rstest};
use serde::Serialize;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: martin-mbtiles/tests/mbtiles.rs
source: mbtiles/tests/mbtiles.rs
expression: actual_value
---
[[]]
Expand Down
2 changes: 1 addition & 1 deletion tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MARTIN_URL="http://localhost:${MARTIN_PORT}"
MARTIN_ARGS="${MARTIN_ARGS:---listen-addresses localhost:${MARTIN_PORT}}"
MARTIN_BIN="${MARTIN_BIN:-cargo run --} ${MARTIN_ARGS}"

MBTILES_BUILD="${MBTILES_BUILD:-cargo build -p martin-mbtiles}"
MBTILES_BUILD="${MBTILES_BUILD:-cargo build -p mbtiles}"
MBTILES_BIN="${MBTILES_BIN:-target/debug/mbtiles}"

LOG_DIR="${LOG_DIR:-target/test_logs}"
Expand Down

0 comments on commit 47b3106

Please sign in to comment.