Commit 8d29a372 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' into b0.15.0

* master:
  [Repo] Use raising bang variant for git operations.
  [Source] Allow the specify the master repo dir from an environment variable.
  [Linter] Improved checks for the summary and the git tag.
  [Repo] Fix banner.
  [Source] list the name of the repos.
  [Changelog]
  [Config] Added update_notification attribute.
  Support extracting .tar.bz2 files
parents 4bee32b8 616e3db4
......@@ -18,6 +18,12 @@
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.14.0...master)
###### Enhancements
- Added config option to disable the new version available message.
[#448](https://github.com/CocoaPods/CocoaPods/issues/448)
- Added support for extracting `.tar.bz2` files
[#522](https://github.com/CocoaPods/CocoaPods/issues/522)
###### Bug fixes
- In certain conditions pod setup would execute twice.
- The git cache now is updated if a branch is not found
......
......@@ -223,15 +223,22 @@ module Pod
messages << "Missing license type" unless license[:type]
messages << "Sample license type" if license[:type] && license[:type] =~ /\(example\)/
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 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 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 be short use `description` (max 140 characters)." if spec.summary.length > 140
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') }
if (git_source = source[:git])
messages << "Git sources should specify either a tag or a commit" unless source[:commit] || source[:tag]
if spec.version.to_s != '0.0.1'
messages << "The version of the spec should be part of the git tag (not always applicable)" if source[:tag] && !source[:tag].include?(spec.version.to_s)
messages << "Git sources without tag should be marked as 0.0.1 (not always applicable)" if !source[:tag]
end
if git_source.include?('github.com')
messages << "Github repositories should end in `.git'" unless git_source.end_with?('.git')
messages << "Github repositories should use `https' link" unless git_source.start_with?('https://github.com') || git_source.start_with?('git://gist.github.com')
......
......@@ -16,7 +16,7 @@ module Pod
Updates the local clone of the spec-repo `NAME'. If `NAME' is omitted
this will update all spec-repos in `~/.cocoapods'.
$ pod repo update [NAME | DIRECTORY]
$ pod repo lint [NAME | DIRECTORY]
Lints the spec-repo `NAME'. If a directory is provided it is assumed
to be the root of a repo. Finally, if NAME is not provided this will
......@@ -58,8 +58,8 @@ module Pod
def add
print_subtitle "Cloning spec repo `#{@name}' from `#{@url}'#{" (branch `#{@branch}')" if @branch}"
config.repos_dir.mkpath
Dir.chdir(config.repos_dir) { git("clone '#{@url}' #{@name}") }
Dir.chdir(dir) { git("checkout #{@branch}") } if @branch
Dir.chdir(config.repos_dir) { git!("clone '#{@url}' #{@name}") }
Dir.chdir(dir) { git!("checkout #{@branch}") } if @branch
check_versions(dir)
end
......@@ -70,7 +70,7 @@ module Pod
Dir.chdir(dir) do
`git rev-parse >/dev/null 2>&1`
if $?.exitstatus.zero?
git("pull")
git!("pull")
else
puts(" Not a git repository") if config.verbose?
end
......@@ -142,7 +142,7 @@ module Pod
"\n[!] The `#{dir.basename.to_s}' repo requires CocoaPods #{version_msg}\n".red +
"Update Cocoapods, or checkout the appropriate tag in the repo.\n\n"
end
puts "\nCocoapods #{versions['last']} is available.\n".green if has_update(versions)
puts "\nCocoapods #{versions['last']} is available.\n".green if has_update(versions) && config.new_version_message?
end
def self.compatible?(name)
......
......@@ -14,7 +14,7 @@ module Pod
attr_accessor :clean, :verbose, :silent
attr_accessor :generate_docs, :doc_install
attr_accessor :integrate_targets
attr_accessor :git_cache_size
attr_accessor :new_version_message
alias_method :clean?, :clean
alias_method :verbose?, :verbose
......@@ -22,11 +22,12 @@ module Pod
alias_method :generate_docs?, :generate_docs
alias_method :doc_install?, :doc_install
alias_method :integrate_targets?, :integrate_targets
alias_method :new_version_message?, :new_version_message
def initialize
@repos_dir = Pathname.new(File.expand_path("~/.cocoapods"))
@verbose = @silent = false
@clean = @generate_docs = @doc_install = @integrate_targets = true
@clean = @generate_docs = @doc_install = @integrate_targets = @new_version_message = true
end
def project_root
......
......@@ -34,6 +34,8 @@ module Pod
:tgz
elsif url =~ /.tar$/
:tar
elsif url =~ /.(tbz|tar\.bz2)$/
:tbz
else
nil
end
......@@ -47,6 +49,8 @@ module Pod
"file.tgz"
when :tar
"file.tar"
when :tbz
"file.tbz"
else
raise UnsupportedFileTypeError.new "Unsupported file type: #{type}"
end
......@@ -64,6 +68,8 @@ module Pod
tar! "xfz '#{full_filename}' -C '#{target_path}'"
when :tar
tar! "xf '#{full_filename}' -C '#{target_path}'"
when :tbz
tar! "xfj '#{full_filename}' -C '#{target_path}'"
else
raise UnsupportedFileTypeError.new "Unsupported file type: #{type}"
end
......
......@@ -2,16 +2,26 @@ module Pod
class Source
class Aggregate
def all
@sources ||= begin
@sources ||= dirs.map { |repo| Source.new(repo) }
end
def dirs
if ENV['CP_MASTER_REPO_DIR']
[Pathname.new(ENV['CP_MASTER_REPO_DIR'])]
else
repos_dir = Config.instance.repos_dir
unless repos_dir.exist?
raise Informative, "No spec repos found in `#{repos_dir}'. " \
"To fetch the `master' repo run: $ pod setup"
"To fetch the `master' repo run: $ pod setup"
end
repos_dir.children.select(&:directory?).map { |repo| Source.new(repo) }
repos_dir.children.select(&:directory?)
end
end
def names
dirs.map { |repo| repo.basename.to_s }.sort
end
def all_sets
all.map(&:pod_sets).flatten
end
......@@ -48,6 +58,10 @@ module Pod
Aggregate.new.search_by_name(name, full_text_search)
end
def self.names
Aggregate.new.names
end
attr_reader :repo
def initialize(repo)
......
......@@ -32,6 +32,12 @@ describe Pod::Downloader::Http do
downloader.should.be.instance_of Pod::Downloader::Http
downloader.type.should == :tgz
downloader = Pod::Downloader.for_pod(stub_pod_with_source(
:http => 'http://www.kernel.org/pub/linux/kernel/v1.0/linux-1.0.tar.bz2'
))
downloader.should.be.instance_of Pod::Downloader::Http
downloader.type.should == :tbz
downloader = Pod::Downloader.for_pod(stub_pod_with_source(
:http => 'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0',
:type => :zip
......@@ -54,6 +60,13 @@ describe Pod::Downloader::Http do
downloader.expects(:download_file).with(anything())
downloader.expects(:extract_with_type).with(anything(), :tgz).at_least_once
downloader.download
downloader = Pod::Downloader.for_pod(stub_pod_with_source(
:http => 'http://www.kernel.org/pub/linux/kernel/v1.0/linux-1.0.tar.bz2'
))
downloader.expects(:download_file).with(anything())
downloader.expects(:extract_with_type).with(anything(), :tbz).at_least_once
downloader.download
end
it 'should raise error when unsupported filetype is pass' do
......
......@@ -36,4 +36,8 @@ describe "Pod::Source" do
Pod::Source.search(Pod::Dependency.new('RestKit/DoesNotExist'))
}.should.raise Pod::Informative
end
it "return the names of the repos" do
Pod::Source.names.should == %w| repo1 repo2 |
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