use std::io::Write;
fn main() {
println!(
"cargo:rustc-env=GITHUB_LAST_RELEASE_URL=https://raw.githubusercontent.com/davehorner/cargo-e/refs/heads/main/cargo-e/LAST_RELEASE"
);
println!("cargo:rerun-if-changed=Cargo.toml");
println!("cargo:rerun-if-changed=src/");
if std::env::var("CARGO_FEATURE_CHANGELOG").is_ok()
&& std::env::var("E_CRATE_CHANGELOG_PATH").is_err()
{
println!("cargo:rustc-env=E_CRATE_CHANGELOG_PATH=../cargo-e.CHANGELOG.md");
}
if std::env::var("CARGO_FEATURE_FORTUNE").is_ok() {
let ext = std::env::var("E_CRATE_FORTUNE_PATH").ok();
let valid_ext = ext.as_ref().and_then(|p| {
let path = std::path::Path::new(p);
if path.is_file() && path.metadata().map(|m| m.len() > 0).unwrap_or(false) {
Some(p.clone())
} else {
None
}
});
let final_path = if let Some(path) = valid_ext {
path
} else {
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR not set");
let out_path = std::path::Path::new(&out_dir).join("fortunes.txt");
let mut file = std::fs::File::create(&out_path)
.expect("Failed to create default fortunes file in OUT_DIR");
for line in default_fortunes() {
writeln!(file, "{}", line).expect("Failed to write default fortune");
}
out_path.to_string_lossy().into_owned()
};
println!("cargo:rustc-env=E_CRATE_FORTUNE_PATH={}", final_path);
}
}
fn default_fortunes() -> Vec<String> {
vec![
String::from("Why do programmers prefer dark mode? Because light attracts bugs."),
String::from("A SQL query walks into a bar, walks up to two tables and asks, 'Can I join you?'."),
String::from("Why do Java developers wear glasses? Because they don't see sharp."),
String::from("There are only 10 types of people in the world: those who understand binary and those who don't."),
String::from("Debugging: Being the detective in a crime movie where you are also the murderer."),
String::from("I would tell you a UDP joke, but you might not get it."),
String::from("https://github.com/davehorner/cargo-e consider a star to show your support"),
String::from("In a world without fences and walls, who needs Gates and Windows?"),
String::from("'Knock, knock.' 'Who's there?' very long pause… 'Java.'"),
String::from("Please consider giving this project a star on https://github.com/davehorner/cargo-e"),
String::from("Why did the programmer quit? No *statistically significant* reason to stay."),
String::from("My code has no bugs, just *undocumented features* in beta."),
String::from("Tabs vs. spaces? I choose chaos: random indentation."),
String::from("I said my code was 90% done. Now I'm trapped in the last 10% forever."),
String::from("What's a programmer's favorite dance? The merge conflict shuffle."),
String::from("Python devs hate JavaScript: too many braces, not enough zen."),
String::from("I named my variable 'i' and now it's having an identity crisis."),
String::from("Why delete a Git branch? To *commit* to a fresh start."),
String::from("My code works fine… until someone observes it. Quantum bugs!"),
String::from("Spellcheck? Nah, `teh` is just *idiomatic* code."),
String::from("Why do programmers prefer Vim? Because `hjkl` is their love language."),
String::from("I tried to write a recursive joke, but I called it too many times."),
String::from("Why did the CSS fail? It couldn't find any *specificity*."),
String::from("Rust programmers don't panic; they just *unwrap* their feelings."),
String::from("I told my boss I'd fix the bug… in the next sprint. Maybe."),
String::from("Why do devs love coffee? It's the only thing keeping the stack from overflowing."),
String::from("My regex works perfectly… on the empty string."),
String::from("Why did the database crash? It had an *identity* crisis during a join."),
String::from("I don't write bugs; I write *easter eggs* for QA."),
String::from("What's a coder's favorite game? Git blame roulette."),
String::from("Why did the function fail? It had too many *side effects* from partying."),
String::from("I pushed to prod on Friday. Now I'm *404: Weekend Not Found*."),
String::from("Why do programmers prefer dark mode? It hides their tears better."),
String::from("My unit tests passed… after I commented out the failing ones."),
String::from("Why did the coder go broke? They kept chasing *null* pointers."),
String::from("I don't use Stack Overflow. I just *grep* my soul for answers."),
String::from("Why do C programmers live dangerously? They play with raw pointers."),
String::from("My code's so clean, it sparkles… until you run it."),
String::from("Why did the dev refuse to pair program? They didn't want to *share* the blame."),
String::from("I wrote a one-liner in Perl. Now it's running for president."),
String::from("Why do front-end devs hate IE? It's the browser that says, 'I'm special.'"),
String::from("My API has 99% uptime… during scheduled maintenance."),
String::from("Why did the programmer burn out? Too many *async* life tasks."),
String::from("I don't fear bugs. I fear the logs that hide them."),
String::from("Why did the loop run forever? It was too *attached* to its condition."),
String::from("My code's modular… until you try to reuse it."),
String::from("Why do Go programmers love simplicity? Because `if err != nil` is their mantra."),
String::from("I tried to optimize my code, but now it's just *prematurely optimized* sadness."),
String::from("Why did the dev quit GitHub? Too many *forking* decisions."),
String::from("My CI pipeline is green… because I disabled the tests."),
String::from("Why do programmers prefer Linux? It's the only OS that *listens* to their screams."),
String::from("I wrote a bug-free program… in my dreams, using pseudocode."),
String::from("Why did the array index start at 0? It wanted to keep a low profile."),
String::from("My microservices are so small, they're just *nano-regrets*."),
String::from("Why do devs hate meetings? They're just *synchronous* interruptions."),
String::from("I don't write documentation. My code is *self-explanatory*… to me, yesterday."),
String::from("Why did the compiler complain? It was having a *syntax* tantrum."),
String::from("My pull request was rejected. Guess I'll just *stash* my ego."),
String::from("Why do programmers prefer headphones? To mute the world's runtime errors."),
String::from("I tried to learn Haskell, but my brain kept asking for *side effects*."),
String::from("Why did the dev go to therapy? Too many *unresolved dependencies*."),
String::from("My code's so legacy, it's eligible for social security."),
String::from("Why do Ruby devs love Rails? It's the only framework that *feels* like a hug."),
String::from("I don't debug; I just *print* my way to victory."),
String::from("Why did the programmer get lost? They followed a *relative* path."),
String::from("My Docker container is so light, it's just *hot air* and hope."),
String::from("Why do devs fear prod? It's where dreams go to *segfault*."),
String::from("I wrote a thread-safe program… by avoiding threads entirely."),
String::from("Why did the JSON fail? It was *malformed* and emotionally unstable."),
String::from("My Agile team has daily standups… to practice for the sprint collapse."),
String::from("Why do programmers prefer night shifts? The bugs are sleepier then."),
String::from("I don't use frameworks. I just *reinvent* the wheel, badly."),
String::from("Why did the dev hate XML? Too many *pointy* brackets."),
String::from("My code's so DRY, it's practically a desert."),
String::from("Why did the database go offline? It needed a *schema* cleanse."),
String::from("I tried pair programming, but my partner kept *refactoring* my personality."),
String::from("Why do PHP devs love chaos? Because `<?php` is their battle cry."),
String::from("My cloud bill is so high, I'm coding in the *stratosphere*."),
String::from("Why did the programmer get fired? They kept *committing* to nothing."),
String::from("I don't write tests. I just *pray* to the CI gods."),
String::from("Why do TypeScript devs feel safe? They've got *types* to protect them."),
String::from("My app's so slow, it's practically a *feature freeze*."),
String::from("Why did the dev hate regex? It's like solving a puzzle with no edges."),
String::from("I named my project 'Done.' Now it's *ironic* every day."),
String::from("Why do programmers love Rust? It's the only language that *cares* about their safety."),
String::from("My code's so old, it's written in *COBOL* and dreams of punch cards."),
String::from("Why did the API return 500? It was having an *existential* crisis."),
String::from("I don't use version control. I just *email* myself ZIP files."),
String::from("Why do devs love Kubernetes? It's like herding *digital* cats."),
String::from("My program crashed… but it looked *aesthetic* doing it."),
String::from("Why did the coder switch to dark mode? To match their *soul*."),
String::from("I tried to write a joke in Assembly, but it was just *MOV*ing sadness."),
String::from("Why do programmers hate deadlines? They're just *arbitrary* segfaults."),
String::from("My code's so fragile, it breaks when you *look* at it."),
String::from("Why did the dev use NoSQL? They wanted to live *schemaless* and free."),
String::from("I don't fix bugs; I just *work around* them creatively."),
String::from("Why do programmers love memes? They're the only thing *compiled* faster than code."),
String::from("My IDE crashed. Now I'm coding in *Notepad* like it's 1999."),
String::from("Why did the function return null? It was *socially distancing*."),
String::from("I tried to learn functional programming, but I kept *mutating* my mindset."),
String::from("Why do programmers prefer silence? Because *noise* is just unhandled exceptions."),
String::from("My backlog's so long, it's practically a *linked list* to nowhere."),
String::from("Why did the dev hate Java? Too many *boilerplate* emotions."),
String::from("I don't write comments. My code is a *mystery novel* for future me."),
String::from("Why do programmers love open source? It's like free bugs for everyone!"),
String::from("My app's so secure, even *I* can't log in."),
String::from("Why did the coder go to art school? To learn how to *draw* a better stack trace."),
String::from("I don't fear memory leaks. I fear the *void* they leave behind."),
String::from("Why do programmers prefer dark mode? It's easier to hide their *syntax errors*."),
String::from("Why do programmers prefer dark mode? Because light attracts bugs."),
String::from("I would tell you a joke about UDP, but you might not get it."),
String::from("Why do Java developers wear glasses? Because they don't see sharp."),
String::from("A SQL query walks into a bar, walks up to two tables and asks, 'Can I join you?'"),
String::from("How many programmers does it take to change a light bulb? None, it's a hardware problem."),
String::from("There are 10 types of people in the world: those who understand binary and those who don't."),
String::from("Debugging: Being the detective in a crime movie where you are also the murderer."),
String::from("I changed my password to 'incorrect' so when I forget it, the computer will say 'Your password is incorrect.'"),
String::from("Why was the JavaScript developer sad? Because he didn't know how to 'null' his feelings."),
String::from("Why do computers always sing? Because they have good bytes."),
String::from("My code doesn't always work, but when it does, I don't know why."),
String::from("Why did the developer go broke? Because he used up all his cache."),
String::from("What's a computer's least favorite food? Spam."),
String::from("Why do Python programmers wear glasses? Because they can't C."),
String::from("The Wi-Fi is down, so I had to spend time with my family. They seem like nice people."),
String::from("Why do IT guys hate nature? It has too many bugs."),
String::from("A byte walks into a bar and orders a pint. Bartender says, 'Sorry, we don't serve your type.'"),
String::from("I'd make a joke about recursion, but you've probably heard it before."),
String::from("I have a joke on cloud storage, but it would take forever to download."),
String::from("Why did the computer go to therapy? It had too many 'issues'."),
String::from("I named my hard drive 'dat ass' so once a month my computer asks if I want to back dat ass up."),
String::from("Old programmers never die — they just can't C as well."),
String::from("The programmer's wife told him: 'While you're at the store, get some milk.' He never came back."),
String::from("What's a developer's favorite hangout place? The Foo Bar."),
String::from("Why was the developer unhappy at their job? They wanted arrays."),
String::from("My computer beat me at chess, but it was no match for me at kickboxing."),
String::from("Why couldn't the computer take its hat off? It had a bad case of CAPS LOCK."),
String::from("How do you comfort a JavaScript bug? You console it."),
String::from("Why are computers so smart? They listen to their motherboards."),
String::from("The only thing worse than a bug is a feature."),
String::from("You know you're a programmer when you spend more time googling than coding."),
String::from("I told my computer I needed a break, and now it won't stop sending me KitKat ads."),
String::from("I love pressing F5. It's so refreshing."),
String::from("What's a programmer's favorite musical key? C#."),
String::from("Why don't robots panic? They take things byte by byte."),
String::from("I'm not anti-social, I'm just not user friendly."),
String::from("Why don't computers make good singers? Too many processing errors."),
String::from("Why was the computer cold? It left its Windows open."),
String::from("404: Joke not found."),
String::from("You had me at 'Hello World'."),
String::from("Why do programmers always mix up Halloween and Christmas? Because Oct 31 == Dec 25."),
String::from("What do you call 8 hobbits? A hobbyte."),
String::from("Why was the C developer so mean? Because they didn't give a null."),
String::from("What did the computer say to the internet? 'Are you down for maintenance again?'"),
String::from("What's the object-oriented way to become wealthy? Inheritance."),
String::from("My software never has bugs. It just develops random features."),
String::from("Knock knock. Who's there? Control Freak. Con... 'Okay, now you say Control Freak who?'"),
String::from("The problem with troubleshooting is that trouble shoots back."),
String::from("Why did the computer squeak? Because someone stepped on its mouse."),
String::from("I made a pun about the Windows registry, but it wasn't key."),
String::from("The internet: where men are men, women are men, and children are FBI agents."),
String::from("I updated my resume with all my GitHub commits. Now it's full of bugs."),
String::from("Programmer's diet: caffeine, pizza, and semicolons."),
String::from("Why don't programmers need glasses? Because they code in IDEs."),
String::from("The shortest horror story ever: 'Segmentation fault (core dumped).'"),
String::from("My backup plan is just Ctrl+Z."),
String::from("Programmers do it with recursion."),
String::from("Why did the tech support guy break up with his girlfriend? No response from server."),
String::from("System: Would you like to save your changes? Me: No, I prefer chaos."),
String::from("I turned off auto-correct. Now I'm typing like it's 1995."),
String::from("If at first you don't succeed, call it version 1.0."),
String::from("I opened my terminal and typed 'sudo make me a sandwich'. It worked."),
String::from("Why don't Macs ever get viruses? They're too expensive for hackers."),
String::from("Every time someone says 'It works on my machine', a QA angel loses its wings."),
String::from("What does a computer do when it's hungry? It goes for a byte."),
String::from("If Java had true garbage collection, most programs would delete themselves."),
String::from("Why do developers like working late? Because the world is quiet and stack overflow is awake."),
String::from("'Command not found' is my spirit animal."),
String::from("How do you hide a bug? Rename it as a feature."),
String::from("Coding is 90% debugging, 10% writing bugs."),
String::from("I started out with nothing, and I still have most of it — just like my RAM."),
String::from("Computers are like air conditioners — they stop working properly if you open Windows."),
String::from("Why did the developer leave the party? Because he couldn't find the class."),
String::from("Git happens."),
String::from("A good programmer is someone who always looks both ways before crossing a one-way street."),
String::from("To understand recursion, you must first understand recursion."),
String::from("The best thing about a Boolean is even if you are wrong, you are only off by a bit."),
String::from("A computer once beat me at Scrabble, but it was no match for me at Jenga."),
String::from("Why was the developer always calm? He had exception handling."),
String::from("What do you call a computer superhero? A screen saver."),
String::from("I deleted all my cookies. Now my computer is on a diet."),
String::from("Did you hear about the guy who forgot to use version control? Neither did anyone else."),
String::from("I'm not procrastinating — I'm just buffering."),
String::from("The only thing more annoying than a semicolon error is not knowing why."),
String::from("Programming is like writing a book… except if you miss a single comma, the whole plot makes no sense."),
String::from("Why did the software developer stay in bed? Because he didn't want to face the stack."),
String::from("There's no place like 127.0.0.1."),
String::from("Why don't software engineers tell jokes while coding? They can't handle exceptions."),
String::from("Programmer's motto: When in doubt, use brute force."),
String::from("I couldn't hack it in cybersecurity, so now I build walls in Minecraft."),
String::from("I think my code just went on strike — it refuses to run."),
String::from("Never trust a computer you can't throw out a window."),
String::from("I wrote clean code once. It was a hello world script."),
String::from("Programmers drink coffee because debugging is easier when you're jittery."),
String::from("I once debugged a bug by accidentally deleting the entire file."),
String::from("The cloud is just someone else's computer."),
String::from("I tried to write a joke about threads… but it got deadlocked."),
String::from("Don't worry if your computer can't spell — it autocorrects to worse."),
String::from("Why do developers hate meetings? They can't be 'compiled' into productivity."),
String::from("My code runs perfectly, but I think it's lonely; it never calls anyone."),
String::from("Why do programmers mix up Halloween and Christmas? Because Oct 31 equals Dec 25."),
String::from("What's a programmer's favorite type of music? Algorithms and Blues."),
String::from("I told my computer a joke, and it laughed so hard it overflowed its buffer."),
String::from("Why was the JavaScript file so anxious? It had too many callbacks."),
String::from("My favorite programming language is 'Sarcasm.' It compiles everywhere."),
String::from("What do you call a happy programmer? Content with their code."),
String::from("I'm not lazy, I'm just in energy-saving mode."),
String::from("Why did the Python programmer get a cold? Too much exposure to `pip`."),
String::from("The best way to a programmer's heart is through their terminal."),
String::from("I only use comments to leave passive-aggressive notes for my future self."),
String::from("My software is so user-friendly, even I can't break it (yet)."),
String::from("Why did the developer go to art school? To learn how to draw a better stack trace."),
String::from("What's a programmer's favorite snack? Microchips."),
String::from("I'm trying to become a full-stack developer. So far, I've mastered coffee and anxiety."),
String::from("Why did the network go down? Too many arguments between the packets."),
String::from("My code isn't spaghetti; it's a carefully curated bowl of ramen."),
String::from("I believe in life after `main`."),
String::from("Why did the HTML element break up with the CSS element? They just had no `div`ine connection."),
String::from("My manager asked for a deadline. I told him 'Infinity plus one.'"),
String::from("What do you call a programmer who's always angry? A *compiler*."),
String::from("I'm fluent in sarcasm and binary. One for people, one for computers."),
String::from("My computer's security question is 'What is your favorite color?' I always answer 'Blue Screen of Death.'"),
String::from("Why was the database always invited to parties? It had all the *relations*."),
String::from("I'm not a hacker, I just really like pressing F12."),
String::from("What's a programmer's least favorite exercise? Running out of memory."),
String::from("My code is like a fine wine: it gets worse with age."),
String::from("Why do developers hate nature? Too many unresolved dependencies (bugs)."),
String::from("I tried to be a minimalist, but then I realized I needed more monitors."),
String::from("What do you call a sad strawberry in a server room? A **berry** of contention."),
String::from("I'm not procrastinating; I'm just letting the bugs marinate."),
String::from("Why do programmers prefer dark roast coffee? Because it's less `null`."),
String::from("My code is self-documenting. If it breaks, it's your fault for not understanding."),
String::from("What's a developer's favorite type of sandwich? A stack trace sandwich."),
String::from("I have a love-hate relationship with my code. I love it when it works, I hate it when it doesn't."),
String::from("Why did the compiler get upset? It had too many `syntax` issues."),
String::from("My favorite part of debugging is finding out I'm the bug."),
String::from("What do you call a computer that sings? A Dell-ightful machine."),
String::from("I don't need a map; I have `git log` to tell me where I've been."),
String::from("Why did the image file go to jail? For `jpeg`-ing sensitive data."),
String::from("My code is always on time, it's the deadlines that are arbitrary."),
String::from("What's a developer's favorite board game? Debugging Dungeons."),
String::from("I'm not a programmer; I just translate human into computer-speak."),
String::from("Why did the variable get into trouble? It was out of scope."),
String::from("My favorite IDE is 'The one that works today.'"),
String::from("What's a programmer's least favorite type of weather? Cloudy with a chance of `null` references."),
String::from("I don't have a messy desk; I have a highly optimized workflow chaos system."),
String::from("Why did the network cable break up with the router? It felt too much tension."),
String::from("My code is like a rebellious teenager: it does what it wants, when it wants."),
String::from("What's the best way to catch a runaway computer? With a netbook."),
String::from("I'm not obsessed with coding; I just have a very strong `commit`ment."),
String::from("Why did the computer wear glasses? To improve its `site`."),
String::from("My brain has too many tabs open."),
String::from("What's a programmer's favorite type of story? A `byte`-sized tale."),
String::from("I'm a full-stack developer: I specialize in coffee stains on my keyboard and existential dread."),
String::from("Why did the array get stuck in traffic? It had too many `elements`."),
String::from("My code is so clean, it practically sanitizes itself."),
String::from("What do you call a nervous web server? A `jittery` connection."),
String::from("I tried to write a joke about parallel computing, but it was too complex."),
String::from("Why was the blockchain so calm? It had great `hashing` algorithms."),
String::from("My project manager asked for a `ETA`. I replied, `NaN`."),
String::from("What's a programmer's favorite kind of cookie? A `byte`-sized one."),
String::from("I'm not a robot, but I do respond well to `if/else` statements."),
String::from("Why did the developer get a raise? They had excellent `merge` skills."),
String::from("My code is like a house of cards: beautiful until you touch it."),
String::from("What's a programmer's favorite type of tree? A binary tree."),
String::from("I tried to learn machine learning, but my brain kept `overfitting`."),
String::from("Why did the `bug` go to therapy? It had too many `issues`."),
String::from("My favorite part of the day is when I successfully `push` to production."),
String::from("What's a programmer's favorite dessert? Pi."),
String::from("I'm not lazy, I just configure `cron` jobs to do my work."),
String::from("Why was the computer so good at poker? It always knew when to `fold`."),
String::from("My code's so old, it remembers dial-up."),
String::from("What do you call a fake noodle? An `impasta`."),
String::from("I debugged for hours only to realize the issue was me, not the code."),
String::from("Why did the developer go to the beach? To find some `sand`box to play in."),
String::from("My code is like my coffee: complex, dark, and keeps me up all night."),
String::from("What's a programmer's favorite mode of transportation? The `bus`."),
String::from("I'm a full-stack developer: I handle the front-end, the back-end, and the screaming."),
String::from("Why did the programmer break up with the compiler? Too many `errors` in their relationship."),
String::from("My code doesn't have bugs, it has `undocumented features`."),
String::from("What's a programmer's favorite type of animal? A `server` dog."),
String::from("I believe in good code, but I also believe in duct tape and prayers."),
String::from("Why was the database always calm? It had excellent ` ACID` properties."),
String::from("My computer's memory is so bad, it forgets what it had for breakfast."),
String::from("What's a programmer's favorite holiday? `Hash`giving."),
String::from("I'm not a morning person; my brain needs to compile first."),
String::from("Why did the developer bring a ladder to work? To reach the `cloud`."),
String::from("My code is a work of art, if art includes `segmentation faults`."),
String::from("What's a programmer's favorite movie genre? Sci-`fi`."),
String::from("I'm just one `git commit` away from either glory or total disaster."),
String::from("Why did the router get a promotion? It had great `connectivity` with its team."),
String::from("My code doesn't just work; it performs a majestic ballet of `if-else` statements."),
String::from("What's a programmer's favorite type of dance? The `bug`aloo."),
String::from("I'm not an expert, but I can Google really well."),
String::from("Why did the HTML tag feel sad? It had too many `unclosed` issues."),
String::from("My favorite thing about computers is that they are logical; my least favorite thing is people."),
String::from("What's a programmer's favorite place to visit? The `data` center."),
String::from("I'm not a `debugger`; I'm a `bug whisperer`."),
String::from("Why did the API get a therapist? It had too many `unhandled exceptions`."),
String::from("My code is so optimized, it practically writes itself (after I write it first)."),
String::from("What's a programmer's favorite game to play with friends? `Code` of Duty."),
]
}