combat 0.8.6 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +13 -2
- data/lib/combat.rb +18 -5
- data/lib/settings.rb +8 -2
- data/lib/version.rb +1 -1
- data/templates/template.erb +49 -10
- metadata +2 -2
data/Readme.md
CHANGED
@@ -15,12 +15,16 @@ In your mobile applications directory run
|
|
15
15
|
|
16
16
|
combat setup
|
17
17
|
|
18
|
-
This creates a new <tt>
|
18
|
+
This creates a new <tt>combat.yml</tt>.
|
19
19
|
|
20
20
|
To run a new deploy type
|
21
21
|
|
22
22
|
combat deploy
|
23
23
|
|
24
|
+
To open the deploy page run
|
25
|
+
|
26
|
+
combat open
|
27
|
+
|
24
28
|
# Configuration
|
25
29
|
|
26
30
|
Create a <tt>~/.combatrc</tt> with default configuration for all combat projects, like this example:
|
@@ -34,4 +38,11 @@ Create a <tt>~/.combatrc</tt> with default configuration for all combat projects
|
|
34
38
|
|
35
39
|
Todo stuff:
|
36
40
|
|
37
|
-
*
|
41
|
+
* Slicker ui, better design
|
42
|
+
* Dynamic behaviour: when you start the download process the button should turn to "Downloading in progress"
|
43
|
+
* Refactor code
|
44
|
+
* Support for private deploys (via .htaccess or some other password scheme)
|
45
|
+
|
46
|
+
# Author
|
47
|
+
|
48
|
+
Copyright © 2011 Tomislav Car, [Infinum](http://www.infinumdigital.com)
|
data/lib/combat.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
class Combat < Thor
|
2
2
|
include Thor::Actions
|
3
3
|
|
4
|
+
map '-s' => 'setup'
|
5
|
+
map '-d' => 'deploy'
|
6
|
+
map '-o' => 'open'
|
7
|
+
|
4
8
|
desc "setup", "Setup a new mobile project for deploying"
|
5
9
|
def setup
|
6
10
|
defaults = load_defaults
|
@@ -51,6 +55,9 @@ class Combat < Thor
|
|
51
55
|
load_config
|
52
56
|
|
53
57
|
if @config.valid?
|
58
|
+
deploy_html_file = 'combat_deployed_page.html'
|
59
|
+
|
60
|
+
@config.deployed_at = Time.now
|
54
61
|
system "ssh #{@config.user_and_host} 'mkdir -p #{@config.path}'"
|
55
62
|
system "ssh #{@config.user_and_host} 'rm -fr #{@config.path}/*'"
|
56
63
|
|
@@ -61,18 +68,24 @@ class Combat < Thor
|
|
61
68
|
else
|
62
69
|
system "scp bin/*.apk #{@config.user_and_host}:#{@config.path}"
|
63
70
|
end
|
71
|
+
|
72
|
+
system "scp '#{@config.icon_source_path}' #{@config.user_and_host}:#{@config.path}/#{@config.icon_path}"
|
64
73
|
|
65
|
-
File.open(
|
66
|
-
|
67
|
-
|
68
|
-
system "scp deployed/index.html #{@config.user_and_host}:#{@config.path}"
|
69
|
-
remove_file 'deployed/index.html'
|
74
|
+
File.open(deploy_html_file, 'w+'){|x| x.puts generate_html_file }
|
75
|
+
system "scp #{deploy_html_file} #{@config.user_and_host}:#{@config.path}/index.html"
|
76
|
+
remove_file deploy_html_file
|
70
77
|
|
71
78
|
say "Successfully deployed to #{@config.url}"
|
72
79
|
else
|
73
80
|
say "Config not valid, please check"
|
74
81
|
end
|
75
82
|
end
|
83
|
+
|
84
|
+
desc "open", "Open the deploy page in the browser (Mac OS only)"
|
85
|
+
def open
|
86
|
+
load_config
|
87
|
+
%x{open #{@config.url}}
|
88
|
+
end
|
76
89
|
|
77
90
|
no_tasks do
|
78
91
|
def load_defaults
|
data/lib/settings.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Settings
|
2
2
|
attr_accessor :name, :url, :path, :filename, :plist_file, :provision_file_name, :remote_user, :host, :type, :template_file, :ipa_file
|
3
|
+
attr_accessor :deployed_at, :icon_source_path, :icon_path
|
3
4
|
|
4
5
|
def initialize(options)
|
5
6
|
@name = options[:name]
|
@@ -16,12 +17,17 @@ class Settings
|
|
16
17
|
@ipa_file = "#{@filename}.ipa"
|
17
18
|
@plist_file_url = "#{@url}#{@plist_file}"
|
18
19
|
@template_file = options[:template] || "#{COMBAT_ROOT}/templates/template.erb"
|
20
|
+
@deployer = %x(whoami).strip
|
19
21
|
|
20
22
|
if (type == 'android')
|
21
|
-
@
|
23
|
+
@icon_source_path = "res/drawable-hdpi/icon.png"
|
24
|
+
# @qrcode = "http://qrcode.kaywa.com/img.php?s=6&d=#{ERB::Util.url_encode(@url)}#{@filename}.apk"
|
22
25
|
else
|
23
|
-
@
|
26
|
+
@icon_source_path = "Icon@2x.png"
|
24
27
|
end
|
28
|
+
@qrcode = "http://qrcode.kaywa.com/img.php?s=6&d=#{ERB::Util.url_encode(@url)}"
|
29
|
+
|
30
|
+
@icon_path = "icon.png"
|
25
31
|
end
|
26
32
|
|
27
33
|
def user_and_host
|
data/lib/version.rb
CHANGED
data/templates/template.erb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<title><%= @name %></title>
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
|
6
6
|
<style type="text/css" media="screen">
|
7
|
-
@media only screen and (max-device-width:
|
7
|
+
@media only screen and (max-device-width: 640px) {
|
8
8
|
.desktop_only {
|
9
9
|
display:none;
|
10
10
|
}
|
@@ -13,14 +13,20 @@
|
|
13
13
|
font-family: Helvetica;
|
14
14
|
}
|
15
15
|
h1{
|
16
|
-
|
16
|
+
padding-left: 10px;
|
17
|
+
margin-bottom: 5px;
|
17
18
|
}
|
18
19
|
p{
|
19
|
-
|
20
|
+
padding-left: 10px;
|
21
|
+
margin-top: 0px;
|
22
|
+
}
|
23
|
+
table{
|
24
|
+
margin-bottom: 10px;
|
20
25
|
}
|
21
26
|
#container{
|
22
27
|
width: 100%;
|
23
28
|
max-width: 300px;
|
29
|
+
width: 300px;
|
24
30
|
margin: 10px auto;
|
25
31
|
}
|
26
32
|
a{
|
@@ -41,16 +47,49 @@
|
|
41
47
|
li{
|
42
48
|
margin-bottom: 20px;
|
43
49
|
}
|
50
|
+
.date{
|
51
|
+
font-size: 0.8em;
|
52
|
+
color: #666;
|
53
|
+
text-align: right;
|
54
|
+
font-style: italic;
|
55
|
+
}
|
56
|
+
.instructions{
|
57
|
+
font-size: 0.8em;
|
58
|
+
}
|
59
|
+
.icon{
|
60
|
+
margin-top: 10px;
|
61
|
+
}
|
62
|
+
.text_center{
|
63
|
+
text-align: center;
|
64
|
+
}
|
44
65
|
</style>
|
45
66
|
</head>
|
46
67
|
<body>
|
47
68
|
<div id="container">
|
48
|
-
<
|
49
|
-
|
50
|
-
<% if @
|
51
|
-
|
52
|
-
|
53
|
-
|
69
|
+
<table>
|
70
|
+
<tr>
|
71
|
+
<% if @icon_path %>
|
72
|
+
<td valign="top">
|
73
|
+
<img class="icon" src="<%= @icon_path %>" width="72" height="72" />
|
74
|
+
</td>
|
75
|
+
<% end %>
|
76
|
+
|
77
|
+
<td>
|
78
|
+
<h1><%= @name %></h1>
|
79
|
+
<p class="instructions">
|
80
|
+
<% if @type == 'iphone' %>
|
81
|
+
To install <%= @name %> take two steps on your iPhone or iPad device:
|
82
|
+
<% else %>
|
83
|
+
To install just click the following link on your Android device:
|
84
|
+
<% end %>
|
85
|
+
</p>
|
86
|
+
</td>
|
87
|
+
</tr>
|
88
|
+
</table>
|
89
|
+
<p class="date">
|
90
|
+
Deployed <%= @deployed_at.strftime("%B %d, %Y at %I:%M") %>
|
91
|
+
<% if @deployer %>
|
92
|
+
by <%= @deployer %>
|
54
93
|
<% end %>
|
55
94
|
</p>
|
56
95
|
<ol>
|
@@ -74,7 +113,7 @@
|
|
74
113
|
</li>
|
75
114
|
<% end %>
|
76
115
|
</ol>
|
77
|
-
<p class="desktop_only">
|
116
|
+
<p class="desktop_only text_center">
|
78
117
|
<% if @type == 'android' %>
|
79
118
|
Use QR code to install APK
|
80
119
|
<img src="<%= @qrcode %>" />
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: combat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.9.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tomislav Car
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-10-25 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: Deploy your iPhone and Android apps to clients with ease. It's like Capistrano, only for mobile apps.
|