-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve README for Rails to reload app/bot/**/*.rb files #58
Improve README for Rails to reload app/bot/**/*.rb files #58
Conversation
…r to reload bot files
@@ -312,7 +312,15 @@ reference constants. You'll need to explicitly load `app/bot`, then: | |||
```ruby | |||
# config/initializers/bot.rb | |||
unless Rails.env.production? | |||
Dir["#{Rails.root}/app/bot/**/*.rb"].each { |file| require file } | |||
api_files = Dir[Rails.root.join('app', 'bot', '**', '*.rb')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elct9620 Probably, we should use something like bot_files
or bots
instead of api_files
in variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think change it to bot_files
will better than api_files
@gauravtiwari I have updated README code from |
@elct9620 Awesome thanks! Should we add this too above the section you have added to make it more clear? # Add bots paths to config/application.rb.
# Auto-load bots and its subdirectories
config.paths.add File.join('app', 'bots'), glob: File.join('**', '*.rb')
config.autoload_paths += Dir[Rails.root.join('app', 'bots', '*')] |
@gauravtiwari Yeah, I also add it into my |
Oh yeah! that's right @elct9620 I guess this should be it then 👍 |
@gauravtiwari I update README add code into README, but I am not sure is my description good for this code snippet. |
@@ -312,10 +312,26 @@ reference constants. You'll need to explicitly load `app/bot`, then: | |||
```ruby | |||
# config/initializers/bot.rb | |||
unless Rails.env.production? | |||
Dir["#{Rails.root}/app/bot/**/*.rb"].each { |file| require file } | |||
bot_files = Dir[Rails.root.join('app', 'bot', '**', '*.rb')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elct9620 One small change, just rename bot
to bots
so, it matches with the application.rb
code example.
@gauravtiwari Ok, I updated it. |
Use same folder name as application.rb setup
@elct9620 Awesome stuff! Have some 🍰 |
Would you, guyes consider releasing v0.9? |
Absolutely, @dmitryshagin! Released in 530db0c. |
🎉 🍰 @jgorset |
Hi,
I try to let Rails auto reload files in
app/bot
and I foundFileUpdateChecker
in grape README.I update README to use same way to let bot files can reload by Rails without restart server.