motion-cocoapods 1.2.2 → 1.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/motion/project/cocoapods.rb +55 -49
  2. metadata +17 -12
  3. checksums.yaml +0 -7
@@ -1,15 +1,15 @@
1
1
  # Copyright (c) 2012, Laurent Sansonetti <lrz@hipbyte.com>
2
2
  # All rights reserved.
3
- #
3
+ #
4
4
  # Redistribution and use in source and binary forms, with or without
5
5
  # modification, are permitted provided that the following conditions are met:
6
- #
6
+ #
7
7
  # 1. Redistributions of source code must retain the above copyright notice,
8
8
  # this list of conditions and the following disclaimer.
9
9
  # 2. Redistributions in binary form must reproduce the above copyright notice,
10
10
  # this list of conditions and the following disclaimer in the documentation
11
11
  # and/or other materials provided with the distribution.
12
- #
12
+ #
13
13
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14
14
  # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
15
  # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -37,23 +37,28 @@ module Motion::Project
37
37
  def pods(&block)
38
38
  @pods ||= Motion::Project::CocoaPods.new(self)
39
39
  if block
40
+ @pods.instance_eval(&block)
41
+
40
42
  # We run the update/install commands only if necessary.
41
- podfile_lock = Pod::Config.instance.project_lockfile
42
- podfile_changed = (!File.exist?(podfile_lock) or File.mtime(self.project_file) > File.mtime(podfile_lock))
43
- if podfile_changed and !ENV['COCOAPODS_NO_UPDATE']
44
- Pod::Command::Repo.new(Pod::Command::ARGV.new(["update"])).run
43
+ cp_config = Pod::Config.instance
44
+ analyzer = Pod::Installer::Analyzer.new(cp_config.sandbox, @pods.podfile, cp_config.lockfile)
45
+ if analyzer.needs_install?
46
+ @pods.install!
45
47
  end
46
- @pods.instance_eval(&block)
47
- @pods.install!
48
+ @pods.link_project
48
49
  end
49
50
  @pods
50
51
  end
51
52
  end
52
53
 
54
+ #---------------------------------------------------------------------------#
55
+
53
56
  class CocoaPods
54
- VERSION = '1.2.2'
57
+ VERSION = '1.3.0.rc1'
55
58
  PODS_ROOT = 'vendor/Pods'
56
59
 
60
+ attr_accessor :podfile
61
+
57
62
  def initialize(config)
58
63
  @config = config
59
64
 
@@ -61,6 +66,7 @@ module Motion::Project
61
66
  @podfile.platform :ios, config.deployment_target
62
67
  cp_config.podfile = @podfile
63
68
 
69
+ cp_config.skip_repo_update = ENV['COCOAPODS_NO_UPDATE']
64
70
  if ENV['COCOAPODS_VERBOSE']
65
71
  cp_config.verbose = true
66
72
  else
@@ -68,9 +74,12 @@ module Motion::Project
68
74
  end
69
75
 
70
76
  cp_config.integrate_targets = false
71
- cp_config.project_root = Pathname.new(File.expand_path(config.project_dir)) + 'vendor'
77
+ cp_config.installation_root = Pathname.new(File.expand_path(config.project_dir)) + 'vendor'
72
78
  end
73
79
 
80
+ # DSL
81
+ #-------------------------------------------------------------------------#
82
+
74
83
  def pod(*name_and_version_requirements, &block)
75
84
  @podfile.pod(*name_and_version_requirements, &block)
76
85
  end
@@ -84,32 +93,31 @@ module Motion::Project
84
93
  @podfile.post_install(&block)
85
94
  end
86
95
 
96
+ # Installation & Linking
97
+ #-------------------------------------------------------------------------#
98
+
87
99
  def pods_installer
88
- @installer ||= begin
89
- # This should move into a factory method in CocoaPods.
90
- sandbox = Pod::Sandbox.new(cp_config.project_pods_root)
91
- resolver = Pod::Resolver.new(@podfile, cp_config.lockfile, sandbox)
92
- resolver.update_mode = !!ENV['UPDATE']
93
- Pod::Installer.new(resolver)
94
- end
100
+ @installer ||= Pod::Installer.new(cp_config.sandbox, @podfile, cp_config.lockfile)
95
101
  end
96
102
 
103
+ # Performs a CocoaPods Installation.
104
+ #
97
105
  # For now we only support one Pods target, this will have to be expanded
98
106
  # once we work on more spec support.
107
+ #
108
+ # Let RubyMotion re-generate the BridgeSupport file whenever the list of
109
+ # installed pods changes.
110
+ #
99
111
  def install!
100
- if bridgesupport_file.exist? && cp_config.project_lockfile.exist?
101
- installed_pods_before = installed_pods
102
- end
103
-
104
112
  pods_installer.install!
105
-
106
- # Let RubyMotion re-generate the BridgeSupport file whenever the list of
107
- # installed pods changes.
108
- if bridgesupport_file.exist? && installed_pods_before &&
109
- installed_pods_before != installed_pods
113
+ if bridgesupport_file.exist? && !pods_installer.installed_specs.empty?
110
114
  bridgesupport_file.delete
111
115
  end
116
+ end
112
117
 
118
+ # Adds the Pods project to the RubyMotion config as a vendored project.
119
+ #
120
+ def link_project
113
121
  install_resources
114
122
 
115
123
  @config.vendor_project(PODS_ROOT, :xcode,
@@ -143,12 +151,25 @@ module Motion::Project
143
151
  end
144
152
  end
145
153
 
146
- def cp_config
147
- Pod::Config.instance
154
+ def install_resources
155
+ FileUtils.mkdir_p(resources_dir)
156
+ resources.each do |file|
157
+ begin
158
+ FileUtils.cp_r file, resources_dir
159
+ rescue ArgumentError => exc
160
+ unless exc.message =~ /same file/
161
+ raise
162
+ end
163
+ end
164
+ end
165
+ @config.resources_dirs << resources_dir.to_s
148
166
  end
149
167
 
150
- def installed_pods
151
- YAML.load(cp_config.project_lockfile.read)['PODS']
168
+ # Helpers
169
+ #-------------------------------------------------------------------------#
170
+
171
+ def cp_config
172
+ Pod::Config.instance
152
173
  end
153
174
 
154
175
  def bridgesupport_file
@@ -160,14 +181,9 @@ module Motion::Project
160
181
  Xcodeproj::Config.new(path)
161
182
  end
162
183
 
163
- def resources_dir
164
- Pathname.new(@config.project_dir) + PODS_ROOT + 'Resources'
165
- end
166
-
167
184
  def resources
168
185
  resources = []
169
- pods_resources_path = Pathname.new(@config.project_dir) + PODS_ROOT + "Pods-resources.sh"
170
- File.open(pods_resources_path) { |f|
186
+ File.open(Pathname.new(@config.project_dir) + PODS_ROOT + 'Pods-resources.sh') { |f|
171
187
  f.each_line do |line|
172
188
  if matched = line.match(/install_resource\s+'(.*)'/)
173
189
  resources << Pathname.new(@config.project_dir) + PODS_ROOT + matched[1]
@@ -177,18 +193,8 @@ module Motion::Project
177
193
  resources
178
194
  end
179
195
 
180
- def install_resources
181
- FileUtils.mkdir_p(resources_dir)
182
- resources.each do |file|
183
- begin
184
- FileUtils.cp_r file, resources_dir
185
- rescue ArgumentError => exc
186
- unless exc.message =~ /same file/
187
- raise
188
- end
189
- end
190
- end
191
- @config.resources_dirs << resources_dir.to_s
196
+ def resources_dir
197
+ Pathname.new(@config.project_dir) + PODS_ROOT + 'Resources'
192
198
  end
193
199
 
194
200
  def inspect
metadata CHANGED
@@ -1,29 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-cocoapods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0.rc1
5
+ prerelease: 6
5
6
  platform: ruby
6
7
  authors:
7
8
  - Laurent Sansonetti
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-03-01 00:00:00.000000000 Z
12
+ date: 2013-03-29 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: cocoapods
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
- version: 0.14.0
21
+ version: 0.17.0
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
- version: 0.14.0
29
+ version: 0.17.0
27
30
  description: motion-cocoapods allows RubyMotion projects to have access to the CocoaPods
28
31
  dependency manager.
29
32
  email: lrz@hipbyte.com
@@ -37,25 +40,27 @@ files:
37
40
  - LICENSE
38
41
  homepage: http://www.rubymotion.com
39
42
  licenses: []
40
- metadata: {}
41
43
  post_install_message:
42
44
  rdoc_options: []
43
45
  require_paths:
44
46
  - lib
45
47
  required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
46
49
  requirements:
47
- - - '>='
50
+ - - ! '>='
48
51
  - !ruby/object:Gem::Version
49
52
  version: '0'
50
53
  required_rubygems_version: !ruby/object:Gem::Requirement
54
+ none: false
51
55
  requirements:
52
- - - '>='
56
+ - - ! '>'
53
57
  - !ruby/object:Gem::Version
54
- version: '0'
58
+ version: 1.3.1
55
59
  requirements: []
56
60
  rubyforge_project:
57
- rubygems_version: 2.0.0
61
+ rubygems_version: 1.8.23
58
62
  signing_key:
59
- specification_version: 4
63
+ specification_version: 3
60
64
  summary: CocoaPods integration for RubyMotion projects
61
65
  test_files: []
66
+ has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 9a6515bb61266bad77ded4c9f831a9440aed449e
4
- data.tar.gz: 994cc2b82fa82f326e86696e2339fccef531eff7
5
- SHA512:
6
- metadata.gz: c6d54b304477048265ed2ab7702078eb8f5fe3ed2827637532da4c8468ef97d7d102887d90e5c28f8e59edd4c0df1ce024eec47ee7e022583ad6dc7a7edd9cc5
7
- data.tar.gz: 29f060ffc2213922b8563ac275a4be19baea01f5f69dcd3554b963e37d8a10b809e52f25a0ef66b8f369efab21b398f36a566febc613f1e386d800f4789a2ff0