cocoapods-downloader 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of cocoapods-downloader might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e28fef84925c83ab93ce7cb957dc72bbdfa737c
4
- data.tar.gz: 4818acececd068574baf57d8814b59b17a1ec582
3
+ metadata.gz: 6f28eb1ab8b3da09fd0ad05abdd2b524aa81e329
4
+ data.tar.gz: 91e761ece6ef2da8f5b4086e2f9961cd66dc4daf
5
5
  SHA512:
6
- metadata.gz: 493f42df8b9495d6ebd51ef7958e7ca544f23fb7c1d4eaa573192184952728f3baa65341ae6319b1f87786199c5db1a39a3d3a6494c11ba4a82d11192e5f32f7
7
- data.tar.gz: 2a306f3a6c3c8cef9fcfd3490d3e3dda876d6785c478cdf74bad15e627f5829efa61c05fb3ae9c3fb1f1fb2c724bb711ae49ace5b7d5f5eea44a75600fc0d2ac
6
+ metadata.gz: 504d84edc7468bc3daebac5778ebd984425c703175a21cd0df78a34d9911a8cd92128e7e3700ec8b671323862457a43c6fe4bbed26bb80fe0278cc7af126658b
7
+ data.tar.gz: 68479c06a8cf758c63851155bea0413d43ea15e62afbca1c35d5d8a25c93d5449ed271562087dbd1b2f3a256720ae8340c6c9bcc6464b23b528589bd2fe7400f
@@ -2,8 +2,9 @@
2
2
 
3
3
  A small library for downloading files from remotes in a folder.
4
4
 
5
- [![Build Status](https://travis-ci.org/CocoaPods/cocoapods-downloader.png?branch=master)](https://travis-ci.org/CocoaPods/cocoapods-downloader)
6
- [![Coverage Status](https://coveralls.io/repos/CocoaPods/cocoapods-downloader/badge.png?branch=master)](https://coveralls.io/r/CocoaPods/cocoapods-downloader)
5
+ [![Build Status](https://travis-ci.org/CocoaPods/cocoapods-downloader.svg?branch=master)](https://travis-ci.org/CocoaPods/cocoapods-downloader)
6
+ [![Coverage Status](http://img.shields.io/coveralls/CocoaPods/cocoapods-downloader.svg)](https://coveralls.io/r/CocoaPods/cocoapods-downloader)
7
+ [![Code Climate](http://img.shields.io/codeclimate/github/CocoaPods/cocoapods-downloader.svg)](https://codeclimate.com/github/CocoaPods/cocoapods-downloader)
7
8
 
8
9
  ## Install
9
10
 
@@ -18,7 +19,7 @@ require 'cocoapods-downloader'
18
19
 
19
20
  target_path = './Downloads/MyDownload'
20
21
  options = { :git => 'example.com' }
21
- downloader = Pod::Downloaders.for_target(target_path, options)
22
+ downloader = Pod::Downloader.for_target(target_path, options)
22
23
  downloader.cache_root = '~/Library/Caches/APPNAME'
23
24
  downloader.max_cache_size = 500
24
25
  downloader.download
@@ -30,7 +31,7 @@ The downloader class supports the following option keys:
30
31
  - git: commit, tag, branch, submodules
31
32
  - hg: revision
32
33
  - bzr: revision, tag
33
- - svn: revision, tag, folder
34
+ - svn: revision, tag, folder, externals
34
35
  - http: type
35
36
 
36
37
  The downloader also provides hooks which allow to customize its output or the way in which the commands are executed
@@ -1,4 +1,3 @@
1
-
2
1
  module Pod
3
2
  module Downloader
4
3
  require 'cocoapods-downloader/gem_version'
@@ -1,3 +1,13 @@
1
+ require "shellwords"
2
+
3
+ class Pathname
4
+ # @return [String] a version of the path that is escaped to be safe to use in
5
+ # a shell.
6
+ def shellescape
7
+ to_s.shellescape
8
+ end
9
+ end
10
+
1
11
  module Pod
2
12
  module Downloader
3
13
 
@@ -21,6 +21,9 @@ module Pod
21
21
 
22
22
  private
23
23
 
24
+ # @group Private Helpers
25
+ #-----------------------------------------------------------------------#
26
+
24
27
  executable :bzr
25
28
 
26
29
  def download!
@@ -34,18 +37,26 @@ module Pod
34
37
  end
35
38
 
36
39
  def download_head!
37
- bzr! %|branch "#{url}" #{dir_opts} "#{target_path}"|
40
+ bzr! %|branch "#{url}" #{dir_opts} #{@target_path.shellescape}|
38
41
  end
39
42
 
40
43
  def download_revision!(rev)
41
- bzr! %|branch "#{url}" #{dir_opts} -r '#{rev}' "#{target_path}"|
44
+ bzr! %|branch "#{url}" #{dir_opts} -r '#{rev}' #{@target_path.shellescape}|
42
45
  end
43
46
 
47
+ # @return [String] The command line flags to use according to whether the
48
+ # target path exits.
49
+ #
44
50
  def dir_opts
45
- return '--use-existing-dir' if @target_path.exist?
46
- ''
51
+ if @target_path.exist?
52
+ '--use-existing-dir'
53
+ else
54
+ ''
55
+ end
47
56
  end
48
57
 
58
+ #-----------------------------------------------------------------------#
59
+
49
60
  end
50
61
  end
51
62
  end
@@ -4,7 +4,7 @@ module Pod
4
4
  # @return [String] Downloader’s version, following
5
5
  # [semver](http://semver.org).
6
6
  #
7
- VERSION = '0.3.0'
7
+ VERSION = '0.4.0'
8
8
 
9
9
  end
10
10
  end
@@ -64,7 +64,7 @@ module Pod
64
64
  #
65
65
  def clone(from, to, flags = '')
66
66
  ui_sub_action("Cloning to Pods folder") do
67
- command = %Q|clone "#{from}" "#{to}"|
67
+ command = %Q|clone #{from} #{to.shellescape}|
68
68
  command << ' ' + flags if flags
69
69
  git!(command)
70
70
  end
@@ -20,7 +20,7 @@ module Pod
20
20
 
21
21
  def download!
22
22
  @filename = filename_with_type(type)
23
- @download_path = target_path + @filename
23
+ @download_path = (target_path + @filename)
24
24
  download_file(@download_path)
25
25
  extract_with_type(@download_path, type)
26
26
  end
@@ -84,29 +84,31 @@ module Pod
84
84
  end
85
85
 
86
86
  def download_file(full_filename)
87
- curl! "-L -o '#{full_filename}' '#{url}'"
87
+ curl! %|-L -o #{full_filename.shellescape} #{url} --create-dirs|
88
88
  end
89
89
 
90
90
  def extract_with_type(full_filename, type=:zip)
91
+ unpack_from = full_filename.shellescape
92
+ unpack_to = @target_path.shellescape
91
93
  case type
92
94
  when :zip
93
- unzip! "'#{full_filename}' -d '#{target_path}'"
95
+ unzip! %|#{unpack_from} -d #{unpack_to}|
94
96
  when :tgz
95
- tar! "xfz '#{full_filename}' -C '#{target_path}'"
97
+ tar! %|xfz #{unpack_from} -C #{unpack_to}|
96
98
  when :tar
97
- tar! "xf '#{full_filename}' -C '#{target_path}'"
99
+ tar! %|xf #{unpack_from} -C #{unpack_to}|
98
100
  when :tbz
99
- tar! "xfj '#{full_filename}' -C '#{target_path}'"
101
+ tar! %|xfj #{unpack_from} -C #{unpack_to}|
100
102
  when :txz
101
- tar! "xf '#{full_filename}' -C '#{target_path}'"
103
+ tar! %|xf #{unpack_from} -C #{unpack_to}|
102
104
  else
103
105
  raise UnsupportedFileTypeError.new "Unsupported file type: #{type}"
104
106
  end
105
107
 
106
108
  # If the archive is a tarball and it only contained a folder, move its contents to the target (#727)
107
109
  if should_flatten?
108
- contents = target_path.children
109
- contents.delete(full_filename)
110
+ contents = @target_path.children
111
+ contents.delete(target_path + @filename)
110
112
  entry = contents.first
111
113
  if contents.count == 1 && entry.directory?
112
114
  FileUtils.move(entry.children, target_path)
@@ -32,11 +32,11 @@ module Pod
32
32
  end
33
33
 
34
34
  def download_head!
35
- hg! %|clone "#{url}" "#{target_path}"|
35
+ hg! %|clone #{url} #{@target_path.shellescape}|
36
36
  end
37
37
 
38
38
  def download_revision!
39
- hg! %|clone "#{url}" --rev '#{options[:revision]}' "#{target_path}"|
39
+ hg! %|clone "#{url}" --rev '#{options[:revision]}' #{@target_path.shellescape}|
40
40
  end
41
41
 
42
42
  end
@@ -3,7 +3,7 @@ module Pod
3
3
  class Subversion < Base
4
4
 
5
5
  def self.options
6
- [:revision, :tag, :folder]
6
+ [:revision, :tag, :folder, :externals]
7
7
  end
8
8
 
9
9
  def options_specific?
@@ -23,12 +23,12 @@ module Pod
23
23
  executable :svn
24
24
 
25
25
  def download!
26
- output = svn!(%|#{export_subcommand} "#{reference_url}" "#{target_path}"|)
26
+ output = svn!(%|#{export_subcommand} "#{reference_url}" #{@target_path.shellescape}|)
27
27
  store_exported_revision(output)
28
28
  end
29
29
 
30
30
  def download_head!
31
- output = svn!(%|#{export_subcommand} "#{trunk_url}" "#{target_path}"|)
31
+ output = svn!(%|#{export_subcommand} "#{trunk_url}" #{@target_path.shellescape}|)
32
32
  store_exported_revision(output)
33
33
  end
34
34
 
@@ -39,6 +39,8 @@ module Pod
39
39
 
40
40
  def export_subcommand
41
41
  result = 'export --non-interactive --trust-server-cert --force'
42
+ result << ' --ignore-externals' if options[:externals] == false
43
+ result
42
44
  end
43
45
 
44
46
  def reference_url
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-downloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-24 00:00:00.000000000 Z
12
+ date: 2014-03-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email:
@@ -19,6 +19,9 @@ executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
+ - LICENSE
23
+ - README.markdown
24
+ - lib/cocoapods-downloader.rb
22
25
  - lib/cocoapods-downloader/api.rb
23
26
  - lib/cocoapods-downloader/api_exposable.rb
24
27
  - lib/cocoapods-downloader/base.rb
@@ -28,9 +31,6 @@ files:
28
31
  - lib/cocoapods-downloader/http.rb
29
32
  - lib/cocoapods-downloader/mercurial.rb
30
33
  - lib/cocoapods-downloader/subversion.rb
31
- - lib/cocoapods-downloader.rb
32
- - README.markdown
33
- - LICENSE
34
34
  homepage: https://github.com/CocoaPods/Downloader
35
35
  licenses:
36
36
  - MIT
@@ -41,17 +41,17 @@ require_paths:
41
41
  - lib
42
42
  required_ruby_version: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  requirements:
49
- - - '>='
49
+ - - ">="
50
50
  - !ruby/object:Gem::Version
51
51
  version: '0'
52
52
  requirements: []
53
53
  rubyforge_project:
54
- rubygems_version: 2.0.3
54
+ rubygems_version: 2.2.2
55
55
  signing_key:
56
56
  specification_version: 3
57
57
  summary: A small library for downloading files from remotes in a folder.