appfog-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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Y2EwMmYyYjdjMzkxMTdiYmQ2MGEyYTYzNDNjM2I4NTZjMzNjYzc1OQ==
5
+ data.tar.gz: !binary |-
6
+ ZGQwODc4OGJlOGQ5YjcxYzA3Y2Q4NjM4NDk4ZDRiYjQ2MmYwMDVhZA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NzViZmE0MWViYTE0Yjk0MDIxOGVjODVjYzk5YTZiYjRmZDg1ZjEzYWVmNTBh
10
+ ZjI1MzI4OTJiZGY4ZGE3NmYyOTQyYzljOWU5MWExODMwYWIwMDM0NGUxZmJi
11
+ MDZjMTVkODE4NTQ5YmNhOTAwMDEzMGM3MDYwNDIwNTFjNDFkNzI=
12
+ data.tar.gz: !binary |-
13
+ ZWVhOTZhOWE4NzQzNjY3MmMzYzczNjZjZDUwNzFkZDJkMjk2YjRiMWFkMTc3
14
+ N2JlN2QxYTMwNDU0Yjc3MTU0MTZiMmUzYTE4YmI1NjA1Y2RjYTc5MTZiNGM4
15
+ N2VmYzlhMmI5NWQzNGVkYTQ0OTI2Nzg0NGY3ZmMwYzYzOWQzZjE=
@@ -0,0 +1,63 @@
1
+ module VMC::App
2
+ class Env_old < Base
3
+ VALID_ENV_VAR = /^[a-zA-Za-z_][[:alnum:]_]*$/
4
+
5
+ desc "Show all environment variables set for an app"
6
+ group :apps, :info, :hidden => true
7
+ input :app, :desc => "Application to inspect the environment of",
8
+ :argument => true, :from_given => by_name(:app)
9
+
10
+ desc "Set an environment variable"
11
+ group :apps, :info, :hidden => true
12
+ input :app, :desc => "Application to set the variable for",
13
+ :argument => true, :from_given => by_name(:app)
14
+ input :name, :desc => "Variable name", :argument => true
15
+ input :value, :desc => "Variable value", :argument => :optional
16
+ input :restart, :desc => "Restart app after updating?", :default => true
17
+ def env_add
18
+ app = input[:app]
19
+ name = input[:name]
20
+
21
+ if value = input[:value]
22
+ name = input[:name]
23
+ elsif name["="]
24
+ name, value = name.split("=")
25
+ end
26
+
27
+ unless name =~ VALID_ENV_VAR
28
+ fail "Invalid variable name; must match #{VALID_ENV_VAR.inspect}"
29
+ end
30
+
31
+ with_progress("Updating #{c(app.name, :name)}") do
32
+ app.env[name] = value
33
+ app.update!
34
+ end
35
+
36
+ if app.started? && input[:restart]
37
+ invoke :restart, :app => app
38
+ end
39
+ end
40
+
41
+
42
+ desc "Remove an environment variable"
43
+ group :apps, :info, :hidden => true
44
+ input :app, :desc => "Application to set the variable for",
45
+ :argument => true, :from_given => by_name(:app)
46
+ input :name, :desc => "Variable name", :argument => true
47
+ input :restart, :desc => "Restart app after updating?", :default => true
48
+ def env_del
49
+ app = input[:app]
50
+ name = input[:name]
51
+
52
+ with_progress("Updating #{c(app.name, :name)}") do
53
+ app.env.delete(name)
54
+ app.update!
55
+ end
56
+
57
+ if app.started? && input[:restart]
58
+ invoke :restart, :app => app
59
+ end
60
+ end
61
+ end
62
+ end
63
+
@@ -0,0 +1,40 @@
1
+ module VMC::App
2
+ class Mem < Base
3
+ IS_UTF8 = !!(ENV["LC_ALL"] || ENV["LC_CTYPE"] || ENV["LANG"] || "")["UTF-8"].freeze
4
+
5
+ desc "Show app memory usage"
6
+ group :apps
7
+ input :app, :desc => "App to show", :argument => :required,
8
+ :from_given => by_name(:app)
9
+ input :mem, :desc => "Memory limit", :argument => :optional
10
+
11
+ def mem
12
+ app = input[:app]
13
+
14
+ if input.has?(:mem)
15
+ mem = input[:mem]
16
+ else
17
+ mem = input[:mem, app.memory]
18
+ end
19
+
20
+ app.memory = megabytes(mem) if input.has?(:mem)
21
+ fail "No changes!" unless app.changed?
22
+
23
+ with_progress("Scaling #{c(app.name, :name)}") do
24
+ app.update!
25
+ end
26
+
27
+ if app.started?
28
+ invoke :restart, :app => app
29
+ end
30
+
31
+ end
32
+
33
+ private
34
+
35
+ def ask_mem(default)
36
+ ask("Memory Limit", :choices => memory_choices(default),
37
+ :default => human_mb(default), :allow_other => true)
38
+ end
39
+ end
40
+ end
@@ -1,3 +1,3 @@
1
1
  module VMCAppfog
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.1.1".freeze
3
3
  end
@@ -0,0 +1,40 @@
1
+ module VMC::App
2
+ class Instances < Base
3
+ IS_UTF8 = !!(ENV["LC_ALL"] || ENV["LC_CTYPE"] || ENV["LANG"] || "")["UTF-8"].freeze
4
+
5
+ desc "Update the instances limit for an application"
6
+ group :apps
7
+ input :app, :desc => "App to show", :argument => :required,
8
+ :from_given => by_name(:app)
9
+ input :inst, :desc => "Number of instances to run", :argument => :optional
10
+
11
+ def instances
12
+ app = input[:app]
13
+
14
+ if input.has?(:inst)
15
+ inst = input[:inst]
16
+ else
17
+ inst = input[:inst, app.total_instances]
18
+ end
19
+
20
+ app.total_instances = inst if input.has?(:inst)
21
+ fail "No changes!" unless app.changed?
22
+
23
+ with_progress("Scaling #{c(app.name, :name)}") do
24
+ app.update!
25
+ end
26
+
27
+ if app.started?
28
+ invoke :restart, :app => app
29
+ end
30
+
31
+ end
32
+
33
+ private
34
+
35
+ def ask_inst(default)
36
+ ask("Instances", :default => default)
37
+ end
38
+ end
39
+ end
40
+
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appfog-vmc-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tim Santeford
@@ -15,7 +14,6 @@ dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: cfoundry
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ~>
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ~>
29
26
  - !ruby/object:Gem::Version
@@ -53,35 +50,37 @@ files:
53
50
  - lib/appfog-vmc-plugin/commands/infra.rb
54
51
  - lib/appfog-vmc-plugin/commands/pull.rb
55
52
  - lib/appfog-vmc-plugin/commands/runtimes.rb
53
+ - lib/appfog-vmc-plugin/deprecated/env.rb
54
+ - lib/appfog-vmc-plugin/deprecated/mem.rb
56
55
  - lib/appfog-vmc-plugin/help.rb
57
56
  - lib/appfog-vmc-plugin/net_http.rb
58
57
  - lib/appfog-vmc-plugin/non_uaa.rb
59
58
  - lib/appfog-vmc-plugin/plugin.rb
60
59
  - lib/appfog-vmc-plugin/version.rb
61
60
  - lib/appfog-vmc-plugin/vmc/app/apps.rb
61
+ - lib/appfog-vmc-plugin/vmc/app/instances.rb
62
62
  - lib/appfog-vmc-plugin/vmc.rb
63
63
  homepage: http://www.appfog.com/
64
64
  licenses: []
65
+ metadata: {}
65
66
  post_install_message:
66
67
  rdoc_options: []
67
68
  require_paths:
68
69
  - lib
69
70
  required_ruby_version: !ruby/object:Gem::Requirement
70
- none: false
71
71
  requirements:
72
72
  - - ! '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
- none: false
77
76
  requirements:
78
77
  - - ! '>='
79
78
  - !ruby/object:Gem::Version
80
79
  version: '0'
81
80
  requirements: []
82
81
  rubyforge_project:
83
- rubygems_version: 1.8.23
82
+ rubygems_version: 2.0.1
84
83
  signing_key:
85
- specification_version: 3
84
+ specification_version: 4
86
85
  summary: AppFog specific plugins for the AF CLI
87
86
  test_files: []