motion-cocoapods 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +4 -4
  2. data/lib/motion/project/cocoapods.rb +36 -39
  3. metadata +14 -13
data/README.rdoc CHANGED
@@ -34,13 +34,13 @@ That's all. The build system will properly download the given pods and their dep
34
34
 
35
35
  1. Setup a local development environment.
36
36
 
37
- $ git clone git://github.com/HipByte/motion-cocoapods.git
38
- $ cd motion-cocoapods
39
- $ rake bootstrap
37
+ $ git clone git://github.com/HipByte/motion-cocoapods.git
38
+ $ cd motion-cocoapods
39
+ $ rake bootstrap
40
40
 
41
41
  2. Verify that all the tests are passing.
42
42
 
43
- $ rake spec
43
+ $ rake spec
44
44
 
45
45
  3. Create your patch and send a pull-request[http://help.github.com/send-pull-requests/].
46
46
 
@@ -36,71 +36,68 @@ module Motion::Project
36
36
  @pods ||= Motion::Project::CocoaPods.new(self)
37
37
  if block
38
38
  @pods.instance_eval(&block)
39
- @pods.resolve!
39
+ @pods.install!
40
40
  end
41
41
  @pods
42
42
  end
43
43
  end
44
44
 
45
45
  class CocoaPods
46
- VERSION = '1.0.1'
46
+ VERSION = '1.0.2'
47
47
 
48
48
  def initialize(config)
49
49
  @config = config
50
50
  @podfile = Pod::Podfile.new {}
51
51
  @podfile.platform :ios
52
52
 
53
- Pod::Config.instance.silent = true
54
- Pod::Config.instance.rootspec = @podfile
55
- Pod::Config.instance.instance_variable_set(:@project_pods_root, Pathname.new(File.join(config.project_dir, 'vendor')))
53
+ cp_config = Pod::Config.instance
54
+ if ENV['COCOAPODS_VERBOSE']
55
+ cp_config.verbose = true
56
+ else
57
+ cp_config.silent = true
58
+ end
59
+ cp_config.rootspec = @podfile if cp_config.respond_to?(:rootspec) # CocoaPods 0.5.x backward compatibility
60
+ cp_config.integrate_targets = false if cp_config.respond_to?(:integrate_targets) # CocoaPods 0.6 forward compatibility
61
+ cp_config.project_root = Pathname.new(config.project_dir) + 'vendor'
56
62
  end
57
63
 
58
64
  def dependency(*name_and_version_requirements, &block)
59
65
  @podfile.dependency(*name_and_version_requirements, &block)
60
66
  end
61
67
 
68
+ def post_install(&block)
69
+ @podfile.post_install(&block)
70
+ end
71
+
62
72
  def pods_installer
63
73
  @installer ||= Pod::Installer.new(@podfile)
64
74
  end
65
75
 
66
- def resolve!
67
- pods_installer.install_dependencies!
68
- specs = pods_installer.build_specifications
69
- header_paths = specs.map do |podspec|
70
- podspec.expanded_source_files.select do |p|
71
- File.extname(p) == '.h'
72
- end.map do |p|
73
- "-I\"" + File.expand_path(File.join('./vendor', File.dirname(p))) + "\""
74
- end
75
- end.flatten.join(' ')
76
- specs.each do |podspec|
77
- cflags = (podspec.compiler_flags or '') + ' ' + header_paths
78
- source_files = podspec.expanded_source_files.map do |path|
79
- # Remove the first part of the path which is the project directory.
80
- path.to_s.split('/')[1..-1].join('/')
81
- end
76
+ # For now we only support one Pods target, this will have to be expanded
77
+ # once we work on more spec support.
78
+ def install!
79
+ pods_installer.install!
82
80
 
83
- @config.vendor_project(podspec.pod_destroot, :static,
84
- :cflags => cflags,
85
- :source_files => source_files)
81
+ @config.vendor_project('vendor/Pods', :xcode,
82
+ :target => 'Pods',
83
+ :headers_dir => 'Headers',
84
+ :products => %w{ libPods.a }
85
+ )
86
86
 
87
- ldflags = podspec.xcconfig.to_hash['OTHER_LDFLAGS']
88
- if ldflags
89
- @config.frameworks.concat(ldflags.scan(/-framework\s+([^\s]+)/).map { |m| m[0] })
90
- @config.frameworks.uniq!
91
- @config.libs.concat(ldflags.scan(/-l([^\s]+)/).map { |m| "/usr/lib/lib#{m[0]}.dylib" })
92
- @config.libs.uniq!
87
+ xcconfig = @installer.target_installers.find do |target_installer|
88
+ if target_installer.respond_to?(:definition)
89
+ target_installer.definition.name == :default
90
+ else
91
+ # CocoaPods 0.6 forward compatibility
92
+ target_installer.target_definition.name == :default
93
93
  end
94
+ end.xcconfig
94
95
 
95
- =begin
96
- # Remove .h files that are not covered in the podspec, to avoid
97
- # future preprocessor #include collisions.
98
- headers_to_ignore = (Dir.chdir(podspec.pod_destroot) do
99
- Dir.glob('*/**/*.h')
100
- end) - source_files.select { |p| File.extname(p) == '.h' }
101
- p headers_to_ignore,source_files.select { |p| File.extname(p) == '.h' } ,:ok
102
- #headers_to_ignore.each { |p| FileUtils.rm_rf File.join(podspec.pod_destroot, p) }
103
- =end
96
+ if ldflags = xcconfig.to_hash['OTHER_LDFLAGS']
97
+ @config.frameworks.concat(ldflags.scan(/-framework\s+([^\s]+)/).map { |m| m[0] })
98
+ @config.frameworks.uniq!
99
+ @config.libs.concat(ldflags.scan(/-l([^\s]+)/).map { |m| "/usr/lib/lib#{m[0]}.dylib" })
100
+ @config.libs.uniq!
104
101
  end
105
102
  end
106
103
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-cocoapods
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 19
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 0
8
- - 1
9
- segments_generated: true
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Laurent Sansonetti
@@ -15,24 +15,24 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-07 00:00:00 +02:00
19
- default_executable:
18
+ date: 2012-05-15 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ type: :runtime
22
23
  version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ none: false
23
25
  requirements:
24
26
  - - ">="
25
27
  - !ruby/object:Gem::Version
28
+ hash: 9
26
29
  segments:
27
30
  - 0
28
31
  - 5
29
32
  - 1
30
- segments_generated: true
31
33
  version: 0.5.1
32
34
  requirement: *id001
33
35
  name: cocoapods
34
- prerelease: false
35
- type: :runtime
36
36
  description: motion-cocoapods allows RubyMotion projects to have access to the CocoaPods dependency manager.
37
37
  email: lrz@hipbyte.com
38
38
  executables: []
@@ -46,7 +46,6 @@ files:
46
46
  - lib/motion-cocoapods.rb
47
47
  - README.rdoc
48
48
  - LICENSE
49
- has_rdoc: true
50
49
  homepage: http://www.rubymotion.com
51
50
  licenses: []
52
51
 
@@ -56,25 +55,27 @@ rdoc_options: []
56
55
  require_paths:
57
56
  - lib
58
57
  required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
+ hash: 3
62
63
  segments:
63
64
  - 0
64
- segments_generated: true
65
65
  version: "0"
66
66
  required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
67
68
  requirements:
68
69
  - - ">="
69
70
  - !ruby/object:Gem::Version
71
+ hash: 3
70
72
  segments:
71
73
  - 0
72
- segments_generated: true
73
74
  version: "0"
74
75
  requirements: []
75
76
 
76
77
  rubyforge_project:
77
- rubygems_version: 1.3.6
78
+ rubygems_version: 1.8.21
78
79
  signing_key:
79
80
  specification_version: 3
80
81
  summary: CocoaPods integration for RubyMotion projects