Class: BetaBuilder::DeploymentStrategies::Web

Inherits:
Strategy
  • Object
show all
Defined in:
lib/beta_builder/deployment_strategies/web.rb

Instance Method Summary collapse

Methods inherited from Strategy

#configure, #initialize

Constructor Details

This class inherits a constructor from BetaBuilder::DeploymentStrategies::Strategy

Instance Method Details

#deployObject



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/beta_builder/deployment_strategies/web.rb', line 86

def deploy
  cmd = []

  cmd.push "scp"

  if @configuration.remote_port
    cmd.push "-P #{@configuration.remote_port}"
  end

  cmd.push "pkg/dist/*"
  cmd.push "#{@configuration.remote_host}:#{@configuration.remote_installation_path}"

  cmd = cmd.join(" ")

  puts "* Running `#{cmd}`"
  system(cmd)
end

#extended_configuration_for_strategyObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/beta_builder/deployment_strategies/web.rb', line 4

def extended_configuration_for_strategy
  proc do
    def deployment_url
      File.join(deploy_to, target.downcase, ipa_name)
    end

    def manifest_url
      File.join(deploy_to, target.downcase, "manifest.plist")
    end

    def remote_installation_path
      File.join(remote_directory, target.downcase)
    end
  end
end

#prepareObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/beta_builder/deployment_strategies/web.rb', line 20

def prepare
  plist = CFPropertyList::List.new(:file => "pkg/Payload/#{@configuration.app_file_name}/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