combat 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,14 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
1
+ #!/usr/bin/env ruby
2
+ COMBAT_ROOT = File.join(File.dirname(File.expand_path(__FILE__)), '..')
3
+ $:.unshift File.join(COMBAT_ROOT, 'lib')
2
4
  require "rubygems"
3
5
  require "bundler/setup"
4
6
 
5
7
  # gems and libraries
6
8
  require 'ostruct'
7
9
  require 'erb'
10
+ require 'yaml'
11
+ require 'thor'
8
12
 
9
13
  # local classes
10
14
  require 'settings'
@@ -42,6 +46,8 @@ class Combat < Thor
42
46
  system "scp index.html #{@config.user_and_host}:#{@config.path}"
43
47
  remove_file 'index.html'
44
48
  # system "scp -r app/config www-data@vz1.infinum.hr:l/labs.infinum.hr/rba/stage/config"
49
+
50
+ say "Successfully deployed to #{@config.url}"
45
51
  else
46
52
  say "Config not valid, please check"
47
53
  end
@@ -61,9 +67,10 @@ class Combat < Thor
61
67
  end
62
68
 
63
69
  def generate_html_file
64
- erb = ERB.new(File.read("template_#{@config.type}.erb"))
70
+ erb = ERB.new(File.read(@config.template_file))
65
71
  erb.result(@config.get_binding)
66
72
  end
67
73
  end
74
+ end
68
75
 
69
- end
76
+ Combat.start
@@ -1,5 +1,5 @@
1
1
  class Settings
2
- attr_accessor :name, :url, :path, :filename, :plist_file, :provision_file_name, :remote_user, :host, :type
2
+ attr_accessor :name, :url, :path, :filename, :plist_file, :provision_file_name, :remote_user, :host, :type, :template_file
3
3
 
4
4
  def initialize(options)
5
5
  @name = options[:name]
@@ -13,6 +13,7 @@ class Settings
13
13
  @provision_file_name = "#{@filename}_AdHoc.mobileprovision"
14
14
  @plist_file = "#{@filename}.plist"
15
15
  @plist_file_url = "#{@url}#{@plist_file}"
16
+ @template_file = "#{COMBAT_ROOT}/templates/template_#{@type}.erb"
16
17
  end
17
18
 
18
19
  def user_and_host
metadata CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 6
8
- version: "0.6"
7
+ - 7
8
+ version: "0.7"
9
9
  platform: ruby
10
10
  authors:
11
11
  - Tomislav Car
@@ -30,12 +30,11 @@ extra_rdoc_files:
30
30
  files:
31
31
  - Readme.md
32
32
  - LICENSE
33
- - combat.yml
34
33
  - Gemfile
35
34
  - Gemfile.lock
36
- - main.thor
37
- - settings.rb
38
- - template_iphone.erb
35
+ - bin/combat
36
+ - lib/settings.rb
37
+ - templates/template_iphone.erb
39
38
  has_rdoc: true
40
39
  homepage: http://github.com/infinum/combat
41
40
  licenses: []
data/combat.yml DELETED
@@ -1,7 +0,0 @@
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