-
Notifications
You must be signed in to change notification settings - Fork 111
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
Add Rake tasks for update, remove, and version. #117
Add Rake tasks for update, remove, and version. #117
Conversation
I think the update tasks probably need to accept version numbers since any code specifying a version number to lock to won’t be loaded when these are run |
Additionally the new tasks should not be in the main Rakefile - they should be in a separate file other projects require - See http://mdzhang.com/blog/code/2016/09/10/create-ruby-gem-that-adds-rake-tasks/ - ignore the part about separate files for each task though - that seems unnecessary |
We also want to be able to use caching with update. I'm thinking we probably want to leverage The description should be more clear; something like: Info about this should also get added to the README Finally, I think we want to do |
@twalpole @titusfortner I wasn't sure of the expectation at first, but your comments and links made them very clear. Thanks for that :) Updated task descriptions:
Added options for
I would like to DRY up the I will update the |
d6d9643
to
c10c6ba
Compare
Rake can take multiple tasks on the same command line ( |
Additionally please add Railtie support as described in the previous link I sent, so that for users of Rails the rake tasks get automatically loaded. |
@twalpole I haven't tested it, but wouldn't this work as expected?
Of note, users will also need to set |
@titusfortner that might, but what if my tests run with chromedriver and geckodriver - then you can't set multiple versions, however
would allow it (and simplifies the tasks by removing the need for OptionParser in favor of using rakes native features). |
hmm - of course that then breaks in zsh by default and users need to escape the [ and ] on the command line - 🤷♂ |
c10c6ba
to
626b60c
Compare
Updated the tasks as per the discussion here and on Slack: $ bundle exec rake -T
rake webdrivers:chromedriver:remove # Force remove chromedriver
rake webdrivers:chromedriver:update[version] # Remove and download updated chromedriver if necessary
rake webdrivers:geckodriver:remove # Force remove geckodriver
rake webdrivers:geckodriver:update[version] # Remove and download updated geckodriver if necessary
rake webdrivers:iedriver:remove # Force remove IEDriverServer
rake webdrivers:iedriver:update[version] # Remove and download updated IEDriverServer if necessary The following works now and $ bundle exec rake webdrivers:chromedriver:update[2.46] webdrivers:geckodriver:update[0.24.0] CACHE_TIME=30
2019-05-15 22:36:41 INFO Webdrivers Updated to chromedriver 2.46.628388
2019-05-15 22:36:41 INFO Webdrivers Updated to geckodriver 0.24.0 @twalpole Added |
626b60c
to
a43200f
Compare
Yeah, this looks really good. I still like the OptionParser better as it is more explicit, and then just tell people to create their own rake file if they want to combine them, but whatever, let's do it the default Rake way. :) Only two changes:
|
Tested out the railties - seems to work fine
One thing I did think about is the install dir - I think we probably want a way to specify that for these tasks too - thoughts? |
@titusfortner I'll add support for @twalpole Sounds reasonable. How about Additionally, I would like to rename |
Note to myself:
|
dbeb231
to
ddec5af
Compare
Here's the updated list: $ bundle exec rake -T
rake webdrivers:chromedriver:remove # Force remove chromedriver
rake webdrivers:chromedriver:update[version] # Remove and download updated chromedriver if necessary
rake webdrivers:chromedriver:version # Print current chromedriver version
rake webdrivers:geckodriver:remove # Force remove geckodriver
rake webdrivers:geckodriver:update[version] # Remove and download updated geckodriver if necessary
rake webdrivers:geckodriver:version # Print current geckodriver version
rake webdrivers:iedriver:remove # Force remove IEDriverServer
rake webdrivers:iedriver:update[version] # Remove and download updated IEDriverServer if necessary
rake webdrivers:iedriver:version # Print current IEDriverServer version
$ bundle exec rake webdrivers:chromedriver:version
2019-05-18 17:45:59 INFO Webdrivers chromedriver 74.0.3729.6 |
17e02d1
to
fc075a3
Compare
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.
LGTM. Couple notes, then I'm cool with merging. Next release will be a beta to make sure it works for users, so they can let us know if there are issues or use cases we overlooked... :)
@@ -26,7 +26,7 @@ def delete(file) | |||
end | |||
|
|||
def install_dir | |||
Webdrivers.install_dir || File.expand_path(File.join(ENV['HOME'], '.webdrivers')) | |||
Webdrivers.install_dir |
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.
is this different from just using the attr_accessor
?
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.
The accessor (reader method) was only returning the user define path or nil
. I attempted to move all the logic in System.install_dir
and have Webdrivers.install_dir
reference it, but then that created a circular reference as the first check in System is for Webdrivers.install_dir
, which itself was referencing System.install_dir
to get the default path.
Oh, this also needs a README update to discuss ENV specifics & Available tasks |
f3b2b9d
to
5c12329
Compare
Made requested changes and updated |
Closes #28.