Sha256: 467e001a03597f022294f1ff510816371d02155cf5b46d5f1da0e0bcea85b1b0

Contents?: true

Size: 975 Bytes

Versions: 9

Compression:

Stored size: 975 Bytes

Contents

<% module_namespacing do -%>
class <%= class_name %> < <%= parent_class_name.classify %>
  has_many :<%= job.plural_name %>, dependent: :destroy
  has_machete_workflow_of :<%= job.plural_name %>

<% attributes.select(&:reference?).each do |attribute| -%>
  belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %>
<% end -%>
<% if attributes.any?(&:password_digest?) -%>
  has_secure_password
<% end -%>

  # Name that defines the template/target dirs
  def staging_template_name
    "<%= file_name %>"
  end

  # Define tasks to do after staging template directory typically copy over
  # uploaded files here
  # def after_stage(staged_dir)
  #   # CODE HERE
  # end

  # Build an array of Machete jobs that are then submitted to the batch server
  def build_jobs(staged_dir, job_list = [])
    job_list << OSC::Machete::Job.new(script: staged_dir.join("main.sh"))
  end

  # Make copy of workflow
  def copy
    self.dup
  end
end
<% end -%>

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
osc_machete_rails-2.1.2 lib/generators/active_record/templates/workflow_model.rb
osc_machete_rails-2.1.0 lib/generators/active_record/templates/workflow_model.rb
osc_machete_rails-2.0.0 lib/generators/active_record/templates/workflow_model.rb
osc_machete_rails-1.3.1 lib/generators/active_record/templates/workflow_model.rb
osc_machete_rails-1.3.0 lib/generators/active_record/templates/workflow_model.rb
osc_machete_rails-1.2.2 lib/generators/active_record/templates/workflow_model.rb
osc_machete_rails-2.0.0.pre1 lib/generators/active_record/templates/workflow_model.rb
osc_machete_rails-1.2.1 lib/generators/active_record/templates/workflow_model.rb
osc_machete_rails-1.2.0 lib/generators/active_record/templates/workflow_model.rb