betabuilder 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/LICENSE +19 -0
  2. data/README.md +83 -0
  3. data/lib/beta_builder.rb +141 -0
  4. data/lib/betabuilder.rb +1 -0
  5. metadata +86 -0
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Luke Redpath
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # BetaBuilder, a gem for managing iOS ad-hoc builds
2
+
3
+ BetaBuilder is a simple collection of Rake tasks and utilities for managing and publishing Adhoc builds of your iOS apps.
4
+
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
+
7
+ ## Motiviation
8
+
9
+ 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.
10
+
11
+ 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.
12
+
13
+ This simple task library allows you to configure once and then build, package and distribute your ad-hoc releases with a single command.
14
+
15
+ ## Usage
16
+
17
+ 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.
18
+
19
+ You can install the BetaBuilder gem from your terminal (OSX 10.6 works with a perfectly useful Ruby installation):
20
+
21
+ $ gem install betabuilder
22
+
23
+ At the top of your Rakefile, you'll need to require `rubygems` and the `betabuilder` gem (obviously).
24
+
25
+ require 'rubygems'
26
+ require 'betabuilder'
27
+
28
+ 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:
29
+
30
+ BetaBuilder::Tasks.new do |config|
31
+ # your Xcode target name
32
+ config.target = "MyGreatApp"
33
+
34
+ # the Xcode configuration profile
35
+ config.configuration = "Adhoc"
36
+
37
+ # where the distribution files will be uploaded to
38
+ config.deploy_to = "http://yourwebsite.com/betas/"
39
+ end
40
+
41
+ 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:
42
+
43
+ rake beta:build # Build the beta release of the app
44
+ rake beta:deploy # Deploy the beta to your server
45
+ rake beta:package # Package the beta release as an IPA file
46
+
47
+ To deploy a beta to your server, some additional configuration is needed (see the next section).
48
+
49
+ 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.
50
+
51
+ If you are not using the automatic deployment task, you will need to upload the contents of the pkg/dist directory to your server.
52
+
53
+ ## Automatic deployment
54
+
55
+ BetaBuilder also comes with a (rather rudimentary) automatic deployment task that uses SCP so you will need SSH access to your server and appropriate permissions to use it. You will also need one extra line of configuration in your Rakefile, specifying the path on the remote server where the files will be copied to:
56
+
57
+ config.remote_directory = "/var/www/yourwebsite.com/betas"
58
+
59
+ 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 pkg/dist directory to the remote directory you have configured (again, you will need to ensure that you have the correct permissions for this to work).
60
+
61
+ ## License
62
+
63
+ This code is licensed under the MIT license.
64
+
65
+ Copyright (c) 2010 Luke Redpath
66
+
67
+ Permission is hereby granted, free of charge, to any person obtaining a copy
68
+ of this software and associated documentation files (the "Software"), to deal
69
+ in the Software without restriction, including without limitation the rights
70
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
71
+ copies of the Software, and to permit persons to whom the Software is
72
+ furnished to do so, subject to the following conditions:
73
+
74
+ The above copyright notice and this permission notice shall be included in
75
+ all copies or substantial portions of the Software.
76
+
77
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
78
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
79
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
80
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
81
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
82
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
83
+ THE SOFTWARE.
@@ -0,0 +1,141 @@
1
+ require 'ostruct'
2
+ require 'fileutils'
3
+ require 'cfpropertylist'
4
+
5
+ module BetaBuilder
6
+ class Tasks < ::Rake::TaskLib
7
+ def initialize(&block)
8
+ @configuration = Configuration.new(
9
+ :configuration => "Adhoc",
10
+ :build_dir => "build"
11
+ )
12
+ yield @configuration if block_given?
13
+ define
14
+ end
15
+
16
+ class Configuration < OpenStruct
17
+ def build_arguments
18
+ "-target #{target} -configuration #{configuration} -sdk iphoneos"
19
+ end
20
+
21
+ def app_name
22
+ "#{target}.app"
23
+ end
24
+
25
+ def ipa_name
26
+ "#{target}.ipa"
27
+ end
28
+
29
+ def built_app_path
30
+ "#{build_dir}/#{configuration}-iphoneos/#{app_name}"
31
+ end
32
+
33
+ def deployment_url
34
+ File.join(deploy_to, target.downcase, ipa_name)
35
+ end
36
+
37
+ def manifest_url
38
+ File.join(deploy_to, target.downcase, "manifest.plist")
39
+ end
40
+
41
+ def remote_installation_path
42
+ File.join(remote_directory, target.downcase)
43
+ end
44
+ end
45
+
46
+ private
47
+
48
+ def define
49
+ namespace :beta do
50
+ desc "Build the beta release of the app"
51
+ task :build => :clean do
52
+ system("xcodebuild #{@configuration.build_arguments} build")
53
+ end
54
+
55
+ task :clean do
56
+ system("xcodebuild #{@configuration.build_arguments} clean")
57
+ end
58
+
59
+ desc "Package the beta release as an IPA file"
60
+ task :package => :build do
61
+ FileUtils.rm_rf('pkg') && FileUtils.mkdir_p('pkg')
62
+ FileUtils.mkdir_p("pkg/Payload")
63
+ FileUtils.mv(@configuration.built_app_path, "pkg/Payload/#{@configuration.app_name}")
64
+ Dir.chdir("pkg") do
65
+ system("zip -r #{@configuration.ipa_name} Payload")
66
+ end
67
+ FileUtils.mkdir('pkg/dist')
68
+ FileUtils.mv("pkg/#{@configuration.ipa_name}", "pkg/dist")
69
+ plist = CFPropertyList::List.new(:file => "pkg/Payload/#{@configuration.app_name}/Info.plist")
70
+ plist_data = CFPropertyList.native_types(plist.value)
71
+ File.open("pkg/dist/manifest.plist", "w") do |io|
72
+ io << %{
73
+ <?xml version="1.0" encoding="UTF-8"?>
74
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
75
+ <plist version="1.0">
76
+ <dict>
77
+ <key>items</key>
78
+ <array>
79
+ <dict>
80
+ <key>assets</key>
81
+ <array>
82
+ <dict>
83
+ <key>kind</key>
84
+ <string>software-package</string>
85
+ <key>url</key>
86
+ <string>#{@configuration.deployment_url}</string>
87
+ </dict>
88
+ </array>
89
+ <key>metadata</key>
90
+ <dict>
91
+ <key>bundle-identifier</key>
92
+ <string>#{plist_data['CFBundleIdentifier']}</string>
93
+ <key>bundle-version</key>
94
+ <string>#{plist_data['CFBundleVersion']}</string>
95
+ <key>kind</key>
96
+ <string>software</string>
97
+ <key>title</key>
98
+ <string>#{plist_data['CFBundleDisplayName']}</string>
99
+ </dict>
100
+ </dict>
101
+ </array>
102
+ </dict>
103
+ </plist>
104
+ }
105
+ end
106
+ File.open("pkg/dist/index.html", "w") do |io|
107
+ io << %{
108
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
109
+ <html xmlns="http://www.w3.org/1999/xhtml">
110
+ <head>
111
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
112
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
113
+ <title>Beta Download</title>
114
+ <style type="text/css">
115
+ body {background:#fff;margin:0;padding:0;font-family:arial,helvetica,sans-serif;text-align:center;padding:10px;color:#333;font-size:16px;}
116
+ #container {width:300px;margin:0 auto;}
117
+ h1 {margin:0;padding:0;font-size:14px;}
118
+ p {font-size:13px;}
119
+ .link {background:#ecf5ff;border-top:1px solid #fff;border:1px solid #dfebf8;margin-top:.5em;padding:.3em;}
120
+ .link a {text-decoration:none;font-size:15px;display:block;color:#069;}
121
+ </style>
122
+ </head>
123
+ <body>
124
+ <div id="container">
125
+ <div class="link"><a href="itms-services://?action=download-manifest&url=#{@configuration.manifest_url}">Tap Here to Install<br />#{@configuration.target}<br />On Your Device</a></div>
126
+ <p><strong>Link didn't work?</strong><br />
127
+ Make sure you're visiting this page on your device, not your computer.</p>
128
+ </body>
129
+ </html>
130
+ }
131
+ end
132
+ end
133
+
134
+ desc "Deploy the beta to your server"
135
+ task :deploy => :package do
136
+ system("scp pkg/dist/* lukeredpath.co.uk:#{@configuration.remote_installation_path}")
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1 @@
1
+ require 'beta_builder'
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: betabuilder
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Luke Redpath
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-02 00:00:00 +00:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: CFPropertyList
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 15
30
+ segments:
31
+ - 2
32
+ - 0
33
+ - 0
34
+ version: 2.0.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description:
38
+ email: luke@lukeredpath.co.uk
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - README.md
45
+ files:
46
+ - LICENSE
47
+ - README.md
48
+ - lib/beta_builder.rb
49
+ - lib/betabuilder.rb
50
+ has_rdoc: false
51
+ homepage: http://lukeredpath.co.uk
52
+ licenses: []
53
+
54
+ post_install_message:
55
+ rdoc_options:
56
+ - --main
57
+ - README.md
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ requirements: []
79
+
80
+ rubyforge_project:
81
+ rubygems_version: 1.3.7
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: A set of Rake tasks and utilities for managing iOS ad-hoc builds
85
+ test_files: []
86
+