Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use the cloudfoundry-client gem instead of the vmc gem

  • Loading branch information...
commit 850996817261f8a67f807f3d88f8bb7c9c589109 1 parent b9cf774
@frodenas authored
Showing with 8,326 additions and 6,242 deletions.
  1. +2 −0  .gitignore
  2. +1 −0  .rspec
  3. +9 −11 Gemfile
  4. +0 −144 Gemfile.lock
  5. +46 −6 README.md
  6. +8 −6 app/controllers/application_controller.rb
  7. +1 −1  app/controllers/apps_controller.rb
  8. +5 −1 app/controllers/services_controller.rb
  9. +9 −9 app/controllers/sessions_controller.rb
  10. +77 −113 app/models/app.rb
  11. +11 −26 app/models/service.rb
  12. +10 −5 app/models/system.rb
  13. +9 −14 app/models/user.rb
  14. +6 −0 config/initializers/json_patch.rb
  15. +1 −1  public/humans.txt
  16. +23 −23 spec/controllers/apps_controller_spec.rb
  17. +1 −1  spec/controllers/dashboard_controller_spec.rb
  18. +1 −2  spec/controllers/services_controller_spec.rb
  19. +23 −23 spec/controllers/sessions_controller_spec.rb
  20. +1 −1  spec/controllers/system_controller_spec.rb
  21. +7 −5 spec/controllers/users_controller_spec.rb
  22. +279 −0 spec/fixtures/controllers/admin/users.yml
  23. +318 −0 spec/fixtures/controllers/admin/users_create_action.yml
  24. +244 −0 spec/fixtures/controllers/admin/users_create_again_action.yml
  25. +234 −0 spec/fixtures/controllers/admin/users_delete_action.yml
  26. +242 −0 spec/fixtures/controllers/logged/apps.yml
  27. +336 −0 spec/fixtures/controllers/logged/dashboard.yml
  28. +404 −0 spec/fixtures/controllers/logged/services.yml
  29. +365 −0 spec/fixtures/controllers/logged/services_create_action.yml
  30. +238 −0 spec/fixtures/controllers/logged/services_delete_action.yml
  31. +258 −0 spec/fixtures/controllers/logged/sessions.yml
  32. +80 −0 spec/fixtures/controllers/logged/sessions_create_action.yml
  33. +447 −0 spec/fixtures/controllers/logged/system.yml
  34. +275 −0 spec/fixtures/controllers/logged/users.yml
  35. +83 −0 spec/fixtures/controllers/no_logged/apps.yml
  36. +83 −0 spec/fixtures/controllers/no_logged/dashboard.yml
  37. +83 −0 spec/fixtures/controllers/no_logged/services.yml
  38. +153 −0 spec/fixtures/controllers/no_logged/sessions.yml
  39. +80 −0 spec/fixtures/controllers/no_logged/sessions_create_action.yml
  40. +83 −0 spec/fixtures/controllers/no_logged/system.yml
  41. +83 −0 spec/fixtures/controllers/no_logged/users.yml
  42. +80 −0 spec/fixtures/models/admin/client.yml
  43. +44 −0 spec/fixtures/models/admin/user_create.yml
  44. +36 −0 spec/fixtures/models/admin/user_create_action.yml
  45. +44 −0 spec/fixtures/models/admin/user_delete.yml
  46. +96 −0 spec/fixtures/models/admin/user_delete_action.yml
  47. +483 −0 spec/fixtures/models/logged/app.yml
  48. +81 −0 spec/fixtures/models/logged/app_bind_invalid_service_action.yml
  49. +206 −0 spec/fixtures/models/logged/app_bind_service_action.yml
  50. +44 −0 spec/fixtures/models/logged/app_bind_service_binded_action.yml
  51. +42 −0 spec/fixtures/models/logged/app_create_action.yml
  52. +81 −0 spec/fixtures/models/logged/app_map_url_action.yml
  53. +44 −0 spec/fixtures/models/logged/app_map_url_mapped_action.yml
  54. +122 −0 spec/fixtures/models/logged/app_modify_var_action.yml
  55. +134 −0 spec/fixtures/models/logged/app_set_instances_action.yml
  56. +175 −0 spec/fixtures/models/logged/app_set_memory_action.yml
  57. +122 −0 spec/fixtures/models/logged/app_set_var_action.yml
  58. +159 −0 spec/fixtures/models/logged/app_unbind_service_action.yml
  59. +81 −0 spec/fixtures/models/logged/app_unmap_url_action.yml
  60. +122 −0 spec/fixtures/models/logged/app_unset_var_action.yml
  61. +80 −0 spec/fixtures/models/logged/client.yml
  62. +169 −0 spec/fixtures/models/logged/service_create.yml
  63. +87 −0 spec/fixtures/models/logged/service_create_action.yml
  64. +83 −0 spec/fixtures/models/logged/service_delete.yml
  65. +40 −0 spec/fixtures/models/logged/service_delete_action.yml
  66. +143 −0 spec/fixtures/models/logged/system.yml
  67. +110 −0 spec/fixtures/models/logged/user.yml
  68. +43 −0 spec/fixtures/models/no_logged/app.yml
  69. +43 −0 spec/fixtures/models/no_logged/client.yml
  70. +43 −0 spec/fixtures/models/no_logged/service.yml
  71. +83 −0 spec/fixtures/models/no_logged/system.yml
  72. +74 −0 spec/fixtures/models/no_logged/user.yml
  73. +17 −0 spec/helpers/application_helper_spec.rb
  74. +369 −233 spec/models/app_spec.rb
  75. +32 −24 spec/models/service_spec.rb
  76. +3 −3 spec/models/system_spec.rb
  77. +62 −40 spec/models/user_spec.rb
  78. +11 −0 spec/spec_helper.rb
  79. +18 −19 spec/support/cf_connection_helper.rb
  80. +1 −1  spec/support/vcr.rb
  81. +0 −363 spec/vcr_cassettes/controllers/admin/users.yml
  82. +0 −201 spec/vcr_cassettes/controllers/admin/users_create_action.yml
  83. +0 −119 spec/vcr_cassettes/controllers/admin/users_delete_action.yml
  84. +0 −402 spec/vcr_cassettes/controllers/logged/apps.yml
  85. +0 −489 spec/vcr_cassettes/controllers/logged/dashboard.yml
  86. +0 −458 spec/vcr_cassettes/controllers/logged/services.yml
  87. +0 −247 spec/vcr_cassettes/controllers/logged/services_create_action.yml
  88. +0 −162 spec/vcr_cassettes/controllers/logged/services_delete_action.yml
  89. +0 −160 spec/vcr_cassettes/controllers/logged/sessions.yml
  90. +0 −40 spec/vcr_cassettes/controllers/logged/sessions_create_action.yml
  91. +0 −272 spec/vcr_cassettes/controllers/logged/system.yml
  92. +0 −266 spec/vcr_cassettes/controllers/logged/users.yml
  93. +0 −39 spec/vcr_cassettes/controllers/no_logged/apps.yml
  94. +0 −39 spec/vcr_cassettes/controllers/no_logged/dashboard.yml
  95. +0 −39 spec/vcr_cassettes/controllers/no_logged/services.yml
  96. +0 −113 spec/vcr_cassettes/controllers/no_logged/sessions.yml
  97. +0 −40 spec/vcr_cassettes/controllers/no_logged/sessions_create_action.yml
  98. +0 −39 spec/vcr_cassettes/controllers/no_logged/system.yml
  99. +0 −39 spec/vcr_cassettes/controllers/no_logged/users.yml
  100. +0 −40 spec/vcr_cassettes/models/admin/client.yml
  101. +0 −88 spec/vcr_cassettes/models/admin/user_create.yml
  102. +0 −36 spec/vcr_cassettes/models/admin/user_create_action.yml
  103. +0 −40 spec/vcr_cassettes/models/admin/user_delete.yml
  104. +0 −80 spec/vcr_cassettes/models/admin/user_delete_action.yml
  105. +0 −713 spec/vcr_cassettes/models/logged/app.yml
  106. +0 −79 spec/vcr_cassettes/models/logged/app_started_map_external_url_action.yml
  107. +0 −80 spec/vcr_cassettes/models/logged/app_started_map_reserved_url_action.yml
  108. +0 −40 spec/vcr_cassettes/models/logged/client.yml
  109. +0 −130 spec/vcr_cassettes/models/logged/service_create.yml
  110. +0 −84 spec/vcr_cassettes/models/logged/service_create_action.yml
  111. +0 −40 spec/vcr_cassettes/models/logged/service_delete.yml
  112. +0 −125 spec/vcr_cassettes/models/logged/service_delete_action.yml
  113. +0 −151 spec/vcr_cassettes/models/logged/system.yml
  114. +0 −121 spec/vcr_cassettes/models/logged/user.yml
  115. +0 −39 spec/vcr_cassettes/models/no_logged/app.yml
  116. +0 −39 spec/vcr_cassettes/models/no_logged/service.yml
  117. +0 −39 spec/vcr_cassettes/models/no_logged/system.yml
  118. +0 −39 spec/vcr_cassettes/models/no_logged/user.yml
View
2  .gitignore
@@ -3,8 +3,10 @@
.idea
.rbenv-version
.sass-cache/
+Gemfile.lock
bin/
db/*.sqlite3
+doc/coverage/
log/*.log
tmp/
vendor/bundle/ruby/
View
1  .rspec
@@ -1 +1,2 @@
--colour
+--format=nested
View
20 Gemfile
@@ -1,16 +1,13 @@
source 'http://rubygems.org'
-gem 'rails', '3.1.1'
-gem 'json', '~> 1.6.1'
-gem 'haml', '~> 3.1.3'
-gem 'vmc', '~> 0.3.12'
-gem 'coderay', '~> 1.0.1'
+gem 'rails', '3.1.3'
+gem 'haml', '~> 3.1.4'
+gem 'coderay', '~> 1.0.4'
+gem 'cloudfoundry-client', '~> 0.1.1'
group :assets do
- gem 'sass-rails', '~> 3.1.4'
- gem 'uglifier', '>= 1.0.4'
- #gem 'execjs', '~> 1.2.9'
- #gem 'therubyracer', '~> 0.9.8'
+ gem 'sass-rails', '~> 3.1.5'
+ gem 'uglifier', '>= 1.1.0'
end
# RSpec2 needs to be in the :development group to expose generators and rake tasks without having to type RAILS_ENV=test
@@ -19,6 +16,7 @@ group :development, :test do
end
group :test do
- gem "webmock", "~> 1.7.7"
- gem "vcr", "~> 2.0.0.beta1"
+ gem "webmock", "~> 1.7.8"
+ gem "vcr", "~> 2.0.0.beta2"
+ gem 'simplecov', "~> 0.5.4", :require => false
end
View
144 Gemfile.lock
@@ -1,144 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- actionmailer (3.1.1)
- actionpack (= 3.1.1)
- mail (~> 2.3.0)
- actionpack (3.1.1)
- activemodel (= 3.1.1)
- activesupport (= 3.1.1)
- builder (~> 3.0.0)
- erubis (~> 2.7.0)
- i18n (~> 0.6)
- rack (~> 1.3.2)
- rack-cache (~> 1.1)
- rack-mount (~> 0.8.2)
- rack-test (~> 0.6.1)
- sprockets (~> 2.0.2)
- activemodel (3.1.1)
- activesupport (= 3.1.1)
- builder (~> 3.0.0)
- i18n (~> 0.6)
- activerecord (3.1.1)
- activemodel (= 3.1.1)
- activesupport (= 3.1.1)
- arel (~> 2.2.1)
- tzinfo (~> 0.3.29)
- activeresource (3.1.1)
- activemodel (= 3.1.1)
- activesupport (= 3.1.1)
- activesupport (3.1.1)
- multi_json (~> 1.0)
- addressable (2.2.6)
- arel (2.2.1)
- builder (3.0.0)
- coderay (1.0.4)
- crack (0.3.1)
- diff-lcs (1.1.3)
- erubis (2.7.0)
- execjs (1.2.9)
- multi_json (~> 1.0)
- haml (3.1.3)
- highline (1.6.5)
- hike (1.2.1)
- i18n (0.6.0)
- json (1.6.1)
- json_pure (1.5.4)
- spruz (~> 0.2.8)
- mail (2.3.0)
- i18n (>= 0.4.0)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- mime-types (1.17.2)
- multi_json (1.0.3)
- polyglot (0.3.3)
- rack (1.3.5)
- rack-cache (1.1)
- rack (>= 0.4)
- rack-mount (0.8.3)
- rack (>= 1.0.0)
- rack-ssl (1.3.2)
- rack
- rack-test (0.6.1)
- rack (>= 1.0)
- rails (3.1.1)
- actionmailer (= 3.1.1)
- actionpack (= 3.1.1)
- activerecord (= 3.1.1)
- activeresource (= 3.1.1)
- activesupport (= 3.1.1)
- bundler (~> 1.0)
- railties (= 3.1.1)
- railties (3.1.1)
- actionpack (= 3.1.1)
- activesupport (= 3.1.1)
- rack-ssl (~> 1.3.2)
- rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (~> 0.14.6)
- rake (0.9.2.2)
- rdoc (3.11)
- json (~> 1.4)
- rest-client (1.6.7)
- mime-types (>= 1.16)
- rspec (2.7.0)
- rspec-core (~> 2.7.0)
- rspec-expectations (~> 2.7.0)
- rspec-mocks (~> 2.7.0)
- rspec-core (2.7.1)
- rspec-expectations (2.7.0)
- diff-lcs (~> 1.1.2)
- rspec-mocks (2.7.0)
- rspec-rails (2.7.0)
- actionpack (~> 3.0)
- activesupport (~> 3.0)
- railties (~> 3.0)
- rspec (~> 2.7.0)
- rubyzip2 (2.0.1)
- sass (3.1.10)
- sass-rails (3.1.4)
- actionpack (~> 3.1.0)
- railties (~> 3.1.0)
- sass (>= 3.1.4)
- sprockets (~> 2.0.0)
- tilt (~> 1.3.2)
- sprockets (2.0.3)
- hike (~> 1.2)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- spruz (0.2.13)
- terminal-table (1.4.3)
- thor (0.14.6)
- tilt (1.3.3)
- treetop (1.4.10)
- polyglot
- polyglot (>= 0.3.1)
- tzinfo (0.3.30)
- uglifier (1.0.4)
- execjs (>= 0.3.0)
- multi_json (>= 1.0.2)
- vcr (2.0.0.beta1)
- vmc (0.3.12)
- highline (~> 1.6.1)
- json_pure (~> 1.5.1)
- rest-client (>= 1.6.1, < 1.7.0)
- rubyzip2 (~> 2.0.1)
- terminal-table (~> 1.4.2)
- webmock (1.7.7)
- addressable (~> 2.2, > 2.2.5)
- crack (>= 0.1.7)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- coderay (~> 1.0.1)
- haml (~> 3.1.3)
- json (~> 1.6.1)
- rails (= 3.1.1)
- rspec-rails (~> 2.7.0)
- sass-rails (~> 3.1.4)
- uglifier (>= 1.0.4)
- vcr (~> 2.0.0.beta1)
- vmc (~> 0.3.12)
- webmock (~> 1.7.7)
View
52 README.md
@@ -4,6 +4,9 @@ CF-Console
CF-Console is an easy-to-use web-based interface for [Cloud Foundry](http://cloudfoundry.org/),
the industry’s first open Platform as a Service (PaaS) offering.
+Continuous Integration
+----------------------
+
[![Build Status](https://secure.travis-ci.org/frodenas/cf-console.png)](http://travis-ci.org/frodenas/cf-console)
Demo
@@ -36,14 +39,51 @@ So just type:
rake spec
-Changelog
----------
-
-### v0.1: October 23, 2011
-* First commit to github
+Contributing
+------------
+In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help
+improve this project.
+
+Here are some ways *you* can contribute:
+
+* by using alpha, beta, and prerelease versions
+* by reporting bugs
+* by suggesting new features
+* by writing or editing documentation
+* by writing specifications
+* by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)
+* by refactoring code
+* by closing [issues](http://github.com/frodenas/cf-console/issues)
+* by reviewing patches
+
+
+Submitting an Issue
+-------------------
+We use the [GitHub issue tracker](http://github.com/frodenas/cf-console/issues) to track bugs and features.
+Before submitting a bug report or feature request, check to make sure it hasn't already been submitted. You can indicate
+support for an existing issue by voting it up. When submitting a bug report, please include a
+[Gist](http://gist.github.com/) that includes a stack trace and any details that may be necessary to reproduce the bug,
+including your gem version, Ruby version, and operating system. Ideally, a bug report should include a pull request with
+ failing specs.
+
+
+Submitting a Pull Request
+-------------------------
+1. Fork the project.
+2. Create a topic branch.
+3. Implement your feature or bug fix.
+4. Add specs for your feature or bug fix.
+5. Run <tt>rake spec</tt>. If your changes are not 100% covered, go back to step 4.
+6. Commit and push your changes.
+7. Submit a pull request.
+
+Authors
+-------
+By [Ferran Rodenas](http://www.rodenas.org/) <frodenas@gmail.com>
Copyright
---------
-Copyright (c) 2011 Ferran Rodenas. See LICENSE for details.
+See [LICENSE](https://github.com/frodenas/cf-console/blob/master/LICENSE) for details.
+Copyright (c) 2011 [Ferran Rodenas](http://www.rodenas.org/).
View
14 app/controllers/application_controller.rb
@@ -1,3 +1,5 @@
+require 'cloudfoundry'
+
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :require_login
@@ -6,18 +8,18 @@ class ApplicationController < ActionController::Base
def require_login
begin
- @cf_client = vmc_client(cookies[:vmc_target_url], cookies.signed[:vmc_auth_token])
+ @cf_client = cloudfoundry_client(cookies[:cf_target_url], cookies.signed[:cf_auth_token])
@cf_logged_in = @cf_client.logged_in?
rescue Exception => ex
@cf_logged_in = false
end
if @cf_logged_in
@cf_user = @cf_client.user
- @cf_target = @cf_client.target
+ @cf_target = @cf_client.target_url
begin
user = User.new(@cf_client)
@cf_admin_user = user.is_admin?(@cf_user)
- rescue VMC::Client::TargetError
+ rescue CloudFoundry::Client::Exception::Forbidden
@cf_admin_user = false
end
else
@@ -25,8 +27,8 @@ def require_login
end
end
- def vmc_client(vmc_target_url, vmc_auth_token = nil)
- vmc_target_url ||= VMC::DEFAULT_TARGET
- @client = VMC::Client.new(vmc_target_url, vmc_auth_token)
+ def cloudfoundry_client(cf_target_url, cf_auth_token = nil)
+ cf_target_url ||= CloudFoundry::Client::DEFAULT_TARGET
+ @client = CloudFoundry::Client.new({:target => cf_target_url, :auth_token => cf_auth_token})
end
end
View
2  app/controllers/apps_controller.rb
@@ -27,7 +27,7 @@ def show
@available_instances = find_available_instances(@app[:state], @app[:resources][:memory], @app[:instances])
@available_memsizes = find_available_memsizes(@app[:state], @app[:resources][:memory], @app[:instances])
@available_services = find_available_services()
- rescue VMC::Client::NotFound => ex
+ rescue CloudFoundry::Client::Exception::NotFound => ex
flash[:alert] = ex.message
redirect_to apps_info_url
rescue Exception => ex
View
6 app/controllers/services_controller.rb
@@ -18,7 +18,11 @@ def create
if !@ss.nil? && !@ss.empty?
begin
service = Service.new(@cf_client)
- service_info = service.find(@name)
+ begin
+ service_info = service.find(@name)
+ rescue
+ service_info = nil
+ end
if service_info.nil?
service.create(@name, @ss)
service_info = service.find(@name)
View
18 app/controllers/sessions_controller.rb
@@ -2,10 +2,10 @@ class SessionsController < ApplicationController
skip_before_filter :require_login, :only => [:new, :create]
def new
- if cookies[:vmc_target_url]
- @target_url = cookies[:vmc_target_url]
+ if cookies[:cf_target_url]
+ @target_url = cookies[:cf_target_url]
else
- @target_url = VMC::DEFAULT_TARGET
+ @target_url = CloudFoundry::Client::DEFAULT_TARGET
end
end
@@ -15,7 +15,7 @@ def create
@target_url = params[:target_url]
@remember_me = params[:remember_me]
begin
- cf = vmc_client(@target_url)
+ cf = cloudfoundry_client(@target_url)
auth_token = cf.login(@email, @password)
rescue
auth_token = nil
@@ -23,11 +23,11 @@ def create
if auth_token
if @remember_me
- cookies.permanent[:vmc_target_url] = @target_url
- cookies.permanent.signed[:vmc_auth_token] = auth_token
+ cookies.permanent[:cf_target_url] = @target_url
+ cookies.permanent.signed[:cf_auth_token] = auth_token
else
- cookies[:vmc_target_url] = @target_url
- cookies.signed[:vmc_auth_token] = auth_token
+ cookies[:cf_target_url] = @target_url
+ cookies.signed[:cf_auth_token] = auth_token
end
redirect_to root_url
else
@@ -37,7 +37,7 @@ def create
end
def destroy
- cookies.delete(:vmc_auth_token)
+ cookies.delete(:cf_auth_token)
redirect_to root_url
end
end
View
190 app/models/app.rb
@@ -4,12 +4,12 @@ class App
GIVEUP_TICKS = 120 / SLEEP_TIME
HEALTH_TICKS = 5 / SLEEP_TIME
- def initialize(cf_conn)
- @cf_conn = cf_conn
+ def initialize(cf_client)
+ @cf_client = cf_client
end
def find_all_apps()
- return @cf_conn.apps || []
+ return @cf_client.list_apps || []
end
def find_all_states()
@@ -32,7 +32,8 @@ def find_all_states()
end
def find(name)
- app_info = @cf_conn.app_info(name) || {}
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ app_info = @cf_client.app_info(name) || {}
if !app_info.empty?
app_info[:instances_info] = find_app_instances(name)
app_info[:crashes] = find_app_crashes(name)
@@ -46,10 +47,11 @@ def find(name)
end
def find_app_instances(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
app_instances = []
- instances_info = @cf_conn.app_instances(name) || {}
+ instances_info = @cf_client.app_instances(name) || {}
if !instances_info.empty? && !instances_info[:instances].empty?
- instances_stats = @cf_conn.app_stats(name) || []
+ instances_stats = @cf_client.app_stats(name) || []
else
instances_stats = []
end
@@ -69,7 +71,8 @@ def find_app_instances(name)
end
def find_app_crashes(name)
- return @cf_conn.app_crashes(name)[:crashes] || {}
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ return @cf_client.app_crashes(name)[:crashes] || {}
end
def find_app_instances_states(app_info)
@@ -97,13 +100,17 @@ def find_app_instances_states(app_info)
return app_instances_states
end
+ def create(name, manifest = {})
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ raise "Invalid application name: \"" + name + "\". Must contain only word characters (letter, number, underscore)" if (name =~ /^[\w-]+$/).nil?
+ @cf_client.create_app(name, manifest)
+ end
+
def start(name)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- app = @cf_conn.app_info(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ app = @cf_client.app_info(name)
app[:state] = "STARTED"
- @cf_conn.update_app(name, app)
+ @cf_client.update_app(name, app)
count = 0
start_time = Time.now.to_i
loop do
@@ -119,49 +126,35 @@ def start(name)
break
end
end
- return @cf_conn.app_info(name) || {}
+ return @cf_client.app_info(name) || {}
end
def stop(name)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- app = @cf_conn.app_info(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ app = @cf_client.app_info(name)
app[:state] = "STOPPED"
- @cf_conn.update_app(name, app)
+ @cf_client.update_app(name, app)
return app
end
def restart(name)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
+ raise "Application name cannot be blank" if name.nil? || name.empty?
app = stop(name)
app = start(name)
return app
end
def delete(name)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- @cf_conn.delete_app(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ @cf_client.delete_app(name)
end
def set_instances(name, instances)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- if instances.nil? || instances.empty?
- raise "Number of instances cannot be blank"
- end
- if (instances =~ /^\d+$/).nil?
- raise "Number of instances must be numeric"
- end
- if instances.to_i < 1
- raise "There must be at least 1 instance"
- end
- app = @cf_conn.app_info(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ raise "Number of instances cannot be blank" if instances.nil? || instances.empty?
+ raise "Number of instances must be numeric" if (instances =~ /^\d+$/).nil?
+ raise "There must be at least 1 instance" if instances.to_i < 1
+ app = @cf_client.app_info(name)
current_instances = app[:instances]
wanted_mem = instances.to_i * app[:resources][:memory]
if app[:state] != 'STOPPED'
@@ -172,21 +165,16 @@ def set_instances(name, instances)
end
if (instances.to_i != current_instances.to_i)
app[:instances] = instances
- @cf_conn.update_app(name, app)
+ @cf_client.update_app(name, app)
end
+ return true
end
def set_memsize(name, memsize)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- if memsize.nil? || memsize.empty?
- raise "Memory size cannot be blank"
- end
- if (memsize =~ /^\d+$/).nil?
- raise "Memory size must be numeric"
- end
- app = @cf_conn.app_info(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ raise "Memory size cannot be blank" if memsize.nil? || memsize.empty?
+ raise "Memory size must be numeric" if (memsize =~ /^\d+$/).nil?
+ app = @cf_client.app_info(name)
current_memory = app[:resources][:memory]
wanted_mem = memsize.to_i * app[:instances]
if app[:state] != 'STOPPED'
@@ -197,22 +185,17 @@ def set_memsize(name, memsize)
end
if (memsize.to_i != current_memory.to_i)
app[:resources][:memory] = memsize
- @cf_conn.update_app(name, app)
+ @cf_client.update_app(name, app)
check_app_for_restart(name)
end
+ return true
end
def set_var(name, var_name, var_value, restart = "true")
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- if var_name.nil? || var_name.empty?
- raise "Variable name cannot be blank"
- end
- if (var_name =~ /^[\w-]+$/).nil?
- raise "Invalid variable name: \"" + var_name + "\". Must contain only word characters (letter, number, underscore)"
- end
- app = @cf_conn.app_info(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ raise "Variable name cannot be blank" if var_name.nil? || var_name.empty?
+ raise "Invalid variable name: \"" + var_name + "\". Must contain only word characters (letter, number, underscore)" if (var_name =~ /^[\w-]+$/).nil?
+ app = @cf_client.app_info(name)
envvars = app[:env] || []
var_exists = nil
envvars.each do |env|
@@ -227,7 +210,7 @@ def set_var(name, var_name, var_value, restart = "true")
end
envvars << "#{var_name}=#{var_value}"
app[:env] = envvars
- @cf_conn.update_app(name, app)
+ @cf_client.update_app(name, app)
if restart == "true"
check_app_for_restart(name)
end
@@ -235,13 +218,9 @@ def set_var(name, var_name, var_value, restart = "true")
end
def unset_var(name, var_name)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- if var_name.nil? || var_name.empty?
- raise "Variable name cannot be blank"
- end
- app = @cf_conn.app_info(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ raise "Variable name cannot be blank" if var_name.nil? || var_name.empty?
+ app = @cf_client.app_info(name)
envvars = app[:env] || []
var_deleted = nil
envvars.each do |env|
@@ -254,64 +233,56 @@ def unset_var(name, var_name)
if var_deleted
envvars.delete(var_deleted)
app[:env] = envvars
- @cf_conn.update_app(name, app)
+ @cf_client.update_app(name, app)
check_app_for_restart(name)
else
raise "Environment variable \"" + var_name + "\" is not set"
end
+ return var_deleted
end
def bind_service(name, service)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- if service.nil? || service.empty?
- raise "Service cannot be blank"
- end
- app = @cf_conn.app_info(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ raise "Service cannot be blank" if service.nil? || service.empty?
+ app = @cf_client.app_info(name)
services = app[:services] || []
service_exists = services.index(service)
if !service_exists
app[:services] = services << service
- @cf_conn.update_app(name, app)
+ @cf_client.update_app(name, app)
check_app_for_restart(name)
else
raise "Service \"" + service + "\" already binded"
end
+ return true
end
def unbind_service(name, service)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- if service.nil? || service.empty?
- raise "Service cannot be blank"
- end
- app = @cf_conn.app_info(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ raise "Service cannot be blank" if service.nil? || service.empty?
+ app = @cf_client.app_info(name)
services = app[:services] || []
service_deleted = services.delete(service)
if service_deleted
app[:services] = services
- @cf_conn.update_app(name, app)
+ @cf_client.update_app(name, app)
check_app_for_restart(name)
else
raise "Service \"" + service + "\" is not binded"
end
+ return true
end
def map_url(name, url)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- if url.nil? || url.empty?
- raise "URL cannot be blank"
- end
- app = @cf_conn.app_info(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ raise "URL cannot be blank" if url.nil? || url.empty?
+ url = url.strip.gsub(/^http(s*):\/\//i, '').downcase
+ app = @cf_client.app_info(name)
uris = app[:uris] || []
url_exists = uris.index(url)
if !url_exists
app[:uris] = uris << url
- @cf_conn.update_app(name, app)
+ @cf_client.update_app(name, app)
else
raise "URL \"" + url + "\" already mapped"
end
@@ -319,45 +290,38 @@ def map_url(name, url)
end
def unmap_url(name, url)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- if url.nil? || url.empty?
- raise "URL cannot be blank"
- end
- app = @cf_conn.app_info(name)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ raise "URL cannot be blank" if url.nil? || url.empty?
+ url = url.strip.gsub(/^http(s*):\/\//i, '').downcase
+ app = @cf_client.app_info(name)
uris = app[:uris] || []
url_deleted = uris.delete(url)
if url_deleted
app[:uris] = uris
- @cf_conn.update_app(name, app)
+ @cf_client.update_app(name, app)
else
raise "URL \"" + url + "\" is not mapped"
end
return url
end
- def view_file(name, path, instance)
- if name.nil? || name.empty?
- raise "Application name cannot be blank"
- end
- if instance.nil?
- raise "Instance cannot be blank"
- end
- contents = @cf_conn.app_files(name, path, instance) || []
+ def view_file(name, path, instance = 0)
+ raise "Application name cannot be blank" if name.nil? || name.empty?
+ raise "Path cannot be blank" if path.nil? || path.empty?
+ contents = @cf_client.app_files(name, path, instance) || []
return contents
end
private
def app_crashes(name, since = 0)
- crashes = @cf_conn.app_crashes(name)[:crashes] || {}
+ crashes = @cf_client.app_crashes(name)[:crashes] || {}
crashes.delete_if {|crash| crash[:since] < since}
return crashes
end
def app_started_properly(name, error_on_health)
- app = @cf_conn.app_info(name)
+ app = @cf_client.app_info(name)
case health(app)
when 'N/A'
raise "Application state is undetermined, not enough information available" if error_on_health
@@ -370,12 +334,12 @@ def app_started_properly(name, error_on_health)
end
def check_app_for_restart(name)
- app = @cf_conn.app_info(name) || {}
+ app = @cf_client.app_info(name) || {}
restart(name) if app[:state] == 'STARTED'
end
def check_has_capacity_for(wanted_mem)
- system = System.new(@cf_conn)
+ system = System.new(@cf_client)
available_for_use = system.find_available_memory()
return (available_for_use - wanted_mem.to_i) >= 0
end
View
37 app/models/service.rb
@@ -1,41 +1,26 @@
class Service
- def initialize(cf_conn)
- @cf_conn = cf_conn
+ def initialize(cf_client)
+ @cf_client = cf_client
end
def find_all_services()
- return @cf_conn.services || []
+ return @cf_client.list_services || []
end
def find(name)
- service_info = nil
- services = find_all_services()
- services.each do |service_item|
- if service_item[:name] == name
- service_info = service_item
- break
- end
- end
- return service_info
+ raise "Name cannot be blank" if name.nil? || name.empty?
+ return @cf_client.service_info(name) || nil
end
def create(name, ss)
- if name.nil? || name.empty?
- raise "Name cannot be blank"
- end
- if (name =~ /^[\w-]+$/).nil?
- raise "Invalid service name: \"" + name + "\". Must contain only word characters (letter, number, underscore)."
- end
- if ss.nil? || ss.empty?
- raise "Service cannot be blank"
- end
- @cf_conn.create_service(ss, name)
+ raise "Name cannot be blank" if name.nil? || name.empty?
+ raise "Invalid service name: \"" + name + "\". Must contain only word characters (letter, number, underscore)." if (name =~ /^[\w-]+$/).nil?
+ raise "Service cannot be blank" if ss.nil? || ss.empty?
+ @cf_client.create_service(ss, name)
end
def delete(name)
- if name.nil? || name.empty?
- raise "Name cannot be blank"
- end
- @cf_conn.delete_service(name)
+ raise "Name cannot be blank" if name.nil? || name.empty?
+ @cf_client.delete_service(name)
end
end
View
15 app/models/system.rb
@@ -1,10 +1,10 @@
class System
- def initialize(cf_conn)
- @cf_conn = cf_conn
+ def initialize(cf_client)
+ @cf_client = cf_client
end
def find_account_info()
- return @cf_conn.info || {}
+ return @cf_client.cloud_info || {}
end
def find_all_frameworks()
@@ -13,6 +13,12 @@ def find_all_frameworks()
end
def find_all_runtimes()
+ # FIXME
+ # Return runtimes from info Hash instead of runtimes_info Hash as there's more much runtime information
+ # Info gets runtime information from staged plugins's
+ # Runtime_info gets runtime information from cloud_controller.yml
+ runtimes = @cf_client.cloud_runtimes_info || {}
+
runtimes = {}
frameworks = find_all_frameworks()
frameworks.each do |fwk_name, fwk_data|
@@ -23,10 +29,9 @@ def find_all_runtimes()
end
def find_all_system_services()
- return @cf_conn.services_info || {}
+ return @cf_client.cloud_services_info || {}
end
-
def find_available_memory()
info = find_account_info()
usage = info[:usage]
View
23 app/models/user.rb
@@ -1,13 +1,14 @@
class User
- def initialize(cf_conn)
- @cf_conn = cf_conn
+ def initialize(cf_client)
+ @cf_client = cf_client
end
def find_all_users()
- return @cf_conn.users || []
+ return @cf_client.list_users || []
end
def find(username)
+ raise "Email cannot be blank" if username.nil? || username.empty?
user_info = nil
users = find_all_users()
users.each do |user_item|
@@ -29,19 +30,13 @@ def is_admin?(username)
end
def create(username, password)
- if username.nil? || username.empty?
- raise "Email cannot be blank"
- end
- if password.nil? || password.empty?
- raise "Password cannot be blank"
- end
- @cf_conn.add_user(username, password)
+ raise "Email cannot be blank" if username.nil? || username.empty?
+ raise "Password cannot be blank" if password.nil? || password.empty?
+ @cf_client.create_user(username, password)
end
def delete(username)
- if username.nil? || username.empty?
- raise "Email cannot be blank"
- end
- @cf_conn.delete_user(username)
+ raise "Email cannot be blank" if username.nil? || username.empty?
+ @cf_client.delete_user(username)
end
end
View
6 config/initializers/json_patch.rb
@@ -0,0 +1,6 @@
+# Fix to deal with an ActiveSupport and json/pure incompatibility-
+class Fixnum
+ def to_json(options = nil)
+ to_s
+ end
+end
View
2  public/humans.txt
@@ -14,7 +14,7 @@
/* SITE */
Standards: HTML5, CSS3
Components: Modernizr, jQuery, Datatables, jQuery flot, jQuery jEditable, jQuery Selectbox
- Software: Rails, HAML, CodeRay, VMC
+ Software: Rails, HAML, CodeRay, CloudFoundy-Client
View
46 spec/controllers/apps_controller_spec.rb
@@ -15,105 +15,105 @@
describe "GET show" do
it "redirects to login page" do
- get :show, :name => "app-mock-started"
+ get :show, :name => "newapp"
response.should redirect_to("/login")
end
end
describe "PUT stop" do
it "redirects to login page" do
- put :stop, :name => "app-mock-started"
+ put :stop, :name => "newapp"
response.should redirect_to("/login")
end
end
describe "PUT start" do
it "redirects to login page" do
- put :start, :name => "app-mock-started"
+ put :start, :name => "newapp"
response.should redirect_to("/login")
end
end
describe "PUT restart" do
it "redirects to login page" do
- put :restart, :name => "app-mock-started"
- response.should redirect_to("/login")
- end
- end
-
- describe "DELETE delete" do
- it "redirects to login page" do
- delete :delete, :name => "app-mock-started"
+ put :restart, :name => "newapp"
response.should redirect_to("/login")
end
end
describe "PUT set_instances" do
it "redirects to login page" do
- put :set_instances, :name => "app-mock-started", :instances => "1"
+ put :set_instances, :name => "newapp", :instances => "1"
response.should redirect_to("/login")
end
end
describe "PUT set_memsize" do
it "redirects to login page" do
- put :set_memsize, :name => "app-mock-started", :memsize => "128"
+ put :set_memsize, :name => "newapp", :memsize => "128"
response.should redirect_to("/login")
end
end
describe "PUT set_var" do
it "redirects to login page" do
- put :set_var, :name => "app-mock-started", :var_name => "app-mock-started-envvar-var-mock", :var_value => "value-mock"
+ put :set_var, :name => "newapp", :var_name => "app-mock-started-envvar-var-mock", :var_value => "value-mock"
response.should redirect_to("/login")
end
end
describe "PUT unset_var" do
it "redirects to login page" do
- put :unset_var, :name => "app-mock-started", :var_name => "var-mock"
+ put :unset_var, :name => "newapp", :var_name => "var-mock"
response.should redirect_to("/login")
end
end
describe "PUT bind_service" do
it "redirects to login page" do
- put :bind_service, :name => "app-mock-started", :service => "redis-mock"
+ put :bind_service, :name => "newapp", :service => "redis-mock"
response.should redirect_to("/login")
end
end
describe "PUT unbind_service" do
it "redirects to login page" do
- put :unbind_service, :name => "app-mock-started", :service => "redis-mock"
+ put :unbind_service, :name => "newapp", :service => "redis-mock"
response.should redirect_to("/login")
end
end
describe "PUT map_url" do
it "redirects to login page" do
- put :map_url, :name => "app-mock-started", :url => "http://app-mock.vcap.me"
+ put :map_url, :name => "newapp", :url => "http://newapp.vcap.me"
response.should redirect_to("/login")
end
end
describe "PUT unmap_url" do
it "redirects to login page" do
- put :unmap_url, :name => "app-mock-started", :url => "http://app-mock.vcap.me"
+ put :unmap_url, :name => "newapp", :url => "http://newapp.vcap.me"
response.should redirect_to("/login")
end
end
describe "GET files" do
it "redirects to login page" do
- get :files, :name => "app-mock-started", :instance => 0, :filename => Base64.encode64("/")
+ get :files, :name => "newapp", :instance => 0, :filename => Base64.encode64("/")
response.should redirect_to("/login")
end
end
describe "GET view_file" do
it "redirects to login page" do
- get :view_file, :name => "app-mock-started", :instance => 0, :filename => Base64.encode64("logs/stdout.log")
+ get :view_file, :name => "newapp", :instance => 0, :filename => Base64.encode64("logs/stdout.log")
+ response.should redirect_to("/login")
+ end
+ end
+
+ describe "DELETE delete" do
+ it "redirects to login page" do
+ delete :delete, :name => "newapp"
response.should redirect_to("/login")
end
end
@@ -121,7 +121,7 @@
context "with a user logged in" do
before(:each) do
- vmc_set_user_cookies(VMC::DEFAULT_LOCAL_TARGET)
+ cloudfoundry_set_user_cookies(CloudFoundry::Client::DEFAULT_TARGET)
end
use_vcr_cassette "controllers/logged/apps", :record => :new_episodes
@@ -136,7 +136,7 @@
it "assigns applications info as @apps" do
get :index
assigns(:apps).should_not be_nil
- assigns(:apps).should_not be_empty
+ assigns(:apps).should be_empty
end
end
View
2  spec/controllers/dashboard_controller_spec.rb
@@ -16,7 +16,7 @@
context "with a user logged in" do
before(:each) do
- vmc_set_user_cookies(VMC::DEFAULT_LOCAL_TARGET)
+ cloudfoundry_set_user_cookies(CloudFoundry::Client::DEFAULT_TARGET)
end
use_vcr_cassette "controllers/logged/dashboard", :record => :new_episodes
View
3  spec/controllers/services_controller_spec.rb
@@ -30,7 +30,7 @@
context "with a user logged in" do
before(:each) do
- vmc_set_user_cookies(VMC::DEFAULT_LOCAL_TARGET)
+ cloudfoundry_set_user_cookies(CloudFoundry::Client::DEFAULT_TARGET)
end
use_vcr_cassette "controllers/logged/services", :record => :new_episodes
@@ -101,7 +101,6 @@
it "redirects to services page with a flash alert when service does not exists" do
delete :delete, :name => "redis-mock"
flash[:alert].should_not be_empty
- flash[:alert].should include("redis-mock")
response.should redirect_to("/services")
end
end
View
46 spec/controllers/sessions_controller_spec.rb
@@ -7,28 +7,28 @@
use_vcr_cassette "controllers/no_logged/sessions", :record => :new_episodes
describe "GET new" do
- it "assigns target_url as DEFAULT_TARGET if cookie vmc_target_url is not set" do
+ it "assigns target_url as DEFAULT_TARGET if cookie cf_target_url is not set" do
get :new
- assigns(:target_url).should eql(VMC::DEFAULT_TARGET)
+ assigns(:target_url).should eql(CloudFoundry::Client::DEFAULT_TARGET)
end
- it "assigns target_url as DEFAULT_LOCAL_TARGET if cookie vmc_target_url is set" do
- request.cookies[:vmc_target_url] = VMC::DEFAULT_LOCAL_TARGET
+ it "assigns target_url as DEFAULT_TARGET if cookie cf_target_url is set" do
+ request.cookies[:cf_target_url] = CloudFoundry::Client::DEFAULT_TARGET
get :new
- assigns(:target_url).should eql(VMC::DEFAULT_LOCAL_TARGET)
+ assigns(:target_url).should eql(CloudFoundry::Client::DEFAULT_TARGET)
end
end
describe "GET create" do
it "with an invalid user renders new template with a flash alert" do
- get :create, :email => "no-user@vcap.me", :password => "foobar", :target_url => VMC::DEFAULT_LOCAL_TARGET
+ get :create, :email => "no-user@vcap.me", :password => "foobar", :target_url => CloudFoundry::Client::DEFAULT_TARGET, :remember_me => true
flash[:alert].should_not be_empty
response.code.should eq("200")
response.should render_template("new")
end
it "with an invalid password renders new template with a flash alert" do
- get :create, :email => "user@vcap.me", :password => "no-password", :target_url => VMC::DEFAULT_LOCAL_TARGET
+ get :create, :email => "user@vcap.me", :password => "no-password", :target_url => CloudFoundry::Client::DEFAULT_TARGET, :remember_me => true
flash[:alert].should_not be_empty
response.code.should eq("200")
response.should render_template("new")
@@ -36,9 +36,9 @@
it "with valid credentials redirects to root url and sets proper cookies" do
VCR.use_cassette("controllers/no_logged/sessions_create_action", :record => :new_episodes, :exclusive => true) do
- get :create, :email => "user@vcap.me", :password => "foobar", :target_url => VMC::DEFAULT_LOCAL_TARGET
- response.cookies["vmc_target_url"].should_not be_nil
- response.cookies["vmc_auth_token"].should_not be_nil
+ get :create, :email => "user@vcap.me", :password => "foobar", :target_url => CloudFoundry::Client::DEFAULT_TARGET, :remember_me => true
+ response.cookies["cf_target_url"].should_not be_nil
+ response.cookies["cf_auth_token"].should_not be_nil
response.should redirect_to("/")
end
end
@@ -47,7 +47,7 @@
describe "GET destroy" do
it "redirects to login page and deletes cookies" do
get :destroy
- response.cookies["vmc_auth_token"].should be_nil
+ response.cookies["cf_auth_token"].should be_nil
response.should redirect_to("/login")
end
end
@@ -55,34 +55,34 @@
context "with a user logged in" do
before(:each) do
- vmc_set_user_cookies(VMC::DEFAULT_LOCAL_TARGET)
+ cloudfoundry_set_user_cookies(CloudFoundry::Client::DEFAULT_TARGET)
end
use_vcr_cassette "controllers/logged/sessions", :record => :new_episodes
describe "GET new" do
- it "assigns target_url as DEFAULT_LOCAL_TARGET if cookie vmc_target_url is not set" do
+ it "assigns target_url as DEFAULT_TARGET if cookie cf_target_url is not set" do
get :new
- assigns(:target_url).should eql(VMC::DEFAULT_LOCAL_TARGET)
+ assigns(:target_url).should eql(CloudFoundry::Client::DEFAULT_TARGET)
end
- it "assigns target_url as DEFAULT_LOCAL_TARGET if cookie vmc_target_url is set" do
- request.cookies[:vmc_target_url] = VMC::DEFAULT_LOCAL_TARGET
+ it "assigns target_url as DEFAULT_TARGET if cookie cf_target_url is set" do
+ request.cookies[:cf_target_url] = CloudFoundry::Client::DEFAULT_TARGET
get :new
- assigns(:target_url).should eql(VMC::DEFAULT_LOCAL_TARGET)
+ assigns(:target_url).should eql(CloudFoundry::Client::DEFAULT_TARGET)
end
end
describe "GET create" do
it "with an invalid user renders new template with a flash alert" do
- get :create, :email => "no-user@vcap.me", :password => "foobar", :target_url => VMC::DEFAULT_LOCAL_TARGET
+ get :create, :email => "no-user@vcap.me", :password => "foobar", :target_url => CloudFoundry::Client::DEFAULT_TARGET
flash[:alert].should_not be_empty
response.code.should eq("200")
response.should render_template("new")
end
it "with an invalid password renders new template with a flash alert" do
- get :create, :email => "user@vcap.me", :password => "no-password", :target_url => VMC::DEFAULT_LOCAL_TARGET
+ get :create, :email => "user@vcap.me", :password => "no-password", :target_url => CloudFoundry::Client::DEFAULT_TARGET
flash[:alert].should_not be_empty
response.code.should eq("200")
response.should render_template("new")
@@ -90,9 +90,9 @@
it "with valid credentials redirects to root url and sets proper cookies" do
VCR.use_cassette("controllers/logged/sessions_create_action", :record => :new_episodes, :exclusive => true) do
- get :create, :email => "user@vcap.me", :password => "foobar", :target_url => VMC::DEFAULT_LOCAL_TARGET
- response.cookies["vmc_target_url"].should_not be_nil
- response.cookies["vmc_auth_token"].should_not be_nil
+ get :create, :email => "user@vcap.me", :password => "foobar", :target_url => CloudFoundry::Client::DEFAULT_TARGET
+ response.cookies["cf_target_url"].should_not be_nil
+ response.cookies["cf_auth_token"].should_not be_nil
response.should redirect_to("/")
end
end
@@ -101,7 +101,7 @@
describe "GET destroy" do
it "redirects to root url and deletes cookies" do
get :destroy
- response.cookies["vmc_auth_token"].should be_nil
+ response.cookies["cf_auth_token"].should be_nil
response.should redirect_to("/")
end
end
View
2  spec/controllers/system_controller_spec.rb
@@ -16,7 +16,7 @@
context "with a user logged in" do
before(:each) do
- vmc_set_user_cookies(VMC::DEFAULT_LOCAL_TARGET)
+ cloudfoundry_set_user_cookies(CloudFoundry::Client::DEFAULT_TARGET)
end
use_vcr_cassette "controllers/logged/system", :record => :new_episodes
View
12 spec/controllers/users_controller_spec.rb
@@ -30,7 +30,7 @@
context "with a user logged in" do
before(:each) do
- vmc_set_user_cookies(VMC::DEFAULT_LOCAL_TARGET)
+ cloudfoundry_set_user_cookies(CloudFoundry::Client::DEFAULT_TARGET)
end
use_vcr_cassette "controllers/logged/users", :record => :new_episodes
@@ -73,7 +73,7 @@
context "with an admin user logged in" do
before(:each) do
- vmc_set_admin_cookies(VMC::DEFAULT_LOCAL_TARGET)
+ cloudfoundry_set_admin_cookies(CloudFoundry::Client::DEFAULT_TARGET)
end
use_vcr_cassette "controllers/admin/users", :record => :new_episodes
@@ -134,9 +134,11 @@
end
it "redirects to users page with a flash alert when user already exists" do
- post :create, :email => "fakeuser@vcap.me", :password => "foobar", :vpassword => "foobar"
- flash[:alert].should_not be_empty
- response.should redirect_to("/users")
+ VCR.use_cassette("controllers/admin/users_create_again_action", :record => :new_episodes, :exclusive => true) do
+ post :create, :email => "fakeuser@vcap.me", :password => "foobar", :vpassword => "foobar"
+ flash[:alert].should_not be_empty
+ response.should redirect_to("/users")
+ end
end
end
View
279 spec/fixtures/controllers/admin/users.yml
@@ -0,0 +1,279 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: http://api.vcap.me:80/info
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:34 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Etag:
+ - ! '"cd198bb1b4a5fcc7eb642fade6dd1eb4"'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '{"name":"vcap","build":2222,"support":"http://support.cloudfoundry.com","version":"0.999","description":"VMware''s
+ Cloud Application Platform","allow_debug":true,"user":"admin@vcap.me","limits":{"memory":32768,"app_uris":16,"services":32,"apps":200},"usage":{"memory":0,"apps":0,"services":0},"frameworks":{"grails":{"name":"grails","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"lift":{"name":"lift","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"php":{"name":"php","runtimes":[{"name":"php","version":"5.3","description":"PHP
+ 5"}],"appservers":[{"name":"apache","description":"Apache"}],"detection":[{"*.php":true}]},"spring":{"name":"spring","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"java_web":{"name":"java_web","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"django":{"name":"django","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]},"rails3":{"name":"rails3","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"config/application.rb":true},{"config/environment.rb":true}]},"node":{"name":"node","runtimes":[{"name":"node","version":"0.4.5","description":"Node.js"}],"appservers":[],"detection":[{"*.js":"."}]},"otp_rebar":{"name":"otp_rebar","runtimes":[{"name":"erlangR14B02","version":"R14B02","description":"Erlang
+ R14B02"}],"appservers":[],"detection":[{"releases/*/*.rel":"."}]},"sinatra":{"name":"sinatra","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"*.rb":"require
+ ''sinatra''|require \"sinatra\""},{"config/environment.rb":false}]},"wsgi":{"name":"wsgi","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]}}}'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:37 GMT
+- request:
+ method: get
+ uri: http://api.vcap.me:80/info
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:35 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Etag:
+ - ! '"cd198bb1b4a5fcc7eb642fade6dd1eb4"'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '{"name":"vcap","build":2222,"support":"http://support.cloudfoundry.com","version":"0.999","description":"VMware''s
+ Cloud Application Platform","allow_debug":true,"user":"admin@vcap.me","limits":{"memory":32768,"app_uris":16,"services":32,"apps":200},"usage":{"memory":0,"apps":0,"services":0},"frameworks":{"grails":{"name":"grails","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"lift":{"name":"lift","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"php":{"name":"php","runtimes":[{"name":"php","version":"5.3","description":"PHP
+ 5"}],"appservers":[{"name":"apache","description":"Apache"}],"detection":[{"*.php":true}]},"spring":{"name":"spring","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"java_web":{"name":"java_web","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"django":{"name":"django","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]},"rails3":{"name":"rails3","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"config/application.rb":true},{"config/environment.rb":true}]},"node":{"name":"node","runtimes":[{"name":"node","version":"0.4.5","description":"Node.js"}],"appservers":[],"detection":[{"*.js":"."}]},"otp_rebar":{"name":"otp_rebar","runtimes":[{"name":"erlangR14B02","version":"R14B02","description":"Erlang
+ R14B02"}],"appservers":[],"detection":[{"releases/*/*.rel":"."}]},"sinatra":{"name":"sinatra","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"*.rb":"require
+ ''sinatra''|require \"sinatra\""},{"config/environment.rb":false}]},"wsgi":{"name":"wsgi","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]}}}'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:37 GMT
+- request:
+ method: get
+ uri: http://api.vcap.me:80/info
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:35 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Etag:
+ - ! '"cd198bb1b4a5fcc7eb642fade6dd1eb4"'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '{"name":"vcap","build":2222,"support":"http://support.cloudfoundry.com","version":"0.999","description":"VMware''s
+ Cloud Application Platform","allow_debug":true,"user":"admin@vcap.me","limits":{"memory":32768,"app_uris":16,"services":32,"apps":200},"usage":{"memory":0,"apps":0,"services":0},"frameworks":{"grails":{"name":"grails","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"lift":{"name":"lift","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"php":{"name":"php","runtimes":[{"name":"php","version":"5.3","description":"PHP
+ 5"}],"appservers":[{"name":"apache","description":"Apache"}],"detection":[{"*.php":true}]},"spring":{"name":"spring","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"java_web":{"name":"java_web","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"django":{"name":"django","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]},"rails3":{"name":"rails3","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"config/application.rb":true},{"config/environment.rb":true}]},"node":{"name":"node","runtimes":[{"name":"node","version":"0.4.5","description":"Node.js"}],"appservers":[],"detection":[{"*.js":"."}]},"otp_rebar":{"name":"otp_rebar","runtimes":[{"name":"erlangR14B02","version":"R14B02","description":"Erlang
+ R14B02"}],"appservers":[],"detection":[{"releases/*/*.rel":"."}]},"sinatra":{"name":"sinatra","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"*.rb":"require
+ ''sinatra''|require \"sinatra\""},{"config/environment.rb":false}]},"wsgi":{"name":"wsgi","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]}}}'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:37 GMT
+- request:
+ method: get
+ uri: http://api.vcap.me:80/users
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:35 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Etag:
+ - ! '"83aaba0ee95e8379c17e88d2287f4f08"'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '[{"email":"admin@vcap.me","admin":true,"apps":[]},{"email":"user@vcap.me","admin":false,"apps":[]}]'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:37 GMT
+- request:
+ method: get
+ uri: http://api.vcap.me:80/users
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:35 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Etag:
+ - ! '"83aaba0ee95e8379c17e88d2287f4f08"'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '[{"email":"admin@vcap.me","admin":true,"apps":[]},{"email":"user@vcap.me","admin":false,"apps":[]}]'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:37 GMT
+- request:
+ method: delete
+ uri: http://api.vcap.me:80/users/fakeuser@vcap.me
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - ! '*/*'
+ response:
+ status:
+ code: 403
+ message: Forbidden
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:37 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Cache-Control:
+ - no-cache
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '{"code":201,"description":"User not found"}'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:39 GMT
+recorded_with: VCR 2.0.0.beta2
View
318 spec/fixtures/controllers/admin/users_create_action.yml
@@ -0,0 +1,318 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: http://api.vcap.me:80/info
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:35 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Etag:
+ - ! '"cd198bb1b4a5fcc7eb642fade6dd1eb4"'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '{"name":"vcap","build":2222,"support":"http://support.cloudfoundry.com","version":"0.999","description":"VMware''s
+ Cloud Application Platform","allow_debug":true,"user":"admin@vcap.me","limits":{"memory":32768,"app_uris":16,"services":32,"apps":200},"usage":{"memory":0,"apps":0,"services":0},"frameworks":{"grails":{"name":"grails","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"lift":{"name":"lift","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"php":{"name":"php","runtimes":[{"name":"php","version":"5.3","description":"PHP
+ 5"}],"appservers":[{"name":"apache","description":"Apache"}],"detection":[{"*.php":true}]},"spring":{"name":"spring","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"java_web":{"name":"java_web","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"django":{"name":"django","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]},"rails3":{"name":"rails3","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"config/application.rb":true},{"config/environment.rb":true}]},"node":{"name":"node","runtimes":[{"name":"node","version":"0.4.5","description":"Node.js"}],"appservers":[],"detection":[{"*.js":"."}]},"otp_rebar":{"name":"otp_rebar","runtimes":[{"name":"erlangR14B02","version":"R14B02","description":"Erlang
+ R14B02"}],"appservers":[],"detection":[{"releases/*/*.rel":"."}]},"sinatra":{"name":"sinatra","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"*.rb":"require
+ ''sinatra''|require \"sinatra\""},{"config/environment.rb":false}]},"wsgi":{"name":"wsgi","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]}}}'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:37 GMT
+- request:
+ method: get
+ uri: http://api.vcap.me:80/info
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:35 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Etag:
+ - ! '"cd198bb1b4a5fcc7eb642fade6dd1eb4"'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '{"name":"vcap","build":2222,"support":"http://support.cloudfoundry.com","version":"0.999","description":"VMware''s
+ Cloud Application Platform","allow_debug":true,"user":"admin@vcap.me","limits":{"memory":32768,"app_uris":16,"services":32,"apps":200},"usage":{"memory":0,"apps":0,"services":0},"frameworks":{"grails":{"name":"grails","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"lift":{"name":"lift","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"php":{"name":"php","runtimes":[{"name":"php","version":"5.3","description":"PHP
+ 5"}],"appservers":[{"name":"apache","description":"Apache"}],"detection":[{"*.php":true}]},"spring":{"name":"spring","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"java_web":{"name":"java_web","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"django":{"name":"django","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]},"rails3":{"name":"rails3","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"config/application.rb":true},{"config/environment.rb":true}]},"node":{"name":"node","runtimes":[{"name":"node","version":"0.4.5","description":"Node.js"}],"appservers":[],"detection":[{"*.js":"."}]},"otp_rebar":{"name":"otp_rebar","runtimes":[{"name":"erlangR14B02","version":"R14B02","description":"Erlang
+ R14B02"}],"appservers":[],"detection":[{"releases/*/*.rel":"."}]},"sinatra":{"name":"sinatra","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"*.rb":"require
+ ''sinatra''|require \"sinatra\""},{"config/environment.rb":false}]},"wsgi":{"name":"wsgi","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]}}}'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:37 GMT
+- request:
+ method: get
+ uri: http://api.vcap.me:80/info
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:35 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Etag:
+ - ! '"cd198bb1b4a5fcc7eb642fade6dd1eb4"'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '{"name":"vcap","build":2222,"support":"http://support.cloudfoundry.com","version":"0.999","description":"VMware''s
+ Cloud Application Platform","allow_debug":true,"user":"admin@vcap.me","limits":{"memory":32768,"app_uris":16,"services":32,"apps":200},"usage":{"memory":0,"apps":0,"services":0},"frameworks":{"grails":{"name":"grails","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"lift":{"name":"lift","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"php":{"name":"php","runtimes":[{"name":"php","version":"5.3","description":"PHP
+ 5"}],"appservers":[{"name":"apache","description":"Apache"}],"detection":[{"*.php":true}]},"spring":{"name":"spring","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"java_web":{"name":"java_web","runtimes":[{"name":"java","version":"1.6","description":"Java
+ 6"}],"appservers":[{"name":"tomcat","description":"Tomcat"}],"detection":[{"*.war":true}]},"django":{"name":"django","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]},"rails3":{"name":"rails3","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"config/application.rb":true},{"config/environment.rb":true}]},"node":{"name":"node","runtimes":[{"name":"node","version":"0.4.5","description":"Node.js"}],"appservers":[],"detection":[{"*.js":"."}]},"otp_rebar":{"name":"otp_rebar","runtimes":[{"name":"erlangR14B02","version":"R14B02","description":"Erlang
+ R14B02"}],"appservers":[],"detection":[{"releases/*/*.rel":"."}]},"sinatra":{"name":"sinatra","runtimes":[{"name":"ruby18","version":"1.8.7","description":"Ruby
+ 1.8.7"},{"name":"ruby19","version":"1.9.2p180","description":"Ruby 1.9.2"}],"appservers":[{"name":"thin","description":"Thin"}],"detection":[{"*.rb":"require
+ ''sinatra''|require \"sinatra\""},{"config/environment.rb":false}]},"wsgi":{"name":"wsgi","runtimes":[{"name":"python26","version":"2.6.5","description":"Python
+ 2.6.5"}],"appservers":[],"detection":[{"*.py":"."}]}}}'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:38 GMT
+- request:
+ method: get
+ uri: http://api.vcap.me:80/users
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:35 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Etag:
+ - ! '"83aaba0ee95e8379c17e88d2287f4f08"'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '[{"email":"admin@vcap.me","admin":true,"apps":[]},{"email":"user@vcap.me","admin":false,"apps":[]}]'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:38 GMT
+- request:
+ method: get
+ uri: http://api.vcap.me:80/users
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:36 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Etag:
+ - ! '"83aaba0ee95e8379c17e88d2287f4f08"'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '[{"email":"admin@vcap.me","admin":true,"apps":[]},{"email":"user@vcap.me","admin":false,"apps":[]}]'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:38 GMT
+- request:
+ method: post
+ uri: http://api.vcap.me:80/users
+ body: ! '{"email":"fakeuser@vcap.me","password":"foobar"}'
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ response:
+ status:
+ code: 204
+ message: No Content
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:36 GMT
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Cache-Control:
+ - no-cache
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ''
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:38 GMT
+- request:
+ method: get
+ uri: http://api.vcap.me:80/users
+ body: ''
+ headers:
+ User-Agent:
+ - cloudfoundry-client-0.1.1
+ Authorization:
+ - 04085b0849221261646d696e40766361702e6d65063a0645546c2b07b108e54e221912a91b37781faa5c88a9ffea3b0b6abd0c28983b
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Wed, 07 Dec 2011 22:39:36 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Transfer-Encoding:
+ - chunked
+ Connection:
+ - keep-alive
+ Keep-Alive:
+ - timeout=20
+ Etag:
+ - ! '"17415edd5147984b53b400311cbc8c7c"'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ X-Ua-Compatible:
+ - IE=Edge
+ body: ! '[{"email":"admin@vcap.me","admin":true,"apps":[]},{"email":"user@vcap.me","admin":false,"apps":[]},{"email":"fakeuser@vcap.me","admin":false,"apps":[]}]'
+ http_version: !!null
+ recorded_at: Wed, 07 Dec 2011 22:39:38 GMT
+recorded_with: VCR 2.0.0.beta2
View
244 spec/fixtures/controllers/admin/users_create_again_action.yml