Commit cdecc32a authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' into b0.15.0

* master:
  [Specs] Minor fix for Command::Push.
  [Push] Use git! where possible.
  [Specs] fix for the fix that was supposed to fix Travis.
  [Specs] Fix for Travis issues.
  [Source] The name should be an attribute.
  [Specs] Fixed Travis errors related to Command::Repo.
  [Linter] Fixed minor bug.
  Update CHANGELOG.md
  Update lib/cocoapods/generator/acknowledgements/markdown.rb
  Update lib/cocoapods/generator/acknowledgements/markdown.rb
  [Linter] Promote long summary warning to an error.

Conflicts:
	lib/cocoapods/command/push.rb
parents 76cb703e a478de62
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
- In certain conditions pod setup would execute twice. - In certain conditions pod setup would execute twice.
- The git cache now is updated if a branch is not found - The git cache now is updated if a branch is not found
[#514](https://github.com/CocoaPods/CocoaPods/issues/514) [#514](https://github.com/CocoaPods/CocoaPods/issues/514)
- Forcing UTF-8 encoding on licenses generation in Ruby 1.9.
[#530](https://github.com/CocoaPods/CocoaPods/issues/530)
## 0.14.0 ## 0.14.0
......
...@@ -166,10 +166,11 @@ module Pod ...@@ -166,10 +166,11 @@ module Pod
messages << "Unrecognized platfrom" unless platform_valid? messages << "Unrecognized platfrom" unless platform_valid?
messages << "Missing name" unless spec.name messages << "Missing name" unless spec.name
messages << "Missing version" unless spec.version messages << "Missing version" unless spec.version
messages << "Missing summary" unless spec.summary messages << "Missing summary" if !spec.summary || spec.summary.empty?
messages << "Missing homepage" unless spec.homepage messages << "Missing homepage" unless spec.homepage
messages << "Missing author(s)" unless spec.authors messages << "Missing author(s)" unless spec.authors
messages << "Missing or invalid source: #{spec.source}" unless source_valid? messages << "Missing or invalid source: #{spec.source}" unless source_valid?
messages << "The summary should be short use `description` (max 140 characters)." if spec.summary && spec.summary.length > 140
# attributes with multiplatform values # attributes with multiplatform values
return messages unless platform_valid? return messages unless platform_valid?
...@@ -223,13 +224,11 @@ module Pod ...@@ -223,13 +224,11 @@ module Pod
messages << "Missing license type" unless license[:type] messages << "Missing license type" unless license[:type]
messages << "Sample license type" if license[:type] && license[:type] =~ /\(example\)/ messages << "Sample license type" if license[:type] && license[:type] =~ /\(example\)/
messages << "Invalid license type" if license[:type] && license[:type] =~ /\n/ messages << "Invalid license type" if license[:type] && license[:type] =~ /\n/
messages << "The summary is required" if spec.summary.empty?
messages << "The summary is not meaningful" if spec.summary =~ /A short description of/ messages << "The summary is not meaningful" if spec.summary =~ /A short description of/
messages << "The description is not meaningful" if spec.description && spec.description =~ /An optional longer description of/ messages << "The description is not meaningful" if spec.description && spec.description =~ /An optional longer description of/
messages << "The summary should end with a dot" if spec.summary !~ /.*\./ messages << "The summary should end with a dot" if spec.summary !~ /.*\./
messages << "The description should end with a dot" if spec.description !~ /.*\./ && spec.description != spec.summary messages << "The description should end with a dot" if spec.description !~ /.*\./ && spec.description != spec.summary
messages << "The summary should end with a dot" if spec.summary !~ /.*\./ messages << "The summary should end with a dot" if spec.summary !~ /.*\./
messages << "The summary should be short use `description` (max 140 characters)." if spec.summary.length > 140
messages << "Comments must be deleted" if text.scan(/^\s*#/).length > 24 messages << "Comments must be deleted" if text.scan(/^\s*#/).length > 24
messages << "Warnings must not be disabled (`-Wno' compiler flags)" if spec.compiler_flags.split(' ').any? {|flag| flag.start_with?('-Wno') } messages << "Warnings must not be disabled (`-Wno' compiler flags)" if spec.compiler_flags.split(' ').any? {|flag| flag.start_with?('-Wno') }
......
...@@ -43,6 +43,7 @@ module Pod ...@@ -43,6 +43,7 @@ module Pod
def update_repo def update_repo
UI.puts "Updating the `#{@repo}' repo\n".yellow unless config.silent UI.puts "Updating the `#{@repo}' repo\n".yellow unless config.silent
# show the output of git even if not verbose # show the output of git even if not verbose
# TODO: use the `git!' and find a way to show the output in realtime.
Dir.chdir(repo_dir) { UI.puts `git pull 2>&1` } Dir.chdir(repo_dir) { UI.puts `git pull 2>&1` }
end end
...@@ -97,9 +98,9 @@ module Pod ...@@ -97,9 +98,9 @@ module Pod
FileUtils.mkdir_p(output_path) FileUtils.mkdir_p(output_path)
FileUtils.cp(Pathname.new(spec.name+'.podspec'), output_path) FileUtils.cp(Pathname.new(spec.name+'.podspec'), output_path)
Dir.chdir(repo_dir) do Dir.chdir(repo_dir) do
git("add #{spec.name}") git!("add #{spec.name}")
# Bypass the pre-commit hook because we already performed validation # Bypass the pre-commit hook because we already performed validation
git("commit --no-verify -m '#{message}'") git!("commit --no-verify -m '#{message}'")
end end
end end
end end
......
...@@ -177,10 +177,10 @@ module Pod ...@@ -177,10 +177,10 @@ module Pod
output_path = sandbox.root + "Local Podspecs/#{name}.podspec" output_path = sandbox.root + "Local Podspecs/#{name}.podspec"
output_path.dirname.mkpath output_path.dirname.mkpath
if podspec.is_a?(String) if podspec.is_a?(String)
raise Informative, "No podspec found for `#{name}' in `#{description}'" unless podspec.include?('Spec.new') raise Informative, "No podspec found for `#{name}' in #{description}" unless podspec.include?('Spec.new')
output_path.open('w') { |f| f.puts(podspec) } output_path.open('w') { |f| f.puts(podspec) }
else else
raise Informative, "No podspec found for `#{name}' in `#{description}'" unless podspec.exist? raise Informative, "No podspec found for `#{name}' in #{description}" unless podspec.exist?
FileUtils.copy(podspec, output_path) FileUtils.copy(podspec, output_path)
end end
end end
......
...@@ -28,6 +28,7 @@ module Pod ...@@ -28,6 +28,7 @@ module Pod
licenses_string = "#{title_from_string(header_title, 1)}\n#{header_text}\n" licenses_string = "#{title_from_string(header_title, 1)}\n#{header_text}\n"
@pods.each do |pod| @pods.each do |pod|
if (license = string_for_pod(pod)) if (license = string_for_pod(pod))
license = license.force_encoding("UTF-8") if license.respond_to?(:force_encoding)
licenses_string += license licenses_string += license
end end
end end
......
...@@ -18,10 +18,6 @@ module Pod ...@@ -18,10 +18,6 @@ module Pod
end end
end end
def names
dirs.map { |repo| repo.basename.to_s }.sort
end
def all_sets def all_sets
all.map(&:pod_sets).flatten all.map(&:pod_sets).flatten
end end
...@@ -58,16 +54,16 @@ module Pod ...@@ -58,16 +54,16 @@ module Pod
Aggregate.new.search_by_name(name, full_text_search) Aggregate.new.search_by_name(name, full_text_search)
end end
def self.names
Aggregate.new.names
end
attr_reader :repo attr_reader :repo
def initialize(repo) def initialize(repo)
@repo = repo @repo = repo
end end
def name
@repo.basename.to_s
end
def pod_sets def pod_sets
@repo.children.map do |child| @repo.children.map do |child|
if child.directory? && child.basename.to_s != '.git' if child.directory? && child.basename.to_s != '.git'
......
...@@ -44,9 +44,9 @@ describe Pod::Command::Push do ...@@ -44,9 +44,9 @@ describe Pod::Command::Push do
git_config('local_repo', 'remote.origin.url').should == (tmp_repos_path + 'upstream').to_s git_config('local_repo', 'remote.origin.url').should == (tmp_repos_path + 'upstream').to_s
# prepare the spec # prepare the spec
spec_fix = (fixture('spec-repos') + 'master/JSONKit/1.4/JSONKit.podspec').read spec = (fixture('spec-repos') + 'master/JSONKit/1.4/JSONKit.podspec').read
spec_add = spec_fix.gsub(/https:\/\/github\.com\/johnezang\/JSONKit\.git/, fixture('integration/JSONKit').to_s) spec_fix = spec.gsub(/https:\/\/github\.com\/johnezang\/JSONKit\.git/, fixture('integration/JSONKit').to_s)
spec_add.gsub!(/'JSONKit'/, "'PushTest'") spec_add = spec.gsub(/'JSONKit'/, "'PushTest'")
File.open(temporary_directory + 'JSONKit.podspec', 'w') {|f| f.write(spec_fix) } File.open(temporary_directory + 'JSONKit.podspec', 'w') {|f| f.write(spec_fix) }
File.open(temporary_directory + 'PushTest.podspec', 'w') {|f| f.write(spec_add) } File.open(temporary_directory + 'PushTest.podspec', 'w') {|f| f.write(spec_add) }
end end
......
...@@ -78,35 +78,40 @@ describe "Pod::Command::Repo" do ...@@ -78,35 +78,40 @@ describe "Pod::Command::Repo" do
tmp_repos_path + "repo1/CocoaPods-version.yml" tmp_repos_path + "repo1/CocoaPods-version.yml"
end end
def write_version_file(hash)
yaml = YAML.dump(hash)
File.open(versions_file, 'w') {|f| f.write(yaml) }
end
it "it doesn't requires CocoaPods-version.yml" do it "it doesn't requires CocoaPods-version.yml" do
lambda { run_command('repo', 'update') }.should.not.raise cmd = command('repo', 'update')
lambda { cmd.check_versions(versions_file.dirname) }.should.not.raise
end end
it "runs with a compatible repo" do it "runs with a compatible repo" do
yaml = YAML.dump({'min' => "0.0.1"}) write_version_file({'min' => "0.0.1"})
File.open(versions_file, 'w') {|f| f.write(yaml) } cmd = command('repo', 'update')
lambda { run_command('repo', 'update') }.should.not.raise lambda { cmd.check_versions(versions_file.dirname) }.should.not.raise
end end
it "raises if a repo is not compatible" do it "raises if a repo is not compatible" do
yaml = YAML.dump({'min' => "999.0.0"}) write_version_file({'min' => "999.0.0"})
File.open(versions_file, 'w') {|f| f.write(yaml) } cmd = command('repo', 'update')
lambda { run_command('repo', 'update') }.should.raise Pod::Informative lambda { cmd.check_versions(versions_file.dirname) }.should.raise Pod::Informative
end end
it "informs about a higher known CocoaPods version" do it "informs about a higher known CocoaPods version" do
yaml = YAML.dump({'last' => "999.0.0"}) write_version_file({'last' => "999.0.0"})
File.open(versions_file, 'w') {|f| f.write(yaml) } cmd = command('repo', 'update')
run_command('repo', 'update').should.include "Cocoapods 999.0.0 is available" cmd.check_versions(versions_file.dirname)
cmd.output.should.include "Cocoapods 999.0.0 is available"
end end
it "has a class method that returns if a repo is supported" do it "has a class method that returns if a repo is supported" do
yaml = YAML.dump({'min' => "999.0.0"}) write_version_file({'min' => "999.0.0"})
File.open(versions_file, 'w') {|f| f.write(yaml) }
Pod::Command::Repo.compatible?('repo1').should == false Pod::Command::Repo.compatible?('repo1').should == false
yaml = YAML.dump({'min' => "0.0.1"}) write_version_file({'min' => "0.0.1"})
File.open(versions_file, 'w') {|f| f.write(yaml) }
Pod::Command::Repo.compatible?('repo1').should == true Pod::Command::Repo.compatible?('repo1').should == true
end end
end end
......
...@@ -30,6 +30,7 @@ module SpecHelper ...@@ -30,6 +30,7 @@ module SpecHelper
def add_repo(name, from) def add_repo(name, from)
command = command('repo', 'add', name, from) command = command('repo', 'add', name, from)
command.run command.run
# The test branch is used by the push specs
Dir.chdir(command.dir) do Dir.chdir(command.dir) do
`git checkout -b test >/dev/null 2>&1` `git checkout -b test >/dev/null 2>&1`
`git branch --set-upstream test origin/master >/dev/null 2>&1` `git branch --set-upstream test origin/master >/dev/null 2>&1`
......
...@@ -38,6 +38,6 @@ describe "Pod::Source" do ...@@ -38,6 +38,6 @@ describe "Pod::Source" do
end end
it "return the names of the repos" do it "return the names of the repos" do
Pod::Source.names.should == %w| repo1 repo2 | Pod::Source.all.map(&:name).should == %w| repo1 repo2 |
end end
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