combat 0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1 @@
1
+ gem "thor", "~> 0.14.6"
data/Gemfile.lock ADDED
@@ -0,0 +1,9 @@
1
+ GEM
2
+ specs:
3
+ thor (0.14.6)
4
+
5
+ PLATFORMS
6
+ ruby
7
+
8
+ DEPENDENCIES
9
+ thor (~> 0.14.6)
data/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2011 Infinum
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Readme.md ADDED
@@ -0,0 +1,28 @@
1
+ # Combat
2
+
3
+ Deploy your iPhone and Android apps to clients with ease. It's like Capistrano, only for mobile apps.
4
+
5
+ # Install
6
+
7
+ Run
8
+
9
+ gem install combat
10
+
11
+
12
+ # Usage
13
+
14
+ In your mobile applications directory run
15
+
16
+ combat setup
17
+
18
+ This creates a new <tt>config.yml</tt>.
19
+
20
+ To run a new deploy type
21
+
22
+ combat deploy
23
+
24
+ # TODO
25
+
26
+ Todo stuff:
27
+
28
+ * Android support
data/combat.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ :type: iphone
3
+ :name: New project
4
+ :host: my.hostname.com
5
+ :path: /var/www/my.hostname.com/deploy_folder
6
+ :url: http://my.hostname.com/deploy_folder
7
+ :remote_user: www-data
data/main.thor ADDED
@@ -0,0 +1,69 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__)
2
+ require "rubygems"
3
+ require "bundler/setup"
4
+
5
+ # gems and libraries
6
+ require 'ostruct'
7
+ require 'erb'
8
+
9
+ # local classes
10
+ require 'settings'
11
+
12
+ class Combat < Thor
13
+ include Thor::Actions
14
+
15
+ desc "setup", "Setup a new mobile project for deploying"
16
+ def setup
17
+ settings = {
18
+ :type => 'iphone',
19
+ :name => 'New project',
20
+ :host => 'my.hostname.com',
21
+ :path => '/var/www/my.hostname.com/deploy_folder',
22
+ :url => 'http://my.hostname.com/deploy_folder',
23
+ :remote_user => 'www-data'
24
+ }
25
+
26
+ unless File.exists?('combat.yml')
27
+ create_file 'combat.yml', settings.to_yaml
28
+ end
29
+ end
30
+
31
+ desc "deploy", "Deploy a project to the server for testing"
32
+ def deploy
33
+ load_config
34
+
35
+ if @config.valid?
36
+ system "ssh #{@config.user_and_host} 'mkdir -p #{@config.path}'"
37
+ system "ssh #{@config.user_and_host} 'rm -fr #{@config.path}/*'"
38
+ File.open('index.html', 'w+'){|x|
39
+ str = generate_html_file
40
+ x.puts generate_html_file
41
+ }
42
+ system "scp index.html #{@config.user_and_host}:#{@config.path}"
43
+ remove_file 'index.html'
44
+ # system "scp -r app/config www-data@vz1.infinum.hr:l/labs.infinum.hr/rba/stage/config"
45
+ else
46
+ say "Config not valid, please check"
47
+ end
48
+ end
49
+
50
+ no_tasks do
51
+ def load_config
52
+ string = File.read("combat.yml")
53
+ yml = YAML::load(string)
54
+ @config = Settings.new(yml)
55
+ end
56
+
57
+ def header(text)
58
+ say "=" * text.size
59
+ say text
60
+ say "=" * text.size
61
+ end
62
+
63
+ def generate_html_file
64
+ erb = ERB.new(File.read("template_#{@config.type}.erb"))
65
+ erb.result(@config.get_binding)
66
+ end
67
+ end
68
+
69
+ end
data/settings.rb ADDED
@@ -0,0 +1,29 @@
1
+ class Settings
2
+ attr_accessor :name, :url, :path, :filename, :plist_file, :provision_file_name, :remote_user, :host, :type
3
+
4
+ def initialize(options)
5
+ @name = options[:name]
6
+ @url = options[:url]
7
+ @host = options[:host]
8
+ @path = options[:path]
9
+ @type = options[:type]
10
+ @remote_user = options[:remote_user]
11
+
12
+ @filename = @name.downcase.gsub(" ", "_")
13
+ @provision_file_name = "#{@filename}_AdHoc.mobileprovision"
14
+ @plist_file = "#{@filename}.plist"
15
+ @plist_file_url = "#{@url}#{@plist_file}"
16
+ end
17
+
18
+ def user_and_host
19
+ "#{remote_user}@#{host}"
20
+ end
21
+
22
+ def get_binding
23
+ binding
24
+ end
25
+
26
+ def valid?
27
+ @name != nil && @url != nil
28
+ end
29
+ end
@@ -0,0 +1,60 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4
+ <title><%= @name %></title>
5
+ <style type="text/css" media="screen">
6
+ *{
7
+ font-family: Helvetica;
8
+ }
9
+ h1{
10
+ text-align: center;
11
+ }
12
+ p{
13
+ text-align: center;
14
+ }
15
+ #container{
16
+ width: 320px;
17
+ margin: 0px auto;
18
+ }
19
+ a{
20
+ background-color: #dc0021;
21
+ padding: 10px;
22
+ display: block;
23
+ color: white;
24
+ text-shadow: black 1px 1px 1px;
25
+ text-decoration: none;
26
+ border-radius: 10px;
27
+ font-weight: bold;
28
+ text-align: center;
29
+ }
30
+ ol{
31
+ list-style-type: none;
32
+ padding-left: 0px;
33
+ }
34
+ li{
35
+ margin-bottom: 20px;
36
+ }
37
+ </style>
38
+ </head>
39
+ <body>
40
+ <div id="container">
41
+ <h1><%= @name %></h1>
42
+ <p>
43
+ To install <%= @name %> take 2 steps on your iPhone or iPad device:
44
+ </p>
45
+ <ol>
46
+ <li>
47
+ <a href="<%= @provision_file_name %>">
48
+ Install provisioning file<br/>
49
+ (only first time)
50
+ </a>
51
+ </li>
52
+ <li>
53
+ <a href="itms-services://?action=download-manifest&url=<%= @plist_file_url %>">
54
+ Install <%= @name %>
55
+ </a>
56
+ </li>
57
+ </ol>
58
+ </div>
59
+ </body>
60
+ </html>
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: combat
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 6
8
+ version: "0.6"
9
+ platform: ruby
10
+ authors:
11
+ - Tomislav Car
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2011-07-08 00:00:00 +02:00
17
+ default_executable:
18
+ dependencies: []
19
+
20
+ description: Deploy your iPhone and Android apps to clients with ease. It's like Capistrano, only for mobile apps.
21
+ email:
22
+ - tomislav@infinum.hr
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - Readme.md
29
+ - LICENSE
30
+ files:
31
+ - Readme.md
32
+ - LICENSE
33
+ - combat.yml
34
+ - Gemfile
35
+ - Gemfile.lock
36
+ - main.thor
37
+ - settings.rb
38
+ - template_iphone.erb
39
+ has_rdoc: true
40
+ homepage: http://github.com/infinum/combat
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options:
45
+ - --main
46
+ - Readme.md
47
+ - --inline-source
48
+ - --charset=UTF-8
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ requirements: []
68
+
69
+ rubyforge_project:
70
+ rubygems_version: 1.3.7
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: Deploy your iPhone and Android apps to clients with ease. It's like Capistrano, only for mobile apps.
74
+ test_files: []
75
+