Commit 4826f0d5 authored by Eloy Duran's avatar Eloy Duran

Allow both the name of a pod _and_ a github url to be specified.

This ensures the name of a pods will be properly cased in cases where
the url does not contain it.

This is simply hacked in, it needs some proper looking over.
parent 9c4baa84
...@@ -25,11 +25,14 @@ module Pod ...@@ -25,11 +25,14 @@ module Pod
def initialize(argv) def initialize(argv)
args = argv.arguments args = argv.arguments
unless (args[0] == 'create' && args.size == 2) || unless (args[0] == 'create' && 2..3 === args.size) ||
(args[0] == 'lint' && args.size <= 2) (args[0] == 'lint' && args.size <= 2)
super super
end end
@action, @name_or_url = args.first(2) @action, @name_or_url = args.first(2)
if @action == 'create' && args.size == 3
@url = args[2]
end
end end
def run def run
...@@ -37,8 +40,10 @@ module Pod ...@@ -37,8 +40,10 @@ module Pod
end end
def create def create
if repo_id = @name_or_url[/github.com\/([^\/\.]*\/[^\/\.]*)\.*/, 1] if repo_id_match = (@url || @name_or_url).match(/github.com\/([^\/\.]*\/[^\/\.]*)\.*/)
repo_id = repo_id_match[1]
data = github_data_for_template(repo_id) data = github_data_for_template(repo_id)
data[:name] = @name_or_url if @url
puts semantic_versioning_notice(repo_id, data[:name]) if data[:version] == '0.0.1' puts semantic_versioning_notice(repo_id, data[:name]) if data[:version] == '0.0.1'
else else
data = default_data_for_template(@name_or_url) data = default_data_for_template(@name_or_url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment