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

Does this work with diff data returned by the GH api? #73

Closed
marcamillion opened this issue Jul 18, 2016 · 2 comments
Closed

Does this work with diff data returned by the GH api? #73

marcamillion opened this issue Jul 18, 2016 · 2 comments

Comments

@marcamillion
Copy link

I love a lot of what I read in the ReadMe. The functionality seems to be almost exactly what I need.

The one thing that's missing is that it seems to focus primarily on raw text as the input.

Would this gem work with the actual diff data returned by Github API?

For instance, here is a sample from the API:

 :patch=>
  "@@ -727,7 +727,6 @@ def require_association_class(class_name)\n         def add_multiple_associated_save_callbacks(association_name)\n           method_name = \"validate_associated_records_for_\#{association_name}\".to_sym\n           define_method(method_name) do\n-            @new_record_before_save = new_record?\n             association = instance_variable_get(\"@\#{association_name}\")\n             if association.respond_to?(:loaded?)\n               if new_record?\n@@ -741,6 +740,7 @@ def add_multiple_associated_save_callbacks(association_name)\n           end\n \n           validate method_name\n+          before_save(\"@new_record_before_save = new_record?; true\")\n \n           after_callback = <<-end_eval\n             association = instance_variable_get(\"@\#{association_name}\")\n@@ -754,9 +754,6 @@ def add_multiple_associated_save_callbacks(association_name)\n               records_to_save.each { |record| association.send(:insert_record, record) }\n               association.send(:construct_sql)   # reconstruct the SQL queries now that we know the owner's id\n             end\n-            \n-            @new_record_before_save = false\n-            true\n           end_eval\n                 \n           # Doesn't use after_save as that would save associations added in after_create/after_update twice"}
]

Can I use this patch data as input and be able to customize it easily per the docs?

@marcamillion
Copy link
Author

marcamillion commented Jul 18, 2016

@samg The advice you gave here - #59 (comment) - seems like it could be exactly what I am looking for, but I would love some more direction.

Do you mind expanding on this a bit, because the specs don't fully show me how to do what I am trying to do.

Thanks.

Edit 1

Would be cool if you could do the same for Split Diffing too -- ideally that's the output I would want.

@samg
Copy link
Owner

samg commented Aug 11, 2016

Hi @marcamillion. Yeah, that's not currently a supported feature, but should be fairly easy to hack out if you don't mind getting into the codebase. If you can get your github returned diff data in the format the HTML formatter expects it should work great.

@samg samg closed this as completed Aug 11, 2016
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

No branches or pull requests

2 participants