conan_deploy_stackato3 0.1.3 → 0.1.4

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.
@@ -1,5 +1,6 @@
1
1
  require 'rest_client'
2
2
  require 'json'
3
+ require 'open3'
3
4
 
4
5
  class Stackato
5
6
 
@@ -10,9 +11,12 @@ class Stackato
10
11
  def initialize(target, dry_run=false)
11
12
  @target = target
12
13
  @dry_run = dry_run
14
+ v = get_version
15
+ puts(v)
16
+ raise "Stackato 3.1.* required. Found #{v}" unless v =~ /\(3\.1\.[0-9]+\)/
13
17
  end
14
18
 
15
- def shell_cmd(stackato_cmd, args)
19
+ def shell_cmd(stackato_cmd, args, ignoreErrs=false)
16
20
  base_args = "--target #{@target} --token-file #{@@token_file}"
17
21
 
18
22
  cmd = "#{@@executable} #{stackato_cmd} #{base_args} #{args}"
@@ -20,20 +24,42 @@ class Stackato
20
24
  if @dry_run
21
25
  puts "Dry-run, skipping execution of command: #{cmd}"
22
26
  else
23
- system(cmd)
27
+ # output, err, status = Open3.capture3(cmd)
28
+ # raise "Stackato error: #{err}" unless (ignoreErrs||status.success?)
29
+ # output
30
+ Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr|
31
+ while line = stdout_err.gets
32
+ puts line
33
+ end
34
+
35
+ exit_status = wait_thr.value
36
+ unless ignoreErrs || exit_status.success?
37
+ abort "Stackato #{stackato_cmd} failed: #{stdout_err.read}"
38
+ end
39
+ end
24
40
  end
25
41
  end
26
42
 
43
+ def get_version
44
+ begin
45
+ v, err, status = Open3.capture3("#{@@executable} version")
46
+ abort "Stackato error: #{err}" unless status.success?
47
+ v
48
+ rescue Exception => e
49
+ abort "Failed to invoke Stackato client: #{e}"
50
+ end
51
+ end
52
+
27
53
  def login(username, password, space)
28
54
  shell_cmd("login", "--space #{space} --password '#{password}' #{username}")
29
55
  end
30
56
 
31
57
  def push(manifest)
32
- shell_cmd("push", "--manifest #{manifest} --no-prompt --reset")
58
+ shell_cmd("push", "--manifest #{manifest} --no-prompt --reset --timeout 15m")
33
59
  end
34
60
 
35
61
  def delete(app_name)
36
- shell_cmd("delete", "--no-prompt #{app_name}")
62
+ shell_cmd("delete", "--no-prompt #{app_name}", true)
37
63
  end
38
64
 
39
65
  def map(app_name, url)
@@ -10,10 +10,14 @@ module Templates
10
10
  Dir.glob(File.join(templates_dir, '*.erb')) do |template|
11
11
  target_file = File.join(output_dir, File.basename(template)[0..-5])
12
12
  eruby = Erubis::Eruby.new(File.read(template))
13
- if (File.exist? target_file)
14
- Tempfile.open(File.basename template) { |t|
15
- t.write(eruby.evaluate(context))
16
- t.rewind
13
+ if (File.exist? target_file)
14
+ Tempfile.open(File.basename template) { |t|
15
+ begin
16
+ t.write(eruby.evaluate(context))
17
+ t.rewind
18
+ rescue Exception => e
19
+ abort "Failed to evaluate #{template} template: #{e}"
20
+ end
17
21
  if (FileUtils.identical? t.path, target_file)
18
22
  puts "-- No change from: #{File.basename template} => #{target_file}"
19
23
  else
data/lib/conan/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Conan
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conan_deploy_stackato3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Mike Reardon
@@ -9,11 +10,12 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-09-05 00:00:00.000000000 Z
13
+ date: 2014-09-11 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: daphne_util
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
20
  - - '='
19
21
  - !ruby/object:Gem::Version
@@ -21,6 +23,7 @@ dependencies:
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - '='
26
29
  - !ruby/object:Gem::Version
@@ -32,7 +35,6 @@ executables:
32
35
  extensions: []
33
36
  extra_rdoc_files: []
34
37
  files:
35
- - README.md
36
38
  - bin/conan-stackato3
37
39
  - lib/conan/application.rb
38
40
  - lib/conan/application_helper.rb
@@ -52,27 +54,30 @@ files:
52
54
  - lib/conan/stackato.rb
53
55
  - lib/conan/templates.rb
54
56
  - lib/conan/version.rb
57
+ - README.md
55
58
  homepage: http://github.com/MTNSatelliteComm/conan/README.md
56
59
  licenses: []
57
- metadata: {}
58
60
  post_install_message:
59
61
  rdoc_options: []
60
62
  require_paths:
61
63
  - lib
62
64
  required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
63
66
  requirements:
64
67
  - - ! '>='
65
68
  - !ruby/object:Gem::Version
66
69
  version: '0'
67
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
68
72
  requirements:
69
73
  - - ! '>='
70
74
  - !ruby/object:Gem::Version
71
75
  version: '0'
72
76
  requirements: []
73
77
  rubyforge_project:
74
- rubygems_version: 2.2.2
78
+ rubygems_version: 1.8.23
75
79
  signing_key:
76
- specification_version: 4
80
+ specification_version: 3
77
81
  summary: Conan da Deployer
78
82
  test_files: []
83
+ has_rdoc:
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZTZiNWQ1NjU2YWZlNGQ0YjU0MTViMGI1YjlmMjFhMzhlYTdjZDhkYw==
5
- data.tar.gz: !binary |-
6
- YTJkMDk5NWVjYTQ3NzZmZDBiYmZiMGMzNDIwYWQ0Y2U4MTVjMzhmNg==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- ZjFmYmI1YjgxODRkZWVkNmZhOGViYzY4NzI3Y2I1NmEyMTlkNTgxNjZjZjY0
10
- MmU5MGZkNjgyOTVlN2YwYzE5YWZlZWExNWQ3NDYwZjZjNDNkODM1MTVkNThl
11
- YTNhZTYwMjlhM2Q1YzE1YmRhMjc3ODliNjExZTM1MTYyNjc5ZTY=
12
- data.tar.gz: !binary |-
13
- NzNmN2ZlOWI4OTY0OTY1Y2RlMzU5MDgxYTQxZDU2MWQ3MGI3OTMzNTdiN2Zl
14
- MGU3NWNkYzU5YzAxZDMxOWNkMDg2YTYzZTY4Y2MyODBlZTkyMjRmNzk2NjQy
15
- Y2RiNzU4Y2JkNDg0NzY5OWI4MTgxNGUzNzY3NTIwZmNmZjM5ZTE=