Class: AzkabanScheduler::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/azkaban_scheduler/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, description) ⇒ Project

Returns a new instance of Project.


9
10
11
12
13
# File 'lib/azkaban_scheduler/project.rb', line 9

def initialize(name, description)
  @name = name
  @description = description
  @jobs = {}
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description


6
7
8
# File 'lib/azkaban_scheduler/project.rb', line 6

def description
  @description
end

#idObject

Returns the value of attribute id


7
8
9
# File 'lib/azkaban_scheduler/project.rb', line 7

def id
  @id
end

#jobsObject

Returns the value of attribute jobs


6
7
8
# File 'lib/azkaban_scheduler/project.rb', line 6

def jobs
  @jobs
end

#nameObject

Returns the value of attribute name


6
7
8
# File 'lib/azkaban_scheduler/project.rb', line 6

def name
  @name
end

#versionObject

Returns the value of attribute version


7
8
9
# File 'lib/azkaban_scheduler/project.rb', line 7

def version
  @version
end

Instance Method Details

#add_job(name, job) ⇒ Object


15
16
17
# File 'lib/azkaban_scheduler/project.rb', line 15

def add_job(name, job)
  @jobs[name] = job
end

#buildObject


19
20
21
22
23
24
# File 'lib/azkaban_scheduler/project.rb', line 19

def build
  io = StringIO.new
  write(io)
  io.rewind
  io
end

#write(io) ⇒ Object


26
27
28
29
30
31
32
33
# File 'lib/azkaban_scheduler/project.rb', line 26

def write(io)
  Zip::OutputStream.write_buffer(io) do |out|
    @jobs.each do |name, job|
      out.put_next_entry("#{name}.job")
      job.write(out)
    end
  end
end