Class: MediafluxScriptFactory

Inherits:
Object
  • Object
show all
Defined in:
app/services/mediaflux_script_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(project:) ⇒ MediafluxScriptFactory

Returns a new instance of MediafluxScriptFactory.



4
5
6
7
8
9
10
11
# File 'app/services/mediaflux_script_factory.rb', line 4

def initialize(project:)
  @project = project
  @metadata = project.

  root_ns = Rails.configuration.mediaflux["api_root_collection_namespace"]
  parent_collection = Rails.configuration.mediaflux["api_root_collection_name"]
  @root_info = Mediaflux::RootCollectionAsset.new(session_token: nil, root_ns: root_ns, parent_collection: parent_collection)
end

Instance Method Details

#aterm_scriptObject



13
14
15
16
# File 'app/services/mediaflux_script_factory.rb', line 13

def aterm_script
  prolog = "# Run these steps from Aterm to create a project in Mediaflux with its related components"
  [prolog, script_root_tree_create, script_asset_create, script_accumulators].join("\r\n\r\n")
end

#project_namespaceObject



18
19
20
# File 'app/services/mediaflux_script_factory.rb', line 18

def project_namespace
  Pathname.new(@root_info.parent_ns).join(@project.project_directory_short + "NS")
end

#project_parent_pathObject



22
23
24
# File 'app/services/mediaflux_script_factory.rb', line 22

def project_parent_path
  Pathname.new(@root_info.path)
end

#project_pathObject



26
27
28
# File 'app/services/mediaflux_script_factory.rb', line 26

def project_path
  Pathname.new(project_parent_path).join(@project.project_directory_short)
end