I know there isn't one here currently but it might be cool to have a replicate drush plugin so that you could quickly replicate items via command line. I maintain the replicate UI module and so I know that UI items are not in scope of replicate as its an API for developers so before I added drush plugins (would take all of like an hour probably) I was seeing if that would be something that would have a chance of being added here or if I should just author a replicate_drush or even add it to the replicate_ui project namespace.
Ideas for capabilities would be along the lines of:
drush replicate {entity type} {id number}
Comment | File | Size | Author |
---|---|---|---|
#15 | replicate-drush_integration-2338345-15.patch | 1.96 KB | vbouchet |
#14 | drush_plugin-2338345-14.patch | 1.62 KB | mmilutinovic1313 |
#11 | drush_plugin-2338345-11.patch | 1.62 KB | mmilutinovic1313 |
Comments
Comment #1
jgalletta CreditAttribution: jgalletta commentedSorry for the delay but yes, that would be added here, feel free to submit a patch :)
Comment #2
mmilutinovic1313 CreditAttribution: mmilutinovic1313 commentedCurrently working on this as a patch. Updates to come soon!
Comment #3
mmilutinovic1313 CreditAttribution: mmilutinovic1313 commentedHi all,
Here is the code's status. I'm just working on some error checking so that users will get friendly error messages if they enter something invalid. I'll be posting the patch soon after I finish that process. Here is the github link to my work:
https://github.com/mmilutinovic1313/replicate
Comment #4
mmilutinovic1313 CreditAttribution: mmilutinovic1313 commentedHere is the patch. Let me know if it needs any changes!
-Mark
Comment #5
btopro CreditAttribution: btopro commentedSome critique. account for not including argument 2. If no entityID is supplied then we need to make sure it's accounted for. Shouldn't throw a warning it should throw a message
are both thrown when no ID is supplied
ALso the usage examples when you type drep --help is different then the actual command. Says drush rep node 1 but drep appears to be the call. Make it replicate and maybe rep as the shorthand if you want to use one.
Comment #6
mmilutinovic1313 CreditAttribution: mmilutinovic1313 commentedHere is a new patch, I think this one handles the errors better.
Command: drush replicate
Shorthand: drush rep
Requires 2 params
Let me know if you need anything else added!
Comment #7
btopro CreditAttribution: btopro commenteddrush_replicate_drush_help is still a placeholder. other then that looking good
Comment #8
mmilutinovic1313 CreditAttribution: mmilutinovic1313 commentedThis invokes replicate_drush_help properly
Comment #9
btopro CreditAttribution: btopro commentedSee like 47:
This should be a call to
replicate_entity_by_id
then you don't need the last two functions.Also comment / document each function in the
style
Comment #10
mmilutinovic1313 CreditAttribution: mmilutinovic1313 commentedTHIS PATCH DID NOT DIFF PROPERLY. NEW PATCH COMING IN 5 MIN
Comment #11
mmilutinovic1313 CreditAttribution: mmilutinovic1313 commentedOkay this should have the correct simplified formatting and code with proper hook references.
Comment #12
btopro CreditAttribution: btopro commentedLooks good to me, could use some testing by a third party since in full disclosure mark works for me.
Comment #13
jgalletta CreditAttribution: jgalletta commentedQuick code review:
Comment #14
mmilutinovic1313 CreditAttribution: mmilutinovic1313 commentedFixed the formatting listed above! Please let me know if you have any other fixes!
Comment #15
vbouchetHi @mmilutinovic1313,
I updated your patch with various standard fixes but also updated the drush command to accept a list of entity IDs instead of only one. It's of course accepting only one ID if you want to replicate only one entity.
Comment #16
btopro CreditAttribution: btopro commentedReviewed, looks good to me!
Comment #19
vbouchetThis had been merged, will be available in the next release.
Comment #20
chefnelone CreditAttribution: chefnelone commentedIs there a way to replicate a node several times with Drush?
Let say I want to create 5 copies of a node which ID is 174.
Can I do it with Drush?
Comment #21
btopro CreditAttribution: btopro commentedI mean you could call the drush command 5 times w/ the same ID. Or you could use dev of this to get the replicate drush plugin then write a recipe via http://drupal.org/project/drush_recipes to chain build the item X number of times. this would be pretty easy to do with the looping part of the spec
Comment #22
chefnelone CreditAttribution: chefnelone commentedok, which is the command to replicate a node?
Comment #23
btopro CreditAttribution: btopro commenteddrush replicate node 1,2,3