combat 0.8.2 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/combat +2 -105
- data/lib/combat.rb +104 -0
- data/lib/version.rb +3 -0
- data/templates/template.erb +10 -3
- metadata +4 -2
data/bin/combat
CHANGED
@@ -12,110 +12,7 @@ require 'thor'
|
|
12
12
|
|
13
13
|
# local classes
|
14
14
|
require 'settings'
|
15
|
+
require 'combat'
|
15
16
|
|
16
|
-
|
17
|
-
include Thor::Actions
|
18
|
-
|
19
|
-
desc "setup", "Setup a new mobile project for deploying"
|
20
|
-
def setup
|
21
|
-
defaults = load_defaults
|
22
|
-
name = Dir['*.xcodeproj']
|
23
|
-
|
24
|
-
if name.size == 1
|
25
|
-
name = name.first.gsub(/.xcodeproj/, '')
|
26
|
-
type = 'iphone'
|
27
|
-
else
|
28
|
-
name = Dir['AndroidManifest.xml']
|
29
|
-
|
30
|
-
if name.size == 1
|
31
|
-
name = File.basename(Dir.pwd)
|
32
|
-
type = 'android'
|
33
|
-
else
|
34
|
-
name = 'New project'
|
35
|
-
type = 'iphone'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
defaults[:path] = File.join(defaults[:path], type, name) if defaults[:path]
|
40
|
-
defaults[:url] = File.join(defaults[:url], type, name) if defaults[:url]
|
41
|
-
|
42
|
-
settings = {
|
43
|
-
:type => type,
|
44
|
-
:name => name,
|
45
|
-
:host => defaults[:host] || 'my.hostname.com',
|
46
|
-
:path => defaults[:path] || '/var/www/my.hostname.com/deploy_folder',
|
47
|
-
:url => defaults[:url] || 'http://my.hostname.com/deploy_folder',
|
48
|
-
:remote_user => defaults[:remote_user] || 'www-data'
|
49
|
-
}
|
50
|
-
|
51
|
-
unless File.exists?('combat.yml')
|
52
|
-
create_file 'combat.yml', settings.to_yaml
|
53
|
-
end
|
54
|
-
|
55
|
-
system "mkdir -p deployed"
|
56
|
-
|
57
|
-
if settings[:type] == 'iphone'
|
58
|
-
say "Combat has been setup for #{name}. Copy your #{name}.mobileprovision, #{name}.plist and #{name}.ipa to the deployed/ folder"
|
59
|
-
else
|
60
|
-
say "Combat has been setup for #{name}."
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
desc "deploy", "Deploy a project to the server for testing"
|
65
|
-
def deploy
|
66
|
-
load_config
|
67
|
-
|
68
|
-
if @config.valid?
|
69
|
-
system "ssh #{@config.user_and_host} 'mkdir -p #{@config.path}'"
|
70
|
-
system "ssh #{@config.user_and_host} 'rm -fr #{@config.path}/*'"
|
71
|
-
|
72
|
-
if @config.type == 'iphone'
|
73
|
-
system "scp deployed/#{@config.provision_file_name} #{@config.user_and_host}:#{@config.path}"
|
74
|
-
system "scp deployed/#{@config.plist_file} #{@config.user_and_host}:#{@config.path}"
|
75
|
-
system "scp deployed/#{@config.ipa_file} #{@config.user_and_host}:#{@config.path}"
|
76
|
-
else
|
77
|
-
system "scp bin/*.apk #{@config.user_and_host}:#{@config.path}"
|
78
|
-
end
|
79
|
-
|
80
|
-
File.open('deployed/index.html', 'w+'){|x|
|
81
|
-
x.puts generate_html_file
|
82
|
-
}
|
83
|
-
system "scp deployed/index.html #{@config.user_and_host}:#{@config.path}"
|
84
|
-
remove_file 'deployed/index.html'
|
85
|
-
|
86
|
-
say "Successfully deployed to #{@config.url}"
|
87
|
-
else
|
88
|
-
say "Config not valid, please check"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
no_tasks do
|
93
|
-
def load_defaults
|
94
|
-
defaults_file_path = File.expand_path('~/.combatrc')
|
95
|
-
if File.exists?(defaults_file_path)
|
96
|
-
YAML::load(File.read(defaults_file_path))
|
97
|
-
else
|
98
|
-
{}
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def load_config
|
103
|
-
string = File.read("combat.yml")
|
104
|
-
yml = YAML::load(string)
|
105
|
-
@config = Settings.new(yml)
|
106
|
-
end
|
107
|
-
|
108
|
-
def header(text)
|
109
|
-
say "=" * text.size
|
110
|
-
say text
|
111
|
-
say "=" * text.size
|
112
|
-
end
|
113
|
-
|
114
|
-
def generate_html_file
|
115
|
-
erb = ERB.new(File.read(@config.template_file))
|
116
|
-
erb.result(@config.get_binding)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
17
|
+
# run combat with thor
|
121
18
|
Combat.start
|
data/lib/combat.rb
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
class Combat < Thor
|
2
|
+
include Thor::Actions
|
3
|
+
|
4
|
+
desc "setup", "Setup a new mobile project for deploying"
|
5
|
+
def setup
|
6
|
+
defaults = load_defaults
|
7
|
+
name = Dir['*.xcodeproj']
|
8
|
+
|
9
|
+
if name.size == 1
|
10
|
+
name = name.first.gsub(/.xcodeproj/, '')
|
11
|
+
type = 'iphone'
|
12
|
+
else
|
13
|
+
name = Dir['AndroidManifest.xml']
|
14
|
+
|
15
|
+
if name.size == 1
|
16
|
+
name = File.basename(Dir.pwd)
|
17
|
+
type = 'android'
|
18
|
+
else
|
19
|
+
name = 'New project'
|
20
|
+
type = 'iphone'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
defaults[:path] = File.join(defaults[:path], type, name) if defaults[:path]
|
25
|
+
defaults[:url] = File.join(defaults[:url], type, name) if defaults[:url]
|
26
|
+
|
27
|
+
settings = {
|
28
|
+
:type => type,
|
29
|
+
:name => name,
|
30
|
+
:host => defaults[:host] || 'my.hostname.com',
|
31
|
+
:path => defaults[:path] || '/var/www/my.hostname.com/deploy_folder',
|
32
|
+
:url => defaults[:url] || 'http://my.hostname.com/deploy_folder',
|
33
|
+
:remote_user => defaults[:remote_user] || 'www-data'
|
34
|
+
}
|
35
|
+
|
36
|
+
unless File.exists?('combat.yml')
|
37
|
+
create_file 'combat.yml', settings.to_yaml
|
38
|
+
end
|
39
|
+
|
40
|
+
system "mkdir -p deployed"
|
41
|
+
|
42
|
+
if settings[:type] == 'iphone'
|
43
|
+
say "Combat has been setup for #{name}. Copy your #{name}.mobileprovision, #{name}.plist and #{name}.ipa to the deployed/ folder"
|
44
|
+
else
|
45
|
+
say "Combat has been setup for #{name}."
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "deploy", "Deploy a project to the server for testing"
|
50
|
+
def deploy
|
51
|
+
load_config
|
52
|
+
|
53
|
+
if @config.valid?
|
54
|
+
system "ssh #{@config.user_and_host} 'mkdir -p #{@config.path}'"
|
55
|
+
system "ssh #{@config.user_and_host} 'rm -fr #{@config.path}/*'"
|
56
|
+
|
57
|
+
if @config.type == 'iphone'
|
58
|
+
system "scp deployed/#{@config.provision_file_name} #{@config.user_and_host}:#{@config.path}"
|
59
|
+
system "scp deployed/#{@config.plist_file} #{@config.user_and_host}:#{@config.path}"
|
60
|
+
system "scp deployed/#{@config.ipa_file} #{@config.user_and_host}:#{@config.path}"
|
61
|
+
else
|
62
|
+
system "scp bin/*.apk #{@config.user_and_host}:#{@config.path}"
|
63
|
+
end
|
64
|
+
|
65
|
+
File.open('deployed/index.html', 'w+'){|x|
|
66
|
+
x.puts generate_html_file
|
67
|
+
}
|
68
|
+
system "scp deployed/index.html #{@config.user_and_host}:#{@config.path}"
|
69
|
+
remove_file 'deployed/index.html'
|
70
|
+
|
71
|
+
say "Successfully deployed to #{@config.url}"
|
72
|
+
else
|
73
|
+
say "Config not valid, please check"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
no_tasks do
|
78
|
+
def load_defaults
|
79
|
+
defaults_file_path = File.expand_path('~/.combatrc')
|
80
|
+
if File.exists?(defaults_file_path)
|
81
|
+
YAML::load(File.read(defaults_file_path))
|
82
|
+
else
|
83
|
+
{}
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def load_config
|
88
|
+
string = File.read("combat.yml")
|
89
|
+
yml = YAML::load(string)
|
90
|
+
@config = Settings.new(yml)
|
91
|
+
end
|
92
|
+
|
93
|
+
def header(text)
|
94
|
+
say "=" * text.size
|
95
|
+
say text
|
96
|
+
say "=" * text.size
|
97
|
+
end
|
98
|
+
|
99
|
+
def generate_html_file
|
100
|
+
erb = ERB.new(File.read(@config.template_file))
|
101
|
+
erb.result(@config.get_binding)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
data/lib/version.rb
ADDED
data/templates/template.erb
CHANGED
@@ -2,7 +2,13 @@
|
|
2
2
|
<head>
|
3
3
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
4
4
|
<title><%= @name %></title>
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
|
5
6
|
<style type="text/css" media="screen">
|
7
|
+
@media only screen and (max-device-width: 480px) {
|
8
|
+
.desktop_only {
|
9
|
+
display:none;
|
10
|
+
}
|
11
|
+
}
|
6
12
|
*{
|
7
13
|
font-family: Helvetica;
|
8
14
|
}
|
@@ -13,8 +19,9 @@
|
|
13
19
|
text-align: center;
|
14
20
|
}
|
15
21
|
#container{
|
16
|
-
width:
|
17
|
-
|
22
|
+
width: 100%;
|
23
|
+
max-width: 300px;
|
24
|
+
margin: 10px auto;
|
18
25
|
}
|
19
26
|
a{
|
20
27
|
background-color: #dc0021;
|
@@ -67,7 +74,7 @@
|
|
67
74
|
</li>
|
68
75
|
<% end %>
|
69
76
|
</ol>
|
70
|
-
<p>
|
77
|
+
<p class="desktop_only">
|
71
78
|
QR code to this page
|
72
79
|
<img src="<%= @qrcode %>" />
|
73
80
|
</p>
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: combat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.8.
|
5
|
+
version: 0.8.5
|
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-08-05 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.
|
@@ -29,7 +29,9 @@ files:
|
|
29
29
|
- Gemfile
|
30
30
|
- Gemfile.lock
|
31
31
|
- bin/combat
|
32
|
+
- lib/combat.rb
|
32
33
|
- lib/settings.rb
|
34
|
+
- lib/version.rb
|
33
35
|
- templates/template.erb
|
34
36
|
homepage: http://github.com/infinum/combat
|
35
37
|
licenses: []
|