Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 180 lines (155 sloc) 6.297 kb
0a93b37 Blake Watters Upgraded to UISpecRunner 0.4.0. Added Rakefile for running all the specs...
blakewatters authored
1 require 'rubygems'
4b84c15 Blake Watters Migrated Test Server execution to the new RestKit gem
blakewatters authored
2 require 'bundler/setup'
c4e40ba Blake Watters Switch test automation to xctasks
blakewatters authored
3 Bundler.setup
4 require 'xctasks/test_task'
656c2d6 Blake Watters Dump RestKit gem in favor of RakeUp (https://github.com/blakewatters/Rak...
blakewatters authored
5 require 'rakeup'
0a93b37 Blake Watters Upgraded to UISpecRunner 0.4.0. Added Rakefile for running all the specs...
blakewatters authored
6
656c2d6 Blake Watters Dump RestKit gem in favor of RakeUp (https://github.com/blakewatters/Rak...
blakewatters authored
7 RakeUp::ServerTask.new do |t|
4b84c15 Blake Watters Migrated Test Server execution to the new RestKit gem
blakewatters authored
8 t.port = 4567
9 t.pid_file = 'Tests/Server/server.pid'
10 t.rackup_file = 'Tests/Server/server.ru'
656c2d6 Blake Watters Dump RestKit gem in favor of RakeUp (https://github.com/blakewatters/Rak...
blakewatters authored
11 t.server = :thin
0a93b37 Blake Watters Upgraded to UISpecRunner 0.4.0. Added Rakefile for running all the specs...
blakewatters authored
12 end
13
c4e40ba Blake Watters Switch test automation to xctasks
blakewatters authored
14 XCTasks::TestTask.new(:test) do |t|
15 t.workspace = 'RestKit.xcworkspace'
16 t.schemes_dir = 'Tests/Schemes'
17 t.runner = :xcpretty
18 t.actions = %w{test}
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
19
c4e40ba Blake Watters Switch test automation to xctasks
blakewatters authored
20 t.subtask(ios: 'RestKitTests') do |s|
21 s.sdk = :iphonesimulator
5dce4c3 Blake Watters Migrate unit testing infrastructure from xcoder to xctool. Add Travis CI...
blakewatters authored
22 end
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
23
c4e40ba Blake Watters Switch test automation to xctasks
blakewatters authored
24 t.subtask(osx: 'RestKitFrameworkTests') do |s|
25 s.sdk = :macosx
f8c35cc Blake Watters Add colorized output for full Rake suite execution
blakewatters authored
26 end
c4e40ba Blake Watters Switch test automation to xctasks
blakewatters authored
27 end
28
29 task default: 'test'
30
31 namespace :test do
c907c62 Blake Watters Add Rake task for verifying that RestKit continues to build without dire...
blakewatters authored
32 # Provides validation that RestKit continues to build without Core Data. This requires conditional compilation that is error prone
33 task :building_without_core_data do
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
34 title 'Testing without Core Data'
35 run("cd Examples/RKTwitter && pod install")
36 run("xctool -workspace Examples/RKTwitter/RKTwitter.xcworkspace -scheme RKTwitterCocoaPods -sdk iphonesimulator clean build ONLY_ACTIVE_ARCH=NO")
c907c62 Blake Watters Add Rake task for verifying that RestKit continues to build without dire...
blakewatters authored
37 end
6b9bebd Blake Watters Implemented Rake tasks for executing unit tests for iOS and OS X
blakewatters authored
38 end
39
4c1c928 Blake Watters Simplify `rake test` execution a bit
blakewatters authored
40 task :default => ["server:autostart", :test, "server:autostop"]
6b9bebd Blake Watters Implemented Rake tasks for executing unit tests for iOS and OS X
blakewatters authored
41
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
42 def restkit_version
43 @restkit_version ||= ENV['VERSION'] || File.read("VERSION").chomp
44 end
45
46 def apple_doc_command
b92ecc6 Paul Melnikow Rakefile: Remove template path from appledoc invocation
paulmelnikow authored
47 "/usr/local/bin/appledoc -o Docs/API -p RestKit -v #{restkit_version} -c \"RestKit\" " +
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
48 "--company-id org.restkit --warn-undocumented-object --warn-undocumented-member --warn-empty-description --warn-unknown-directive " +
49 "--warn-invalid-crossref --warn-missing-arg --no-repeat-first-par "
50 end
51
946c558 Blake Watters Updated appledoc binary and templates. Fixed ampersands in some comments...
blakewatters authored
52 def run(command, min_exit_status = 0)
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
53 puts "Executing: `#{command}`"
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
54 sh(command)
946c558 Blake Watters Updated appledoc binary and templates. Fixed ampersands in some comments...
blakewatters authored
55 if $?.exitstatus > min_exit_status
6f40587 Blake Watters Updated appledoc binary
blakewatters authored
56 puts "[!] Failed with exit code #{$?.exitstatus} while running: `#{command}`"
57 exit($?.exitstatus)
1437026 Blake Watters Fail out build process when run_command encounters non-zero exit status....
blakewatters authored
58 end
946c558 Blake Watters Updated appledoc binary and templates. Fixed ampersands in some comments...
blakewatters authored
59 return $?.exitstatus
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
60 end
61
9593612 Blake Watters Closes gh-47. Initial implementation of OS X build integrating changes s...
blakewatters authored
62 desc "Build RestKit for iOS and Mac OS X"
63 task :build do
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
64 title 'Building RestKit'
906e33d Blake Watters Restore execution of Unit Tests via Rake
blakewatters authored
65 run("xcodebuild -workspace RestKit.xcworkspace -scheme RestKit -sdk iphonesimulator5.0 clean build")
66 run("xcodebuild -workspace RestKit.xcworkspace -scheme RestKit -sdk iphoneos clean build")
67 run("xcodebuild -workspace RestKit.xcworkspace -scheme RestKit -sdk macosx10.6 clean build")
9593612 Blake Watters Closes gh-47. Initial implementation of OS X build integrating changes s...
blakewatters authored
68 end
9af6a59 Blake Watters Initial implementation of documentation generation using the Appledoc pa...
blakewatters authored
69
70 desc "Generate documentation via appledoc"
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
71 task :docs => 'docs:generate'
72
d4104c2 Blake Watters Only generate docs from header files to remove private classes from bein...
blakewatters authored
73 namespace :appledoc do
74 task :check do
75 unless File.exists?('/usr/local/bin/appledoc')
475e7ff Paul Melnikow Rakefile: Prevent 'rake docs' from failing silently when appledoc is not...
paulmelnikow authored
76 puts "appledoc not found at /usr/local/bin/appledoc: Install via homebrew and try again: `brew install --HEAD appledoc`"
d4104c2 Blake Watters Only generate docs from header files to remove private classes from bein...
blakewatters authored
77 exit 1
78 end
79 end
80 end
81
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
82 namespace :docs do
d4104c2 Blake Watters Only generate docs from header files to remove private classes from bein...
blakewatters authored
83 task :generate => 'appledoc:check' do
84 command = apple_doc_command << " --no-create-docset --keep-intermediate-files --create-html `find Code/ -name '*.h'`"
db0b976 Blake Watters Allow exit status of 1 (Warning) for `rake docs:generate`
blakewatters authored
85 run(command, 1)
5ef0c07 Mickey Reiss Fix typo
mickeyreiss authored
86 puts "Generated HTML documentation at Docs/API/html"
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
87 end
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
88
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
89 desc "Check that documentation can be built from the source code via appledoc successfully."
d4104c2 Blake Watters Only generate docs from header files to remove private classes from bein...
blakewatters authored
90 task :check => 'appledoc:check' do
91 command = apple_doc_command << " --no-create-html --verbose 5 `find Code/ -name '*.h'`"
946c558 Blake Watters Updated appledoc binary and templates. Fixed ampersands in some comments...
blakewatters authored
92 exitstatus = run(command, 1)
93 if exitstatus == 0
94 puts "appledoc generation completed successfully!"
95 elsif exitstatus == 1
96 puts "appledoc generation produced warnings"
97 elsif exitstatus == 2
98 puts "! appledoc generation encountered an error"
d810791 Blake Watters Expanded `rake validate` task to build all the example projects. fixes #...
blakewatters authored
99 exit(exitstatus)
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
100 else
946c558 Blake Watters Updated appledoc binary and templates. Fixed ampersands in some comments...
blakewatters authored
101 puts "!! appledoc generation failed with a fatal error"
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
102 end
3d0f0ab Blake Watters Introduced the RKTableController component for iOS.
blakewatters authored
103 exit(exitstatus)
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
104 end
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
105
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
106 desc "Generate & install a docset into Xcode from the current sources"
d4104c2 Blake Watters Only generate docs from header files to remove private classes from bein...
blakewatters authored
107 task :install => 'appledoc:check' do
108 command = apple_doc_command << " --install-docset `find Code/ -name '*.h'`"
ac5d2d5 Blake Watters Don't fail out `rake docs:install` when Appledoc exits with warning exit...
blakewatters authored
109 run(command, 1)
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
110 end
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
111
7d612fc Blake Watters Add support for building and publishing docs during CI build. refs #685
blakewatters authored
112 desc "Build and publish the documentation set to the remote server (using rsync over SSH)"
5f918a8 Blake Watters Don't publish the feed when Jenkins regenerates the documentation
blakewatters authored
113 task :publish, :version, :destination, :publish_feed do |t, args|
114 args.with_defaults(:version => File.read("VERSION").chomp, :destination => "restkit.org:/var/www/public/restkit.org/public/api/", :publish_feed => 'true')
7d612fc Blake Watters Add support for building and publishing docs during CI build. refs #685
blakewatters authored
115 version = args[:version]
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
116 destination = args[:destination]
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
117 puts "Generating RestKit docset for version #{version}..."
118 command = apple_doc_command <<
119 " --keep-intermediate-files" <<
120 " --docset-feed-name \"RestKit #{version} Documentation\"" <<
121 " --docset-feed-url http://restkit.org/api/%DOCSETATOMFILENAME" <<
d4104c2 Blake Watters Only generate docs from header files to remove private classes from bein...
blakewatters authored
122 " --docset-package-url http://restkit.org/api/%DOCSETPACKAGEFILENAME --publish-docset --verbose 3 `find Code/ -name '*.h'`"
946c558 Blake Watters Updated appledoc binary and templates. Fixed ampersands in some comments...
blakewatters authored
123 run(command, 1)
7d612fc Blake Watters Add support for building and publishing docs during CI build. refs #685
blakewatters authored
124 puts "Uploading docset to #{destination}..."
125 versioned_destination = File.join(destination, version)
126 command = "rsync -rvpPe ssh --delete Docs/API/html/ #{versioned_destination}"
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
127 run(command)
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
128
5f918a8 Blake Watters Don't publish the feed when Jenkins regenerates the documentation
blakewatters authored
129 should_publish_feed = %{yes true 1}.include?(args[:publish_feed].downcase)
130 if $?.exitstatus == 0 && should_publish_feed
9a04de9 Blake Watters Re-enable publishing of the Atom feed
blakewatters authored
131 command = "rsync -rvpPe ssh Docs/API/publish/* #{destination}"
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
132 run(command)
133 end
134 end
135 end
136
d810791 Blake Watters Expanded `rake validate` task to build all the example projects. fixes #...
blakewatters authored
137 namespace :build do
138 desc "Build all Example projects to ensure they are building properly"
139 task :examples do
79af50d Blake Watters Update `rake validate` to build using xctool instead of xcodebuild for m...
blakewatters authored
140 ios_sdks = %w{iphonesimulator5.0 iphonesimulator6.0}
d810791 Blake Watters Expanded `rake validate` task to build all the example projects. fixes #...
blakewatters authored
141 osx_sdks = %w{macosx}
142 osx_projects = %w{RKMacOSX}
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
143
d810791 Blake Watters Expanded `rake validate` task to build all the example projects. fixes #...
blakewatters authored
144 examples_path = File.join(File.expand_path(File.dirname(__FILE__)), 'Examples')
145 example_projects = `find #{examples_path} -name '*.xcodeproj'`.split("\n")
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
146 title "Building #{example_projects.size} Example projects..."
d810791 Blake Watters Expanded `rake validate` task to build all the example projects. fixes #...
blakewatters authored
147 example_projects.each do |example_project|
148 project_name = File.basename(example_project).gsub('.xcodeproj', '')
149 sdks = osx_projects.include?(project_name) ? osx_sdks : ios_sdks
150 sdks.each do |sdk|
151 puts "Building '#{example_project}' with SDK #{sdk}..."
152 scheme = project_name
79af50d Blake Watters Update `rake validate` to build using xctool instead of xcodebuild for m...
blakewatters authored
153 run("xctool -workspace #{example_project}/project.xcworkspace -scheme #{scheme} -sdk #{sdk} clean build")
d810791 Blake Watters Expanded `rake validate` task to build all the example projects. fixes #...
blakewatters authored
154 end
155 end
156 end
157 end
158
462cf35 Blake Watters Implemented Rake tasks for generating documentation via Appledoc very si...
blakewatters authored
159 desc "Validate a branch is ready for merging by checking for common issues"
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
160 task :validate => ['build:examples', 'docs:check', :test] do
3d0f0ab Blake Watters Introduced the RKTableController component for iOS.
blakewatters authored
161 puts "Project state validated successfully. Proceed with merge."
9af6a59 Blake Watters Initial implementation of documentation generation using the Appledoc pa...
blakewatters authored
162 end
4be1629 Samuel E. Giddins Update CI rake task
segiddins authored
163
164 task :lint do
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
165 title 'Linting pod'
166 run('bundle exec pod lib lint')
4be1629 Samuel E. Giddins Update CI rake task
segiddins authored
167 end
168
169 desc 'Runs the CI suite'
170 task :ci => ['server:start', :test, 'test:building_without_core_data', :lint]
171
4e6f1f4 Samuel E. Giddins [Rakefile] Use run instead of system
segiddins authored
172 def title(title)
173 cyan_title = "\033[0;36m#{title}\033[0m"
174 puts
175 puts "-" * 80
176 puts cyan_title
177 puts "-" * 80
178 puts
179 end
Something went wrong with that request. Please try again.