cocoapods 0.33.1 → 0.34.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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +171 -46
  3. data/README.md +9 -9
  4. data/bin/pod +5 -5
  5. data/bin/sandbox-pod +2 -6
  6. data/lib/cocoapods.rb +4 -4
  7. data/lib/cocoapods/command.rb +12 -10
  8. data/lib/cocoapods/command/init.rb +12 -13
  9. data/lib/cocoapods/command/inter_process_communication.rb +6 -17
  10. data/lib/cocoapods/command/lib.rb +27 -24
  11. data/lib/cocoapods/command/list.rb +9 -9
  12. data/lib/cocoapods/command/outdated.rb +4 -9
  13. data/lib/cocoapods/command/project.rb +57 -19
  14. data/lib/cocoapods/command/push.rb +0 -1
  15. data/lib/cocoapods/command/repo.rb +14 -15
  16. data/lib/cocoapods/command/repo/push.rb +24 -19
  17. data/lib/cocoapods/command/search.rb +12 -13
  18. data/lib/cocoapods/command/setup.rb +10 -9
  19. data/lib/cocoapods/command/spec.rb +67 -63
  20. data/lib/cocoapods/config.rb +21 -54
  21. data/lib/cocoapods/downloader.rb +0 -1
  22. data/lib/cocoapods/executable.rb +3 -8
  23. data/lib/cocoapods/external_sources.rb +2 -4
  24. data/lib/cocoapods/external_sources/abstract_external_source.rb +15 -10
  25. data/lib/cocoapods/external_sources/downloader_source.rb +0 -2
  26. data/lib/cocoapods/external_sources/path_source.rb +1 -4
  27. data/lib/cocoapods/external_sources/podspec_source.rb +1 -3
  28. data/lib/cocoapods/gem_version.rb +1 -2
  29. data/lib/cocoapods/generator/acknowledgements.rb +5 -8
  30. data/lib/cocoapods/generator/acknowledgements/markdown.rb +5 -7
  31. data/lib/cocoapods/generator/acknowledgements/plist.rb +9 -10
  32. data/lib/cocoapods/generator/bridge_support.rb +1 -1
  33. data/lib/cocoapods/generator/copy_resources_script.rb +10 -14
  34. data/lib/cocoapods/generator/dummy_source.rb +3 -3
  35. data/lib/cocoapods/generator/prefix_header.rb +15 -16
  36. data/lib/cocoapods/generator/target_environment_header.rb +122 -36
  37. data/lib/cocoapods/generator/xcconfig.rb +0 -4
  38. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +74 -65
  39. data/lib/cocoapods/generator/xcconfig/private_pod_xcconfig.rb +92 -95
  40. data/lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb +48 -51
  41. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +10 -10
  42. data/lib/cocoapods/hooks/installer_representation.rb +15 -18
  43. data/lib/cocoapods/hooks/library_representation.rb +4 -8
  44. data/lib/cocoapods/hooks/pod_representation.rb +1 -5
  45. data/lib/cocoapods/hooks_manager.rb +63 -0
  46. data/lib/cocoapods/installer.rb +60 -47
  47. data/lib/cocoapods/installer/analyzer.rb +60 -62
  48. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +5 -8
  49. data/lib/cocoapods/installer/file_references_installer.rb +7 -10
  50. data/lib/cocoapods/installer/hooks_context.rb +74 -0
  51. data/lib/cocoapods/installer/migrator.rb +99 -0
  52. data/lib/cocoapods/installer/pod_source_installer.rb +9 -29
  53. data/lib/cocoapods/installer/target_installer.rb +7 -17
  54. data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +40 -41
  55. data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +43 -54
  56. data/lib/cocoapods/installer/user_project_integrator.rb +54 -10
  57. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +66 -117
  58. data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +116 -0
  59. data/lib/cocoapods/open_uri.rb +1 -2
  60. data/lib/cocoapods/project.rb +34 -8
  61. data/lib/cocoapods/resolver.rb +43 -21
  62. data/lib/cocoapods/sandbox.rb +80 -75
  63. data/lib/cocoapods/sandbox/file_accessor.rb +3 -8
  64. data/lib/cocoapods/sandbox/headers_store.rb +6 -7
  65. data/lib/cocoapods/sandbox/path_list.rb +7 -10
  66. data/lib/cocoapods/sources_manager.rb +81 -49
  67. data/lib/cocoapods/target.rb +18 -12
  68. data/lib/cocoapods/target/aggregate_target.rb +43 -18
  69. data/lib/cocoapods/target/pod_target.rb +37 -4
  70. data/lib/cocoapods/user_interface.rb +19 -18
  71. data/lib/cocoapods/user_interface/error_report.rb +23 -4
  72. data/lib/cocoapods/validator.rb +30 -33
  73. metadata +100 -73
  74. data/lib/cocoapods/command/help.rb +0 -25
data/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  ### CocoaPods: The Objective-C dependency manager
4
4
 
5
- [![Build Status](http://img.shields.io/travis/CocoaPods/CocoaPods/master.svg)](https://travis-ci.org/CocoaPods/CocoaPods)
6
- [![Gem Version](http://img.shields.io/gem/v/cocoapods.svg)](http://badge.fury.io/rb/cocoapods)
7
- [![Code Climate](http://img.shields.io/codeclimate/github/CocoaPods/CocoaPods.svg)](https://codeclimate.com/github/CocoaPods/CocoaPods)
5
+ [![Build Status](http://img.shields.io/travis/CocoaPods/CocoaPods/master.svg?style=flat)](https://travis-ci.org/CocoaPods/CocoaPods)
6
+ [![Gem Version](http://img.shields.io/gem/v/cocoapods.svg?style=flat)](http://badge.fury.io/rb/cocoapods)
7
+ [![Code Climate](http://img.shields.io/codeclimate/github/CocoaPods/CocoaPods.svg?style=flat)](https://codeclimate.com/github/CocoaPods/CocoaPods)
8
8
 
9
9
  CocoaPods manages dependencies for your Xcode projects.
10
10
 
@@ -50,10 +50,10 @@ CocoaPods is composed by the following projects:
50
50
 
51
51
  | Status | Project | Description | Info |
52
52
  | :----- | :------ | :--- | :--- |
53
- | [![Build Status](http://img.shields.io/travis/CocoaPods/CocoaPods/master.svg)](http://travis-ci.org/CocoaPods/CocoaPods) | [CocoaPods](https://github.com/CocoaPods/CocoaPods) | The CocoaPods command line tool. | [docs](http://docs.cocoapods.org/cocoapods)
54
- | [![Build Status](http://img.shields.io/travis/CocoaPods/Core/master.svg)](http://travis-ci.org/CocoaPods/Core) | [CocoaPods Core](https://github.com/CocoaPods/Core) | Support for working with specifications and podfiles. | [docs](http://docs.cocoapods.org/cocoapods_core)
55
- | [![Build Status](http://img.shields.io/travis/CocoaPods/cocoapods-downloader/master.svg)](http://travis-ci.org/CocoaPods/cocoapods-downloader) |[CocoaPods Downloader](https://github.com/CocoaPods/cocoapods-downloader) | Downloaders for various source types. | [docs](http://docs.cocoapods.org/cocoapods_downloader/index.html)
56
- | [![Build Status](http://img.shields.io/travis/CocoaPods/Xcodeproj/master.svg)](https://travis-ci.org/CocoaPods/Xcodeproj) | [Xcodeproj](https://github.com/CocoaPods/Xcodeproj) | Create and modify Xcode projects from Ruby. | [docs](http://docs.cocoapods.org/xcodeproj/index.html)
57
- | [![Build Status](http://img.shields.io/travis/CocoaPods/CLAide/master.svg)](https://travis-ci.org/CocoaPods/CLAide) | [CLAide](https://github.com/CocoaPods/CLAide) | A small command-line interface framework. | [docs](http://docs.cocoapods.org/claide/index.html)
58
- | [![Build Status](http://img.shields.io/travis/CocoaPods/Specs/master.svg)](http://travis-ci.org/CocoaPods/Specs) | [Master Repo ](https://github.com/CocoaPods/Specs) | Master repository of specifications. | [guide](http://docs.cocoapods.org/guides/contributing_to_the_master_repo.html)
53
+ | [![Build Status](http://img.shields.io/travis/CocoaPods/CocoaPods/master.svg?style=flat)](http://travis-ci.org/CocoaPods/CocoaPods) | [CocoaPods](https://github.com/CocoaPods/CocoaPods) | The CocoaPods command line tool. | [docs](http://docs.cocoapods.org/cocoapods)
54
+ | [![Build Status](http://img.shields.io/travis/CocoaPods/Core/master.svg?style=flat)](http://travis-ci.org/CocoaPods/Core) | [CocoaPods Core](https://github.com/CocoaPods/Core) | Support for working with specifications and podfiles. | [docs](http://docs.cocoapods.org/cocoapods_core)
55
+ | [![Build Status](http://img.shields.io/travis/CocoaPods/cocoapods-downloader/master.svg?style=flat)](http://travis-ci.org/CocoaPods/cocoapods-downloader) |[CocoaPods Downloader](https://github.com/CocoaPods/cocoapods-downloader) | Downloaders for various source types. | [docs](http://docs.cocoapods.org/cocoapods_downloader/index.html)
56
+ | [![Build Status](http://img.shields.io/travis/CocoaPods/Xcodeproj/master.svg?style=flat)](https://travis-ci.org/CocoaPods/Xcodeproj) | [Xcodeproj](https://github.com/CocoaPods/Xcodeproj) | Create and modify Xcode projects from Ruby. | [docs](http://docs.cocoapods.org/xcodeproj/index.html)
57
+ | [![Build Status](http://img.shields.io/travis/CocoaPods/CLAide/master.svg?style=flat)](https://travis-ci.org/CocoaPods/CLAide) | [CLAide](https://github.com/CocoaPods/CLAide) | A small command-line interface framework. | [docs](http://docs.cocoapods.org/claide/index.html)
58
+ | | [Master Repo ](https://github.com/CocoaPods/Specs) | Master repository of specifications. | [guide](http://docs.cocoapods.org/guides/contributing_to_the_master_repo.html)
59
59
 
data/bin/pod CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  if RUBY_VERSION > '1.8.7' && Encoding.default_external != Encoding::UTF_8
4
4
  puts "\e[33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding."
5
- if ENV["TRAVIS"]
5
+ if ENV['TRAVIS']
6
6
  puts <<-DOC
7
7
  Consider adding the following settings to .travis.yml
8
8
 
@@ -19,12 +19,12 @@ end
19
19
 
20
20
  if $PROGRAM_NAME == __FILE__ && !ENV['COCOAPODS_NO_BUNDLER']
21
21
  ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
22
- require "rubygems"
23
- require "bundler/setup"
22
+ require 'rubygems'
23
+ require 'bundler/setup'
24
24
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
25
25
  elsif ENV['COCOAPODS_NO_BUNDLER']
26
- require "rubygems"
27
- gem "cocoapods"
26
+ require 'rubygems'
27
+ gem 'cocoapods'
28
28
  end
29
29
 
30
30
  STDOUT.sync = true if ENV['CP_STDOUT_SYNC'] == 'TRUE'
@@ -52,7 +52,7 @@ PROFILE_ERB_TEMPLATE = <<-EOS
52
52
  "<%= pod_bin %>"
53
53
  "<%= ruby_bin %>"
54
54
  )
55
- (regex
55
+ (regex
56
56
  <% prefixes.each do |prefix| %>
57
57
  #"^<%= prefix %>/*"
58
58
  <% end %>
@@ -105,9 +105,7 @@ PROFILE_ERB_TEMPLATE = <<-EOS
105
105
  (deny default)
106
106
  EOS
107
107
 
108
-
109
108
  class Profile
110
-
111
109
  def pod_bin
112
110
  File.expand_path('../pod', __FILE__)
113
111
  end
@@ -159,14 +157,12 @@ class Profile
159
157
  def generate
160
158
  ERB.new(PROFILE_ERB_TEMPLATE, 0, '>').result(binding)
161
159
  end
162
-
163
160
  end
164
161
 
165
162
  # Ensure the `pod` bin doesn’t think it needs to use Bundler.
166
163
  ENV['COCOAPODS_NO_BUNDLER'] = '1'
167
164
 
168
165
  profile = Profile.new
169
- #puts profile.generate
166
+ # puts profile.generate
170
167
  command = ['/usr/bin/sandbox-exec', '-p', profile.generate, profile.pod_bin, *ARGV]
171
168
  exec(*command)
172
-
@@ -35,17 +35,18 @@ module Pod
35
35
  end
36
36
  end
37
37
 
38
+ autoload :AggregateTarget, 'cocoapods/target/aggregate_target'
38
39
  autoload :Command, 'cocoapods/command'
39
40
  autoload :Executable, 'cocoapods/executable'
40
41
  autoload :ExternalSources, 'cocoapods/external_sources'
41
42
  autoload :Installer, 'cocoapods/installer'
42
- autoload :SourcesManager, 'cocoapods/sources_manager'
43
- autoload :Target, 'cocoapods/target'
44
- autoload :AggregateTarget, 'cocoapods/target/aggregate_target'
43
+ autoload :HooksManager, 'cocoapods/hooks_manager'
45
44
  autoload :PodTarget, 'cocoapods/target/pod_target'
46
45
  autoload :Project, 'cocoapods/project'
47
46
  autoload :Resolver, 'cocoapods/resolver'
48
47
  autoload :Sandbox, 'cocoapods/sandbox'
48
+ autoload :SourcesManager, 'cocoapods/sources_manager'
49
+ autoload :Target, 'cocoapods/target'
49
50
  autoload :Validator, 'cocoapods/validator'
50
51
 
51
52
  module Generator
@@ -65,7 +66,6 @@ module Pod
65
66
  autoload :LibraryRepresentation, 'cocoapods/hooks/library_representation'
66
67
  autoload :PodRepresentation, 'cocoapods/hooks/pod_representation'
67
68
  end
68
-
69
69
  end
70
70
 
71
71
  if ENV['COCOA_PODS_ENV'] == 'development'
@@ -7,8 +7,6 @@ module Pod
7
7
  end
8
8
 
9
9
  class Command < CLAide::Command
10
-
11
- require 'cocoapods/command/help'
12
10
  require 'cocoapods/command/inter_process_communication'
13
11
  require 'cocoapods/command/lib'
14
12
  require 'cocoapods/command/list'
@@ -29,6 +27,8 @@ module Pod
29
27
  self.description = 'CocoaPods, the Objective-C library package manager.'
30
28
  self.plugin_prefix = 'cocoapods'
31
29
 
30
+ [Install, Update, Outdated, IPC::Podfile, IPC::Repl].each { |c| c.send(:include, ProjectDirectory) }
31
+
32
32
  def self.options
33
33
  [
34
34
  ['--silent', 'Show nothing'],
@@ -44,15 +44,18 @@ module Pod
44
44
  end
45
45
 
46
46
  def self.run(argv)
47
- help! "You cannot run CocoaPods as root." if Process.uid == 0
47
+ help! 'You cannot run CocoaPods as root.' if Process.uid == 0
48
48
  super(argv)
49
49
  UI.print_warnings
50
50
  end
51
51
 
52
52
  def self.report_error(exception)
53
- if exception.is_a?(Interrupt)
54
- puts "[!] Cancelled".red
53
+ case exception
54
+ when Interrupt
55
+ puts '[!] Cancelled'.red
55
56
  Config.instance.verbose? ? raise : exit(1)
57
+ when SystemExit
58
+ raise
56
59
  else
57
60
  if ENV['COCOA_PODS_ENV'] != 'development'
58
61
  puts UI::ErrorReport.report(exception)
@@ -76,9 +79,9 @@ module Pod
76
79
  def initialize(argv)
77
80
  super
78
81
  config.silent = argv.flag?('silent', config.silent)
79
- config.verbose = self.verbose? unless self.verbose.nil?
82
+ config.verbose = self.verbose? unless verbose.nil?
80
83
  unless self.ansi_output?
81
- String.send(:define_method, :colorize) { |string , _| string }
84
+ String.send(:define_method, :colorize) { |string, _| string }
82
85
  end
83
86
  end
84
87
 
@@ -96,7 +99,7 @@ module Pod
96
99
  #
97
100
  def verify_podfile_exists!
98
101
  unless config.podfile
99
- raise Informative, "No `Podfile' found in the current working directory."
102
+ raise Informative, "No `Podfile' found in the project directory."
100
103
  end
101
104
  end
102
105
 
@@ -108,9 +111,8 @@ module Pod
108
111
  #
109
112
  def verify_lockfile_exists!
110
113
  unless config.lockfile
111
- raise Informative, "No `Podfile.lock' found in the current working directory, run `pod install'."
114
+ raise Informative, "No `Podfile.lock' found in the project directory, run `pod install'."
112
115
  end
113
116
  end
114
117
  end
115
118
  end
116
-
@@ -4,13 +4,12 @@ require 'active_support/core_ext/string/strip'
4
4
  module Pod
5
5
  class Command
6
6
  class Init < Command
7
-
8
7
  self.summary = 'Generate a Podfile for the current directory.'
9
8
  self.description = <<-DESC
10
9
  Creates a Podfile for the current directory if none currently exists. If
11
- an Xcode project file is specified or if there is only a single project
12
- file in the current directory, targets will be automatically generated
13
- based on targets defined in the project.
10
+ an `XCODEPROJ` project file is specified or if there is only a single
11
+ project file in the current directory, targets will be automatically
12
+ generated based on targets defined in the project.
14
13
 
15
14
  It is possible to specify a list of dependencies which will be used by
16
15
  the template in the `Podfile.default` (normal targets) `Podfile.test`
@@ -18,11 +17,11 @@ module Pod
18
17
  `~/.cocoapods/templates` folder.
19
18
  DESC
20
19
  self.arguments = [
21
- ['XCODEPROJ', :optional]
20
+ CLAide::Argument.new('XCODEPROJ', :false),
22
21
  ]
23
22
 
24
23
  def initialize(argv)
25
- @podfile_path = Pathname.pwd + "Podfile"
24
+ @podfile_path = Pathname.pwd + 'Podfile'
26
25
  @project_path = argv.shift_argument
27
26
  @project_paths = Pathname.pwd.children.select { |pn| pn.extname == '.xcodeproj' }
28
27
  super
@@ -30,13 +29,13 @@ module Pod
30
29
 
31
30
  def validate!
32
31
  super
33
- raise Informative, "Existing Podfile found in directory" unless config.podfile.nil?
32
+ raise Informative, 'Existing Podfile found in directory' unless config.podfile_path_in_dir(Pathname.pwd).nil?
34
33
  if @project_path
35
34
  help! "Xcode project at #{@project_path} does not exist" unless File.exist? @project_path
36
35
  project_path = @project_path
37
36
  else
38
- raise Informative, "No xcode project found, please specify one" unless @project_paths.length > 0
39
- raise Informative, "Multiple xcode projects found, please specify one" unless @project_paths.length == 1
37
+ raise Informative, 'No xcode project found, please specify one' unless @project_paths.length > 0
38
+ raise Informative, 'Multiple xcode projects found, please specify one' unless @project_paths.length == 1
40
39
  project_path = @project_paths.first
41
40
  end
42
41
  @xcode_project = Xcodeproj::Project.open(project_path)
@@ -60,7 +59,8 @@ module Pod
60
59
  # Uncomment this line to define a global platform for your project
61
60
  # platform :ios, "6.0"
62
61
  PLATFORM
63
- for target in project.targets
62
+
63
+ project.targets.each do |target|
64
64
  podfile << target_module(target)
65
65
  end
66
66
  podfile << "\n"
@@ -82,12 +82,11 @@ module Pod
82
82
  target_module << "\nend\n"
83
83
  end
84
84
 
85
-
86
85
  def template_contents(path)
87
86
  if path.exist?
88
- path.read.chomp.lines.map{ |line| " #{line}" }.join("\n")
87
+ path.read.chomp.lines.map { |line| " #{line}" }.join("\n")
89
88
  else
90
- String.new
89
+ ''
91
90
  end
92
91
  end
93
92
  end
@@ -1,7 +1,6 @@
1
1
  module Pod
2
2
  class Command
3
3
  class IPC < Command
4
-
5
4
  self.abstract_command = true
6
5
  self.summary = 'Inter-process communication'
7
6
 
@@ -12,11 +11,10 @@ module Pod
12
11
  #-----------------------------------------------------------------------#
13
12
 
14
13
  class Spec < IPC
15
-
16
14
  self.summary = 'Converts a podspec to JSON.'
17
15
  self.description = 'Converts a podspec to JSON and prints it to STDOUT.'
18
16
  self.arguments = [
19
- ['PATH', :required]
17
+ CLAide::Argument.new('PATH', true),
20
18
  ]
21
19
 
22
20
  def initialize(argv)
@@ -26,24 +24,23 @@ module Pod
26
24
 
27
25
  def validate!
28
26
  super
29
- help! "A specification path is required." unless @path
27
+ help! 'A specification path is required.' unless @path
30
28
  end
31
29
 
32
30
  def run
31
+ require 'json'
33
32
  spec = Specification.from_file(@path)
34
- output_pipe.puts spec.to_json
33
+ output_pipe.puts(JSON.pretty_generate(spec))
35
34
  end
36
-
37
35
  end
38
36
 
39
37
  #-----------------------------------------------------------------------#
40
38
 
41
39
  class Podfile < IPC
42
-
43
40
  self.summary = 'Converts a Podfile to YAML.'
44
41
  self.description = 'Converts a Podfile to YAML and prints it to STDOUT.'
45
42
  self.arguments = [
46
- ['PATH', :required]
43
+ CLAide::Argument.new('PATH', true),
47
44
  ]
48
45
 
49
46
  def initialize(argv)
@@ -53,20 +50,18 @@ module Pod
53
50
 
54
51
  def validate!
55
52
  super
56
- help! "A Podfile path is required." unless @path
53
+ help! 'A Podfile path is required.' unless @path
57
54
  end
58
55
 
59
56
  def run
60
57
  podfile = Pod::Podfile.from_file(@path)
61
58
  output_pipe.puts podfile.to_yaml
62
59
  end
63
-
64
60
  end
65
61
 
66
62
  #-----------------------------------------------------------------------#
67
63
 
68
64
  class List < IPC
69
-
70
65
  self.summary = 'Lists the specifications known to CocoaPods.'
71
66
  self.description = <<-DESC
72
67
  Prints to STDOUT a YAML dictionary where the keys are the name of the
@@ -99,13 +94,11 @@ module Pod
99
94
  end
100
95
  output_pipe.puts result.to_yaml
101
96
  end
102
-
103
97
  end
104
98
 
105
99
  #-----------------------------------------------------------------------#
106
100
 
107
101
  class UpdateSearchIndex < IPC
108
-
109
102
  self.summary = 'Updates the search index.'
110
103
  self.description = <<-DESC
111
104
  Updates the search index and prints its path to standard output.
@@ -123,13 +116,11 @@ module Pod
123
116
  SourcesManager.updated_search_index
124
117
  output_pipe.puts(SourcesManager.search_index_path)
125
118
  end
126
-
127
119
  end
128
120
 
129
121
  #-----------------------------------------------------------------------#
130
122
 
131
123
  class Repl < IPC
132
-
133
124
  END_OF_OUTPUT_SIGNAL = "\n\r"
134
125
 
135
126
  self.summary = 'The repl listens to commands on standard input.'
@@ -172,11 +163,9 @@ module Pod
172
163
  signal_end_of_output
173
164
  end
174
165
  end
175
-
176
166
  end
177
167
 
178
168
  #-----------------------------------------------------------------------#
179
-
180
169
  end
181
170
  end
182
171
  end
@@ -10,13 +10,15 @@ module Pod
10
10
  self.summary = 'Creates a new Pod'
11
11
 
12
12
  self.description = <<-DESC
13
- Creates a scaffold for the development of a new Pod according to the CocoaPods best practices.
14
- If a `TEMPLATE_URL`, pointing to a git repo containing a compatible template, is specified, it will be used in place of the default one.
13
+ Creates a scaffold for the development of a new Pod named `NAME`
14
+ according to the CocoaPods best practices.
15
+ If a `TEMPLATE_URL`, pointing to a git repo containing a compatible
16
+ template, is specified, it will be used in place of the default one.
15
17
  DESC
16
18
 
17
19
  self.arguments = [
18
- ['NAME', :required],
19
- ['TEMPLATE_URL', :optional]
20
+ CLAide::Argument.new('NAME', true),
21
+ CLAide::Argument.new('TEMPLATE_URL', false),
20
22
  ]
21
23
 
22
24
  def initialize(argv)
@@ -27,8 +29,8 @@ module Pod
27
29
 
28
30
  def validate!
29
31
  super
30
- help! "A name for the Pod is required." unless @name
31
- help! "The Pod name cannot contain spaces." if @name.match(/\s/)
32
+ help! 'A name for the Pod is required.' unless @name
33
+ help! 'The Pod name cannot contain spaces.' if @name.match(/\s/)
32
34
  help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.'
33
35
  end
34
36
 
@@ -48,9 +50,9 @@ module Pod
48
50
  executable :git
49
51
  executable :ruby
50
52
 
51
- TEMPLATE_REPO = "https://github.com/CocoaPods/pod-template.git"
52
- TEMPLATE_INFO_URL = "https://github.com/CocoaPods/pod-template"
53
- CREATE_NEW_POD_INFO_URL = "http://guides.cocoapods.org/making/making-a-cocoapod"
53
+ TEMPLATE_REPO = 'https://github.com/CocoaPods/pod-template.git'
54
+ TEMPLATE_INFO_URL = 'https://github.com/CocoaPods/pod-template'
55
+ CREATE_NEW_POD_INFO_URL = 'http://guides.cocoapods.org/making/making-a-cocoapod'
54
56
 
55
57
  # Clones the template from the remote in the working directory using
56
58
  # the name of the Pod.
@@ -59,7 +61,7 @@ module Pod
59
61
  #
60
62
  def clone_template
61
63
  UI.section("Cloning `#{template_repo_url}` into `#{@name}`.") do
62
- git!"clone '#{template_repo_url}' #{@name}"
64
+ git! "clone '#{template_repo_url}' #{@name}"
63
65
  end
64
66
  end
65
67
 
@@ -70,10 +72,10 @@ module Pod
70
72
  def configure_template
71
73
  UI.section("Configuring #{@name} template.") do
72
74
  Dir.chdir(@name) do
73
- if File.exists? "configure"
74
- system "./configure #{@name}"
75
+ if File.exist?('configure')
76
+ system("./configure #{@name}")
75
77
  else
76
- UI.warn "Template does not have a configure file."
78
+ UI.warn 'Template does not have a configure file.'
77
79
  end
78
80
  end
79
81
  end
@@ -107,11 +109,11 @@ module Pod
107
109
  DESC
108
110
 
109
111
  def self.options
110
- [ ["--quick", "Lint skips checks that would require to download and build the spec"],
111
- ["--only-errors", "Lint validates even if warnings are present"],
112
- ["--subspec=NAME","Lint validates only the given subspec"],
113
- ["--no-subspecs", "Lint skips validation of subspecs"],
114
- ["--no-clean", "Lint leaves the build directory intact for inspection"] ].concat(super)
112
+ [['--quick', 'Lint skips checks that would require to download and build the spec'],
113
+ ['--only-errors', 'Lint validates even if warnings are present'],
114
+ ['--subspec=NAME', 'Lint validates only the given subspec'],
115
+ ['--no-subspecs', 'Lint skips validation of subspecs'],
116
+ ['--no-clean', 'Lint leaves the build directory intact for inspection']].concat(super)
115
117
  end
116
118
 
117
119
  def initialize(argv)
@@ -151,7 +153,7 @@ module Pod
151
153
  message = "#{validator.spec.name} did not pass validation."
152
154
  if @clean
153
155
  message << "\nYou can use the `--no-clean` option to inspect " \
154
- "any issue."
156
+ 'any issue.'
155
157
  end
156
158
  raise Informative, message
157
159
  end
@@ -171,19 +173,20 @@ module Pod
171
173
  # @raise If multiple podspecs are found.
172
174
  #
173
175
  def podspecs_to_lint
174
- if !@podspecs_paths.empty? then
176
+ if !@podspecs_paths.empty?
175
177
  Array(@podspecs_paths)
176
- else
178
+ else
177
179
  podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.yaml,}')
178
- raise Informative, "Unable to find a podspec in the working directory" if podspecs.count.zero?
180
+ if podspecs.count.zero?
181
+ raise Informative, 'Unable to find a podspec in the working ' \
182
+ 'directory'
183
+ end
179
184
  podspecs
180
185
  end
181
186
  end
182
-
183
187
  end
184
188
 
185
189
  #-----------------------------------------------------------------------#
186
-
187
190
  end
188
191
  end
189
192
  end