Commit 1997d9bc authored by Fabio Pelosin's avatar Fabio Pelosin

Fixed spec and other minor fixes for pod spec create

parent 20613c18
require 'net/https' require 'net/https'
require 'uri' require 'uri'
require 'octokit' require 'octokit'
require 'awesome_print'
require 'json' require 'json'
module Pod module Pod
...@@ -36,7 +35,7 @@ module Pod ...@@ -36,7 +35,7 @@ module Pod
end end
def create def create
if repo_id = @name_or_url[/github.com\/(.*\/.*)/, 1] if repo_id = @name_or_url[/github.com\/([^\/]*\/[^\/]*).*/, 1]
data = github_data_for_template(repo_id) data = github_data_for_template(repo_id)
puts semantic_versioning_notice(repo_id, data[:name]) if data[:tag] == 'HEAD' puts semantic_versioning_notice(repo_id, data[:name]) if data[:tag] == 'HEAD'
else else
...@@ -74,8 +73,8 @@ module Pod ...@@ -74,8 +73,8 @@ module Pod
clean_tag = tag.gsub(/^v(er)? ?/,'') clean_tag = tag.gsub(/^v(er)? ?/,'')
versions_tags[Gem::Version.new(clean_tag)] = tag if Gem::Version.correct?(clean_tag) versions_tags[Gem::Version.new(clean_tag)] = tag if Gem::Version.correct?(clean_tag)
end end
version = versions_tags.keys.sort.last || 'HEAD' version = versions_tags.keys.sort.last || '0.0.1'
tag = version == 'HEAD' ? '0.0.1' : versions_tags[version] tag = version == '0.0.1' ? 'HEAD' : versions_tags[version]
[tag, version.to_s] [tag, version.to_s]
end end
...@@ -102,7 +101,7 @@ module Pod ...@@ -102,7 +101,7 @@ module Pod
data = {} data = {}
data[:name] = name data[:name] = name
data[:version] = '0.0.1' data[:version] = '0.0.1'
data[:summary] = 'A short description of #{name}.' data[:summary] = "A short description of #{name}."
data[:homepage] = "http://EXAMPLE/#{name}" data[:homepage] = "http://EXAMPLE/#{name}"
data[:author_name] = `git config --get user.name`.strip data[:author_name] = `git config --get user.name`.strip
data[:author_email] = `git config --get user.email`.strip data[:author_email] = `git config --get user.email`.strip
......
...@@ -54,11 +54,11 @@ describe "Pod::Command" do ...@@ -54,11 +54,11 @@ describe "Pod::Command" do
spec = Pod::Specification.from_file(path) spec = Pod::Specification.from_file(path)
spec.name.should == 'Bananas' spec.name.should == 'Bananas'
spec.license.should == { :type => "MIT", :file => "LICENSE" } spec.license.should == { :type => "MIT", :file => "LICENSE" }
spec.version.should == Pod::Version.new('1.0.0') spec.version.should == Pod::Version.new('0.0.1')
spec.summary.should == 'A short description of Bananas.' spec.summary.should == 'A short description of Bananas.'
spec.homepage.should == 'http://EXAMPLE/Bananas' spec.homepage.should == 'http://EXAMPLE/Bananas'
spec.authors.should == { `git config --get user.name`.strip => `git config --get user.email`.strip, "other author" => "and email address" } spec.authors.should == { `git config --get user.name`.strip => `git config --get user.email`.strip}
spec.source.should == { :git => 'http://EXAMPLE/Bananas.git', :tag => '1.0.0' } spec.source.should == { :git => 'http://EXAMPLE/Bananas.git', :tag => '0.0.1' }
spec.description.should == 'An optional longer description of Bananas.' spec.description.should == 'An optional longer description of Bananas.'
spec.source_files.should == ['Classes', 'Classes/**/*.{h,m}'] spec.source_files.should == ['Classes', 'Classes/**/*.{h,m}']
end end
......
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