xcodebuilder 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d59aaff9c4a2068306dd0a2b76da9b55b067887
4
- data.tar.gz: b7a552232e3d331c52ecf6c10145702534dbb3f6
3
+ metadata.gz: 5d00f503638861f5ae2c3388a735ce9148ead34d
4
+ data.tar.gz: 9e2c3f9ebbefd5f8deeb58b6b0759f8ae99a97e4
5
5
  SHA512:
6
- metadata.gz: a34aeb8934fa4e1033c6b5bb9330683c35d53fe7daa43afdcbf2236a7bfcb2109fc16d36d7dea2f1b2b1ae55ad9c2a40e81c5eed57e1902957d00a8261fb1b33
7
- data.tar.gz: 006e89e42ced76e226e84b084991fbf6531bd3c5f67d816f0784d21174cad79b44427f3d5512d2b40e448a83b17315f7bebad8d18cbb5aa2d3cc94b205b006f6
6
+ metadata.gz: 600405aa31e63323e562c98b4b2ffc97952a16b693b71e7379254e9077bbf4bddc84346f9c9270cf2425c6e4cea3e532c5706d001c784b23178e52915162c49b
7
+ data.tar.gz: e15b921f581ce76c9f099d5c85b95ac9071578a8c84ab1942f690c5c9f00fb6d66f1dbd821f0357bfc5a222de0bf1b8e7565c8b5284508774fe50f6a33dab566
data/README.md CHANGED
@@ -1,233 +1,63 @@
1
- # BetaBuilder, a gem for managing iOS ad-hoc builds
1
+ # xcodebuilder, a gem for managing iOS builds
2
2
 
3
- BetaBuilder is a simple collection of Rake tasks and utilities for managing and publishing Adhoc builds of your iOS apps.
3
+ xcodebuilder is a fork from [BetaBuilder](https://github.com/lukeredpath/betabuilder), heavily modified to be more generic and convenient.
4
+ It was written to simplify CI for iOS and OSX project, as a mere ruby wrapper on xcodebuild.
4
5
 
5
- If you're looking for the OSX BetaBuilder app -- to which this gem owes most of the credit -- you can find it [here on Github](http://github.com/HunterHillegas/iOS-BetaBuilder).
6
+ In a nutshell, it supports:
7
+ * Building iOS and OSX apps
8
+ * Uploading iOS apps to testflightapp.com.
9
+ * Git tagging builds
10
+ * Automatically incrementing the `kCFBundleVersionKey` key for your project
11
+ * Linting and releasing a CocoaPod library
6
12
 
7
- **Note: As of release 0.7, support for Xcode 3 is deprecated. Xcode 4 has been out for a year, has got much more stable as of 4.1 on Lion (or 4.2 if you've been using the betas) and it's time to move on. Generating Xcode 4 friendly archives and builds in this release still needs a bit of configuration but will become much smoother in 0.8 once Xcode 3 support is removed.**
13
+ All this is implemented in plain ruby, and distributed as a ruby gem, which makes it quite trivial to integrate that with `rake`, or do more complex things should you want to.
8
14
 
9
- ## Motivation
15
+ In short, xcodebuilder is the best thing since chocolate milkshake to setup your Cocoa CI tracks: it takes care of scripting xcodebuild, taking all this complexity away from you, while you still retain fine grain control over your build.
16
+ You can pick your signing identity, add random extra params, upload your builds to TF (with or without DSYM).
17
+ If your project is simple and you don't require any of this fanciness, your rakefile is about 15 lines short.
18
+ If your project is complex and you require a bunch of fanciness, your rakefile is about 30 lines short. w00t!x
10
19
 
11
- The problem with using a GUI app to create the beta packages is that it is yet another manual step in the process of producing an ad-hoc build for your beta testers. It simplifies some steps but it still requires running Build and Archive in Xcode, saving the resulting build as an IPA package, running the Beta Builder app, locating the IPA, filling in the rest of the fields and generating the deployment files. Then you need to upload those files somewhere.
12
-
13
- As a Ruby developer, I use Rake in most of my projects to run repetitive, often build or test-related tasks and it's equally as useful for non-Ruby projects as it is for Ruby ones.
14
-
15
- This simple task library allows you to configure once and then build, package and distribute your ad-hoc releases with a single command.
16
20
 
17
21
  ## Usage
18
22
 
19
- To get started, if you don't already have a Rakefile in the root of your project, create one. If you aren't familiar with Rake, it might be worth [going over some of the basics](http://rake.rubyforge.org/) but it's fairly straightforward.
20
-
21
- You can install the BetaBuilder gem from your terminal (OSX 10.6 ships with a perfectly useful Ruby installation):
23
+ The simplest is to integrate xcodebuilder within a Rakefile.
24
+ Start off by installing xcodebuilder:
22
25
 
23
- $ gem install betabuilder
24
-
25
- At the top of your Rakefile, you'll need to require `rubygems` and the `betabuilder` gem (obviously).
26
+ $ sudo gem install xcodebuilder
26
27
 
28
+ Include the xcodebuilder gem by adding the following at the top of your Rakefile:
27
29
  require 'rubygems'
28
- require 'betabuilder'
29
-
30
- Because BetaBuilder is a Rake task library, you do not need to define any tasks yourself. You simply need to configure BetaBuilder with some basic information about your project and it will generate the tasks for you. A sample configuration might look something like this:
30
+ require 'xcodebuilder'
31
31
 
32
- BetaBuilder::Tasks.new do |config|
33
- # your Xcode target name
34
- config.target = "MyGreatApp"
32
+ Instantiate a builder object:
35
33
 
36
- # the Xcode configuration profile
37
- config.configuration = "Adhoc"
38
- end
39
-
40
- Now, if you run `rake -T` in Terminal.app in the root of your project, the available tasks will be printed with a brief description of each one:
34
+ builder = XcodeBuilder::XcodeBuilder.new do |config|
35
+ config.app_name = "YOUR_APP_NAME"
36
+ end
41
37
 
42
- rake beta:build # Build the beta release of the app
43
- rake beta:package # Package the beta release as an IPA file
44
-
45
- If you use a custom Xcode build directory, rather than the default `${SRCROOT}/build` location, you can configure that too:
38
+ Build your project. This will package an IPA and drop it in ./pkg:
46
39
 
47
- BetaBuilder::Tasks.new do |config|
48
- ...
49
- config.build_dir = "/path/to/custom/build/dir"
40
+ task :build do
41
+ builder.package
50
42
  end
51
43
 
52
- To deploy your beta to your testers, some additional configuration is needed (see the next section).
53
-
54
- Most of the time, you'll not need to run the `beta:build` task directly; it will be run automatically as a dependency of `beta:package`. Upon running this task, your ad-hoc build will be packaged into an IPA file and will be saved in `${PROJECT_ROOT}/pkg/dist`, along with a HTML index file and the manifest file needed for over-the-air installation.
55
-
56
- If you are not using the automatic deployment task, you will need to upload the contents of the pkg/dist directory to your server.
44
+ Release your project. This will package the IPA, drop it in ./pkg, increment the build number and git tag the tree:
57
45
 
58
- To use a namespace other than "beta" for the generated tasks, simply pass in your chosen namespace to BetaBuilder::Tasks.new:
59
-
60
- BetaBuilder::Tasks.new(:my_custom_namespace) do |config|
46
+ task :build do
47
+ builder.release
61
48
  end
62
-
63
- This lets you set up different sets of BetaBuilder tasks for different configurations in the same Rakefile (e.g. a production and staging build).
64
49
 
65
50
  ## Configuration
66
51
  A full list of configuration options and their details
67
52
 
68
- `configuration` - (String) The Xcode Configuration to use (Defined on the Info tab of the Project)
69
-
70
- `build_dir` - (File Path) The directory the build output will be. (`:derived` for Xcode 4 for versions < 0.8)
71
-
72
- `auto_archive` - (true/**false**) Automatically archive when packaging
73
-
74
- `archive_path` - (File Path) Path to the Archives
75
-
76
- `xcodebuild_path` - (File Path) Path to xcodebuild, if its non-standard
77
-
78
- `xcodeargs` - (Arguments) Arguments passed to `xcodebuild` when it runs
79
-
80
- `project_file_path` - (File Path) Path to the `.xcodeproj` file
81
-
82
- `workspace_path` - (File Path) Path to the `.xcworkspace` file
83
-
84
- `ipa_destination_path` - (File Path) Path to output Packaged IPA to
85
-
86
- `scheme` - (String) What Scheme to use when building
87
-
88
- `app_name` - (String) The name of the app being built (should match the file name, less the `.app` extension)
89
-
90
- `arch` - (String) The architecture to build for, if different from project settings
91
-
92
- `xcode4_archive_mode` - (true/**false**) Use Xcode4's Archive mode
93
-
94
- `skip_clean` - (true/**false**) Skip the clean step when building
95
-
96
- `verbose` - (true/**false**) Increased output for debugging
97
-
98
- `dry_run` - (true/**false**) Don't upload to Distribution Strategy, just act like it
99
-
100
- `set_version_number` - (true/**false**) Attempts to set a version number, see below
101
-
102
- ### Configuration (Testflight)
103
- Testflight presents its own set of options that can be configured
104
-
105
- `api_token` - (String) Can be your API key, but its recommended to use an `ENV[""]` variable
106
-
107
- `team_token` - (String) Your Team's Testflight API token
108
-
109
- `distribution_lists` - (Array) A Ruby array (`[1,2]` or `%w{1 2}`) of distribution list names for Testflight
110
-
111
- `notify` - (true/**false**) Notify the distribution list of this build
112
-
113
- `replace` - (true/**false**) Replace if an existing build exists with the same ID and version
114
-
115
- ### Configuration (Web)
116
- Pushing to a web server has the following options.
117
-
118
- SSH keys will simplify authentication and make this process seamless
119
-
120
- `remote_host` - (String) Hostname for the server the build will be pushed to
121
-
122
- `remote_port` - (String) Port Number to use for SCP/SFTP
123
-
124
- `remote_installation_path` - (String) Remote Path
125
-
126
- ### Configuration (RunTime)
127
- Certain configuration options are availabe at the command line, so that you can temporarily set them for a single run without modifying your configuration.
128
-
129
- Pass any of these in as environment variables:
130
-
131
- `DRY` - (true/**false**) Enable Dry Run
132
- `VERBOSE` - (true/**false**) Turn on all output; lets you see the clean, build, and signing output
133
- `SKIPCLEAN` - (true/**false**) Skips the clean step and goes right to Build.
134
-
135
- ####Examples
136
-
137
- `rake staging:deploy DRY=true`
138
-
139
- `rake staging:redeploy VERBOSE=true SKIPCLEAN=true`
140
-
141
- ## Xcode 4 support
142
-
143
- Betabuilder works with Xcode 4, but you may need to tweak your task configuration slightly. The most important change you will need to make is the build directory location, unless you have configured Xcode 4 to use the "build" directory relative to your project, as in Xcode 3.
144
-
145
- If you are using the Xcode derived data directory for your builds, then you will need to specify this. Betabuilder will then scan your build log to determine the path to the automatically generated build directory that Xcode is using for your project.
146
-
147
- config.build_dir = :derived
148
-
149
- This will become the default in 0.8.
150
-
151
- If you wish to generate archives for your Xcode 4 project, you will need to enable this. This will become the default in future once Xcode 3 support is dropped (deprecated in 0.7):
152
-
153
- config.xcode4_archive_mode = true
154
-
155
- If you are working with an Xcode 4 workspace instead of a project file, you will need to configure this too:
156
-
157
- config.workspace_path = "MyWorkspace.xcworkspace"
158
- config.scheme = "My App Scheme"
159
- config.app_name = "MyApp"
160
- set_version_number
161
- If you are using a workspace, then you must specify the scheme. You can still specify the build configuration (e.g. Release).
162
-
163
- ## Automatic deployment with deployment strategies
164
-
165
- BetaBuilder allows you to deploy your built package using it's extensible deployment strategy system; the gem currently comes with support for simple web-based deployment or uploading to [TestFlightApp.com](http://www.testflightapp.com). Eventually, you will be able to write your own custom deployment strategies if neither of these are suitable for your needs.
166
-
167
- ## Setting version numbers automatically
168
-
169
- You can use betabuilder to set a build number using Git's `describe` system. In order for that to work, at least one `tag` must exist somewhere in the git hierarchy for the branch being built from.
170
-
171
- Also, you are required to set your `CFBundleVersion` to `${VERSION_LONG}` inside your `Info.plist`. To accomodate manual builds, add a `VERSION_LONG` Build Setting to your app's Project, and treat it as you normally would your `Info.plist` version number.
172
-
173
- Once a tag is created and your App is configured, simply add this to your BetaBuilder config and it will use Git to generate the
174
-
175
- config.set_version_number = true
176
-
177
- It will generate a version number like: `1.0-15-g6b3c1bb`.
178
-
179
- * *1.0* is the most recent tag
180
- * *15* is the number of commits since the tag was generated
181
- * *g6b3c1bb* is the beginning of the hash of the last commit.
182
-
183
- ### Deploying your app with TestFlight
184
-
185
- By far the easiest way to get your beta release into the hands of your testers is using the excellent [TestFlight service](http://testflightapp.com/), although at the time of writing it is still in private beta. You can use TestFlight to manage your beta testers and notify them of new releases instantly.
186
-
187
- TestFlight provides an upload API and betabuilder uses that to provide a `:testflight` upload strategy. This strategy requires two pieces of information: your TestFlight API token and your team token:
188
-
189
- config.deploy_using(:testflight) do |tf|
190
- tf.api_token = "YOUR_API_TOKEN"
191
- tf.team_token = "YOUR_TEAM_TOKEN"
192
- end
193
-
194
- Now, instead of using the `beta:package` task, you can run the `beta:deploy` task instead. This task will run the package task as a dependency and upload the generated IPA file to TestFlight.
195
-
196
- You will be prompted to enter the release notes for the build; TestFlight requires these to inform your testers of what has changed in this build. Alternatively, if you have a way of generating the release notes automatically (for instance, using a CHANGELOG file or a git log command), you can specify a block that will be called at runtime - you can do whatever you want in this block, as long as you return a string which will be used as the release notes, e.g.
197
-
198
- config.deploy_using(:testflight) do |tf|
199
- ...
200
- tf.generate_release_notes do
201
- # return release notes here
202
- end
203
- end
204
-
205
- Finally, you can also specify an array of distribution lists that you want to allow access to the build:
206
-
207
- config.deploy_using(:testflight) do |tf|
208
- ...
209
- tf.distribution_lists = %w{Testers Internal}
210
- end
211
-
212
- ### Deploying to your own server
213
-
214
- BetaBuilder also comes with a rather rudimentary web-based deployment task that uses SCP, so you will need SSH access to your server and appropriate permissions to use it. This works in the same way as the original iOS-BetaBuilder GUI app by generating a HTML template and manifest file that can be uploaded to a directly on your server. It includes links to install the app automatically on the device or download the IPA file.
215
-
216
- You will to configure betabuilder to use the `web` deployment strategy with some additional configuration:
217
-
218
- config.deploy_using(:web) do |web|
219
- web.deploy_to = "http://beta.myserver.co.uk/myapp"
220
- web.remote_host = "myserver.com"
221
- web.remote_directory = "/remote/path/to/deployment/directory"
222
- end
223
-
224
- The `deploy_to` setting specifies the URL that your app will be published to. The `remote_host` setting is the SSH host that will be used to copy the files to your server using SCP. Finally, the `remote_directory` setting is the path to the location to your server that files will be uploaded to. You will need to configure any virtual hosts on your server to make this work.
53
+ More coming!
225
54
 
226
55
  ## License
227
56
 
228
57
  This code is licensed under the MIT license.
229
58
 
230
59
  Copyright (c) 2010 Luke Redpath
60
+ Copyright (c) 2013 Olivier Larivain
231
61
 
232
62
  Permission is hereby granted, free of charge, to any person obtaining a copy
233
63
  of this software and associated documentation files (the "Software"), to deal
data/lib/xcode_builder.rb CHANGED
@@ -11,7 +11,7 @@ module XcodeBuilder
11
11
 
12
12
  def initialize(namespace = :xcbuild, &block)
13
13
  @configuration = Configuration.new(
14
- :configuration => "Adhoc",
14
+ :configuration => "Release",
15
15
  :build_dir => "build",
16
16
  :xcodebuild_extra_args => nil,
17
17
  :xcrun_extra_args => nil,
@@ -241,7 +241,7 @@ module XcodeBuilder
241
241
  # runs a pod dry run before tagging
242
242
  def pod_dry_run
243
243
  print "Pod dry run..."
244
- result = system "pod lib lint --only-errors"
244
+ result = system "pod lib lint #{@configuration.podspec_file} --only-errors"
245
245
  raise "** Pod dry run failed **" if !result
246
246
  puts "Done"
247
247
  end
@@ -251,6 +251,7 @@ module XcodeBuilder
251
251
  cmd << "pod"
252
252
  cmd << "push"
253
253
  cmd << @configuration.pod_repo
254
+ cmd << @configuration.podspec_file
254
255
  cmd << "--allow-warnings"
255
256
 
256
257
  print "Pushing to CocoaPod..."
@@ -10,7 +10,7 @@ module XcodeBuilder
10
10
  end
11
11
 
12
12
  if @branch == nil then
13
- @branch = "master"
13
+ @branch = `git rev-parse --abbrev-ref HEAD`.gsub("\n", "")
14
14
  end
15
15
 
16
16
  if @tag_name == nil then
@@ -34,6 +34,13 @@ module XcodeBuilder
34
34
  puts
35
35
  puts "Done"
36
36
 
37
+ puts
38
+ puts "Pulling from remote repo before pushing..."
39
+ result = system("git pull #{@origin} #{@branch}")
40
+ raise "Couldn't merge from #{@origin} #{@branch} - did somebody push a conflicting commit while I was building?" unless result
41
+ puts
42
+ puts "Done"
43
+
37
44
  # then push tags to the remote server
38
45
  print "Pushing tag to #{@origin} on branch #{@branch}"
39
46
  cmd = []
@@ -62,8 +69,8 @@ module XcodeBuilder
62
69
  @configuration.increment_pod_number
63
70
 
64
71
  # commit
65
- print "Committing #{@configuration.info_plist} and #{@configuration.podspec_file} with version #{build_number}"
66
- stage_files [@configuration.info_plist, @configuration.podspec_file]
72
+ print "Committing #{@configuration.podspec_file} with version #{build_number}"
73
+ stage_files [@configuration.podspec_file]
67
74
  commit_and_push_with_message "Preparing for next pod release #{next_build_number}..."
68
75
 
69
76
  puts "Done"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcodebuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Larivain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-01 00:00:00.000000000 Z
11
+ date: 2014-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: CFPropertyList