bridgetownrb / bridgetown

A next-generation progressive site generator & fullstack framework, powered by Ruby
https://www.bridgetownrb.com
MIT License
1.16k stars 112 forks source link

feat: Add `bin/bt` alias #411

Closed jaredcwhite closed 3 years ago

jaredcwhite commented 3 years ago

From a comment by @ayushn21:

Do you think it's worth duplicating bin/bridgetown to bin/bt? It's a tiny amount of code that's unlikely to change so duplicating the file isn't the big deal in my opinion. It'll avoid putting the onus on the developer to set up an alias and provide a concise way to invoke commands out of the box.

meg-gutshall commented 3 years ago

Hey @jaredcwhite! Can I take this one?

jaredcwhite commented 3 years ago

Hey @jaredcwhite! Can I take this one?

@meg-gutshall Go for it!

meg-gutshall commented 3 years ago

Would you like me to update the documentation along with this? I'm not exactly sure how to word that there's now an alias for the bridgetown command. Any ideas?

jaredcwhite commented 3 years ago

Thanks @meg-gutshall for digging into this. So…it's one of those non-obvious things to be sure, but that's not actually the right bin/bridgetown to alias (the one inside the core gem there is what gets installed globally by RubyGems).

What the issue is referring to is the "binstub" which gets generated by Bundler in the new site template. This is brand new in the v1.0 alpha—when a new site is created it will have a bin/bridgetown inside of it which is really just a handier way of running bundle exec bridgetown.

If we can update the new command so that after Bundler generates binstubs we copy bridgetown to bt, that would be ideal.

Let me know if that makes sense (or not 😅)!

meg-gutshall commented 3 years ago

Okay. I think I'll need to dig around a bit more then because I don't have experience working on this type of file structure. Is there usually someone hanging around on the Discord? I may be able to pop on later tonight and it would be nice to have someone to bounce ideas off of.

ayushn21 commented 3 years ago

@meg-gutshall There's usually someone online on Discord who can help. I'll be on there through the week; but unlikely to be online later tonight.

For this issue, the new command (https://github.com/bridgetownrb/bridgetown/blob/main/bridgetown-core/lib/bridgetown-core/commands/new.rb) is what needs updating. Like Jared said, when we create a new Bridgetown site using bridgetown new my_site; bundler will create a bin/ directory and generate a bridgetown file in it.

In new.rb, we need to add a line after run "bundle binstub bridgetown-core" that copies the generated bin/bridgetown file to bin/bt. That should do the trick! If you need help just post here or in Discord and either me or someone else should be able to help you out!

meg-gutshall commented 3 years ago

Hi @ayushn21, thank you for the detailed description! I plan to tackle this tonight when pairing with a friend of mine.

jaredcwhite commented 3 years ago

Fixed in https://github.com/bridgetownrb/bridgetown/commit/f1a65723a28b531fadffc99be122d913d5077053