cocoapods 0.16.4 → 0.17.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +108 -0
  3. data/README.md +3 -3
  4. data/bin/pod +1 -1
  5. data/lib/cocoapods.rb +31 -31
  6. data/lib/cocoapods/command.rb +62 -107
  7. data/lib/cocoapods/command/inter_process_communication.rb +103 -0
  8. data/lib/cocoapods/command/list.rb +45 -44
  9. data/lib/cocoapods/command/outdated.rb +28 -25
  10. data/lib/cocoapods/command/project.rb +90 -0
  11. data/lib/cocoapods/command/push.rb +50 -32
  12. data/lib/cocoapods/command/repo.rb +125 -155
  13. data/lib/cocoapods/command/search.rb +23 -12
  14. data/lib/cocoapods/command/setup.rb +103 -64
  15. data/lib/cocoapods/command/spec.rb +329 -90
  16. data/lib/cocoapods/config.rb +197 -44
  17. data/lib/cocoapods/downloader.rb +47 -34
  18. data/lib/cocoapods/executable.rb +98 -41
  19. data/lib/cocoapods/external_sources.rb +325 -0
  20. data/lib/cocoapods/file_list.rb +8 -1
  21. data/lib/cocoapods/gem_version.rb +7 -0
  22. data/lib/cocoapods/generator/acknowledgements.rb +71 -7
  23. data/lib/cocoapods/generator/acknowledgements/markdown.rb +10 -9
  24. data/lib/cocoapods/generator/acknowledgements/plist.rb +9 -8
  25. data/lib/cocoapods/generator/copy_resources_script.rb +2 -2
  26. data/lib/cocoapods/generator/documentation.rb +153 -37
  27. data/lib/cocoapods/generator/prefix_header.rb +82 -0
  28. data/lib/cocoapods/generator/target_header.rb +58 -0
  29. data/lib/cocoapods/generator/xcconfig.rb +130 -0
  30. data/lib/cocoapods/hooks/installer_representation.rb +123 -0
  31. data/lib/cocoapods/hooks/library_representation.rb +79 -0
  32. data/lib/cocoapods/hooks/pod_representation.rb +74 -0
  33. data/lib/cocoapods/installer.rb +398 -147
  34. data/lib/cocoapods/installer/analyzer.rb +556 -0
  35. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +253 -0
  36. data/lib/cocoapods/installer/file_references_installer.rb +179 -0
  37. data/lib/cocoapods/installer/pod_source_installer.rb +289 -0
  38. data/lib/cocoapods/installer/target_installer.rb +307 -112
  39. data/lib/cocoapods/installer/user_project_integrator.rb +140 -176
  40. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +193 -0
  41. data/lib/cocoapods/library.rb +195 -0
  42. data/lib/cocoapods/open_uri.rb +16 -14
  43. data/lib/cocoapods/project.rb +175 -52
  44. data/lib/cocoapods/resolver.rb +151 -164
  45. data/lib/cocoapods/sandbox.rb +276 -54
  46. data/lib/cocoapods/sandbox/file_accessor.rb +210 -0
  47. data/lib/cocoapods/sandbox/headers_store.rb +96 -0
  48. data/lib/cocoapods/sandbox/path_list.rb +178 -0
  49. data/lib/cocoapods/sources_manager.rb +218 -0
  50. data/lib/cocoapods/user_interface.rb +82 -18
  51. data/lib/cocoapods/{command → user_interface}/error_report.rb +5 -5
  52. data/lib/cocoapods/validator.rb +379 -0
  53. metadata +74 -55
  54. data/lib/cocoapods/command/install.rb +0 -55
  55. data/lib/cocoapods/command/linter.rb +0 -317
  56. data/lib/cocoapods/command/update.rb +0 -25
  57. data/lib/cocoapods/dependency.rb +0 -285
  58. data/lib/cocoapods/downloader/git.rb +0 -276
  59. data/lib/cocoapods/downloader/http.rb +0 -99
  60. data/lib/cocoapods/downloader/mercurial.rb +0 -26
  61. data/lib/cocoapods/downloader/subversion.rb +0 -42
  62. data/lib/cocoapods/local_pod.rb +0 -620
  63. data/lib/cocoapods/lockfile.rb +0 -274
  64. data/lib/cocoapods/platform.rb +0 -127
  65. data/lib/cocoapods/podfile.rb +0 -551
  66. data/lib/cocoapods/source.rb +0 -223
  67. data/lib/cocoapods/specification.rb +0 -579
  68. data/lib/cocoapods/specification/set.rb +0 -175
  69. data/lib/cocoapods/specification/statistics.rb +0 -112
  70. data/lib/cocoapods/user_interface/ui_pod.rb +0 -130
  71. data/lib/cocoapods/version.rb +0 -26
@@ -1,175 +0,0 @@
1
- require 'active_support/core_ext/array/conversions'
2
-
3
- module Pod
4
- class Specification
5
-
6
- # A Specification::Set is resposible of handling all the specifications of
7
- # a Pod. This class stores the information of the dependencies that reuired
8
- # a Pod in the resolution process.
9
- #
10
- # @note The alpahbetical order of the sets is used to select a specification
11
- # if multiple are available for a given version.
12
- #
13
- # @note The set class is not and should be not aware of the backing store
14
- # of a Source.
15
- #
16
- class Set
17
-
18
- # @return [String] The name of the Pod.
19
- #
20
- attr_reader :name
21
-
22
- # @return [Array<Source>] The sources that contain the specifications for
23
- # the available versions of a Pod.
24
- #
25
- attr_reader :sources
26
-
27
- # @param [String] name The name of the Pod.
28
- #
29
- # @param [Array<Source>,Source] sources
30
- # The sources that contain a Pod.
31
- #
32
- def initialize(name, sources)
33
- @name = name
34
- sources = sources.is_a?(Array) ? sources : [sources]
35
- @sources = sources.sort_by(&:name)
36
- @required_by = []
37
- @dependencies = []
38
- end
39
-
40
- # @return [void] Stores a dependency on the Pod.
41
- #
42
- # @param [Dependency] dependency A dependency that requires the Pod.
43
- #
44
- # @param [String] dependent_name The name of the owner of the
45
- # dependency. It is used only to display
46
- # the Pod::Informative.
47
- #
48
- # @raises If the versions requirement of the dependency are not
49
- # compatible with the previously stored dependencies.
50
- #
51
- def required_by(dependency, dependent_name)
52
- unless @required_by.empty? || dependency.requirement.satisfied_by?(Gem::Version.new(required_version.to_s))
53
- raise Informative, "#{dependent_name} tries to activate `#{dependency}', but already activated version `#{required_version}' by #{@required_by.to_sentence}."
54
- end
55
- @specification = nil
56
- @required_by << dependent_name
57
- @dependencies << dependency
58
- end
59
-
60
- # @return [Dependency] A dependency including all the versions
61
- # requirements of the stored dependencies.
62
- #
63
- def dependency
64
- @dependencies.inject(Dependency.new(name)) do |previous, dependency|
65
- previous.merge(dependency.to_top_level_spec_dependency)
66
- end
67
- end
68
-
69
- # @return [Specification] The specification for the given subspec name,
70
- # from {specification}.
71
- #
72
- # @param [String] name The name of the specification. It can be the
73
- # name of the top level parent or the name of a
74
- # subspec.
75
- #
76
- # @see specification
77
- #
78
- def specification_by_name(name)
79
- specification.top_level_parent.subspec_by_name(name)
80
- end
81
-
82
- # @return [Specification] The top level specification of the Pod for the
83
- # {required_version}.
84
- #
85
- # @note If multiple sources have a specification for the
86
- # {required_version} The alpahbetical order of their names is used
87
- # to disambiguate.
88
- #
89
- def specification
90
- unless @specification
91
- sources = []
92
- versions_by_source.each{ |source, versions| sources << source if versions.include?(required_version) }
93
- source = sources.sort_by(&:name).first
94
- @specification = source.specification(name, required_version)
95
- end
96
- @specification
97
- end
98
-
99
- # @return [Version] The highest version that satisfies {dependency}.
100
- #
101
- def required_version
102
- versions.find { |v| dependency.match?(name, v) } ||
103
- raise(Informative, "Required version (#{dependency}) not found for `#{name}'.\nAvailable versions: #{versions.join(', ')}")
104
- end
105
-
106
- # @return [Array<Version>] All the available versions for the Pod, sorted
107
- # from highest to lowest.
108
- #
109
- def versions
110
- versions_by_source.values.flatten.uniq.sort.reverse
111
- end
112
-
113
- # @return [Hash{Source => Version}] All the available versions for the
114
- # Pod groupped by source.
115
- #
116
- def versions_by_source
117
- result = {}
118
- sources.each do |source|
119
- result[source] = source.versions(name)
120
- end
121
- result
122
- end
123
-
124
- def ==(other)
125
- self.class === other && @name == other.name && @sources.map(&:name) == other.sources.map(&:name)
126
- end
127
-
128
- def to_s
129
- "#<#{self.class.name} for `#{name}' with required version `#{required_version}' available at `#{sources.map(&:name) * ', '}'>"
130
- end
131
- alias_method :inspect, :to_s
132
-
133
- # The Set::External class handles Pods from external sources. Pods from
134
- # external sources don't use the {Pod::Sources} and are intialized by a
135
- # given specification.
136
- #
137
- # @note External sources *don't* support subspecs.
138
- #
139
- class External < Set
140
- def initialize(specification)
141
- @specification = specification
142
- @required_by = []
143
- @dependencies = []
144
- end
145
-
146
- def name
147
- @specification.top_level_parent.name
148
- end
149
-
150
- def ==(other)
151
- self.class === other && @specification == other.specification
152
- end
153
-
154
- def required_by(dependency, dependent_name)
155
- before = @specification
156
- super(dependency, dependent_name)
157
- ensure
158
- @specification = before
159
- end
160
-
161
- def specification_path
162
- raise "specification_path"
163
- end
164
-
165
- def specification
166
- @specification
167
- end
168
-
169
- def versions
170
- [@specification.version]
171
- end
172
- end
173
- end
174
- end
175
- end
@@ -1,112 +0,0 @@
1
- require 'yaml'
2
-
3
- # This is to make sure Faraday doesn't warn the user about the `system_timer` gem missing.
4
- old_warn, $-w = $-w, nil
5
- begin
6
- require 'faraday'
7
- ensure
8
- $-w = old_warn
9
- end
10
- require 'octokit'
11
-
12
- module Pod
13
- class Specification
14
- class Statistics
15
-
16
- def self.instance
17
- @instance ||= new
18
- end
19
-
20
- def self.instance=(instance)
21
- @instance = instance
22
- end
23
-
24
- attr_accessor :cache_file, :cache_expiration
25
-
26
- def initialize
27
- @cache_file = Config.instance.repos_dir + 'statistics.yml'
28
- @cache_expiration = 60 * 60 * 24 * 3
29
- end
30
-
31
- def creation_date(set)
32
- compute_creation_date(set)
33
- end
34
-
35
- def creation_dates(sets)
36
- dates = {}
37
- sets.each { |set| dates[set.name] = compute_creation_date(set, false) }
38
- save_cache
39
- dates
40
- end
41
-
42
- def github_watchers(set)
43
- github_stats_if_needed(set)
44
- get_value(set, :gh_watchers)
45
- end
46
-
47
- def github_forks(set)
48
- github_stats_if_needed(set)
49
- get_value(set, :gh_forks)
50
- end
51
-
52
- def github_pushed_at(set)
53
- github_stats_if_needed(set)
54
- get_value(set, :pushed_at)
55
- end
56
-
57
- private
58
-
59
- def cache
60
- @cache ||= cache_file && cache_file.exist? ? YAML::load(cache_file.read) : {}
61
- end
62
-
63
- def get_value(set, key)
64
- if cache[set.name] && cache[set.name][key]
65
- cache[set.name][key]
66
- end
67
- end
68
-
69
- def set_value(set, key, value)
70
- cache[set.name] ||= {}
71
- cache[set.name][key] = value
72
- end
73
-
74
- def save_cache
75
- File.open(cache_file, 'w') { |f| f.write(YAML::dump(cache)) } if cache_file
76
- end
77
-
78
- def compute_creation_date(set, save = true)
79
- date = get_value(set, :creation_date)
80
- unless date
81
- Dir.chdir(set.sources.first.repo) do
82
- date = Time.at(`git log --first-parent --format=%ct #{set.name}`.split("\n").last.to_i)
83
- end
84
- set_value(set, :creation_date, date)
85
- end
86
- save_cache if save
87
- date
88
- end
89
-
90
- def github_stats_if_needed(set)
91
- return if get_value(set, :gh_date) && get_value(set, :gh_date) > Time.now - cache_expiration
92
- spec = set.specification
93
- url = spec.source[:git] || ''
94
- repo_id = url[/github.com\/([^\/\.]*\/[^\/\.]*)\.*/, 1]
95
- return unless repo_id
96
-
97
- begin
98
- repo = Octokit.repo(repo_id)
99
- rescue
100
- return
101
- end
102
-
103
- cache[set.name] ||= {}
104
- set_value(set, :gh_watchers, repo['watchers'])
105
- set_value(set, :gh_forks, repo['forks'])
106
- set_value(set, :pushed_at, repo['pushed_at'])
107
- set_value(set, :gh_date, Time.now)
108
- save_cache
109
- end
110
- end
111
- end
112
- end
@@ -1,130 +0,0 @@
1
- require 'active_support/core_ext/array/conversions'
2
-
3
- module Pod
4
- module UserInterface
5
- class UIPod
6
- attr_accessor :set
7
-
8
- def initialize(set)
9
- @set = set
10
- end
11
-
12
- # set information
13
- def name
14
- @set.name
15
- end
16
-
17
- def version
18
- @set.versions.first
19
- end
20
-
21
- def versions
22
- @set.versions.sort.reverse
23
- end
24
-
25
- def verions_by_source
26
- result = []
27
- @set.versions_by_source.each do |source, versions|
28
- result << "#{versions.map(&:to_s) * ', '} [#{source.name} repo]"
29
- end
30
- result * ' - '
31
- end
32
-
33
- # @return [Array<String>]
34
- #
35
- def sources
36
- @set.sources.map(&:name).sort
37
- end
38
-
39
- # specification information
40
- def spec
41
- @set.specification
42
- end
43
-
44
- def authors
45
- spec.authors ? spec.authors.keys.to_sentence : ''
46
- end
47
-
48
- def homepage
49
- spec.homepage
50
- end
51
-
52
- def description
53
- spec.description
54
- end
55
-
56
- def summary
57
- spec.summary
58
- end
59
-
60
- def source_url
61
- spec.source.reject {|k,_| k == :commit || k == :tag }.values.first
62
- end
63
-
64
- def platform
65
- spec.available_platforms.sort { |a,b| a.to_s.downcase <=> b.to_s.downcase }.join(' - ')
66
- end
67
-
68
- def license
69
- spec.license[:type] if spec.license
70
- end
71
-
72
- # will return array of all subspecs (recursevly) or nil
73
- def subspecs
74
- (spec.recursive_subspecs.any? && spec.recursive_subspecs) || nil
75
- end
76
-
77
- # Statistics information
78
- def creation_date
79
- Pod::Specification::Statistics.instance.creation_date(@set)
80
- end
81
-
82
- def github_watchers
83
- Pod::Specification::Statistics.instance.github_watchers(@set)
84
- end
85
-
86
- def github_forks
87
- Pod::Specification::Statistics.instance.github_forks(@set)
88
- end
89
-
90
- def github_last_activity
91
- distance_from_now_in_words(Pod::Specification::Statistics.instance.github_pushed_at(@set))
92
- end
93
-
94
- def ==(other)
95
- self.class === other && @set == other.set
96
- end
97
-
98
- def eql?(other)
99
- self.class === other && name.eql?(other.name)
100
- end
101
-
102
- def hash
103
- name.hash
104
- end
105
-
106
- private
107
-
108
- def distance_from_now_in_words(from_time)
109
- return nil unless from_time
110
- from_time = Time.parse(from_time)
111
- to_time = Time.now
112
- distance_in_days = (((to_time - from_time).abs)/60/60/24).round
113
-
114
- case distance_in_days
115
- when 0..7
116
- "less than a week ago"
117
- when 8..29
118
- "#{distance_in_days} days ago"
119
- when 30..45
120
- "1 month ago"
121
- when 46..365
122
- "#{(distance_in_days.to_f / 30).round} months ago"
123
- else
124
- "more than a year ago"
125
- end
126
- end
127
- end
128
- end
129
- end
130
-
@@ -1,26 +0,0 @@
1
- module Pod
2
- class Version < Gem::Version
3
-
4
- # @returns A Version described by its #to_s method.
5
- #
6
- # @TODO The `from' part of the regexp should be remove before 1.0.0.
7
- #
8
- def self.from_string(string)
9
- if string =~ /HEAD (based on|from) (.*)/
10
- v = Version.new($2)
11
- v.head = true
12
- v
13
- else
14
- Version.new(string)
15
- end
16
- end
17
-
18
- attr_accessor :head
19
- alias_method :head?, :head
20
-
21
- def to_s
22
- head? ? "HEAD based on #{super}" : super
23
- end
24
- end
25
- end
26
-