Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.7.4
* Forked by danhollywells 10/25/11
* added Dropbox Public folder deployment strategy

## 0.7.3
* Made the Xcode derived data directory more robust by grepping for the Validate line in the log.

Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,23 @@ You will to configure betabuilder to use the `web` deployment strategy with some

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.

## Deploying to Dropbox

BetaBuilder now supports deploying to your Dropbox /Public folder. Below is an example configuration block.

config.deploy_using(:dropbox) do |c|
c.user_id = "XXXXXX"
c.open_browser_when_done = true
c.consumer_key = "XXXXXXXXXXX" #see https://www.dropbox.com/developers/apps for keys
c.consumer_secret = "XXXXXXXXXXX"
c.deploy_to = "/dropbox/path/to/deployment"
end

`user_id` is your dropbox UserID
`open_browser_when_done` will launch safari on successful deployment
`consumer_key` and `consumer_secret` Create these values at https://www.dropbox.com/developers/apps
`deploy_to` Path within your /Public folder to deploy

## License

This code is licensed under the MIT license.
Expand Down
7 changes: 5 additions & 2 deletions betabuilder.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

Gem::Specification.new do |s|
s.name = %q{betabuilder}
s.version = "0.7.3"
s.version = "0.7.4"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Luke Redpath"]
s.date = %q{2011-08-05}
s.email = %q{[email protected]}
s.extra_rdoc_files = ["README.md", "LICENSE", "CHANGES.md"]
s.files = ["CHANGES.md", "LICENSE", "README.md", "lib/beta_builder/archived_build.rb", "lib/beta_builder/deployment_strategies/testflight.rb", "lib/beta_builder/deployment_strategies/web.rb", "lib/beta_builder/deployment_strategies.rb", "lib/beta_builder.rb", "lib/betabuilder.rb"]
s.files = ["CHANGES.md", "LICENSE", "README.md", "lib/beta_builder/archived_build.rb", "lib/beta_builder/deployment_strategies/testflight.rb", "lib/beta_builder/deployment_strategies/dropbox.rb", "lib/beta_builder/deployment_strategies/web.rb", "lib/beta_builder/deployment_strategies.rb", "lib/beta_builder.rb", "lib/betabuilder.rb"]
s.homepage = %q{http://github.com/lukeredpath/betabuilder}
s.rdoc_options = ["--main", "README.md"]
s.require_paths = ["lib"]
Expand All @@ -24,16 +24,19 @@ Gem::Specification.new do |s|
s.add_runtime_dependency(%q<uuid>, ["~> 2.3.1"])
s.add_runtime_dependency(%q<rest-client>, ["~> 1.6.1"])
s.add_runtime_dependency(%q<json>, ["~> 1.4.6"])
s.add_runtime_dependency(%q<dropbox-sdk>, ["~> 1.0.beta"])
else
s.add_dependency(%q<CFPropertyList>, ["~> 2.0.0"])
s.add_dependency(%q<uuid>, ["~> 2.3.1"])
s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
s.add_dependency(%q<json>, ["~> 1.4.6"])
s.add_dependency(%q<dropbox-sdk>, ["~> 1.0.beta"])
end
else
s.add_dependency(%q<CFPropertyList>, ["~> 2.0.0"])
s.add_dependency(%q<uuid>, ["~> 2.3.1"])
s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
s.add_dependency(%q<json>, ["~> 1.4.6"])
s.add_dependency(%q<dropbox-sdk>, ["~> 1.0.beta"])
end
end
3 changes: 2 additions & 1 deletion lib/beta_builder/deployment_strategies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ def prepare
private

def self.strategies
{:web => Web, :testflight => TestFlight}
{:web => Web, :testflight => TestFlight, :dropbox => Dropbox}
end
end
end

require 'beta_builder/deployment_strategies/web'
require 'beta_builder/deployment_strategies/testflight'
require 'beta_builder/deployment_strategies/dropbox'

140 changes: 140 additions & 0 deletions lib/beta_builder/deployment_strategies/dropbox.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
require 'tmpdir'
require 'fileutils'
require 'dropbox_sdk'

module BetaBuilder
module DeploymentStrategies
class Dropbox < Strategy
DROPBOXURL = 'http://dl.dropbox.com/u/'
def extended_configuration_for_strategy
proc do
def deployment_url
File.join(DROPBOXURL+user_id+deploy_to, ipa_name)
end
def webpage_url
File.join(DROPBOXURL+user_id+deploy_to, "index.html")
end
def manifest_url
File.join(DROPBOXURL+user_id+deploy_to, "manifest.plist")
end
end
end

def prepare
plist = CFPropertyList::List.new(:file => "pkg/Payload/#{@configuration.app_name}.app/Info.plist")
plist_data = CFPropertyList.native_types(plist.value)
File.open("pkg/dist/manifest.plist", "w") do |io|
io << %{
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>#{@configuration.deployment_url}</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>#{plist_data['CFBundleIdentifier']}</string>
<key>bundle-version</key>
<string>#{plist_data['CFBundleVersion']}</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>#{plist_data['CFBundleDisplayName']}</string>
</dict>
</dict>
</array>
</dict>
</plist>
}
end
File.open("pkg/dist/index.html", "w") do |io|
io << %{
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>Beta Download</title>
<style type="text/css">
body {background:#fff;margin:0;padding:0;font-family:arial,helvetica,sans-serif;text-align:center;padding:10px;color:#333;font-size:16px;}
#container {width:300px;margin:0 auto;}
h1 {margin:0;padding:0;font-size:14px;}
p {font-size:13px;}
.link {background:#ecf5ff;border-top:1px solid #fff;border:1px solid #dfebf8;margin-top:.5em;padding:.3em;}
.link a {text-decoration:none;font-size:15px;display:block;color:#069;}
</style>
</head>
<body>
<div id="container">
<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>
<p><strong>Link didn't work?</strong><br />
Make sure you're visiting this page on your device, not your computer.</p>
</body>
</html>
}
end
end


def deploy
puts "Uploading build to Dropbox..."

if @configuration.dry_run
puts '** Dry Run - No action here! **'
return
end
begin
session = DropboxSession.deserialize(File.read('build/dropbox_saved_session.txt'))
session.get_request_token
rescue Exception => e
session = DropboxSession.new(@configuration.consumer_key, @configuration.consumer_secret)
session.get_request_token
# Make the user log in and authorize this token
authorize_url = session.get_authorize_url
puts "AUTHORIZING", authorize_url
`open "#{authorize_url}"`
puts "Please visit that web page and hit 'Allow', then hit Enter here."
STDIN.gets
session.get_access_token
File.open('build/dropbox_saved_session.txt', 'w') do |f|
f.puts session.serialize
end
end

client = DropboxClient.new(session, :dropbox)
# puts "linked account:", client.account_info().inspect
puts "Almost there..."
file = open('pkg/dist/index.html')
response1 = client.put_file("/Public#{@configuration.deploy_to}/index.html", file, overwrite=true)
# puts "uploaded:", response1.inspect
puts "Just a few more seconds..."
file = open('pkg/dist/manifest.plist')
response2 = client.put_file("/Public#{@configuration.deploy_to}/manifest.plist", file, overwrite=true)
# puts "uploaded:", response2.inspect
puts "It's really close now..."
file = open("pkg/dist/#{@configuration.ipa_name}")
response3 = client.put_file("/Public#{@configuration.deploy_to}/#{@configuration.ipa_name}", file, overwrite=true)
# puts "uploaded:", response3.inspect
puts "Done!"

puts "#{@configuration.webpage_url}"
if @configuration.open_browser_when_done
`open "#{@configuration.webpage_url}"`
end

end

end
end
end