Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 160 lines (138 sloc) 4.751 kb
ad82764 @alloy Add gem:release task.
alloy authored
1 namespace :gem do
2 def gem_version
579c1a7 @lukeredpath Allow specifications to have a local source that exists outside the Pods...
lukeredpath authored
3 require File.join(File.dirname(__FILE__), *%w[lib cocoapods])
ad82764 @alloy Add gem:release task.
alloy authored
4 Pod::VERSION
5 end
6
7 def gem_filename
2fe42a1 @alloy Fix Rakefile gem tasks
alloy authored
8 "cocoapods-#{gem_version}.gem"
ad82764 @alloy Add gem:release task.
alloy authored
9 end
10
11 desc "Build a gem for the current version"
12 task :build do
13 sh "gem build cocoapods.gemspec"
14 end
15
16 desc "Install a gem version of the current code"
17 task :install => :build do
579c1a7 @lukeredpath Allow specifications to have a local source that exists outside the Pods...
lukeredpath authored
18 sh "sudo gem install #{gem_filename}"
ad82764 @alloy Add gem:release task.
alloy authored
19 end
20
b4cf71f @alloy Probably a good idea to run at least the specs as well before releasing.
alloy authored
21 desc "Run all specs, build and install gem, commit version change, tag version change, and push everything"
ad82764 @alloy Add gem:release task.
alloy authored
22 task :release do
23 puts "You are about to release `#{gem_version}', is that correct? [y/n]"
24 exit if STDIN.gets.strip.downcase != 'y'
25 lines = `git diff --numstat`.strip.split("\n")
26 if lines.size == 0
27 puts "Change the version number yourself in lib/cocoapods.rb"
28 elsif lines.size == 1 && lines.first.include?('lib/cocoapods.rb')
b4cf71f @alloy Probably a good idea to run at least the specs as well before releasing.
alloy authored
29 # First see if the specs pass and gem builds and installs
30 Rake::Task['spec:all'].invoke
ad82764 @alloy Add gem:release task.
alloy authored
31 Rake::Task['gem:install'].invoke
32 # Then release
9428428 @alloy Print the commands that are executed during gem:release.
alloy authored
33 sh "git commit lib/cocoapods.rb -m 'Release #{gem_version}'"
34 sh "git tag -a #{gem_version} -m 'Release #{gem_version}'"
35 sh "git push origin master"
36 sh "git push --tags"
37 sh "gem push #{gem_filename}"
ad82764 @alloy Add gem:release task.
alloy authored
38 else
39 puts "Only change the version number in a release commit!"
40 end
41 end
60caa66 @alloy Fix bug that would copy Pods.xcodeproj dir into existing one.
alloy authored
42 end
5d87894 @alloy Add a few rake tasks to run the specs.
alloy authored
43
907fdd1 @lukeredpath Need to build the xcodeproj native extension before running unit specs.
lukeredpath authored
44 namespace :ext do
7e2875a @alloy We need to fix the Travis/RVM 1.8.7 install by symlinking the Ruby inclu...
alloy authored
45 XCODEPROJ_DIR = "./external/Xcodeproj"
907fdd1 @lukeredpath Need to build the xcodeproj native extension before running unit specs.
lukeredpath authored
46
47 task :clean do
7e2875a @alloy We need to fix the Travis/RVM 1.8.7 install by symlinking the Ruby inclu...
alloy authored
48 sh "cd #{XCODEPROJ_DIR} && rake ext:clean"
907fdd1 @lukeredpath Need to build the xcodeproj native extension before running unit specs.
lukeredpath authored
49 end
50
51 task :build do
7e2875a @alloy We need to fix the Travis/RVM 1.8.7 install by symlinking the Ruby inclu...
alloy authored
52 sh "cd #{XCODEPROJ_DIR} && rake ext:build"
907fdd1 @lukeredpath Need to build the xcodeproj native extension before running unit specs.
lukeredpath authored
53 end
54
55 task :cleanbuild => [:clean, :build]
56 end
57
5d87894 @alloy Add a few rake tasks to run the specs.
alloy authored
58 namespace :spec do
59 desc "Run the unit specs"
907fdd1 @lukeredpath Need to build the xcodeproj native extension before running unit specs.
lukeredpath authored
60 task :unit => "ext:cleanbuild" do
c821caa @alloy Make the specs run on MRI 1.9.3
alloy authored
61 sh "bacon spec/unit/**/*_spec.rb"
5d87894 @alloy Add a few rake tasks to run the specs.
alloy authored
62 end
63
64 desc "Run the functional specs"
65594c6 @alloy Cleanup Rakefile and build ext before any type of spec run.
alloy authored
65 task :functional => "ext:cleanbuild" do
c821caa @alloy Make the specs run on MRI 1.9.3
alloy authored
66 sh "bacon spec/functional/*_spec.rb"
5d87894 @alloy Add a few rake tasks to run the specs.
alloy authored
67 end
68
69 desc "Run the integration spec"
65594c6 @alloy Cleanup Rakefile and build ext before any type of spec run.
alloy authored
70 task :integration => "ext:cleanbuild" do
c821caa @alloy Make the specs run on MRI 1.9.3
alloy authored
71 sh "bacon spec/integration_spec.rb"
5d87894 @alloy Add a few rake tasks to run the specs.
alloy authored
72 end
73
65594c6 @alloy Cleanup Rakefile and build ext before any type of spec run.
alloy authored
74 task :all => "ext:cleanbuild" do
c821caa @alloy Make the specs run on MRI 1.9.3
alloy authored
75 sh "bacon spec/**/*_spec.rb"
5d87894 @alloy Add a few rake tasks to run the specs.
alloy authored
76 end
0c8d53a @alloy Add Specification#platform.
alloy authored
77
eafb301 @alloy Try to get Travis to run the specs.
alloy authored
78 desc "Run all specs and build all examples"
79 task :ci => :all do
80 sh "./bin/pod setup" # ensure the spec repo is up-to-date
81 Rake::Task['examples:build'].invoke
82 end
83
84 # For now we don't run the intgration spec, but it should be cleaned up so it can run on Travis.
85 desc "Run the travis CI specs"
1ca552a @lukeredpath Unpack the fixture tarballs on Travis as they are being used.
lukeredpath authored
86 task :travis => [:unpack_fixture_tarballs, :all]
5016b05 @alloy Add spec:ci task.
alloy authored
87
0c8d53a @alloy Add Specification#platform.
alloy authored
88 desc "Rebuild all the fixture tarballs"
89 task :rebuild_fixture_tarballs do
90 tarballs = FileList['spec/fixtures/**/*.tar.gz']
91 tarballs.each do |tarball|
92 basename = File.basename(tarball)
93 sh "cd #{File.dirname(tarball)} && rm #{basename} && tar -zcf #{basename} #{basename[0..-8]}"
94 end
159dd1f @alloy Make the AFNetworking Mac Example work. Fix bug that caused headers to i...
alloy authored
95 end
1ca552a @lukeredpath Unpack the fixture tarballs on Travis as they are being used.
lukeredpath authored
96
97 desc "Unpacks all the fixture tarballs"
98 task :unpack_fixture_tarballs do
99 tarballs = FileList['spec/fixtures/**/*.tar.gz']
100 tarballs.each do |tarball|
101 basename = File.basename(tarball)
102 Dir.chdir(File.dirname(tarball)) do
103 sh "rm -rf #{basename[0..-8]} && tar zxf #{basename}"
104 end
105 end
106 end
159dd1f @alloy Make the AFNetworking Mac Example work. Fix bug that caused headers to i...
alloy authored
107 end
108
aba658e @alloy Add a rake task to open all example workspaces in Xcode. For some reason...
alloy authored
109 namespace :examples do
110 def examples
111 require 'pathname'
112 result = []
113 examples = Pathname.new(File.expand_path('../examples', __FILE__))
7d9479c @alloy Allow the use of the Rake FileList class for source_files, clean_paths, ...
alloy authored
114 return [examples + ENV['example']] if ENV['example']
aba658e @alloy Add a rake task to open all example workspaces in Xcode. For some reason...
alloy authored
115 examples.entries.each do |example|
116 next if %w{ . .. }.include?(example.basename.to_s)
117 example = examples + example
118 next unless example.directory?
119 result << example
120 end
121 result
122 end
123
124 desc "Open all example workspaced in Xcode, which recreates the schemes."
125 task :recreate_workspace_schemes do
126 examples.each do |example|
127 Dir.chdir(example.to_s) do
128 # TODO we need to open the workspace in Xcode at least once, otherwise it might not contain schemes.
129 # The schemes do not seem to survive a SCM round-trip.
130 sh "open '#{example.basename}.xcworkspace'"
131 sleep 5
132 end
133 end
134 end
135
136 desc "Build all examples"
137 task :build do
138 examples.entries.each do |example|
139 puts "Building example: #{example}"
140 puts
141 Dir.chdir(example.to_s) do
142 sh "rm -rf Pods DerivedData"
143 sh "#{'../../bin/' unless ENV['FROM_GEM']}pod install --verbose"
144 command = "xcodebuild -workspace '#{example.basename}.xcworkspace' -scheme '#{example.basename}'"
145 if (example + 'Podfile').read.include?('platform :ios')
146 # Specifically build against the simulator SDK so we don't have to deal with code signing.
147 command << " -sdk /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk"
148 end
149 sh command
30c8a1e @alloy Make the rake build_examples task work and use newer xcodeproj version w...
alloy authored
150 end
aba658e @alloy Add a rake task to open all example workspaces in Xcode. For some reason...
alloy authored
151 puts
159dd1f @alloy Make the AFNetworking Mac Example work. Fix bug that caused headers to i...
alloy authored
152 end
0c8d53a @alloy Add Specification#platform.
alloy authored
153 end
5d87894 @alloy Add a few rake tasks to run the specs.
alloy authored
154 end
155
156 desc "Run all specs"
157 task :spec => 'spec:all'
ef25e3f @lukeredpath Make spec the default task
lukeredpath authored
158
159 task :default => :spec
Something went wrong with that request. Please try again.