🍾 Initial Commit
This commit is contained in:
commit
4e95609367
5
.cargo/config.toml
Normal file
5
.cargo/config.toml
Normal file
@ -0,0 +1,5 @@
|
||||
[registries.lugit]
|
||||
index = "sparse+http://lugit.local/api/packages/lucodear/cargo/"
|
||||
|
||||
[registry]
|
||||
global-credential-providers = ["cargo:token"]
|
||||
4
.cocorc
Normal file
4
.cocorc
Normal file
@ -0,0 +1,4 @@
|
||||
# https://github.com/lucas-labs/coco config
|
||||
|
||||
askScope: false
|
||||
useEmoji: true
|
||||
15
.github/img/rustler.svg
vendored
Normal file
15
.github/img/rustler.svg
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34 32">
|
||||
<style>
|
||||
.a { fill: #000000; }
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.a { fill: #ffffff; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<path class="a" d="M32,22H28a4,4,0,0,0-4,4H22a4,4,0,0,0,4,4h4a4,4,0,0,0-4-4h2A4,4,0,0,0,32,22Z" />
|
||||
<path class="a" d="M9,31V21H24.95508A10.97052,10.97052,0,0,1,14,31Z" />
|
||||
<path class="a" d="M23.80175,22A9.97326,9.97326,0,0,1,14,30H10V22H23.80175m1.68111-2H8.5a.5.5,0,0,0-.5.5v11a.5.5,0,0,0,.5.5H14A12.00035,12.00035,0,0,0,25.989,20.51848.5052.5052,0,0,0,25.48286,20Z" />
|
||||
<path class="a" d="M8.5,14H12a0,0,0,0,1,0,0v0a4,4,0,0,1-4,4H8a0,0,0,0,1,0,0V14.5A.5.5,0,0,1,8.5,14Z" />
|
||||
<path class="a" d="M18.5,14H22a0,0,0,0,1,0,0v0a4,4,0,0,1-4,4h0a0,0,0,0,1,0,0V14.5A.5.5,0,0,1,18.5,14Z" />
|
||||
<path class="a" d="M30,4.5V8H26V.5a.5.5,0,0,0-.5-.5h-7a.5.5,0,0,0-.5.5V2H14V.5a.5.5,0,0,0-.5-.5h-5A.5.5,0,0,0,8,.5V8H4V4.5A.5.5,0,0,0,3.5,4H.5a.5.5,0,0,0-.5.5V8a4,4,0,0,0,4,4H30a4,4,0,0,0,4-4V4.5a.5.5,0,0,0-.5-.5h-3A.5.5,0,0,0,30,4.5ZM22,8H12V4h2V5.5a.5.5,0,0,0,.5.5h3a.5.5,0,0,0,.5-.5V4h4Z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/target
|
||||
.data/*.log
|
||||
.task
|
||||
29
.vscode/launch.json
vendored
Normal file
29
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
// debug rust on windows
|
||||
{
|
||||
"name": "debug: rustler",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/target/debug/rustler.exe",
|
||||
"args": [
|
||||
"server",
|
||||
"--force"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "KURV_HOME",
|
||||
"value": "${workspaceFolder}"
|
||||
}
|
||||
],
|
||||
"externalConsole": true,
|
||||
"preLaunchTask": "cargo: build"
|
||||
},
|
||||
]
|
||||
}
|
||||
25
.vscode/settings.json
vendored
Normal file
25
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"files.exclude": {
|
||||
// ⚙️ config
|
||||
"Taskfile.yaml": true,
|
||||
".cocorc": true,
|
||||
".task": true,
|
||||
".cargo": true,
|
||||
// "Cargo.toml": true,
|
||||
|
||||
// 📦
|
||||
"Cargo.lock": true,
|
||||
"target": true,
|
||||
|
||||
// 📝 readmes
|
||||
"**/**/README.md": true,
|
||||
"LICENSE": true,
|
||||
|
||||
// 🗑️
|
||||
"check_size.py": true,
|
||||
"*.code-workspace": true,
|
||||
".gitignore": true,
|
||||
".vscode": true,
|
||||
".git": true,
|
||||
}
|
||||
}
|
||||
19
.vscode/tasks.json
vendored
Normal file
19
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "cargo: build",
|
||||
"type": "shell",
|
||||
"command": "cargo build",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$rustc"
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
39
Cargo.lock
generated
Normal file
39
Cargo.lock
generated
Normal file
@ -0,0 +1,39 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "eyre"
|
||||
version = "0.6.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec"
|
||||
dependencies = [
|
||||
"indenter",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indenter"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
|
||||
|
||||
[[package]]
|
||||
name = "indoc"
|
||||
version = "2.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "rustler"
|
||||
version = "0.0.0-alpha.0"
|
||||
dependencies = [
|
||||
"eyre",
|
||||
"indoc",
|
||||
]
|
||||
25
Cargo.toml
Normal file
25
Cargo.toml
Normal file
@ -0,0 +1,25 @@
|
||||
[package]
|
||||
name = "rustler"
|
||||
version = "0.0.0-alpha.0"
|
||||
edition = "2021"
|
||||
description = "🤠 » single-action data extractor"
|
||||
authors = ["Lucas Colombo <lucas@lucode.ar>"]
|
||||
|
||||
[profile.release]
|
||||
strip = true
|
||||
lto = true
|
||||
codegen-units = 16
|
||||
opt-level = 'z'
|
||||
panic = "abort"
|
||||
rpath = false
|
||||
overflow-checks = false
|
||||
debug = 0
|
||||
debug-assertions = false
|
||||
|
||||
[dependencies]
|
||||
eyre = { version = "0.6.12", default-features = false, features = ["auto-install"] }
|
||||
indoc = "2.0.4"
|
||||
|
||||
[[bin]]
|
||||
name = "rustler"
|
||||
path = "src/main.rs"
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Lucas Colombo <lucas@lucode.ar>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
||||
<p align="center"><img src=".github/img/rustler.svg" height="256"></p>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
𝐫𝐮𝐬𝐭𝐥𝐞𝐫 is a web scraping service that scrapes several stock market providers for stock pricing data. It is built using the <code>Rust</code> programming language.
|
||||
</p>
|
||||
25
Taskfile.yaml
Normal file
25
Taskfile.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
# https://taskfile.dev
|
||||
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
run:watch:
|
||||
desc: 🚀 watch rustler
|
||||
cmds:
|
||||
- cargo watch -c -x "run -- --version"
|
||||
|
||||
build:watch:
|
||||
desc: 🚀 watch rustler «build»
|
||||
cmds:
|
||||
- cargo watch -c -x "build"
|
||||
|
||||
build:
|
||||
desc: ⚡ build rustler «release»
|
||||
cmds:
|
||||
- cargo build --release
|
||||
- python check_size.py
|
||||
|
||||
fmt:
|
||||
desc: 🚀 format rustler
|
||||
cmds:
|
||||
- cargo +nightly fmt --all
|
||||
56
check_size.py
Normal file
56
check_size.py
Normal file
@ -0,0 +1,56 @@
|
||||
"""
|
||||
small script to run after build, to check if there was a significant
|
||||
change on executable size, compared to the previous build.
|
||||
|
||||
this aims to detect unwanted big differences before it's too late
|
||||
"""
|
||||
|
||||
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
curr_dir = pathlib.Path(os.getcwd())
|
||||
sizefile_path = pathlib.Path(curr_dir.joinpath('.task'))
|
||||
|
||||
|
||||
def bad(txt):
|
||||
return '\033[91m' + txt + '\033[0m'
|
||||
|
||||
|
||||
def good(txt):
|
||||
return '\033[92m' + txt + '\033[0m'
|
||||
|
||||
|
||||
def head(txt):
|
||||
return '\033[94m' + txt + '\033[0m'
|
||||
|
||||
|
||||
files = {
|
||||
'release': curr_dir.joinpath('target/release/rustler.exe'),
|
||||
'debug': curr_dir.joinpath('target/debug/rustler.exe'),
|
||||
}
|
||||
|
||||
print("\n🧉 » exe file sizes change\n")
|
||||
|
||||
for key, exe in files.items():
|
||||
if exe.is_file():
|
||||
sizefile = sizefile_path.joinpath(key)
|
||||
new_size: float = os.stat(exe).st_size / 1024
|
||||
old_size: float
|
||||
|
||||
try:
|
||||
with open(sizefile, 'r') as f:
|
||||
old_size = float(f.read())
|
||||
except FileNotFoundError:
|
||||
old_size = 0
|
||||
|
||||
# diff: str = f'{old_size:.0f}kb'
|
||||
diff = new_size - old_size
|
||||
diff_str = f"{'+' if diff > 0 else '=' if diff == 0 else ''}{diff:.0f}kb"
|
||||
|
||||
fmt = bad if diff > 10 else good
|
||||
|
||||
sizefile.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with open(sizefile, 'w') as f:
|
||||
f.write(f'{new_size}')
|
||||
6
rustfmt.toml
Normal file
6
rustfmt.toml
Normal file
@ -0,0 +1,6 @@
|
||||
max_width = 100
|
||||
array_width = 80
|
||||
chain_width = 100
|
||||
comment_width = 80
|
||||
imports_indent = "Block"
|
||||
imports_granularity = "One"
|
||||
7
src/main.rs
Normal file
7
src/main.rs
Normal file
@ -0,0 +1,7 @@
|
||||
use eyre::Result;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
println!("Hello, rustler!");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
20
🤠 rustler.code-workspace
Normal file
20
🤠 rustler.code-workspace
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"terminal.integrated.env.windows": {
|
||||
// allows to run the command in the terminal for development purposes
|
||||
"PATH": "${workspaceFolder}/target/debug;${env:PATH}",
|
||||
},
|
||||
"lucodear-icons.activeIconPack": "rust_ferris",
|
||||
"lucodear-icons.folders.associations": {
|
||||
".cargo": "rust",
|
||||
},
|
||||
"lucodear-icons.files.associations": {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user