Skip to content

Commit

Permalink
Remove activation of activesupport gem and make code work with Xcodep…
Browse files Browse the repository at this point in the history
…roj gem again.
  • Loading branch information
alloy committed Nov 12, 2011
1 parent ace222e commit e1d788d
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 24 deletions.
2 changes: 0 additions & 2 deletions bin/pod
@@ -1,8 +1,6 @@
#!/usr/bin/env macruby

if $0 == __FILE__
require 'rubygems'
gem 'activesupport', '~> 3.1.1'
$:.unshift File.expand_path('../../external/xcodeproj/lib', __FILE__)
$:.unshift File.expand_path('../../lib', __FILE__)
end
Expand Down
2 changes: 1 addition & 1 deletion external/xcodeproj
8 changes: 4 additions & 4 deletions lib/cocoapods.rb
Expand Up @@ -21,10 +21,10 @@ class Informative < StandardError
autoload :Pathname, 'pathname'
end

module Xcode
autoload :Config, 'cocoapods/xcode_project'
autoload :Project, 'cocoapods/xcode_project'
autoload :Workspace, 'cocoapods/xcode_project'
module Xcodeproj
autoload :Config, 'cocoapods/xcodeproj_ext'
autoload :Project, 'cocoapods/xcodeproj_ext'
autoload :Workspace, 'cocoapods/xcodeproj_ext'
end

class Pathname
Expand Down
10 changes: 5 additions & 5 deletions lib/cocoapods/installer.rb
Expand Up @@ -55,7 +55,7 @@ def initialize(podfile, project, definition)
end

def xcconfig
@xcconfig ||= Xcode::Config.new({
@xcconfig ||= Xcodeproj::Config.new({
# In a workspace this is where the static library headers should be found.
'USER_HEADER_SEARCH_PATHS' => '"$(BUILT_PRODUCTS_DIR)/Pods"',
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
Expand Down Expand Up @@ -164,7 +164,7 @@ def initialize(podfile)

def project
return @project if @project
@project = Xcode::Project.for_platform(@podfile.platform)
@project = Xcodeproj::Project.for_platform(@podfile.platform)
# First we need to resolve dependencies across *all* targets, so that the
# same correct versions of pods are being used for all targets. This
# happens when we call `build_specifications'.
Expand Down Expand Up @@ -221,7 +221,7 @@ def install!
def configure_project(projpath)
root = File.dirname(projpath)
xcworkspace = File.join(root, File.basename(projpath, '.xcodeproj') + '.xcworkspace')
workspace = Xcode::Workspace.new_from_xcworkspace(xcworkspace)
workspace = Xcodeproj::Workspace.new_from_xcworkspace(xcworkspace)
pods_projpath = File.join(config.project_pods_root, 'Pods.xcodeproj')
root = Pathname.new(root).expand_path
[projpath, pods_projpath].each do |path|
Expand All @@ -230,7 +230,7 @@ def configure_project(projpath)
end
workspace.save_as(xcworkspace)

app_project = Xcode::Project.new(projpath)
app_project = Xcodeproj::Project.new(projpath)
return if app_project.files.find { |file| file.path =~ /libPods\.a$/ }

configfile = app_project.files.new('path' => 'Pods/Pods.xcconfig')
Expand All @@ -242,7 +242,7 @@ def configure_project(projpath)

libfile = app_project.files.new_static_library('Pods')
libfile.group = app_project.main_group.groups.find { |g| g.name == 'Frameworks' }
app_project.objects.select_by_class(Xcode::Project::PBXFrameworksBuildPhase).each do |build_phase|
app_project.objects.select_by_class(Xcodeproj::Project::PBXFrameworksBuildPhase).each do |build_phase|
build_phase.files << libfile.buildFiles.new
end

Expand Down
2 changes: 1 addition & 1 deletion lib/cocoapods/specification.rb
Expand Up @@ -22,7 +22,7 @@ def self.from_file(path)

def initialize
@dependencies = []
@xcconfig = Xcode::Config.new
@xcconfig = Xcodeproj::Config.new
yield self if block_given?
end

Expand Down
@@ -1,6 +1,6 @@
require 'xcodeproj'

module Xcode
module Xcodeproj
class Project
# Shortcut access to the `Pods' PBXGroup.
def pods
Expand All @@ -22,7 +22,7 @@ def self.new_pod_dir(project, pod_name, path)
end

def self.for_platform(platform)
project = Xcode::Project.new
project = Xcodeproj::Project.new
project.main_group << project.groups.new({ 'name' => 'Pods' })
framework = project.add_system_framework(platform == :ios ? 'Foundation' : 'Cocoa')
framework.group = project.groups.new({ 'name' => 'Frameworks' })
Expand All @@ -31,15 +31,15 @@ def self.for_platform(platform)
project.main_group << products
project.root_object.products = products

project.root_object.attributes['buildConfigurationList'] = project.objects.add(Xcode::Project::XCConfigurationList, {
project.root_object.attributes['buildConfigurationList'] = project.objects.add(Xcodeproj::Project::XCConfigurationList, {
'defaultConfigurationIsVisible' => '0',
'defaultConfigurationName' => 'Release',
'buildConfigurations' => [
project.objects.add(Xcode::Project::XCBuildConfiguration, {
project.objects.add(Xcodeproj::Project::XCBuildConfiguration, {
'name' => 'Debug',
'buildSettings' => build_settings(platform, :debug)
}),
project.objects.add(Xcode::Project::XCBuildConfiguration, {
project.objects.add(Xcodeproj::Project::XCBuildConfiguration, {
'name' => 'Release',
'buildSettings' => build_settings(platform, :release)
})
Expand Down
6 changes: 3 additions & 3 deletions spec/integration_spec.rb
Expand Up @@ -207,7 +207,7 @@ def should_successfully_perform(command)
installer = SpecHelper::Installer.new(spec)
installer.install!

project = Pod::Xcode::Project.new(config.project_pods_root + 'Pods.xcodeproj')
project = Xcodeproj::Project.new(config.project_pods_root + 'Pods.xcodeproj')
project.source_files.should == installer.project.source_files
end

Expand Down Expand Up @@ -264,10 +264,10 @@ def should_successfully_perform(command)
installer.configure_project(projpath)

xcworkspace = temporary_directory + 'ASIHTTPRequest.xcworkspace'
workspace = Pod::Xcode::Workspace.new_from_xcworkspace(xcworkspace)
workspace = Xcodeproj::Workspace.new_from_xcworkspace(xcworkspace)
workspace.projpaths.sort.should == ['ASIHTTPRequest.xcodeproj', 'Pods/Pods.xcodeproj']

project = Pod::Xcode::Project.new(projpath)
project = Xcodeproj::Project.new(projpath)
libPods = project.files.find { |f| f.name == 'libPods.a' }
project.targets.each do |target|
target.buildConfigurations.each do |config|
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Expand Up @@ -4,7 +4,6 @@
require 'pathname'
ROOT = Pathname.new(File.expand_path('../../', __FILE__))

gem 'activesupport', '~> 3.1.1'
$:.unshift File.expand_path('../../external/xcodeproj/lib', __FILE__)
$:.unshift (ROOT + 'lib').to_s
require 'cocoapods'
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/xcode_spec.rb → spec/unit/xcodeproj_ext_spec.rb
@@ -1,8 +1,8 @@
require File.expand_path('../../spec_helper', __FILE__)

describe 'Xcode::Project' do
describe 'Xcodeproj::Project' do
before do
@project = Xcode::Project.new
@project = Xcodeproj::Project.new
end

def find_object(conditions)
Expand Down

0 comments on commit e1d788d

Please sign in to comment.