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
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,36 @@ Finally, you can also specify an array of distribution lists that you want to al
tf.distribution_lists = %w{Testers Internal}
end

### Deploying to your own server
### Deploying to your own server (SSH)

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.

You will to configure betabuilder to use the `web` deployment strategy with some additional configuration:

config.deploy_using(:web) do |web|
web.protocol = "ssh"
web.deploy_to = "http://beta.myserver.co.uk/myapp"
web.remote_host = "myserver.com"
web.remote_directory = "/remote/path/to/deployment/directory"
end

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 your own server (FTP)

Instead of SSH you can use FTP to deploy to a remote server. You still use the web deployment strategy but with a slightly different configuration than the SSH one:

config.deploy_using(:web) do |web|
web.protocol = "ftp"
web.deploy_to = "http://beta.myserver.co.uk/myapp"
web.remote_host = "myserver.com"
web.username = "myftpusername"
web.password = "myftppassword"
web.remote_directory = "/remote/path/to/deployment/directory"
end

The `deploy_to` setting specifies the URL that your app will be published to. The `remote_host` setting is the FTP host that will be used to copy the files to your server using FTP. 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. The `username` setting is your FTP username and the `password` setting is your FTP password.

## License

This code is licensed under the MIT license.
Expand Down
1 change: 1 addition & 0 deletions lib/beta_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'ostruct'
require 'fileutils'
require 'cfpropertylist'
require 'net/ftp'
require 'beta_builder/archived_build'
require 'beta_builder/deployment_strategies'
require 'beta_builder/build_output_parser'
Expand Down
26 changes: 24 additions & 2 deletions lib/beta_builder/deployment_strategies/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def remote_installation_path
end

def prepare
plist = CFPropertyList::List.new(:file => "pkg/Payload/#{@configuration.app_name}/Info.plist")
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 << %{
Expand Down Expand Up @@ -84,7 +84,29 @@ def prepare
end

def deploy
system("scp pkg/dist/* #{@configuration.remote_host}:#{@configuration.remote_installation_path}")
if @configuration.protocol == "ssh" then
system("scp pkg/dist/* #{@configuration.remote_host}:#{@configuration.remote_installation_path}")
elsif @configuration.protocol == "ftp" then
puts "Connecting to #{@configuration.remote_host} with username #{@configuration.username}"
Net::FTP.open(@configuration.remote_host, @configuration.username, @configuration.password) do |ftp|
begin
puts "Creating folder #{@configuration.remote_installation_path}"
ftp.mkdir(@configuration.remote_installation_path)
rescue Net::FTPError
puts "It looks like the folder is already there."
end
puts "Changing to remote folder #{@configuration.remote_installation_path}"
files = ftp.chdir(@configuration.remote_installation_path)
Dir['pkg/dist/*'].each do |f|
filename = File.basename(f)
puts "Uploading #{filename}"
ftp.putbinaryfile(f, filename, 1024)
end
end

else
puts "No valid protocol definition found. Skipping deployment"
end
end
end
end
Expand Down