manifests-vmc-plugin 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
- require "cf/plugin"
1
+ require "vmc/plugin"
2
2
  require File.expand_path("../../manifests-vmc-plugin", __FILE__)
3
3
 
4
- CF.Plugin do
4
+ VMC.Plugin do
5
5
  class_option :manifest,
6
6
  :aliases => "-m", :desc => "Manifest file"
7
7
 
@@ -9,7 +9,7 @@ CF.Plugin do
9
9
  :aliases => "-p", :desc => "Application path"
10
10
  end
11
11
 
12
- CF.Plugin(CF::App) do
12
+ VMC.Plugin(VMC::App) do
13
13
  include VMCManifests
14
14
 
15
15
  # basic commands that, when given no args, act on the
@@ -28,21 +28,40 @@ CF.Plugin(CF::App) do
28
28
  end
29
29
 
30
30
  # same as above but in reverse dependency-order
31
- [:stop, :delete].each do |wrap|
32
- around(wrap) do |cmd, args|
33
- if args.empty?
34
- reversed = []
31
+ around(:stop) do |cmd, args|
32
+ if args.empty?
33
+ reversed = []
34
+ each_app do |a|
35
+ reversed.unshift a["name"]
36
+ end || err("No applications to act on.")
37
+
38
+ reversed.each do |name|
39
+ cmd.call(name)
40
+ puts "" unless simple_output?
41
+ end
42
+ else
43
+ cmd.call(args)
44
+ end
45
+ end
46
+
47
+ around(:delete) do |cmd, args|
48
+ if args.empty? && !options[:all]
49
+ reversed = []
50
+ has_manifest =
35
51
  each_app do |a|
36
52
  reversed.unshift a["name"]
37
- end || err("No applications to act on.")
38
-
39
- reversed.each do |name|
40
- cmd.call(name)
41
- puts "" unless simple_output?
42
53
  end
43
- else
44
- cmd.call(args)
54
+
55
+ unless has_manifest
56
+ return cmd.call(args)
57
+ end
58
+
59
+ reversed.each do |name|
60
+ cmd.call(name)
61
+ puts "" unless simple_output?
45
62
  end
63
+ else
64
+ cmd.call(args)
46
65
  end
47
66
  end
48
67
 
@@ -1,3 +1,3 @@
1
1
  module VMCManifests
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -13,7 +13,7 @@ module VMCManifests
13
13
  end
14
14
 
15
15
  def save_manifest(save_to = manifest_file)
16
- err "No manifest to save!" unless @manifest
16
+ raise "No manifest to save!" unless @manifest
17
17
 
18
18
  File.open(save_to, "w") do |io|
19
19
  YAML.dump(@manifest, io)
@@ -103,7 +103,7 @@ module VMCManifests
103
103
  resolve_lexically(v, ctx)
104
104
  end
105
105
  when String
106
- val.gsub!(/\$\{([[:alnum:]\-]+)\}/) do
106
+ val.gsub!(/\$\{([^\}]+)\}/) do
107
107
  resolve_symbol($1, ctx)
108
108
  end
109
109
  end
@@ -123,6 +123,9 @@ module VMCManifests
123
123
  when "random-word"
124
124
  "%04x" % [rand(0x0100000)]
125
125
 
126
+ when /^ask (.+)/
127
+ ask($1)
128
+
126
129
  else
127
130
  found = find_symbol(sym, ctx)
128
131
 
@@ -130,7 +133,7 @@ module VMCManifests
130
133
  resolve_lexically(found, ctx)
131
134
  found
132
135
  else
133
- err("Unknown symbol in manifest: #{sym}")
136
+ raise("Unknown symbol in manifest: #{sym}")
134
137
  end
135
138
  end
136
139
  end
@@ -305,7 +308,7 @@ module VMCManifests
305
308
  deps.each do |dep|
306
309
  edep = File.expand_path("../" + dep, manifest_file)
307
310
 
308
- err "Circular dependency detected." if processed.include? edep
311
+ raise "Circular dependency detected." if processed.include? edep
309
312
 
310
313
  dep_apps[dep] = abspaths[edep]
311
314
  end
metadata CHANGED
@@ -1,34 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: manifests-vmc-plugin
3
- version: !ruby/object:Gem::Version
4
- hash: 27
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Alex Suraci
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-05-01 00:00:00 Z
12
+ date: 2012-05-24 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description:
22
- email:
15
+ email:
23
16
  - asuraci@vmware.com
24
17
  executables: []
25
-
26
18
  extensions: []
27
-
28
19
  extra_rdoc_files: []
29
-
30
- files:
31
- - LICENSE
20
+ files:
32
21
  - Rakefile
33
22
  - lib/manifests-vmc-plugin/errors.rb
34
23
  - lib/manifests-vmc-plugin/manifest.rb
@@ -37,36 +26,26 @@ files:
37
26
  - lib/manifests-vmc-plugin.rb
38
27
  homepage: http://cloudfoundry.com/
39
28
  licenses: []
40
-
41
29
  post_install_message:
42
30
  rdoc_options: []
43
-
44
- require_paths:
31
+ require_paths:
45
32
  - lib
46
- required_ruby_version: !ruby/object:Gem::Requirement
33
+ required_ruby_version: !ruby/object:Gem::Requirement
47
34
  none: false
48
- requirements:
49
- - - ">="
50
- - !ruby/object:Gem::Version
51
- hash: 3
52
- segments:
53
- - 0
54
- version: "0"
55
- required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
40
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
64
45
  requirements: []
65
-
66
46
  rubyforge_project: manifests-vmc-plugin
67
- rubygems_version: 1.8.23
47
+ rubygems_version: 1.8.21
68
48
  signing_key:
69
49
  specification_version: 3
70
50
  summary: Cloud Foundry automation via manifest documents.
71
51
  test_files: []
72
-
data/LICENSE DELETED
@@ -1,30 +0,0 @@
1
- Copyright (c)2012, Alex Suraci
2
-
3
- All rights reserved.
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
7
-
8
- * Redistributions of source code must retain the above copyright
9
- notice, this list of conditions and the following disclaimer.
10
-
11
- * Redistributions in binary form must reproduce the above
12
- copyright notice, this list of conditions and the following
13
- disclaimer in the documentation and/or other materials provided
14
- with the distribution.
15
-
16
- * Neither the name of Alex Suraci nor the names of other
17
- contributors may be used to endorse or promote products derived
18
- from this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.