Skip to content

Commit

Permalink
Updated skeleton
Browse files Browse the repository at this point in the history
* Added mixins and links
* Added model skeleton
* Updated routes
  • Loading branch information
Boris Parak committed Aug 15, 2013
1 parent ff187ee commit be449e5
Show file tree
Hide file tree
Showing 59 changed files with 339 additions and 22 deletions.
15 changes: 15 additions & 0 deletions app/controllers/compute_controller.rb
@@ -1,4 +1,19 @@
class ComputeController < ApplicationController
def index
end

def show
end

def create
end

def action
end

def update
end

def delete
end
end
16 changes: 16 additions & 0 deletions app/controllers/mixin_controller.rb
@@ -0,0 +1,16 @@
class MixinController < ApplicationController
def index
end

def action
end

def assign
end

def update
end

def delete
end
end
10 changes: 10 additions & 0 deletions app/controllers/model_controller.rb
@@ -0,0 +1,10 @@
class ModelController < ApplicationController
def index
end

def create
end

def delete
end
end
15 changes: 15 additions & 0 deletions app/controllers/network_controller.rb
@@ -1,4 +1,19 @@
class NetworkController < ApplicationController
def index
end

def show
end

def create
end

def action
end

def update
end

def delete
end
end
10 changes: 10 additions & 0 deletions app/controllers/networkinterface_controller.rb
@@ -0,0 +1,10 @@
class NetworkinterfaceController < ApplicationController
def show
end

def create
end

def delete
end
end
10 changes: 10 additions & 0 deletions app/controllers/os_tpl_controller.rb
@@ -0,0 +1,10 @@
class OsTplController < ApplicationController
def show
end

def index
end

def action
end
end
10 changes: 10 additions & 0 deletions app/controllers/resource_tpl_controller.rb
@@ -0,0 +1,10 @@
class ResourceTplController < ApplicationController
def show
end

def index
end

def action
end
end
10 changes: 10 additions & 0 deletions app/controllers/storagelink_controller.rb
@@ -0,0 +1,10 @@
class StoragelinkController < ApplicationController
def show
end

def create
end

def delete
end
end
8 changes: 8 additions & 0 deletions app/models/networkinterface.rb
@@ -0,0 +1,8 @@
class Networkinterface

include DataMapper::Resource

property :id, Serial


end
8 changes: 8 additions & 0 deletions app/models/os_tpl.rb
@@ -0,0 +1,8 @@
class OsTpl

include DataMapper::Resource

property :id, Serial


end
8 changes: 8 additions & 0 deletions app/models/resource_tpl.rb
@@ -0,0 +1,8 @@
class ResourceTpl

include DataMapper::Resource

property :id, Serial


end
8 changes: 8 additions & 0 deletions app/models/storagelink.rb
@@ -0,0 +1,8 @@
class Storagelink

include DataMapper::Resource

property :id, Serial


end
2 changes: 2 additions & 0 deletions app/views/compute/action.html.erb
@@ -0,0 +1,2 @@
<h1>Compute#action</h1>
<p>Find me in app/views/compute/action.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/compute/create.html.erb
@@ -0,0 +1,2 @@
<h1>Compute#create</h1>
<p>Find me in app/views/compute/create.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/compute/delete.html.erb
@@ -0,0 +1,2 @@
<h1>Compute#delete</h1>
<p>Find me in app/views/compute/delete.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/compute/show.html.erb
@@ -0,0 +1,2 @@
<h1>Compute#show</h1>
<p>Find me in app/views/compute/show.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/compute/update.html.erb
@@ -0,0 +1,2 @@
<h1>Compute#update</h1>
<p>Find me in app/views/compute/update.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/mixin/action.html.erb
@@ -0,0 +1,2 @@
<h1>Mixin#action</h1>
<p>Find me in app/views/mixin/action.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/mixin/assign.html.erb
@@ -0,0 +1,2 @@
<h1>Mixin#assign</h1>
<p>Find me in app/views/mixin/assign.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/mixin/delete.html.erb
@@ -0,0 +1,2 @@
<h1>Mixin#delete</h1>
<p>Find me in app/views/mixin/delete.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/mixin/index.html.erb
@@ -0,0 +1,2 @@
<h1>Mixin#index</h1>
<p>Find me in app/views/mixin/index.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/mixin/update.html.erb
@@ -0,0 +1,2 @@
<h1>Mixin#update</h1>
<p>Find me in app/views/mixin/update.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/model/create.html.erb
@@ -0,0 +1,2 @@
<h1>Model#create</h1>
<p>Find me in app/views/model/create.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/model/delete.html.erb
@@ -0,0 +1,2 @@
<h1>Model#delete</h1>
<p>Find me in app/views/model/delete.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/model/index.html.erb
@@ -0,0 +1,2 @@
<h1>Model#index</h1>
<p>Find me in app/views/model/index.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/network/action.html.erb
@@ -0,0 +1,2 @@
<h1>Network#action</h1>
<p>Find me in app/views/network/action.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/network/create.html.erb
@@ -0,0 +1,2 @@
<h1>Network#create</h1>
<p>Find me in app/views/network/create.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/network/delete.html.erb
@@ -0,0 +1,2 @@
<h1>Network#delete</h1>
<p>Find me in app/views/network/delete.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/network/show.html.erb
@@ -0,0 +1,2 @@
<h1>Network#show</h1>
<p>Find me in app/views/network/show.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/network/update.html.erb
@@ -0,0 +1,2 @@
<h1>Network#update</h1>
<p>Find me in app/views/network/update.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/networkinterface/create.html.erb
@@ -0,0 +1,2 @@
<h1>Networkinterface#create</h1>
<p>Find me in app/views/networkinterface/create.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/networkinterface/delete.html.erb
@@ -0,0 +1,2 @@
<h1>Networkinterface#delete</h1>
<p>Find me in app/views/networkinterface/delete.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/networkinterface/show.html.erb
@@ -0,0 +1,2 @@
<h1>Networkinterface#show</h1>
<p>Find me in app/views/networkinterface/show.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/os_tpl/action.html.erb
@@ -0,0 +1,2 @@
<h1>OsTpl#action</h1>
<p>Find me in app/views/os_tpl/action.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/os_tpl/index.html.erb
@@ -0,0 +1,2 @@
<h1>OsTpl#index</h1>
<p>Find me in app/views/os_tpl/index.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/os_tpl/show.html.erb
@@ -0,0 +1,2 @@
<h1>OsTpl#show</h1>
<p>Find me in app/views/os_tpl/show.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/resource_tpl/action.html.erb
@@ -0,0 +1,2 @@
<h1>ResourceTpl#action</h1>
<p>Find me in app/views/resource_tpl/action.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/resource_tpl/index.html.erb
@@ -0,0 +1,2 @@
<h1>ResourceTpl#index</h1>
<p>Find me in app/views/resource_tpl/index.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/resource_tpl/show.html.erb
@@ -0,0 +1,2 @@
<h1>ResourceTpl#show</h1>
<p>Find me in app/views/resource_tpl/show.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/storagelink/create.html.erb
@@ -0,0 +1,2 @@
<h1>Storagelink#create</h1>
<p>Find me in app/views/storagelink/create.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/storagelink/delete.html.erb
@@ -0,0 +1,2 @@
<h1>Storagelink#delete</h1>
<p>Find me in app/views/storagelink/delete.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/storagelink/show.html.erb
@@ -0,0 +1,2 @@
<h1>Storagelink#show</h1>
<p>Find me in app/views/storagelink/show.html.erb</p>
1 change: 1 addition & 0 deletions config/application.rb
Expand Up @@ -30,6 +30,7 @@ class Application < Rails::Application
generate.helper false
generate.assets false
generate.view_specs false
generate.resource_route false
end
end
end
47 changes: 40 additions & 7 deletions config/routes.rb
@@ -1,5 +1,4 @@
ROCCIServer::Application.routes.draw do

####################################################
## Discovery interface
####################################################
Expand Down Expand Up @@ -67,16 +66,50 @@
delete '/storage/', to: 'storage#delete', as: 'delete_storages'

####################################################
## User-defined mixins (i.e., instance tags)
## Occi::Infrastructure::NetworkInterface
####################################################
get '/link/networkinterface/:id', to: 'networkinterface#show', as: 'networkinterface'

post '/link/networkinterface/', to: 'networkinterface#create', as: 'new_networkinterface'

delete '/link/networkinterface/:id', to: 'networkinterface#delete', as: 'delete_networkinterface'

####################################################
## Occi::Infrastructure::StorageLink
####################################################
get '/link/storagelink/:id', to: 'storagelink#show', as: 'storagelink'

post '/link/storagelink/', to: 'storagelink#create', as: 'new_storagelink'

delete '/link/storagelink/:id', to: 'storagelink#delete', as: 'delete_storagelink'

####################################################
## Occi::Infrastructure::OsTpl
####################################################
get '/mixin/os_tpl/:term/', to: 'os_tpl#show', as: 'os_tpl'
get '/mixin/os_tpl/', to: 'os_tpl#index', as: 'os_tpls'

post '/mixin/os_tpl/:term/', to: 'os_tpl#action', constraints: { query_string: /^\?action=/ }

####################################################
## Occi::Infrastructure::ResourceTpl
####################################################
get '/mixin/resource_tpl/:term/', to: 'resource_tpl#show', as: 'resource_tpl'
get '/mixin/resource_tpl/', to: 'resource_tpl#index', as: 'resource_tpls'

post '/mixin/resource_tpl/:term/', to: 'resource_tpl#action', constraints: { query_string: /^\?action=/ }

####################################################
## Occi::Core::Mixin (user-defined mixins)
####################################################
get '/mixin/:term/', to: 'mixin#index', as: 'assigned_to_mixin'
get '/mixin/*term/', to: 'mixin#index', as: 'mixin'

post '/mixin/:term/', to: 'mixin#action', constraints: { query_string: /^\?action=/ }
post '/mixin/:term/', to: 'mixin#assign', as: 'assign_to_mixin'
post '/mixin/*term/', to: 'mixin#action', constraints: { query_string: /^\?action=/ }
post '/mixin/*term/', to: 'mixin#assign', as: 'assign_mixin'

put '/mixin/:term/', to: 'mixin#update', as: 'update_in_mixin'
put '/mixin/*term/', to: 'mixin#update', as: 'update_mixin'

delete '/mixin/:term/', to: 'mixin#delete', as: 'delete_from_mixin'
delete '/mixin/*term/', to: 'mixin#delete', as: 'unassign_mixin'

####################################################
## Default route
Expand Down
10 changes: 6 additions & 4 deletions spec/controllers/compute_controller_spec.rb
Expand Up @@ -2,11 +2,13 @@

describe ComputeController do

pending "add some examples to (or delete) #{__FILE__}"

describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
end
it "returns http success" do
get 'index'
response.should be_success
end
end

end
14 changes: 14 additions & 0 deletions spec/controllers/mixin_controller_spec.rb
@@ -0,0 +1,14 @@
require 'spec_helper'

describe MixinController do

pending "add some examples to (or delete) #{__FILE__}"

describe "GET 'index'" do
it "returns http success" do
get 'index', { term: 'my_stuff/test' }
response.should be_success
end
end

end
14 changes: 14 additions & 0 deletions spec/controllers/model_controller_spec.rb
@@ -0,0 +1,14 @@
require 'spec_helper'

describe ModelController do

pending "add some examples to (or delete) #{__FILE__}"

describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
end
end

end
10 changes: 6 additions & 4 deletions spec/controllers/network_controller_spec.rb
Expand Up @@ -2,11 +2,13 @@

describe NetworkController do

pending "add some examples to (or delete) #{__FILE__}"

describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
end
it "returns http success" do
get 'index'
response.should be_success
end
end

end
14 changes: 14 additions & 0 deletions spec/controllers/networkinterface_controller_spec.rb
@@ -0,0 +1,14 @@
require 'spec_helper'

describe NetworkinterfaceController do

pending "add some examples to (or delete) #{__FILE__}"

describe "GET 'show'" do
it "returns http success" do
get 'show', { id: 'df45ad6f4adf-daf4d5f6a4d-adf54ad5f6ad' }
response.should be_success
end
end

end

0 comments on commit be449e5

Please sign in to comment.