rename pipeline to pipeline template. refs #1416
authorTom Clegg <tom@clinicalfuture.com>
Tue, 19 Mar 2013 19:53:08 +0000 (12:53 -0700)
committerTom Clegg <tom@clinicalfuture.com>
Tue, 19 Mar 2013 19:53:08 +0000 (12:53 -0700)
16 files changed:
app/assets/javascripts/pipeline_templates.js.coffee [moved from app/assets/javascripts/pipelines.js.coffee with 100% similarity]
app/assets/stylesheets/pipeline_templates.css.scss [moved from app/assets/stylesheets/pipelines.css.scss with 60% similarity]
app/controllers/orvos/v1/pipeline_templates_controller.rb [new file with mode: 0644]
app/controllers/orvos/v1/pipelines_controller.rb [deleted file]
app/helpers/pipeline_templates_helper.rb [new file with mode: 0644]
app/helpers/pipelines_helper.rb [deleted file]
app/models/pipeline_instance.rb
app/models/pipeline_template.rb [moved from app/models/pipeline.rb with 85% similarity]
app/views/pipeline_instances/index.html.erb
config/routes.rb
db/migrate/20130319194637_rename_pipelines_to_pipeline_templates.rb [new file with mode: 0644]
db/schema.rb
test/fixtures/pipeline_templates.yml [moved from test/fixtures/pipelines.yml with 100% similarity]
test/functional/pipeline_templates_controller_test.rb [moved from test/functional/pipelines_controller_test.rb with 100% similarity]
test/unit/helpers/pipeline_templates_helper_test.rb [moved from test/unit/helpers/pipelines_helper_test.rb with 100% similarity]
test/unit/pipeline_template_test.rb [moved from test/unit/pipeline_test.rb with 100% similarity]

similarity index 60%
rename from app/assets/stylesheets/pipelines.css.scss
rename to app/assets/stylesheets/pipeline_templates.css.scss
index fa5d69a15d0e83838fe660a4ee3e9075c7a7677e..35d2946bb0e4868dad2694945bc5ab0970158eb2 100644 (file)
@@ -1,3 +1,3 @@
-// Place all the styles related to the Pipelines controller here.
+// Place all the styles related to the PipelineTemplates controller here.
 // They will automatically be included in application.css.
 // You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/controllers/orvos/v1/pipeline_templates_controller.rb b/app/controllers/orvos/v1/pipeline_templates_controller.rb
new file mode 100644 (file)
index 0000000..626c44b
--- /dev/null
@@ -0,0 +1,3 @@
+class Orvos::V1::PipelineTemplatesController < ApplicationController
+  accept_attribute_as_json :components, Hash
+end
diff --git a/app/controllers/orvos/v1/pipelines_controller.rb b/app/controllers/orvos/v1/pipelines_controller.rb
deleted file mode 100644 (file)
index ba0279e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-class Orvos::V1::PipelinesController < ApplicationController
-  accept_attribute_as_json :components, Hash
-end
diff --git a/app/helpers/pipeline_templates_helper.rb b/app/helpers/pipeline_templates_helper.rb
new file mode 100644 (file)
index 0000000..be82878
--- /dev/null
@@ -0,0 +1,2 @@
+module PipelineTemplatesHelper
+end
diff --git a/app/helpers/pipelines_helper.rb b/app/helpers/pipelines_helper.rb
deleted file mode 100644 (file)
index 6837cde..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-module PipelinesHelper
-end
index 3f79d5b713257e7902f1d9690d64ded56504c4f8..6de861d00547297688fdba19aee5c72d2d05e83e 100644 (file)
@@ -4,15 +4,15 @@ class PipelineInstance < OrvosModel
   include CommonApiTemplate
   serialize :components, Hash
   serialize :properties, Hash
-  belongs_to :pipeline, :foreign_key => :pipeline_uuid, :primary_key => :uuid
-  attr_accessor :pipeline
+  belongs_to :pipeline_template, :foreign_key => :pipeline_template_uuid, :primary_key => :uuid
+  attr_accessor :pipeline_template
 
   before_validation :bootstrap_components
   before_validation :update_success
 
   api_accessible :superuser, :extend => :common do |t|
-    t.add :pipeline_uuid
-    t.add :pipeline, :if => :pipeline
+    t.add :pipeline_template_uuid
+    t.add :pipeline_template, :if => :pipeline_template
     t.add :name
     t.add :components
     t.add :success
@@ -62,8 +62,8 @@ class PipelineInstance < OrvosModel
 
   protected
   def bootstrap_components
-    if pipeline and (!components or components.empty?)
-      self.components = pipeline.components
+    if pipeline_template and (!components or components.empty?)
+      self.components = pipeline_template.components
     end
   end
 
similarity index 85%
rename from app/models/pipeline.rb
rename to app/models/pipeline_template.rb
index d5b6104f21bd8f621847acb781704475907043e1..97e1426f023018cd7a15e15ecf0d07d8f80aa2e6 100644 (file)
@@ -1,4 +1,4 @@
-class Pipeline < OrvosModel
+class PipelineTemplate < OrvosModel
   include AssignUuid
   include KindAndEtag
   include CommonApiTemplate
index 7354c576c5781f3fd6b434f02bf1f322e16bcaec..e8cb553daff3508fce09b54b903743ed640c366c 100644 (file)
@@ -9,7 +9,7 @@
     </th><th>
       uuid
     </th><th>
-      pipeline uuid
+      pipeline template
     </th><th>
       name
     </th><th>
@@ -31,7 +31,7 @@
     </td><td>
       <%= o.uuid %>
     </td><td>
-      <%= o.pipeline_uuid %>
+      <%= o.pipeline_template_uuid %>
     </td><td>
       <%= o.name %>
     </td><td>
index ec0e37573646edf9a34341c323cf90e98b320954..76abf3e5b719a30621b189b13ae9f1b9c62ac82f 100644 (file)
@@ -9,7 +9,7 @@ Server::Application.routes.draw do
   resources :collections
   resources :links
   resources :nodes
-  resources :pipelines
+  resources :pipeline_templates
   resources :pipeline_instances
 
   # The priority is based upon order of creation:
@@ -79,7 +79,7 @@ Server::Application.routes.draw do
       resources :collections
       resources :links
       resources :nodes
-      resources :pipelines
+      resources :pipeline_templates
       resources :pipeline_instances
       resources :specimens
       resources :groups
diff --git a/db/migrate/20130319194637_rename_pipelines_to_pipeline_templates.rb b/db/migrate/20130319194637_rename_pipelines_to_pipeline_templates.rb
new file mode 100644 (file)
index 0000000..006b753
--- /dev/null
@@ -0,0 +1,23 @@
+class RenamePipelinesToPipelineTemplates < ActiveRecord::Migration
+  def up
+    rename_column :pipeline_instances, :pipeline_uuid, :pipeline_template_uuid
+    rename_table :pipelines, :pipeline_templates
+    rename_index :pipeline_templates, :index_pipelines_on_created_at, :index_pipeline_templates_on_created_at
+    rename_index :pipeline_templates, :index_pipelines_on_modified_at, :index_pipeline_templates_on_modified_at
+    rename_index :pipeline_templates, :index_pipelines_on_uuid, :index_pipeline_templates_on_uuid
+    Link.update_all({head_kind:'orvos#pipeline'}, ['head_kind=?','orvos#pipeline_template'])
+    Link.update_all({tail_kind:'orvos#pipeline'}, ['tail_kind=?','orvos#pipeline_template'])
+    Log.update_all({object_kind:'orvos#pipeline'}, ['object_kind=?','orvos#pipeline_template'])
+  end
+
+  def down
+    Link.update_all({head_kind:'orvos#pipeline_template'}, ['head_kind=?','orvos#pipeline'])
+    Link.update_all({tail_kind:'orvos#pipeline_template'}, ['tail_kind=?','orvos#pipeline'])
+    Log.update_all({object_kind:'orvos#pipeline_template'}, ['object_kind=?','orvos#pipeline'])
+    rename_index :pipeline_templates, :index_pipeline_templates_on_created_at, :index_pipelines_on_created_at
+    rename_index :pipeline_templates, :index_pipeline_templates_on_modified_at, :index_pipelines_on_modified_at
+    rename_index :pipeline_templates, :index_pipeline_templates_on_uuid, :index_pipelines_on_uuid
+    rename_table :pipeline_templates, :pipelines
+    rename_column :pipeline_instances, :pipeline_template_uuid, :pipeline_uuid
+  end
+end
index 8704b60880f83d2a8da6fe380763e52d5fbca333..03c096569b520f1d3b15b10f24e3828fe3a97ba4 100644 (file)
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 20130319180730) do
+ActiveRecord::Schema.define(:version => 20130319194637) do
 
   create_table "api_client_authorizations", :force => true do |t|
     t.string   "api_token",               :null => false
@@ -223,11 +223,11 @@ ActiveRecord::Schema.define(:version => 20130319180730) do
     t.string   "modified_by_client"
     t.string   "modified_by_user"
     t.datetime "modified_at"
-    t.string   "pipeline_uuid"
+    t.string   "pipeline_template_uuid"
     t.string   "name"
     t.text     "components"
     t.boolean  "success"
-    t.boolean  "active",             :default => false
+    t.boolean  "active",                 :default => false
     t.datetime "updated_at"
     t.text     "properties"
   end
@@ -236,7 +236,7 @@ ActiveRecord::Schema.define(:version => 20130319180730) do
   add_index "pipeline_instances", ["modified_at"], :name => "index_pipeline_instances_on_modified_at"
   add_index "pipeline_instances", ["uuid"], :name => "index_pipeline_instances_on_uuid", :unique => true
 
-  create_table "pipelines", :force => true do |t|
+  create_table "pipeline_templates", :force => true do |t|
     t.string   "uuid"
     t.string   "owner"
     t.datetime "created_at"
@@ -248,9 +248,9 @@ ActiveRecord::Schema.define(:version => 20130319180730) do
     t.datetime "updated_at"
   end
 
-  add_index "pipelines", ["created_at"], :name => "index_pipelines_on_created_at"
-  add_index "pipelines", ["modified_at"], :name => "index_pipelines_on_modified_at"
-  add_index "pipelines", ["uuid"], :name => "index_pipelines_on_uuid", :unique => true
+  add_index "pipeline_templates", ["created_at"], :name => "index_pipeline_templates_on_created_at"
+  add_index "pipeline_templates", ["modified_at"], :name => "index_pipeline_templates_on_modified_at"
+  add_index "pipeline_templates", ["uuid"], :name => "index_pipeline_templates_on_uuid", :unique => true
 
   create_table "specimens", :force => true do |t|
     t.string   "uuid"