Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

The folder examples holds a few examples that show you how to use dyer integrated with dyer-cli, and of course there are many explanations inside each example.

What are they

They are three examples given in the directory, and some description are provided respectively.

  • dyer-diesel shows how Database integrates with dyer using diesel
  • simple-demo shows how to normally build a app
  • template shows a template generated by dyer-cli

How to Use

Make sure that rust (latest version recommended) and cargo are installed in your OS, then clone this repository with:

git clone --depth=1 https://github.com/HomelyGuy/dyer.git

the xpath-stable feature requires C library libxml2 installed, you can refer to rust-libxml for more details. thexpath-alpha feature is rust-native, don't require any external library, but currently is not stable and remains to be stabilized in the future.

One more thing that this crate requires a safe popular cryptography library OpenSSL, some additional stuff is needed to compile. in general,

# for debian-base OS
sudo apt install pkg-config libssl-dev

# for Arch 
sudo pacman -S pkg-config openssl

# for MacOS
brew install openssl

Things is a little complicated for Windows users, but it's okay if you follow the steps:

  • OpenSSL installation: you can install 3rd-party binary OpenSSL (recommended) or compile it from source. If you install git-bash, then OpenSSL is already installed, anyway, open your prompt or terminal, type

     openssl
  • Set up OPENSSL_DIR download the openssl-dev file and unzip it, you see the files:

     |__ssl/
     |__x64/
     |__x86

    then export the directory as OPENSSL_DIR based on your system. In Start -> This Computer -> Property(right click) -> Advanced System Setting -> Advanced -> Environment Variables -> New, and type

    Variable Value
    OPENSSL_DIR path/to/x64(for 64-bit system)
    OPENSSL_DIR path/to/x86(for 32-bit system)

    then restart the terminal/prompt, and you are ready to go.

Run those examples with:

cd dyer\examples\simple-demo 
dyer c 
dyer run(or cargo run ) 

Note that:

  • all demos take scraping the quote site as example
  • the folder template, as the name suggests, is a template dyer-cli created for illustration.
  • the folder dyer-diesel contains SQL database(Sqlite, PostGresql, Mysql) integration with dyer-cli via diesel.