Class: CIJoePassenger::Project

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Project

Returns a new instance of Project.



19
20
21
22
# File 'lib/cijoe_passenger/project.rb', line 19

def initialize(name)
  @name = name
  @git = Git.new([name])
end

Instance Attribute Details

#gitObject (readonly)

Returns the value of attribute git.



3
4
5
# File 'lib/cijoe_passenger/project.rb', line 3

def git
  @git
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/cijoe_passenger/project.rb', line 3

def name
  @name
end

Class Method Details

.allObject



11
12
13
# File 'lib/cijoe_passenger/project.rb', line 11

def self.all
  dirs.collect{|name| Project.new(name) }
end

.dirsObject



5
6
7
8
9
# File 'lib/cijoe_passenger/project.rb', line 5

def self.dirs
  Dir['*'].select do |name|
    Git.new([name]).repo?
  end
end

.staleObject



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

def self.stale
  all.select(&:stale?)
end

Instance Method Details

#buildObject



28
29
30
31
# File 'lib/cijoe_passenger/project.rb', line 28

def build
  uri = URI.parse("http://#{Config.cijoe_url}/#{name}")
  Net::HTTP.post_form(uri, {})
end

#stale?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/cijoe_passenger/project.rb', line 24

def stale?
  git.current_head != git.upstream_head
end