xcocoapods 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +6303 -0
  3. data/LICENSE +28 -0
  4. data/README.md +80 -0
  5. data/bin/pod +56 -0
  6. data/bin/sandbox-pod +168 -0
  7. data/lib/cocoapods.rb +73 -0
  8. data/lib/cocoapods/command.rb +175 -0
  9. data/lib/cocoapods/command/cache.rb +28 -0
  10. data/lib/cocoapods/command/cache/clean.rb +90 -0
  11. data/lib/cocoapods/command/cache/list.rb +69 -0
  12. data/lib/cocoapods/command/env.rb +66 -0
  13. data/lib/cocoapods/command/init.rb +128 -0
  14. data/lib/cocoapods/command/install.rb +45 -0
  15. data/lib/cocoapods/command/ipc.rb +19 -0
  16. data/lib/cocoapods/command/ipc/list.rb +40 -0
  17. data/lib/cocoapods/command/ipc/podfile.rb +31 -0
  18. data/lib/cocoapods/command/ipc/podfile_json.rb +30 -0
  19. data/lib/cocoapods/command/ipc/repl.rb +51 -0
  20. data/lib/cocoapods/command/ipc/spec.rb +29 -0
  21. data/lib/cocoapods/command/ipc/update_search_index.rb +24 -0
  22. data/lib/cocoapods/command/lib.rb +11 -0
  23. data/lib/cocoapods/command/lib/create.rb +105 -0
  24. data/lib/cocoapods/command/lib/lint.rb +121 -0
  25. data/lib/cocoapods/command/list.rb +39 -0
  26. data/lib/cocoapods/command/options/project_directory.rb +36 -0
  27. data/lib/cocoapods/command/options/repo_update.rb +34 -0
  28. data/lib/cocoapods/command/outdated.rb +140 -0
  29. data/lib/cocoapods/command/repo.rb +29 -0
  30. data/lib/cocoapods/command/repo/add.rb +103 -0
  31. data/lib/cocoapods/command/repo/lint.rb +82 -0
  32. data/lib/cocoapods/command/repo/list.rb +93 -0
  33. data/lib/cocoapods/command/repo/push.rb +281 -0
  34. data/lib/cocoapods/command/repo/remove.rb +36 -0
  35. data/lib/cocoapods/command/repo/update.rb +28 -0
  36. data/lib/cocoapods/command/setup.rb +103 -0
  37. data/lib/cocoapods/command/spec.rb +112 -0
  38. data/lib/cocoapods/command/spec/cat.rb +51 -0
  39. data/lib/cocoapods/command/spec/create.rb +283 -0
  40. data/lib/cocoapods/command/spec/edit.rb +87 -0
  41. data/lib/cocoapods/command/spec/env_spec.rb +53 -0
  42. data/lib/cocoapods/command/spec/lint.rb +137 -0
  43. data/lib/cocoapods/command/spec/which.rb +43 -0
  44. data/lib/cocoapods/command/update.rb +101 -0
  45. data/lib/cocoapods/config.rb +347 -0
  46. data/lib/cocoapods/core_overrides.rb +1 -0
  47. data/lib/cocoapods/downloader.rb +190 -0
  48. data/lib/cocoapods/downloader/cache.rb +233 -0
  49. data/lib/cocoapods/downloader/request.rb +86 -0
  50. data/lib/cocoapods/downloader/response.rb +16 -0
  51. data/lib/cocoapods/executable.rb +222 -0
  52. data/lib/cocoapods/external_sources.rb +57 -0
  53. data/lib/cocoapods/external_sources/abstract_external_source.rb +205 -0
  54. data/lib/cocoapods/external_sources/downloader_source.rb +30 -0
  55. data/lib/cocoapods/external_sources/path_source.rb +55 -0
  56. data/lib/cocoapods/external_sources/podspec_source.rb +54 -0
  57. data/lib/cocoapods/gem_version.rb +5 -0
  58. data/lib/cocoapods/generator/acknowledgements.rb +107 -0
  59. data/lib/cocoapods/generator/acknowledgements/markdown.rb +44 -0
  60. data/lib/cocoapods/generator/acknowledgements/plist.rb +94 -0
  61. data/lib/cocoapods/generator/app_target_helper.rb +244 -0
  62. data/lib/cocoapods/generator/bridge_support.rb +22 -0
  63. data/lib/cocoapods/generator/constant.rb +19 -0
  64. data/lib/cocoapods/generator/copy_resources_script.rb +230 -0
  65. data/lib/cocoapods/generator/dummy_source.rb +31 -0
  66. data/lib/cocoapods/generator/embed_frameworks_script.rb +215 -0
  67. data/lib/cocoapods/generator/header.rb +103 -0
  68. data/lib/cocoapods/generator/info_plist_file.rb +116 -0
  69. data/lib/cocoapods/generator/module_map.rb +99 -0
  70. data/lib/cocoapods/generator/prefix_header.rb +60 -0
  71. data/lib/cocoapods/generator/umbrella_header.rb +46 -0
  72. data/lib/cocoapods/hooks_manager.rb +132 -0
  73. data/lib/cocoapods/installer.rb +703 -0
  74. data/lib/cocoapods/installer/analyzer.rb +972 -0
  75. data/lib/cocoapods/installer/analyzer/analysis_result.rb +87 -0
  76. data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +98 -0
  77. data/lib/cocoapods/installer/analyzer/pod_variant.rb +67 -0
  78. data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +157 -0
  79. data/lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb +54 -0
  80. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +240 -0
  81. data/lib/cocoapods/installer/analyzer/specs_state.rb +84 -0
  82. data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +53 -0
  83. data/lib/cocoapods/installer/analyzer/target_inspector.rb +260 -0
  84. data/lib/cocoapods/installer/installation_options.rb +158 -0
  85. data/lib/cocoapods/installer/pod_source_installer.rb +202 -0
  86. data/lib/cocoapods/installer/pod_source_preparer.rb +77 -0
  87. data/lib/cocoapods/installer/podfile_validator.rb +139 -0
  88. data/lib/cocoapods/installer/post_install_hooks_context.rb +132 -0
  89. data/lib/cocoapods/installer/pre_install_hooks_context.rb +51 -0
  90. data/lib/cocoapods/installer/source_provider_hooks_context.rb +34 -0
  91. data/lib/cocoapods/installer/user_project_integrator.rb +250 -0
  92. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +463 -0
  93. data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +146 -0
  94. data/lib/cocoapods/installer/xcode.rb +8 -0
  95. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +416 -0
  96. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +181 -0
  97. data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +84 -0
  98. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +334 -0
  99. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +777 -0
  100. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +116 -0
  101. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +86 -0
  102. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +256 -0
  103. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +68 -0
  104. data/lib/cocoapods/installer/xcode/target_validator.rb +147 -0
  105. data/lib/cocoapods/open-uri.rb +33 -0
  106. data/lib/cocoapods/project.rb +414 -0
  107. data/lib/cocoapods/resolver.rb +585 -0
  108. data/lib/cocoapods/resolver/lazy_specification.rb +79 -0
  109. data/lib/cocoapods/sandbox.rb +404 -0
  110. data/lib/cocoapods/sandbox/file_accessor.rb +444 -0
  111. data/lib/cocoapods/sandbox/headers_store.rb +146 -0
  112. data/lib/cocoapods/sandbox/path_list.rb +220 -0
  113. data/lib/cocoapods/sandbox/pod_dir_cleaner.rb +85 -0
  114. data/lib/cocoapods/sandbox/podspec_finder.rb +23 -0
  115. data/lib/cocoapods/sources_manager.rb +157 -0
  116. data/lib/cocoapods/target.rb +261 -0
  117. data/lib/cocoapods/target/aggregate_target.rb +338 -0
  118. data/lib/cocoapods/target/build_settings.rb +1075 -0
  119. data/lib/cocoapods/target/pod_target.rb +559 -0
  120. data/lib/cocoapods/user_interface.rb +459 -0
  121. data/lib/cocoapods/user_interface/error_report.rb +187 -0
  122. data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
  123. data/lib/cocoapods/validator.rb +981 -0
  124. metadata +533 -0
@@ -0,0 +1,112 @@
1
+ # encoding: utf-8
2
+
3
+ require 'active_support/core_ext/string/inflections'
4
+ require 'cocoapods/command/spec/create'
5
+ require 'cocoapods/command/spec/lint'
6
+ require 'cocoapods/command/spec/which'
7
+ require 'cocoapods/command/spec/cat'
8
+ require 'cocoapods/command/spec/edit'
9
+
10
+ module Pod
11
+ class Command
12
+ class Spec < Command
13
+ self.abstract_command = true
14
+ self.summary = 'Manage pod specs'
15
+
16
+ #-----------------------------------------------------------------------#
17
+
18
+ # @todo some of the following methods can probably move to one of the
19
+ # subclasses.
20
+
21
+ private
22
+
23
+ # @param [String] query the regular expression string to validate
24
+ #
25
+ # @raise if the query is not a valid regular expression
26
+ #
27
+ def validate_regex!(query)
28
+ /#{query}/
29
+ rescue RegexpError
30
+ help! 'A valid regular expression is required.'
31
+ end
32
+
33
+ # @param [String] spec
34
+ # The name of the specification.
35
+ #
36
+ # @param [Bool] show_all
37
+ # Whether the paths for all the versions should be returned or
38
+ # only the one for the last version.
39
+ #
40
+ # @return [Pathname] the absolute path or paths of the given podspec
41
+ #
42
+ def get_path_of_spec(spec, show_all = false)
43
+ sets = config.sources_manager.search_by_name(spec)
44
+
45
+ if sets.count == 1
46
+ set = sets.first
47
+ elsif sets.map(&:name).include?(spec)
48
+ set = sets.find { |s| s.name == spec }
49
+ else
50
+ names = sets.map(&:name) * ', '
51
+ raise Informative, "More than one spec found for '#{spec}':\n#{names}"
52
+ end
53
+
54
+ unless show_all
55
+ best_spec, spec_source = spec_and_source_from_set(set)
56
+ return pathname_from_spec(best_spec, spec_source)
57
+ end
58
+
59
+ all_paths_from_set(set)
60
+ end
61
+
62
+ # @return [Pathname] the absolute path of the given spec and source
63
+ #
64
+ def pathname_from_spec(spec, _source)
65
+ Pathname(spec.defined_in_file)
66
+ end
67
+
68
+ # @return [String] of spec paths one on each line
69
+ #
70
+ def all_paths_from_set(set)
71
+ paths = ''
72
+
73
+ sources = set.sources
74
+
75
+ sources.each do |source|
76
+ versions = source.versions(set.name)
77
+
78
+ versions.each do |version|
79
+ spec = source.specification(set.name, version)
80
+ paths += "#{pathname_from_spec(spec, source)}\n"
81
+ end
82
+ end
83
+
84
+ paths
85
+ end
86
+
87
+ # @return [Specification, Source] the highest known specification with it's source of the given
88
+ # set.
89
+ #
90
+ def spec_and_source_from_set(set)
91
+ sources = set.sources
92
+
93
+ best_source = best_version = nil
94
+ sources.each do |source|
95
+ versions = source.versions(set.name)
96
+ versions.each do |version|
97
+ if !best_version || version > best_version
98
+ best_source = source
99
+ best_version = version
100
+ end
101
+ end
102
+ end
103
+
104
+ if !best_source || !best_version
105
+ raise Informative, "Unable to locate highest known specification for `#{set.name}'"
106
+ end
107
+
108
+ [best_source.specification(set.name, best_version), best_source]
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,51 @@
1
+ module Pod
2
+ class Command
3
+ class Spec < Command
4
+ class Cat < Spec
5
+ self.summary = 'Prints a spec file'
6
+
7
+ self.description = <<-DESC
8
+ Prints the content of the podspec(s) whose name matches `QUERY` to standard output.
9
+ DESC
10
+
11
+ self.arguments = [
12
+ CLAide::Argument.new('QUERY', false),
13
+ ]
14
+
15
+ def self.options
16
+ [
17
+ ['--regex', 'Interpret the `QUERY` as a regular expression'],
18
+ ['--show-all', 'Pick from all versions of the given podspec'],
19
+ ].concat(super)
20
+ end
21
+
22
+ def initialize(argv)
23
+ @use_regex = argv.flag?('regex')
24
+ @show_all = argv.flag?('show-all')
25
+ @query = argv.shift_argument
26
+ @query = @query.gsub('.podspec', '') unless @query.nil?
27
+ super
28
+ end
29
+
30
+ def validate!
31
+ super
32
+ help! 'A podspec name is required.' unless @query
33
+ validate_regex!(@query) if @use_regex
34
+ end
35
+
36
+ def run
37
+ query = @use_regex ? @query : Regexp.escape(@query)
38
+ filepath = if @show_all
39
+ specs = get_path_of_spec(query, @show_all).split(/\n/)
40
+ index = UI.choose_from_array(specs, "Which spec would you like to print [1-#{specs.count}]? ")
41
+ specs[index]
42
+ else
43
+ get_path_of_spec(query)
44
+ end
45
+
46
+ UI.puts File.read(filepath)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,283 @@
1
+
2
+ module Pod
3
+ class Command
4
+ class Spec < Command
5
+ class Create < Spec
6
+ self.summary = 'Create spec file stub.'
7
+
8
+ self.description = <<-DESC
9
+ Creates a PodSpec, in the current working dir, called `NAME.podspec'.
10
+ If a GitHub url is passed the spec is prepopulated.
11
+ DESC
12
+
13
+ self.arguments = [
14
+ CLAide::Argument.new(%w(NAME https://github.com/USER/REPO), false),
15
+ ]
16
+
17
+ def initialize(argv)
18
+ @name_or_url = argv.shift_argument
19
+ @url = argv.shift_argument
20
+ super
21
+ end
22
+
23
+ def validate!
24
+ super
25
+ help! 'A pod name or repo URL is required.' unless @name_or_url
26
+ end
27
+
28
+ def run
29
+ if repo_id_match = (@url || @name_or_url).match(%r{github.com/([^/\.]*\/[^/\.]*)\.*})
30
+ repo_id = repo_id_match[1]
31
+ data = github_data_for_template(repo_id)
32
+ data[:name] = @name_or_url if @url
33
+ UI.puts semantic_versioning_notice(repo_id, data[:name]) if data[:version] == '0.0.1'
34
+ else
35
+ data = default_data_for_template(@name_or_url)
36
+ end
37
+
38
+ spec = spec_template(data)
39
+ (Pathname.pwd + "#{data[:name]}.podspec").open('w') { |f| f << spec }
40
+ UI.puts "\nSpecification created at #{data[:name]}.podspec".green
41
+ end
42
+
43
+ private
44
+
45
+ #--------------------------------------#
46
+
47
+ # Templates and GitHub information retrieval for spec create
48
+ #
49
+ # @todo It would be nice to have a template class that accepts options
50
+ # and uses the default ones if not provided.
51
+ # @todo The template is outdated.
52
+
53
+ def default_data_for_template(name)
54
+ data = {}
55
+ data[:name] = name
56
+ data[:version] = '0.0.1'
57
+ data[:summary] = "A short description of #{name}."
58
+ data[:homepage] = "http://EXAMPLE/#{name}"
59
+ data[:author_name] = `git config --get user.name`.strip
60
+ data[:author_email] = `git config --get user.email`.strip
61
+ data[:source_url] = "http://EXAMPLE/#{name}.git"
62
+ data[:ref_type] = ':tag'
63
+ data[:ref] = '#{spec.version}'
64
+ data
65
+ end
66
+
67
+ def github_data_for_template(repo_id)
68
+ repo = GitHub.repo(repo_id)
69
+ raise Informative, "Unable to fetch data for `#{repo_id}`" unless repo
70
+ user = GitHub.user(repo['owner']['login'])
71
+ raise Informative, "Unable to fetch data for `#{repo['owner']['login']}`" unless user
72
+ data = {}
73
+
74
+ data[:name] = repo['name']
75
+ data[:summary] = (repo['description'] || '').gsub(/["]/, '\"')
76
+ data[:homepage] = (repo['homepage'] && !repo['homepage'].empty?) ? repo['homepage'] : repo['html_url']
77
+ data[:author_name] = user['name'] || user['login']
78
+ data[:author_email] = user['email'] || 'email@address.com'
79
+ data[:source_url] = repo['clone_url']
80
+
81
+ data.merge suggested_ref_and_version(repo)
82
+ end
83
+
84
+ def suggested_ref_and_version(repo)
85
+ tags = GitHub.tags(repo['html_url']).map { |tag| tag['name'] }
86
+ versions_tags = {}
87
+ tags.each do |tag|
88
+ clean_tag = tag.gsub(/^v(er)? ?/, '')
89
+ versions_tags[Gem::Version.new(clean_tag)] = tag if Gem::Version.correct?(clean_tag)
90
+ end
91
+ version = versions_tags.keys.sort.last || '0.0.1'
92
+ data = { :version => version }
93
+ if version == '0.0.1'
94
+ branches = GitHub.branches(repo['html_url'])
95
+ master_name = repo['master_branch'] || 'master'
96
+ master = branches.find { |branch| branch['name'] == master_name }
97
+ raise Informative, "Unable to find any commits on the master branch for the repository `#{repo['html_url']}`" unless master
98
+ data[:ref_type] = ':commit'
99
+ data[:ref] = master['commit']['sha']
100
+ else
101
+ data[:ref_type] = ':tag'
102
+ data[:ref] = versions_tags[version]
103
+ data[:ref] = '#{spec.version}' if "#{version}" == versions_tags[version]
104
+ data[:ref] = 'v#{spec.version}' if "v#{version}" == versions_tags[version]
105
+ end
106
+ data
107
+ end
108
+
109
+ def spec_template(data)
110
+ <<-SPEC
111
+ #
112
+ # Be sure to run `pod spec lint #{data[:name]}.podspec' to ensure this is a
113
+ # valid spec and to remove all comments including this before submitting the spec.
114
+ #
115
+ # To learn more about Podspec attributes see https://docs.cocoapods.org/specification.html
116
+ # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
117
+ #
118
+
119
+ Pod::Spec.new do |spec|
120
+
121
+ # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
122
+ #
123
+ # These will help people to find your library, and whilst it
124
+ # can feel like a chore to fill in it's definitely to your advantage. The
125
+ # summary should be tweet-length, and the description more in depth.
126
+ #
127
+
128
+ spec.name = "#{data[:name]}"
129
+ spec.version = "#{data[:version]}"
130
+ spec.summary = "#{data[:summary]}"
131
+
132
+ # This description is used to generate tags and improve search results.
133
+ # * Think: What does it do? Why did you write it? What is the focus?
134
+ # * Try to keep it short, snappy and to the point.
135
+ # * Write the description between the DESC delimiters below.
136
+ # * Finally, don't worry about the indent, CocoaPods strips it!
137
+ spec.description = <<-DESC
138
+ DESC
139
+
140
+ spec.homepage = "#{data[:homepage]}"
141
+ # spec.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
142
+
143
+
144
+ # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
145
+ #
146
+ # Licensing your code is important. See https://choosealicense.com for more info.
147
+ # CocoaPods will detect a license file if there is a named LICENSE*
148
+ # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
149
+ #
150
+
151
+ spec.license = "MIT (example)"
152
+ # spec.license = { :type => "MIT", :file => "FILE_LICENSE" }
153
+
154
+
155
+ # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
156
+ #
157
+ # Specify the authors of the library, with email addresses. Email addresses
158
+ # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
159
+ # accepts just a name if you'd rather not provide an email address.
160
+ #
161
+ # Specify a social_media_url where others can refer to, for example a twitter
162
+ # profile URL.
163
+ #
164
+
165
+ spec.author = { "#{data[:author_name]}" => "#{data[:author_email]}" }
166
+ # Or just: spec.author = "#{data[:author_name]}"
167
+ # spec.authors = { "#{data[:author_name]}" => "#{data[:author_email]}" }
168
+ # spec.social_media_url = "https://twitter.com/#{data[:author_name]}"
169
+
170
+ # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
171
+ #
172
+ # If this Pod runs only on iOS or OS X, then specify the platform and
173
+ # the deployment target. You can optionally include the target after the platform.
174
+ #
175
+
176
+ # spec.platform = :ios
177
+ # spec.platform = :ios, "5.0"
178
+
179
+ # When using multiple platforms
180
+ # spec.ios.deployment_target = "5.0"
181
+ # spec.osx.deployment_target = "10.7"
182
+ # spec.watchos.deployment_target = "2.0"
183
+ # spec.tvos.deployment_target = "9.0"
184
+
185
+
186
+ # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
187
+ #
188
+ # Specify the location from where the source should be retrieved.
189
+ # Supports git, hg, bzr, svn and HTTP.
190
+ #
191
+
192
+ spec.source = { :git => "#{data[:source_url]}", #{data[:ref_type]} => "#{data[:ref]}" }
193
+
194
+
195
+ # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
196
+ #
197
+ # CocoaPods is smart about how it includes source code. For source files
198
+ # giving a folder will include any swift, h, m, mm, c & cpp files.
199
+ # For header files it will include any header in the folder.
200
+ # Not including the public_header_files will make all headers public.
201
+ #
202
+
203
+ spec.source_files = "Classes", "Classes/**/*.{h,m}"
204
+ spec.exclude_files = "Classes/Exclude"
205
+
206
+ # spec.public_header_files = "Classes/**/*.h"
207
+
208
+
209
+ # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
210
+ #
211
+ # A list of resources included with the Pod. These are copied into the
212
+ # target bundle with a build phase script. Anything else will be cleaned.
213
+ # You can preserve files from being cleaned, please don't preserve
214
+ # non-essential files like tests, examples and documentation.
215
+ #
216
+
217
+ # spec.resource = "icon.png"
218
+ # spec.resources = "Resources/*.png"
219
+
220
+ # spec.preserve_paths = "FilesToSave", "MoreFilesToSave"
221
+
222
+
223
+ # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
224
+ #
225
+ # Link your library with frameworks, or libraries. Libraries do not include
226
+ # the lib prefix of their name.
227
+ #
228
+
229
+ # spec.framework = "SomeFramework"
230
+ # spec.frameworks = "SomeFramework", "AnotherFramework"
231
+
232
+ # spec.library = "iconv"
233
+ # spec.libraries = "iconv", "xml2"
234
+
235
+
236
+ # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
237
+ #
238
+ # If your library depends on compiler flags you can set them in the xcconfig hash
239
+ # where they will only apply to your library. If you depend on other Podspecs
240
+ # you can include multiple dependencies to ensure it works.
241
+
242
+ # spec.requires_arc = true
243
+
244
+ # spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
245
+ # spec.dependency "JSONKit", "~> 1.4"
246
+
247
+ end
248
+ SPEC
249
+ end
250
+
251
+ def semantic_versioning_notice(repo_id, repo)
252
+ <<-EOS
253
+
254
+ #{'――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
255
+
256
+ I’ve recently added [#{repo}](https://github.com/CocoaPods/Specs/tree/master/#{repo}) to the [CocoaPods](https://github.com/CocoaPods/CocoaPods) package manager repo.
257
+
258
+ CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.
259
+
260
+ However, #{repo} doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.
261
+
262
+ [Semantic version](https://semver.org) tags (instead of plain commit hashes/revisions) allow for [resolution of cross-dependencies](https://github.com/CocoaPods/Specs/wiki/Cross-dependencies-resolution-example).
263
+
264
+ In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:
265
+
266
+ ```
267
+ $ git tag -a 1.0.0 -m "Tag release 1.0.0"
268
+ $ git push --tags
269
+ ```
270
+
271
+ #{'――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
272
+
273
+ #{'[!] This repo does not appear to have semantic version tags.'.yellow}
274
+
275
+ After commiting the specification, consider opening a ticket with the template displayed above:
276
+ - link: https://github.com/#{repo_id}/issues/new
277
+ - title: Please add semantic version tags
278
+ EOS
279
+ end
280
+ end
281
+ end
282
+ end
283
+ end
@@ -0,0 +1,87 @@
1
+ module Pod
2
+ class Command
3
+ class Spec < Command
4
+ class Edit < Spec
5
+ self.summary = 'Edit a spec file'
6
+
7
+ self.description = <<-DESC
8
+ Opens the podspec matching `QUERY` to be edited.
9
+ DESC
10
+
11
+ self.arguments = [
12
+ CLAide::Argument.new('QUERY', false),
13
+ ]
14
+
15
+ def self.options
16
+ [
17
+ ['--regex', 'Interpret the `QUERY` as a regular expression'],
18
+ ['--show-all', 'Pick from all versions of the given podspec'],
19
+ ].concat(super)
20
+ end
21
+
22
+ def initialize(argv)
23
+ @use_regex = argv.flag?('regex')
24
+ @show_all = argv.flag?('show-all')
25
+ @query = argv.shift_argument
26
+ @query = @query.gsub('.podspec', '') unless @query.nil?
27
+ super
28
+ end
29
+
30
+ def validate!
31
+ super
32
+ help! 'A podspec name is required.' unless @query
33
+ validate_regex!(@query) if @use_regex
34
+ end
35
+
36
+ def run
37
+ query = @use_regex ? @query : Regexp.escape(@query)
38
+ if @show_all
39
+ specs = get_path_of_spec(query, @show_all).split(/\n/)
40
+ message = "Which spec would you like to edit [1-#{specs.count}]? "
41
+ index = UI.choose_from_array(specs, message)
42
+ filepath = specs[index]
43
+ else
44
+ filepath = get_path_of_spec(query)
45
+ end
46
+
47
+ exec_editor(filepath.to_s) if File.exist? filepath
48
+ raise Informative, "#{filepath} doesn't exist."
49
+ end
50
+
51
+ def which_editor
52
+ editor = ENV['EDITOR']
53
+ # If an editor wasn't set, try to pick a sane default
54
+ return editor unless editor.nil?
55
+
56
+ editors = [
57
+ # Find Sublime Text 2
58
+ 'subl',
59
+ # Find Textmate
60
+ 'mate',
61
+ # Find BBEdit / TextWrangler
62
+ 'edit',
63
+ # Find Atom
64
+ 'atom',
65
+ # Default to vim
66
+ 'vim',
67
+ ]
68
+ editor = editors.find { |e| Pod::Executable.which(e) }
69
+ return editor if editor
70
+
71
+ raise Informative, "Failed to open editor. Set your 'EDITOR' environment variable."
72
+ end
73
+
74
+ def exec_editor(*args)
75
+ return if args.to_s.empty?
76
+ safe_exec(which_editor, *args)
77
+ end
78
+
79
+ def safe_exec(cmd, *args)
80
+ # This buys us proper argument quoting and evaluation
81
+ # of environment variables in the cmd parameter.
82
+ exec('/bin/sh', '-i', '-c', cmd + ' "$@"', '--', *args)
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end