Skip to content
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

Merged
merged 7 commits into from
Aug 16, 2016

Conversation

elct9620
Copy link
Contributor

Hi,

I try to let Rails auto reload files in app/bot and I found FileUpdateChecker in grape README.

I update README to use same way to let bot files can reload by Rails without restart server.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling b07acf0 on elct9620:feature/improve_rails_autoload into dce93b0 on hyperoslo:master.

@@ -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')]
Copy link
Contributor

@gauravtiwari gauravtiwari Aug 16, 2016

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?

Copy link
Contributor Author

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

@elct9620
Copy link
Contributor Author

@gauravtiwari I have updated README code from api_files into bot_files

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 058965c on elct9620:feature/improve_rails_autoload into dce93b0 on hyperoslo:master.

@gauravtiwari
Copy link
Contributor

gauravtiwari commented Aug 16, 2016

@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', '*')]

@elct9620
Copy link
Contributor Author

@gauravtiwari Yeah, I also add it into my config/application.rb. But if I only add it, the files still not reload because there is no class need to reload which detected by Rails.

@gauravtiwari
Copy link
Contributor

Oh yeah! that's right @elct9620 I guess this should be it then 👍

@elct9620
Copy link
Contributor Author

@gauravtiwari I update README add code into README, but I am not sure is my description good for this code snippet.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling d6bfd91 on elct9620:feature/improve_rails_autoload into dce93b0 on hyperoslo:master.

@@ -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')]
Copy link
Contributor

@gauravtiwari gauravtiwari Aug 16, 2016

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.

@elct9620
Copy link
Contributor Author

@gauravtiwari Ok, I updated it.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 7ac2239 on elct9620:feature/improve_rails_autoload into dce93b0 on hyperoslo:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 7ac2239 on elct9620:feature/improve_rails_autoload into dce93b0 on hyperoslo:master.

Use same folder name as application.rb setup
@gauravtiwari
Copy link
Contributor

@elct9620 Awesome stuff! Have some 🍰

@gauravtiwari gauravtiwari merged commit ca6ef82 into jgorset:master Aug 16, 2016
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 9d38a99 on elct9620:feature/improve_rails_autoload into dce93b0 on hyperoslo:master.

@elct9620 elct9620 deleted the feature/improve_rails_autoload branch August 16, 2016 15:54
@dmitryshagin
Copy link

Would you, guyes consider releasing v0.9?

@jgorset
Copy link
Owner

jgorset commented Aug 17, 2016

Absolutely, @dmitryshagin! Released in 530db0c.

@gauravtiwari
Copy link
Contributor

🎉 🍰 @jgorset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants