vmc-IronFoundry 0.3.17.IF.2 → 0.3.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,7 +51,7 @@ module VMC::Cli
51
51
  begin
52
52
  results = @telnet_client.login("Name"=>auth_info["username"],
53
53
  "Password"=>auth_info["password"])
54
- lines = results.split("\n")
54
+ lines = results.sub("Login: Password: ", "").split("\n")
55
55
  last_line = lines.pop
56
56
  if last_line =~ /[$%#>] \z/n
57
57
  prompt = last_line
@@ -105,29 +105,31 @@ module VMC::Cli
105
105
  end
106
106
 
107
107
  def readline_with_history(prompt)
108
- line = Readline.readline(prompt, true)
109
- return '' if line.nil?
110
- #Don't keep blank or repeat commands in history
111
- if line =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == line
112
- Readline::HISTORY.pop
113
- end
108
+ line = Readline::readline(prompt)
109
+ return nil if line == nil || line == 'quit' || line == 'exit'
110
+ Readline::HISTORY.push(line) if not line =~ /^\s*$/ and Readline::HISTORY.to_a[-1] != line
114
111
  line
115
112
  end
116
113
 
117
114
  def run_console(prompt)
118
- while(cmd = readline_with_history(prompt))
119
- if(cmd == "exit" || cmd == "quit")
120
- #TimeoutError expected, as exit doesn't return anything
121
- @telnet_client.cmd("String"=>cmd,"Timeout"=>1) rescue TimeoutError
122
- close_console
115
+ prev = trap("INT") { |x| exit_console; prev.call(x); exit }
116
+ prev = trap("TERM") { |x| exit_console; prev.call(x); exit }
117
+ loop do
118
+ cmd = readline_with_history(prompt)
119
+ if(cmd == nil)
120
+ exit_console
123
121
  break
124
122
  end
125
- if !cmd.empty?
126
- prompt = send_console_command_display_results(cmd, prompt)
127
- end
123
+ prompt = send_console_command_display_results(cmd, prompt)
128
124
  end
129
125
  end
130
126
 
127
+ def exit_console
128
+ #TimeoutError expected, as exit doesn't return anything
129
+ @telnet_client.cmd("String"=>"exit","Timeout"=>1) rescue TimeoutError
130
+ close_console
131
+ end
132
+
131
133
  def send_console_command_display_results(cmd, prompt)
132
134
  begin
133
135
  lines = send_console_command cmd
@@ -155,4 +157,4 @@ module VMC::Cli
155
157
  }
156
158
  end
157
159
  end
158
- end
160
+ end
@@ -20,7 +20,8 @@ module VMC::Cli
20
20
  'Django' => ['django', { :mem => '128M', :description => 'Python Django Application'}],
21
21
  'ASP.NET 4.0' => ['aspdotnet', { :mem => '64M', :description => 'ASP.NET 4.0 Application'}],
22
22
  'dotNet' => ['dotNet', { :mem => '128M', :description => '.Net Web Application'}],
23
- 'Rack' => ['rack', { :mem => '128M', :description => 'Rack Application'}]
23
+ 'Rack' => ['rack', { :mem => '128M', :description => 'Rack Application'}],
24
+ 'Play' => ['play', { :mem => '256M', :description => 'Play Framework Application'}]
24
25
  }
25
26
 
26
27
  class << self
@@ -55,6 +56,8 @@ module VMC::Cli
55
56
  if !File.directory? path
56
57
  if path.end_with?('.war')
57
58
  return detect_framework_from_war path
59
+ elsif path.end_with?('.zip')
60
+ return detect_framework_from_zip path, available_frameworks
58
61
  elsif available_frameworks.include?(["standalone"])
59
62
  return Framework.lookup('Standalone')
60
63
  else
@@ -126,6 +129,11 @@ module VMC::Cli
126
129
  if File.exist?('server.js') || File.exist?('app.js') || File.exist?('index.js') || File.exist?('main.js')
127
130
  return Framework.lookup('Node')
128
131
  end
132
+
133
+ # Play or Standalone Apps
134
+ elsif Dir.glob('*.zip').first
135
+ zip_file = Dir.glob('*.zip').first
136
+ return detect_framework_from_zip zip_file, available_frameworks
129
137
  end
130
138
 
131
139
  # Default to Standalone if no other match was made
@@ -133,7 +141,6 @@ module VMC::Cli
133
141
  end
134
142
  end
135
143
 
136
- private
137
144
  def detect_framework_from_war(war_file=nil)
138
145
  if war_file
139
146
  contents = ZipUtil.entry_lines(war_file)
@@ -157,6 +164,19 @@ module VMC::Cli
157
164
  return Framework.lookup('JavaWeb')
158
165
  end
159
166
  end
167
+
168
+ def detect_framework_from_zip(zip_file, available_frameworks)
169
+ contents = ZipUtil.entry_lines(zip_file)
170
+ detect_framework_from_zip_contents(contents, available_frameworks)
171
+ end
172
+
173
+ def detect_framework_from_zip_contents(contents, available_frameworks)
174
+ if available_frameworks.include?(["play"]) && contents =~ /lib\/play\..*\.jar/
175
+ return Framework.lookup('Play')
176
+ elsif available_frameworks.include?(["standalone"])
177
+ return Framework.lookup('Standalone')
178
+ end
179
+ end
160
180
  end
161
181
 
162
182
  attr_reader :name, :description, :console
@@ -236,7 +256,7 @@ module VMC::Cli
236
256
  def memory(runtime=nil)
237
257
  default_mem = @memory
238
258
  default_mem = '128M' if runtime =~ /\Aruby/ || runtime == "php"
239
- default_mem = '512M' if runtime == "java"
259
+ default_mem = '512M' if runtime == "java" || runtime == "java7"
240
260
  default_mem
241
261
  end
242
262
 
data/lib/cli/version.rb CHANGED
@@ -2,6 +2,6 @@ module VMC
2
2
  module Cli
3
3
  # This version number is used as the RubyGem release version.
4
4
  # The internal VMC version number is VMC::VERSION.
5
- VERSION = '0.3.17.IF.2'
5
+ VERSION = '0.3.18'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmc-IronFoundry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.17.IF.2
5
- prerelease: 7
4
+ version: 0.3.18
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - VMware / Iron Foundry
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-09 00:00:00.000000000 Z
12
+ date: 2012-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json_pure
16
- requirement: &26494716 !ruby/object:Gem::Requirement
16
+ requirement: &22424532 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: 1.7.0
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *26494716
27
+ version_requirements: *22424532
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rubyzip
30
- requirement: &26494260 !ruby/object:Gem::Requirement
30
+ requirement: &22424004 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ~>
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: 0.9.4
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *26494260
38
+ version_requirements: *22424004
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: rest-client
41
- requirement: &26493816 !ruby/object:Gem::Requirement
41
+ requirement: &22423608 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ! '>='
@@ -49,10 +49,10 @@ dependencies:
49
49
  version: 1.7.0
50
50
  type: :runtime
51
51
  prerelease: false
52
- version_requirements: *26493816
52
+ version_requirements: *22423608
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: terminal-table
55
- requirement: &26492916 !ruby/object:Gem::Requirement
55
+ requirement: &22371264 !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements:
58
58
  - - ~>
@@ -60,10 +60,10 @@ dependencies:
60
60
  version: 1.4.2
61
61
  type: :runtime
62
62
  prerelease: false
63
- version_requirements: *26492916
63
+ version_requirements: *22371264
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: interact
66
- requirement: &26484864 !ruby/object:Gem::Requirement
66
+ requirement: &22370856 !ruby/object:Gem::Requirement
67
67
  none: false
68
68
  requirements:
69
69
  - - ~>
@@ -71,10 +71,10 @@ dependencies:
71
71
  version: 0.4.0
72
72
  type: :runtime
73
73
  prerelease: false
74
- version_requirements: *26484864
74
+ version_requirements: *22370856
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: addressable
77
- requirement: &26484408 !ruby/object:Gem::Requirement
77
+ requirement: &22370352 !ruby/object:Gem::Requirement
78
78
  none: false
79
79
  requirements:
80
80
  - - ~>
@@ -82,10 +82,10 @@ dependencies:
82
82
  version: 2.2.6
83
83
  type: :runtime
84
84
  prerelease: false
85
- version_requirements: *26484408
85
+ version_requirements: *22370352
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: uuidtools
88
- requirement: &26483808 !ruby/object:Gem::Requirement
88
+ requirement: &22369776 !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
91
  - - ~>
@@ -93,10 +93,21 @@ dependencies:
93
93
  version: 2.1.0
94
94
  type: :runtime
95
95
  prerelease: false
96
- version_requirements: *26483808
96
+ version_requirements: *22369776
97
+ - !ruby/object:Gem::Dependency
98
+ name: rb-readline
99
+ requirement: &22369392 !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ~>
103
+ - !ruby/object:Gem::Version
104
+ version: 0.4.2
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: *22369392
97
108
  - !ruby/object:Gem::Dependency
98
109
  name: rake
99
- requirement: &26483304 !ruby/object:Gem::Requirement
110
+ requirement: &22369068 !ruby/object:Gem::Requirement
100
111
  none: false
101
112
  requirements:
102
113
  - - ! '>='
@@ -104,10 +115,10 @@ dependencies:
104
115
  version: '0'
105
116
  type: :development
106
117
  prerelease: false
107
- version_requirements: *26483304
118
+ version_requirements: *22369068
108
119
  - !ruby/object:Gem::Dependency
109
120
  name: rspec
110
- requirement: &26482776 !ruby/object:Gem::Requirement
121
+ requirement: &22368528 !ruby/object:Gem::Requirement
111
122
  none: false
112
123
  requirements:
113
124
  - - ~>
@@ -115,10 +126,10 @@ dependencies:
115
126
  version: 1.3.0
116
127
  type: :development
117
128
  prerelease: false
118
- version_requirements: *26482776
129
+ version_requirements: *22368528
119
130
  - !ruby/object:Gem::Dependency
120
131
  name: webmock
121
- requirement: &26482320 !ruby/object:Gem::Requirement
132
+ requirement: &22368048 !ruby/object:Gem::Requirement
122
133
  none: false
123
134
  requirements:
124
135
  - - ~>
@@ -126,7 +137,7 @@ dependencies:
126
137
  version: 1.5.0
127
138
  type: :development
128
139
  prerelease: false
129
- version_requirements: *26482320
140
+ version_requirements: *22368048
130
141
  description: Client library and CLI that provides access to the VMware Cloud Application
131
142
  Platform.
132
143
  email: help@ironfoundry.org
@@ -195,9 +206,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
195
206
  required_rubygems_version: !ruby/object:Gem::Requirement
196
207
  none: false
197
208
  requirements:
198
- - - ! '>'
209
+ - - ! '>='
199
210
  - !ruby/object:Gem::Version
200
- version: 1.3.1
211
+ version: '0'
201
212
  requirements: []
202
213
  rubyforge_project:
203
214
  rubygems_version: 1.8.16