Skip to content

Github link validation - prep for user input#269

Closed
courte wants to merge 15 commits intoCodeMontageHQ:masterfrom
courte:github_link_validation
Closed

Github link validation - prep for user input#269
courte wants to merge 15 commits intoCodeMontageHQ:masterfrom
courte:github_link_validation

Conversation

@courte
Copy link
Copy Markdown
Member

@courte courte commented Nov 3, 2014

This code prepares to allow users to input a github link when adding new projects to the platform.

  • Adds a module to:
    • match the url to github repo format
    • adjust the link to match githubs preferred format (minimizing 301 responses)
    • check validity of input (Is the link real?)
    • return a hash of the organization/user & repo names, parsed from the url
  • Adds some tests for said module

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😋!

@acrogenesis
Copy link
Copy Markdown
Member

Using the url https://github.com/CodeMontageHQ/codemontage/pull/269 works when it shouldn't

get_github_details('https://github.com/CodeMontageHQ/codemontage/pull/269')
 => {:github_org=>"CodeMontageHQ/codemontage/pull", :github_repo=>"269"} 

@DBNess
Copy link
Copy Markdown
Member

DBNess commented Dec 22, 2014

Nice example, @acrogenesis! Thank you.

@courte
Copy link
Copy Markdown
Member Author

courte commented Dec 30, 2014

Thanks for the heads up, @acrogenesis! I've added some commits that (a) add your example to our existing specs & (b) account for word chars & dashes instead of any non-whitespace character (which was clearly far too broad).

The regex is ugly but (currently, maybe, fingers-crossed) gets the job done.

@courte
Copy link
Copy Markdown
Member Author

courte commented Feb 18, 2015

Simpler, cuter solution at #286.

@courte courte closed this Feb 18, 2015
@courte courte deleted the github_link_validation branch February 18, 2015 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants