mutewinter / Showbot

🤖 An IRC Bot and Website for 5by5.tv written with the Cinch and Sinatra frameworks
MIT License
90 stars 31 forks source link

Centralizing configuration and genericizing showbot + random cleanup #53

Closed rikai closed 7 years ago

rikai commented 11 years ago

I'm thinking of taking this bit of restructuring upon myself sometime here soon to make my life easier. Figured i'd post here first to get some thoughts on the matter.

Brief Explanation:

Basically, Now that .env is in use by ShowBot, i think that most of the stuff showbot uses can be moved into either cinchize.yml or .env (or possibly another non-cinchize.yml config like config.yml if preferred), to help make showbot more generically usable without having to comb the code to make manual edits, and instead only have to modify a few files in the base directory, namely cinchize.yml, .env and/or config.yml. In that spirit, what follows is what i have in mind.

Things that wont be touched

Note: Could be added to cinchize.yml instead and loaded manually instead perhaps, to keep things in one place?

Misc/Undecided

rikai commented 11 years ago

Updated the post now that i've learned a little bit about sharing settings between plugins.

rikai commented 11 years ago

Did the vast majority of the changes in the merge request listed above, what follows are the things that still remain from the list:

Things left:

Things i don't have much experience with but had thoughts on

The MR does not cover any of this at all, i didn't touch the web interface as i haven't looked into how to do in-place substitution or if its even easily possible:

Random cleanup i also ran across

I seem to have fixed the twitter announcing as a side effect of my changes, somehow. Also of these questions still need answers:

mutewinter commented 11 years ago

suggestion.rb#L19 - honestly not sure how to handle this, it seems a shame to make an enviroment variable for a single reference, will have to think on it unless you've got any suggestions.

If there were more than one thing like this, I'd say we centralize it all using a en.yml file and I18n.

Also perhaps moving the port number for sinatra out of procfile.local?

Agreed. The port number should not be hardcoded.

Is hypercritical.json missing from the repo? I see a direct reference to it here, but it's not in the repo. What is this for?

Yes. It must have been test data that I use using a long time ago. Ah the days when I used to junk of repositories with dead code :).

The javascript here seems to be tracking specific to the 5by5 version of showbot, is this intentionally in the public code? Won't that skew analytics results?

Yea, that should be moved into a config or partial that I don't commit. It won't skew data because the analytics tools I'm using should only allow specific domains.

I haven't looked into /public/ and /views/ much, as I dont know much about haml, but if possible, abstract out references to the bot name, 5by5 chat and 5by5 urls to variables to make rebranding for another use or url updates in general even for 5by5 simple. Can the variables from a .env or config.yml be used inside haml easily?

Yes, I'd consider the same approach as fixing the code for suggestion.rb#L19.

rikai commented 11 years ago

Alright, that simplifies things quite a bit. I got i18n and an en.yml going. Even if it's only for a single reference atm, it gives us a place to easily expand things later.

I'm glad you don't mind all this reworking, i know it'll probably be a pain to sort through. ;)

rikai commented 11 years ago

Working on adding i18n to the haml... Having some issues though. I cant get it to parse inline ruby that it passes to the haml renderer. Not sure how to solve that.

rikai commented 11 years ago

Right then. I18n complete, unless there are things i missed of course, but the vast majority is done anyway, so this and #55 should be all good now.

I'll leave taking care of the dead hypercritical code and moving your analytics code to you. I've completed everything else i've set out to do in this issue, i believe.

rikai commented 7 years ago

Done.