Class: Travis::Buildable

Inherits:
Object
  • Object
show all
Defined in:
lib/travis/buildable.rb,
lib/travis/buildable/config.rb

Defined Under Namespace

Classes: Config

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(build) ⇒ Buildable

Returns a new instance of Buildable.



21
22
23
24
25
26
# File 'lib/travis/buildable.rb', line 21

def initialize(build)
  @url    = build[:url] || raise(ArgumentError.new('no url given'))
  @commit = build[:commit]
  @script = build[:script]
  @path   = extract_path(url)
end

Instance Attribute Details

#commitObject (readonly)

Returns the value of attribute commit.



19
20
21
# File 'lib/travis/buildable.rb', line 19

def commit
  @commit
end

#pathObject (readonly)

Returns the value of attribute path.



19
20
21
# File 'lib/travis/buildable.rb', line 19

def path
  @path
end

#urlObject (readonly)

Returns the value of attribute url.



19
20
21
# File 'lib/travis/buildable.rb', line 19

def url
  @url
end

Class Method Details

.base_dirObject



10
11
12
# File 'lib/travis/buildable.rb', line 10

def base_dir
  @@base_dir ||= '/tmp/travis/builds'
end

.base_dir=(base_dir) ⇒ Object



14
15
16
# File 'lib/travis/buildable.rb', line 14

def base_dir=(base_dir)
  @@base_dir = base_dir
end

Instance Method Details

#build!Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/travis/buildable.rb', line 28

def build!
  Bundler.with_clean_env do
    ENV['BUNDLE_GEMFILE'] = nil
    chdir do
      exists? ? fetch : clone
      checkout
      install
      run_script
    end
  end
end